diff options
author | des <des@FreeBSD.org> | 2007-12-19 00:26:36 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2007-12-19 00:26:36 +0000 |
commit | d198b4b8bb4da44884c0738e938e1ac5cec10b47 (patch) | |
tree | 77d4f9993635ffc61688e8a0a9fcefed7606cf3e /lib/libfetch/http.c | |
parent | a2bd2e60b52b58d78553d8455b6d7fca40592eea (diff) | |
download | FreeBSD-src-d198b4b8bb4da44884c0738e938e1ac5cec10b47.zip FreeBSD-src-d198b4b8bb4da44884c0738e938e1ac5cec10b47.tar.gz |
As several people pointed out, I did all the ctype casts the wrong
way (not for the first time...)
Noticed by: bde, ru ++
MFC after: 1 week
Diffstat (limited to 'lib/libfetch/http.c')
-rw-r--r-- | lib/libfetch/http.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index c89f5f1..2ee76e2 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -137,15 +137,15 @@ http_new_chunk(struct httpio *io) if (fetch_getln(io->conn) == -1) return (-1); - if (io->conn->buflen < 2 || !isxdigit((int)*io->conn->buf)) + if (io->conn->buflen < 2 || !isxdigit((unsigned char)*io->conn->buf)) return (-1); - for (p = io->conn->buf; *p && !isspace((int)*p); ++p) { + for (p = io->conn->buf; *p && !isspace((unsigned char)*p); ++p) { if (*p == ';') break; - if (!isxdigit((int)*p)) + if (!isxdigit((unsigned char)*p)) return (-1); - if (isdigit((int)*p)) { + if (isdigit((unsigned char)*p)) { io->chunksize = io->chunksize * 16 + *p - '0'; } else { @@ -417,8 +417,10 @@ http_get_reply(conn_t *conn) return (HTTP_PROTOCOL_ERROR); p += 4; } - if (*p != ' ' || !isdigit((int)p[1]) || - !isdigit((int)p[2]) || !isdigit((int)p[3])) + if (*p != ' ' || + !isdigit((unsigned char)p[1]) || + !isdigit((unsigned char)p[2]) || + !isdigit((unsigned char)p[3])) return (HTTP_PROTOCOL_ERROR); conn->err = (p[1] - '0') * 100 + (p[2] - '0') * 10 + (p[3] - '0'); @@ -436,7 +438,7 @@ http_match(const char *str, const char *hdr) /* nothing */; if (*str || *hdr != ':') return (NULL); - while (*hdr && isspace((int)*++hdr)) + while (*hdr && isspace((unsigned char)*++hdr)) /* nothing */; return (hdr); } @@ -451,7 +453,7 @@ http_next_header(conn_t *conn, const char **p) if (fetch_getln(conn) == -1) return (hdr_syserror); - while (conn->buflen && isspace((int)conn->buf[conn->buflen - 1])) + while (conn->buflen && isspace((unsigned char)conn->buf[conn->buflen - 1])) conn->buflen--; conn->buf[conn->buflen] = '\0'; if (conn->buflen == 0) @@ -500,7 +502,7 @@ http_parse_length(const char *p, off_t *length) { off_t len; - for (len = 0; *p && isdigit((int)*p); ++p) + for (len = 0; *p && isdigit((unsigned char)*p); ++p) len = len * 10 + (*p - '0'); if (*p) return (-1); @@ -525,16 +527,16 @@ http_parse_range(const char *p, off_t *offset, off_t *length, off_t *size) first = last = -1; ++p; } else { - for (first = 0; *p && isdigit((int)*p); ++p) + for (first = 0; *p && isdigit((unsigned char)*p); ++p) first = first * 10 + *p - '0'; if (*p != '-') return (-1); - for (last = 0, ++p; *p && isdigit((int)*p); ++p) + for (last = 0, ++p; *p && isdigit((unsigned char)*p); ++p) last = last * 10 + *p - '0'; } if (first > last || *p != '/') return (-1); - for (len = 0, ++p; *p && isdigit((int)*p); ++p) + for (len = 0, ++p; *p && isdigit((unsigned char)*p); ++p) len = len * 10 + *p - '0'; if (*p || len < last - first + 1) return (-1); @@ -750,7 +752,7 @@ http_print_html(FILE *out, FILE *in) comment = tag = 0; while ((line = fgetln(in, &len)) != NULL) { - while (len && isspace((int)line[len - 1])) + while (len && isspace((unsigned char)line[len - 1])) --len; for (p = q = line; q < line + len; ++q) { if (comment && *q == '-') { |