From: Daniel Stenberg Date: Sun, 3 Oct 2004 21:02:01 +0000 (+0000) Subject: Replaced the use of isspace() with our own version instead since we have most X-Git-Tag: curl-7_12_2~61 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=be7ce435c036f893f6ce04c91d1cbec006a810e5;p=thirdparty%2Fcurl.git Replaced the use of isspace() with our own version instead since we have most data as 'char *' and that makes us pass in negative values if there is 8bit data in the string. Changing to unsigned causes too much warnings or too many required typecasts to the normal string functions. --- diff --git a/lib/cookie.c b/lib/cookie.c index b7a2237a34..47ed95254a 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -84,7 +84,6 @@ Example set of cookies: #include #include -#include #include "urldata.h" #include "cookie.h" @@ -98,6 +97,8 @@ Example set of cookies: #include "memdebug.h" #endif +#define my_isspace(x) ((x == ' ') || (x == '\t')) + static void freecookie(struct Cookie *co) { if(co->expirestr) @@ -175,7 +176,7 @@ Curl_cookie_add(struct SessionHandle *data, semiptr=strchr(lineptr, ';'); /* first, find a semicolon */ - while(*lineptr && isspace((int)*lineptr)) + while(*lineptr && my_isspace(*lineptr)) lineptr++; ptr = lineptr; @@ -198,14 +199,14 @@ Curl_cookie_add(struct SessionHandle *data, /* Strip off trailing whitespace from the 'what' */ size_t len=strlen(what); - while(len && isspace((int)what[len-1])) { + while(len && my_isspace(what[len-1])) { what[len-1]=0; len--; } /* Skip leading whitespace from the 'what' */ whatptr=what; - while(isspace((int)*whatptr)) { + while(my_isspace(*whatptr)) { whatptr++; } @@ -347,7 +348,7 @@ Curl_cookie_add(struct SessionHandle *data, } ptr=semiptr+1; - while(ptr && *ptr && isspace((int)*ptr)) + while(ptr && *ptr && my_isspace(*ptr)) ptr++; semiptr=strchr(ptr, ';'); /* now, find the next semicolon */ @@ -667,7 +668,7 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data, lineptr=line; headerline=FALSE; } - while(*lineptr && isspace((int)*lineptr)) + while(*lineptr && my_isspace(*lineptr)) lineptr++; Curl_cookie_add(data, c, headerline, lineptr, NULL, NULL);