Fix build when char is unsigned by default.

I tested by building/testing with -funsigned-char.  Thanks to apaprocki for
pointing out this problem.
v0.6
Cliff Frey 14 years ago
parent eee60127c0
commit 3258e4a455

@ -332,6 +332,7 @@ size_t http_parser_execute (http_parser *parser,
size_t len)
{
char c, ch;
int8_t unhex_val;
const char *p = data, *pe;
int64_t to_read;
@ -1478,9 +1479,9 @@ size_t http_parser_execute (http_parser *parser,
assert(nread == 1);
assert(parser->flags & F_CHUNKED);
c = unhex[(unsigned char)ch];
if (c == -1) goto error;
parser->content_length = c;
unhex_val = unhex[(unsigned char)ch];
if (unhex_val == -1) goto error;
parser->content_length = unhex_val;
state = s_chunk_size;
break;
}
@ -1494,9 +1495,9 @@ size_t http_parser_execute (http_parser *parser,
break;
}
c = unhex[(unsigned char)ch];
unhex_val = unhex[(unsigned char)ch];
if (c == -1) {
if (unhex_val == -1) {
if (ch == ';' || ch == ' ') {
state = s_chunk_parameters;
break;
@ -1505,7 +1506,7 @@ size_t http_parser_execute (http_parser *parser,
}
parser->content_length *= 16;
parser->content_length += c;
parser->content_length += unhex_val;
break;
}

Loading…
Cancel
Save