X-Git-Url: http://www.project-moonshot.org/gitweb/?p=jansson.git;a=blobdiff_plain;f=src%2Fload.c;h=d1366f833a43c89f92f85bb2acd1270ec40f7d68;hp=aa7f99d67262184a1c55eb68f4b6196dc13d063b;hb=55d25665395551e711fa7d971cf76c8acf0b17f1;hpb=7ee974e91c05d334b3a186937916bc843c537b8e diff --git a/src/load.c b/src/load.c index aa7f99d..d1366f8 100644 --- a/src/load.c +++ b/src/load.c @@ -133,10 +133,7 @@ static char stream_get(stream_t *stream, json_error_t *error) c = stream->buffer[0]; - if(c == EOF && stream->eof(stream->data)) - return EOF; - - if(c < 0) + if(c < 0 && c != EOF) { /* multi-byte UTF-8 sequence */ int i, count; @@ -256,11 +253,11 @@ static void lex_scan_string(lex_t *lex, json_error_t *error) lex->value.string = NULL; lex->token = TOKEN_INVALID; - /* skip the " */ c = lex_get_save(lex, error); while(c != '"') { if(c == EOF) { + lex_unget_unsave(lex, c); if(lex_eof(lex)) error_set(error, lex, "premature end of input"); goto out;