~ubuntu-branches/ubuntu/lucid/curl/lucid-201101212007

« back to all changes in this revision

Viewing changes to lib/escape.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-05-16 15:16:54 UTC
  • mto: (3.1.1 lenny) (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: james.westby@ubuntu.com-20070516151654-x9nkigtr2j0i8d0v
Tags: upstream-7.16.2
ImportĀ upstreamĀ versionĀ 7.16.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
 * KIND, either express or implied.
20
20
 *
21
 
 * $Id: escape.c,v 1.37 2006-04-07 21:50:47 bagder Exp $
 
21
 * $Id: escape.c,v 1.38 2006-10-17 21:32:56 bagder Exp $
22
22
 ***************************************************************************/
23
23
 
24
24
/* Escape and unescape URL encoding in strings. The functions return a new
116
116
  return ns;
117
117
}
118
118
 
119
 
#define ishex(in) ((in >= 'a' && in <= 'f') || \
120
 
                   (in >= 'A' && in <= 'F') || \
121
 
                   (in >= '0' && in <= '9'))
122
 
 
123
119
char *curl_easy_unescape(CURL *handle, const char *string, int length,
124
120
                         int *olen)
125
121
{
138
134
 
139
135
  while(--alloc > 0) {
140
136
    in = *string;
141
 
    if(('%' == in) && ishex(string[1]) && ishex(string[2])) {
 
137
    if(('%' == in) && ISXDIGIT(string[1]) && ISXDIGIT(string[2])) {
142
138
      /* this is two hexadecimal digits following a '%' */
143
139
      char hexstr[3];
144
140
      char *ptr;