* Fix bug with use of capital E in numbers with exponents
authorMichael Clark <michael@metaparadigm.com>
Fri, 7 Dec 2007 02:44:24 +0000 (02:44 +0000)
committerMichael Clark <michael@metaparadigm.com>
Fri, 7 Dec 2007 02:44:24 +0000 (02:44 +0000)
    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
json_object.c
json_tokener.c
json_tokener.h
json_util.c
test1.c
test2.c

index 7121199..002c995 100644 (file)
--- 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
index a629f61..c1ffb0a 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <stddef.h>
 #include <string.h>
 
 #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
index ba329fe..c904f48 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <stddef.h>
 #include <ctype.h>
 #include <string.h>
 
@@ -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;
index d2c2127..2c7ea69 100644 (file)
@@ -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];
index 903a694..1a65596 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <stddef.h>
 #include <limits.h>
 #include <string.h>
 #include <errno.h>
diff --git a/test1.c b/test1.c
index f894fac..a64a255 100644 (file)
--- a/test1.c
+++ b/test1.c
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <stddef.h>
 #include <string.h>
 
 #include "json.h"
diff --git a/test2.c b/test2.c
index afbd386..39c4884 100644 (file)
--- a/test2.c
+++ b/test2.c
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <stddef.h>
 #include <string.h>
 
 #include "json.h"