Merge branch '1.0'
[jansson.git] / src / load.c
index 8d5a392..cdffa11 100644 (file)
@@ -134,7 +134,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;
@@ -257,14 +257,14 @@ static void lex_scan_string(lex_t *lex, json_error_t *error)
     c = lex_get_save(lex, error);
 
     while(c != '"') {
-        if(c == EOF) {
+        if(c == (char)EOF) {
             lex_unget_unsave(lex, c);
             if(lex_eof(lex))
                 error_set(error, lex, "premature end of input");
             goto out;
         }
 
-        else if(0 <= c && c <= 0x1F) {
+        else if((unsigned char)c <= 0x1F) {
             /* control character */
             lex_unget_unsave(lex, c);
             if(c == '\n')
@@ -518,7 +518,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