Fix a bug in json_tokener_parse_ex when re-using the same tokener to parse multiple objects. Now, json_tokener_reset() does not need to be called after a valid object is parsed.
Define a LH_LOAD_FACTOR constant and note the range that it can be set to.
Change the resize check from "count > size" to "count >= size" to avoid a
potential infinite loop with high load factors and a full hash table.
Perform better error checking in json_tokener_parse_verbose and rewrite json_tokener_parse to use that instead of json_tokener_parse_ex.
Fix a typo in the string represenations of the json_tokener_error_depth error (s/to deep/too deep/)
Keith Derrick [Mon, 26 Mar 2012 21:29:31 +0000 (14:29 -0700)]
Rename boolean type to json_bool
In building large systems, there are often clashes over the
preferred base type to use for bool/boolean. At least one
experience has been with a 3rd party proprietary library which
can not be changed. In that case, boolean was a synonym for
unsigned char and used widely in packed structures.
Add json_tokener_get_error() and json_tokener_error_desc() to better encapsulate the process of retrieving errors while parsing.
Add documentation for the json_tokener_parse_ex() function.
Include json_inttypes.h in json_object.h since we use types like int32_t in the API and some systems need that header to compile.
As part of this create a public json_config.h with a custom define to
decide whether to include inttypes.h to avoid conflicting with other
projects config.h header.
Add a test_cast test case. This checks that the casting that is implied when calling the various json_object_get_FOO() functions on a differently typed object works correctly.
Fix a bug in json_object_get_int() where calling it on a string type object would always return 0, instead of the actual numerical value of the string.
ehaszla [Tue, 7 Dec 2010 18:15:35 +0000 (18:15 +0000)]
Simplify things by storing integer values only as int64_t's internally, and
omit the range check during parsing since we already have the checks when
accessing the value. There is no longer a json_type_int64, only json_type_int.
Fix some problems with parsing 0 and -0 values, and add a couple of tests.
Fix some minor compile issues on HPUX environments.
Michael Clark [Wed, 6 Oct 2010 16:39:20 +0000 (16:39 +0000)]
* Add int64 support. Two new functions json_object_net_int64 and
json_object_get_int64. Binary compatibility preserved.
Eric Haszlakiewicz, EHASZLA at transunion com
Rui Miguel Silva Seabra, rms at 1407 dot org
Michael Clark [Thu, 27 Aug 2009 06:40:00 +0000 (06:40 +0000)]
* Fix subtle bug in linkhash where lookup could hang after all slots
were filled then successively freed.
Spotted by Jean-Marc Naud, j dash m at newtraxtech dot com
Michael Clark [Wed, 25 Feb 2009 02:31:32 +0000 (02:31 +0000)]
* Don't use this as a variable, so we can compile with a C++ compiler
* Add casts from void* to type of assignment when using malloc
* Add #ifdef __cplusplus guards to all of the headers
* Add typedefs for json_object, json_tokener, array_list, printbuf, lh_table
Michael Clark, <michael@metaparadigm.com>
Michael Clark [Wed, 25 Feb 2009 01:51:40 +0000 (01:51 +0000)]
* Null pointer dereference fix. Fix json_object_get_boolean strlen test
to not return TRUE for zero length string. Remove redundant includes.
Erik Hovland, erik at hovland dot org
Michael Clark [Fri, 7 Dec 2007 02:50:42 +0000 (02:50 +0000)]
Patch allows for json-c compile with -Werror and not fail due to
-Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
Geoffrey Young, geoff at modperlcookbook dot org
Michael Clark [Tue, 13 Mar 2007 08:26:26 +0000 (08:26 +0000)]
* Add escaping of backslash to json output
* Add escaping of foward slash on tokenizing and output
* Changes to internal tokenizer from using recursion to
using a depth state structure to allow incremental parsing
Michael Clark [Tue, 13 Mar 2007 08:26:25 +0000 (08:26 +0000)]
* Fix bug in escaping of control characters
Johan Bj�rklund, johbjo09 at kth dot se
* Remove include "config.h" from headers (should only
be included from .c files)
Michael Clark <michael@metaparadigm.com>
Michael Clark [Tue, 13 Mar 2007 08:26:23 +0000 (08:26 +0000)]
* Make headers C++ compatible by change *this to *obj
* Add ifdef C++ extern "C" to headers
* Use simpler definition of min and max in bits.h
Larry Lansing, llansing at fuzzynerd dot com
* Remove automake 1.6 requirement
* Move autogen commands into autogen.sh. Update README
* Remove error pointer special case for Windows
* Change license from LGPL to MIT
Michael Clark <michael@metaparadigm.com>
Michael Clark [Tue, 13 Mar 2007 08:26:22 +0000 (08:26 +0000)]
* Fix additional error case in object parsing
* Add back sign reversal in nested object parse as error pointer
value is negative, while error value is positive.
Michael Clark <michael@metaparadigm.com>
Michael Clark [Tue, 13 Mar 2007 08:26:21 +0000 (08:26 +0000)]
* fix pointer arithmetic bug for error pointer check in is_error() macro
* fix type passed to printbuf_memappend in json_tokener
* update autotools bootstrap instructions in README
Michael Clark <michael@metaparadigm.com>
Michael Clark [Tue, 13 Mar 2007 08:26:20 +0000 (08:26 +0000)]
* printbuf.c - C. Watford (christopher dot watford at gmail dot com)
Added a Win32/Win64 compliant implementation of vasprintf
* debug.c - C. Watford (christopher dot watford at gmail dot com)
Removed usage of vsyslog on Win32/Win64 systems, needs to be handled
by a configure script
* json_object.c - C. Watford (christopher dot watford at gmail dot com)
Added scope operator to wrap usage of json_object_object_foreach, this
needs to be rethought to be more ANSI C friendly
* json_object.h - C. Watford (christopher dot watford at gmail dot com)
Added Microsoft C friendly version of json_object_object_foreach
* json_tokener.c - C. Watford (christopher dot watford at gmail dot com)
Added a Win32/Win64 compliant implementation of strndup
* json_util.c - C. Watford (christopher dot watford at gmail dot com)
Added cast and mask to suffice size_t v. unsigned int conversion
correctness
* json_tokener.c - sign reversal issue on error info for nested object parse
spotted by Johan Bj�rklund (johbjo09 at kth.se)
* json_object.c - escape " in json_escape_str
* Change to automake and libtool to build shared and static library
Michael Clark <michael@metaparadigm.com>