From: Petri Lehtinen Date: Thu, 1 Oct 2009 18:52:12 +0000 (+0300) Subject: Make it compile on platforms where char is unsigned X-Git-Tag: v1.0.4~4 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=jansson.git;a=commitdiff_plain;h=9c5a8430dbb05f5308ab19fbd0a26d92483b7118 Make it compile on platforms where char is unsigned Linux on powerpc seems to be one such platform. --- 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