From 9c5a8430dbb05f5308ab19fbd0a26d92483b7118 Mon Sep 17 00:00:00 2001 From: Petri Lehtinen Date: Thu, 1 Oct 2009 21:52:12 +0300 Subject: [PATCH] Make it compile on platforms where char is unsigned Linux on powerpc seems to be one such platform. --- src/dump.c | 2 +- src/load.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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