summaryrefslogtreecommitdiff
path: root/json_util.h
Commit message (Collapse)AuthorAgeFilesLines
* Apply same EINVAL handling to json_parse_uint64() as was done for ↵Eric Haszlakiewicz2022-10-301-1/+10
| | | | json_parse_int64(). Document that overflow/underflow for these functions is not an error, but sets errno=ERANGE.
* Fix incremental parsing of invalid numbers with exponents, such as "0e+-" ↵Eric Haszlakiewicz2020-06-271-0/+3
| | | | | | and "12.3E12E12", while still allowing "0e+" in non-strict mode. Deprecate the json_parse_double() function from json_util.h
* fix json_parse_uint64() usage of errnoPierce Lopez2020-05-101-0/+1
| | | | | introduced in #542 fixes #601
* Make json_abort() internal to json_object.cEric Haszlakiewicz2020-04-181-17/+0
|
* clang-format the filesdota172020-04-031-9/+7
|
* Fixes various Wreturn-type and Wimplicit-fallthrough errors on Mingw-w64Jehan2020-03-161-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a recent regression since commit 6359b798479d379a3202e02c6a938d9b40c0d856 which added various assert(0) calls (often replacing return-s). With Ming-W64 compiler, json-c build was failing with various errors of the sort: > /home/jehan/dev/src/json-c/json_object.c: In function 'json_object_int_inc': > /home/jehan/dev/src/json-c/json_object.c:841:1: error: control reaches end of non-void function [-Werror=return-type] > 841 | } > | ^ > In file included from /home/jehan/dev/src/json-c/json_object.c:17: > /home/jehan/dev/src/json-c/json_object.c: In function 'json_object_get_double': > /home/jehan/.local/share/crossroad/roads/w64/json-c/include/assert.h:76:4: error: this statement may fall through [-Werror=implicit-fallthrough=] > 76 | (_assert(#_Expression,__FILE__,__LINE__),0)) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /home/jehan/dev/src/json-c/json_object.c:1070:7: note: in expansion of macro 'assert' > 1070 | assert(0); > | ^~~~~~ > /home/jehan/dev/src/json-c/json_object.c:1072:3: note: here > 1072 | case json_type_boolean: > | ^~~~ The problem is that Mingw-w64 does not consider assert() as a noreturn (even assert(0)), because it has to be compatible by Microsoft libraries. See the discussion here: https://sourceforge.net/p/mingw-w64/bugs/306/ Instead let's create a new json_abort() function which is basically just an abort() function with an optional message, for such cases where abortion was non-conditional (using assert() and using the assertion condition as a message here was clearly a misuse of the function). And mark json_abort() as 'noreturn', as well as 'cold' for optimization purpose (this is code we expect to never run, unless there is a bug, that is). Finally let's use this json_abort() instead of previous misused assert() calls.
* add uint64 data to json-cdota172020-02-251-0/+1
|
* Add a json_object_from_fd_ex() function, to allow the max nesting depth to ↵Eric Haszlakiewicz2019-11-101-0/+12
| | | | be specified.
* Issue #488: use JSON_EXPORT on functions so they are properly exported on ↵Eric Haszlakiewicz2019-09-081-9/+9
| | | | Windows.
* Issue #418: Fix docs for json_util_from_fd and json_util_from_file to say ↵Eric Haszlakiewicz2018-06-141-2/+2
| | | | that they return NULL on failures.
* Squash doxygen warnings, and make a few slight improvements to the docs.Eric Haszlakiewicz2017-12-061-0/+2
|
* Add a brief overview of each file to the docs.Eric Haszlakiewicz2017-12-061-0/+4
|
* Rename _set_last_err() to _json_c_set_last_err().Eric Haszlakiewicz2017-11-291-2/+2
|
* Issue #161: add a json_object_to_fd() function.Eric Haszlakiewicz2017-06-181-1/+12
|
* Issue #189: Eliminate use of MC_ERROR from json_util.c, and add a ↵Eric Haszlakiewicz2016-06-261-1/+39
| | | | | | json_util_get_last_err() function to retrieve the error for those callers that care about it. Add tests and descriptions for the functions in json_util.c
* Introduce json_object_from_fdMichael Heimpold2014-07-211-0/+1
| | | | | | | Also refactor json_object_from_file to use json_object_from_fd internally. Signed-off-by: Michael Heimpold <mhei@heimpold.de>
* Move the json_min() and json_max() macros to json_util.h and mark everything ↵Eric Haszlakiewicz2014-05-041-0/+9
| | | | | | else in bits.h deprecated. Eliminate all uses of bits.h within the json-c code.
* Update json_utilPascal Bach2013-08-131-2/+2
| | | | | filename should be passed as const char* to functions json_object_to_file and json_object_to_file
* float parsing must be locale independentRemi Collet2012-11-271-0/+1
|
* Add a json_object_to_json_string_ext() function to allow the formatting of ↵Eric Haszlakiewicz2012-04-281-0/+2
| | | | | | | | | output to be selected. There are now three options: JSON_C_TO_STRING_SPACED, JSON_C_TO_STRING_PLAIN and JSON_C_TO_STRING_PRETTY. This also add a json_object_to_file_ext() that takes the same flags. Existing output of json_object_to_json_string() is unchanged, and uses JSON_C_TO_STRING_SPACED. Thanks fo Grant Edwards for the initial patches.
* Add a json_type_to_name() function which returns a string that describes the ↵Eric Haszlakiewicz2011-05-031-0/+6
| | | | | | type. Useful for logging. git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@67 327403b1-1117-474d-bef2-5cb71233fd97
* * Add int64 support. Two new functions json_object_net_int64 andMichael Clark2010-10-061-0/+1
| | | | | | | | | | json_object_get_int64. Binary compatibility preserved. Eric Haszlakiewicz, EHASZLA at transunion com Rui Miguel Silva Seabra, rms at 1407 dot org git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@56 327403b1-1117-474d-bef2-5cb71233fd97
* * Make json_object_from_file take const char *filenameMichael Clark2009-08-271-1/+1
| | | | | | | Spotted by Vikram Raj V, vsagar at attinteractive dot com git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@55 327403b1-1117-474d-bef2-5cb71233fd97
* * Don't use this as a variable, so we can compile with a C++ compilerMichael Clark2009-02-251-0/+8
| | | | | | | | | | * 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> git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@33 327403b1-1117-474d-bef2-5cb71233fd97
* fix typoMichael Clark2009-01-101-1/+1
| | | | git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@29 327403b1-1117-474d-bef2-5cb71233fd97
* * Fix bug in escaping of control charactersMichael Clark2007-03-131-13/+1
| | | | | | | | | | 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> git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@12 327403b1-1117-474d-bef2-5cb71233fd97
* * Make headers C++ compatible by change *this to *objMichael Clark2007-03-131-11/+4
| | | | | | | | | | | | | | | * 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> git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@10 327403b1-1117-474d-bef2-5cb71233fd97
* * printbuf.c - C. Watford (christopher dot watford at gmail dot com)Michael Clark2007-03-131-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | 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> git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@4 327403b1-1117-474d-bef2-5cb71233fd97
* import of version 0.1Michael Clark2007-03-131-0/+13
git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@2 327403b1-1117-474d-bef2-5cb71233fd97