diff --git a/src/dump.c b/src/dump.c index 4831873..28c00b9 100644 --- a/src/dump.c +++ b/src/dump.c @@ -70,7 +70,7 @@ static int dump_string(const char *str, dump_func dump, void *data) char seq[7]; int length; - while(*end && *end != '\\' && *end != '"' && (*end < 0 || *end > 0x1F)) + while(*end && *end != '\\' && *end != '"' && (unsigned char)*end > 0x1F) end++; if(end != str) { diff --git a/src/load.c b/src/load.c index 5175f35..4134182 100644 --- a/src/load.c +++ b/src/load.c @@ -135,7 +135,7 @@ static char stream_get(stream_t *stream, json_error_t *error) c = stream->buffer[0]; - if(c < 0 && c != EOF) + if((unsigned char)c >= 0x80 && c != (char)EOF) { /* multi-byte UTF-8 sequence */ int i, count; @@ -519,7 +519,7 @@ static int lex_scan(lex_t *lex, json_error_t *error) c = lex_get(lex, error); } - if(c == EOF) { + if(c == (char)EOF) { if(lex_eof(lex)) lex->token = TOKEN_EOF; else