From c195f690583bd5f6bd7c0c760ee15fed944bbd7c Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Fri, 19 Mar 2004 20:50:12 +0000 Subject: [PATCH] isspace and friends take an int. solaris cares. svn:r1303 --- src/common/crypto.c | 4 ++-- src/common/util.c | 14 +++++++------- src/or/directory.c | 2 +- src/or/onion.c | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/common/crypto.c b/src/common/crypto.c index 4f5a14d6dc..2b2f3b3118 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -691,9 +691,9 @@ crypto_pk_check_fingerprint_syntax(const char *s) int i; for (i = 0; i < FINGERPRINT_LEN; ++i) { if ((i%5) == 4) { - if (!isspace(s[i])) return 0; + if (!isspace((int)s[i])) return 0; } else { - if (!isxdigit(s[i])) return 0; + if (!isxdigit((int)s[i])) return 0; } } if (s[FINGERPRINT_LEN]) return 0; diff --git a/src/common/util.c b/src/common/util.c index f3ffe676e7..77e7916d86 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -163,8 +163,8 @@ void *smartlist_choose(smartlist_t *sl) { const char *eat_whitespace(const char *s) { assert(s); - while(isspace(*s) || *s == '#') { - while(isspace(*s)) + while(isspace((int)*s) || *s == '#') { + while(isspace((int)*s)) s++; if(*s == '#') { /* read to a \n or \0 */ while(*s && *s != '\n') @@ -186,7 +186,7 @@ const char *eat_whitespace_no_nl(const char *s) { const char *find_whitespace(const char *s) { assert(s); - while(*s && !isspace(*s) && *s != '#') + while(*s && !isspace((int)*s) && *s != '#') s++; return s; @@ -672,18 +672,18 @@ try_next_line: do { *s = 0; s--; - } while (s >= line && isspace(*s)); + } while (s >= line && isspace((int)*s)); key = line; - while(isspace(*key)) + while(isspace((int)*key)) key++; if(*key == 0) goto try_next_line; /* this line has nothing on it */ end = key; - while(*end && !isspace(*end)) + while(*end && !isspace((int)*end)) end++; value = end; - while(*value && isspace(*value)) + while(*value && isspace((int)*value)) value++; if(!*end || !*value) { /* only a key on this line. no value. */ diff --git a/src/or/directory.c b/src/or/directory.c index d6be10eff7..f3f4025cdf 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -105,7 +105,7 @@ int parse_http_response(char *headers, int *code, char **message) { int n1, n2; assert(headers && code); - while(isspace(*headers)) headers++; /* tolerate leading whitespace */ + while(isspace((int)*headers)) headers++; /* tolerate leading whitespace */ if(sscanf(headers, "HTTP/1.%d %d", &n1, &n2) < 2 || (n1 != 0 && n1 != 1) || diff --git a/src/or/onion.c b/src/or/onion.c index 8293b27dcb..8dc3efa904 100644 --- a/src/or/onion.c +++ b/src/or/onion.c @@ -164,11 +164,11 @@ static void add_nickname_list_to_smartlist(smartlist_t *sl, char *list) { char nick[MAX_NICKNAME_LEN]; routerinfo_t *router; - while(isspace(*list) || *list==',') list++; + while(isspace((int)*list) || *list==',') list++; start = list; while(*start) { - end=start; while(*end && !isspace(*end) && *end != ',') end++; + end=start; while(*end && !isspace((int)*end) && *end != ',') end++; memcpy(nick,start,end-start); nick[end-start] = 0; /* null terminate it */ router = router_get_by_nickname(nick); @@ -180,7 +180,7 @@ static void add_nickname_list_to_smartlist(smartlist_t *sl, char *list) { } else log_fn(has_fetched_directory ? LOG_WARN : LOG_INFO, "Nickname list includes '%s' which isn't a known router.",nick); - while(isspace(*end) || *end==',') end++; + while(isspace((int)*end) || *end==',') end++; start = end; } }