From 0f62dac6272e30fa33c59ba97d51dafb06bf12ee Mon Sep 17 00:00:00 2001 From: Petri Lehtinen Date: Tue, 8 Sep 2009 16:22:16 +0300 Subject: [PATCH 1/3] load: Handle EOF correctly In stream_get(), EOF never got it to stream->buffer and because of this, stream_unget() failed on some situations. This patch makes stream_get() handle EOF just like any other byte. As a "side effect", lex_scan_string() now needs to unget the EOF, or otherwise it ends up in error message on premature end of input. --- src/load.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/load.c b/src/load.c index 25df182..fc3679d 100644 --- a/src/load.c +++ b/src/load.c @@ -134,10 +134,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; @@ -257,11 +254,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; From 827a01937f480bfc388da0fe5a5e2242fd2ec1c4 Mon Sep 17 00:00:00 2001 From: Petri Lehtinen Date: Tue, 8 Sep 2009 16:48:26 +0300 Subject: [PATCH 2/3] jansson 1.0.2 --- CHANGES | 4 ++++ configure.ac | 2 +- doc/conf.py | 2 +- src/Makefile.am | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 087e5e0..6211d86 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +Version 1.0.2, released 2009-09-08 + +* Handle EOF correctly in decoder + Version 1.0.1, released 2009-09-04 * Fixed broken json_is_boolean() diff --git a/configure.ac b/configure.ac index 44535ff..4a8c8e5 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.63]) -AC_INIT([jansson], [1.0.1], [petri@digip.org]) +AC_INIT([jansson], [1.0.2], [petri@digip.org]) AM_INIT_AUTOMAKE([1.10 foreign]) diff --git a/doc/conf.py b/doc/conf.py index 0aaee33..0b0b6a9 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -52,7 +52,7 @@ copyright = u'2009, Petri Lehtinen' # The short X.Y version. version = '1.0' # The full version, including alpha/beta/rc tags. -release = '1.0.1' +release = '1.0.2' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/src/Makefile.am b/src/Makefile.am index e6264d5..528e50a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -13,6 +13,6 @@ libjansson_la_SOURCES = \ utf.h \ util.h \ value.c -libjansson_la_LDFLAGS = -version-info 0:1:0 +libjansson_la_LDFLAGS = -version-info 0:2:0 AM_CFLAGS = -Wall -Wextra -Werror -std=c99 From 9cc6fbe58024d63473846ddb424a69b7efc03b90 Mon Sep 17 00:00:00 2001 From: Petri Lehtinen Date: Tue, 8 Sep 2009 16:57:45 +0300 Subject: [PATCH 3/3] Distribute CHANGES --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index f35e697..01b958c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,2 +1,2 @@ -EXTRA_DIST = LICENSE README.rst +EXTRA_DIST = CHANGES LICENSE README.rst SUBDIRS = doc src test