| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
json_parse_int64(). Document that overflow/underflow for these functions is not an error, but sets errno=ERANGE.
|
|
|
|
| |
fails, to match the docs for json_object_get_int.
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes
json_util.c:63:35: error: a function declaration without a prototype is deprecated in all versions of C [-We
rror,-Wstrict-prototypes]
const char *json_util_get_last_err()
^
void
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
|
|
|
| |
castings.
|
|
|
|
|
|
|
|
| |
If the input file is too large to fit into a printbuf then return an
error value instead of silently truncating the parsed content.
This introduces errno handling into printbuf to distinguish between an
input file being too large and running out of memory.
|
|
|
|
| |
Error messages did not reflect actual function names.
|
|
|
|
|
| |
Was detected by Coverity Scan when analyzing GDAL's code base which has
a copy of json-c
|
|
|
|
| |
non-locale-sensitive approaches.
|
|
|
|
|
|
| |
and "12.3E12E12", while still allowing "0e+" in non-strict mode.
Deprecate the json_parse_double() function from json_util.h
|
|
|
|
|
| |
introduced in #542
fixes #601
|
| |
|
| |
|
|
|
|
| |
creating defines for those only when needed, which should exclude mingw environments.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
uint64},...}
|
| |
|
| |
|
|
|
|
| |
be specified.
|
| |
|
|
|
|
| |
_strtoi64.
|
|
|
|
|
|
|
|
|
| |
Got the idea from this blog post:
http://www.enchantedage.com/node/231
Simple & concise stuff :)
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
|
| |
|
|
|
|
| |
directly check for "0" in the input.
|
|
|
|
| |
string is terminated.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If we want to override `strerror()` in libjson-c
to make tests consistent across platforms, we
need to do it build-wide as configure/build
option.
Apple linkers make it really hard to override functions
at link-time, and this seems to be locked down on travis-ci.org
[ for security reasons I assume ].
While I got it to work locally, it did not work
when running on travis.
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
|
| |
|
| |
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
Also refactor json_object_from_file to use json_object_from_fd
internally.
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
|
|
|
|
|
|
| |
else in bits.h deprecated.
Eliminate all uses of bits.h within the json-c code.
|
|
|
|
|
| |
filename should be passed as const char* to functions
json_object_to_file and json_object_to_file
|
|
|
|
| |
Also adjust an error message in json_util to make it unique. Fixes #87.
|
| |
|
|\
| |
| |
| |
| | |
Conflicts:
json_util.c
|
| | |
|
| | |
|
| |
| |
| |
| | |
If that workaround is not needed parsing is nearly twice as fast.
|
| | |
|
|/ |
|
|
|
|
| |
valid numbers after parsing an out of range number works.
|
| |
|
|
|
|
| |
with #define HAVE_X where #define HAVE_X 1|0 is meant.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
VC 9 doesn't support late variable declarations, and doesn't have inttypes
so we need some direct definitions of a couple of more types.
|
|
|
|
|
|
| |
type. Useful for logging.
git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@67 327403b1-1117-474d-bef2-5cb71233fd97
|
|
|
|
|
|
|
|
|
|
| |
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.
git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@60 327403b1-1117-474d-bef2-5cb71233fd97
|
|
|
|
|
|
|
|
| |
Zachary Blair, zack_blair at hotmail dot com
git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@59 327403b1-1117-474d-bef2-5cb71233fd97
|