Skip to content

Commit

Permalink
* Fix bug with use of capital E in numbers with exponents
Browse files Browse the repository at this point in the history
    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
  • Loading branch information
michaeljclark committed Dec 7, 2007
1 parent dfaf670 commit c8f4a6e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion json_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>

#include "debug.h"
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion json_tokener.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <ctype.h>
#include <string.h>

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion json_tokener.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
1 change: 1 addition & 0 deletions json_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <limits.h>
#include <string.h>
#include <errno.h>
Expand Down
1 change: 1 addition & 0 deletions test1.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>

#include "json.h"
Expand Down
1 change: 1 addition & 0 deletions test2.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>

#include "json.h"
Expand Down

0 comments on commit c8f4a6e

Please sign in to comment.