From c8f4a6e7de8a4307ca795f307774ef66e1248c11 Mon Sep 17 00:00:00 2001 From: Michael Clark Date: Fri, 7 Dec 2007 02:44:24 +0000 Subject: [PATCH] * Fix bug with use of capital E in numbers with exponents Mateusz Loskot, mateusz at loskot dot net * Add stddef.h include git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@19 327403b1-1117-474d-bef2-5cb71233fd97 --- ChangeLog | 3 +++ json_object.c | 3 ++- json_tokener.c | 3 ++- json_tokener.h | 2 +- json_util.c | 1 + test1.c | 1 + test2.c | 1 + 7 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 712119920d..002c995e59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 0.8 * Add macros to enable compiling out debug code Geoffrey Young, geoff at modperlcookbook dot org + * Fix bug with use of capital E in numbers with exponents + Mateusz Loskot, mateusz at loskot dot net + * Add stddef.h include 0.7 * Add escaping of backslash to json output diff --git a/json_object.c b/json_object.c index a629f61c12..c1ffb0aafd 100644 --- a/json_object.c +++ b/json_object.c @@ -13,6 +13,7 @@ #include #include +#include #include #include "debug.h" @@ -29,7 +30,7 @@ #define REFCOUNT_DEBUG 1 -char *json_number_chars = "0123456789.+-e"; +char *json_number_chars = "0123456789.+-eE"; char *json_hex_chars = "0123456789abcdef"; #ifdef REFCOUNT_DEBUG diff --git a/json_tokener.c b/json_tokener.c index ba329fe895..c904f48f31 100644 --- a/json_tokener.c +++ b/json_tokener.c @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -378,7 +379,7 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok, case json_tokener_state_number: if(c && strchr(json_number_chars, c)) { printbuf_memappend(tok->pb, &c, 1); - if(c == '.' || c == 'e') tok->is_double = 1; + if(c == '.' || c == 'e' || c == 'E') tok->is_double = 1; } else { int numi; double numd; diff --git a/json_tokener.h b/json_tokener.h index d2c21270f4..2c7ea690a6 100644 --- a/json_tokener.h +++ b/json_tokener.h @@ -71,7 +71,7 @@ struct json_tokener char *str; struct printbuf *pb; int depth, is_double, st_pos, char_offset; - enum json_tokener_error err; + ptrdiff_t err; unsigned int ucs_char; char quote_char; struct json_tokener_srec stack[JSON_TOKENER_MAX_DEPTH]; diff --git a/json_util.c b/json_util.c index 903a694443..1a65596c84 100644 --- a/json_util.c +++ b/json_util.c @@ -13,6 +13,7 @@ #include #include +#include #include #include #include diff --git a/test1.c b/test1.c index f894facecd..a64a255a4b 100644 --- a/test1.c +++ b/test1.c @@ -1,5 +1,6 @@ #include #include +#include #include #include "json.h" diff --git a/test2.c b/test2.c index afbd386a83..39c48844c7 100644 --- a/test2.c +++ b/test2.c @@ -1,5 +1,6 @@ #include #include +#include #include #include "json.h"