Eric Haszlakiewicz
f23486a321
In the json_tokener_state_number case, explicitly adjust what "number" characters are allowed based on the exact micro-state that we're in, and check for invalid following characters in a different way, to allow a valid json_type_number object to be returned at the top level.
This causes previously failing strings like "123-456" to return a valid json_object with the appropriate value. If you care about the trailing content, call json_tokener_parse_ex() and check the parse end point with json_tokener_get_parse_end().
5 years ago
Eric Haszlakiewicz
6eac6986c9
Fix incremental parsing of invalid numbers with exponents, such as "0e+-" and "12.3E12E12", while still allowing "0e+" in non-strict mode.
Deprecate the json_parse_double() function from json_util.h
5 years ago
Eric Haszlakiewicz
84e6032883
Issue #635 : Fix "expression has no effect" warning in json_tokener.c by casting to void.
5 years ago
Eric Haszlakiewicz
7a72805e34
Fix memory leak in test_parse's single_incremental_parse().
5 years ago
Eric Haszlakiewicz
7d3c2d9fad
Drop extra blank lines from arraylist.h
5 years ago
Eric Haszlakiewicz
a68566bf6a
Issue #616 : Change the parsing of surrogate pairs in unicode escapes so it uses a couple of additional states instead of assuming the low surrogate is already present, to ensure that we correctly handle various cases of incremental parsing.
5 years ago
Eric Haszlakiewicz
197e372464
In test_parse, fix lengths passed during a couple of incremental tests.
Add an optional way to use an incremental chunk size ($TEST_PARSE_CHUNKSIZE)
for all of the single_basic_parse tests, in additional to the regular way.
5 years ago
Eric Haszlakiewicz
36118b681e
Rearrange the json_tokener_state_escape_unicode case in json_tokener to simplify the code slightly and make it a bit easier to understand.
While here, drop the utf8_replacement_char that is unnecesarily added if we run out of input in the middle of a unicode escape. No other functional changes (yet).
5 years ago
Eric Haszlakiewicz
50179fb09f
Update the json_tokener_parse_ex() docs to clarify that the final '\0' character is to be included in length passed in.
5 years ago
Eric Hawicz
da76ee26e7
Merge pull request #633 from dota17/issue616
fix issue 616: support the surrogate pair in split file.
5 years ago
Eric Haszlakiewicz
e26a1195f4
Add json_object_array_shrink() (and array_list_shrink()) and use it in json_tokener to minimize the amount of memory used. This results in a 39%-50% reduction in memory use (peak RSS, peak heap usage) on the jc-bench benchmark and 9% shorter runtime.
Also add the json_object_new_array_ext, array_list_new2, and array_list_shrink functions.
5 years ago
Eric Hawicz
99bb2121c6
Merge pull request #632 from json-c/json_object-split
Json object split
5 years ago
Eric Haszlakiewicz
0710c835a1
Reformat the json_object-split branch with clang-format
5 years ago
Eric Hawicz
401b29c021
Merge pull request #634 from micahsnyder/json-c-fPIC
Issue #508 : `-fPIC` to link libjson-c.a with libs
5 years ago
Micah Snyder
60494684a1
Issue #508 : `-fPIC` to link libjson-c.a with libs
json-c has symbol collisions with other popular C JSON libraries.
To prevent random crashes in downstream applications that may use a
library which depends on json-c, the solution is to statically link
libjson-c.a into those libraries.
`-fPIC`/`-fPIE` is required when building a `.a` so it can be linked
into a `.so`.
5 years ago
Eric Haszlakiewicz
9128ec49b1
Include unistd.h to fix the build on OSX
5 years ago
Eric Haszlakiewicz
5ebfeaedc5
Drop the _delete field from struct json_object and call the type-specific delete functions directly from json_object_put. (Thanks @dota17 for the suggestion in PR #632!)
5 years ago
Eric Haszlakiewicz
4c10712114
Drop the useless "char data[1]" from struct json_object. Fix a typo in a comment.
5 years ago
dota17
c1b872d817
fix issue 616: support the surrogate pair in split file.
5 years ago
Eric Haszlakiewicz
85c244f048
Eliminate unnecessary cast that was added to test_double_serializer.
5 years ago
Eric Haszlakiewicz
02fe2e0ccd
Summarize the changes from the json_object-split branch in the ChangeLog.
5 years ago
Eric Haszlakiewicz
ecdfeb18cf
Move the ssize_t typedef from json_inttypes.h to json_object_private.h so as not to affect publically exposed symbols.
5 years ago
Eric Haszlakiewicz
66d91fdf86
The split of json_object into type-specific sub-structures is now functionally complete.
Remove all of the temporary defines, structures, old compat fuctions, extra fields, etc... that were needed during the conversion to a split set of json_object_* structures.
5 years ago
Eric Haszlakiewicz
c4cc673071
More fixes for old MSVC builds.
5 years ago
Eric Haszlakiewicz
0a16b23adf
Fix typo in previous commit to check for SSIZE_T on MSVC.
5 years ago
Eric Haszlakiewicz
eab1375123
Change CMakeLists.txt to look for SSIZE_T on MSVC too.
5 years ago
Eric Haszlakiewicz
b0466b626b
On MSVC, add a ssize_t typedef using SSIZE_T from BaseTsd.h
5 years ago
Eric Haszlakiewicz
0fc9d91277
Kick json_type_string out of struct json_object.
The default is now that string data is stored inline at the end of json_object, though to allow for json_object_set_string() to set a _longer_ string, we still need to allow for the possibility of a separate char * pointer.
All json types have been split out now, next step it cleanup.
5 years ago
Eric Hawicz
bc06f82f85
Merge pull request #628 from clamwin/compat-fixes-master
get_cryptgenrandom_seed: compat with old windows + fallback
5 years ago
Gianluigi Tiesi
481d0a8ede
get_cryptgenrandom_seed: compat with old windows + fallback
5 years ago
Eric Haszlakiewicz
1c6086a86a
Apply the fix from @pointbre in issue #626 to skip "inline" on AIX, but invert the test to make it a little easier to understand.
5 years ago
Eric Haszlakiewicz
fe308b8862
Issue #626 : Restore compatibility with cmake 2.8 by adjusting quoting and explicitly defining the PROJECT_VERSION* variables.
5 years ago
Eric Haszlakiewicz
9ecb1222bd
Kick json_type_int and json_type_double out of struct json_object.
Clean up the code in json_object_new_* a bit by dropping unnecesary json_object_base variables.
5 years ago
Eric Haszlakiewicz
0351bb55c8
Declare variables earlier, to appease Visual Studio 2010.
5 years ago
Eric Haszlakiewicz
d1f83bf5ea
Kick json_type_boolean out of struct json_object.
5 years ago
Eric Haszlakiewicz
5d89fc8a9d
Add some backwards compat for Visual Studio 2013.
5 years ago
Eric Haszlakiewicz
02b687b9a6
Kick json_type_array out of struct json_object; re-enable the test_deep_copy test.
5 years ago
Eric Haszlakiewicz
853b4b5dee
Start splitting struct json_object into multiple sub-types, as descibed at https://github.com/json-c/json-c/wiki/Proposal:-struct-json_object-split
The current changes split out _only_ json_type_object, and thus have a number of hacks
to allow the code to continue to build and work.
Originally mentioned in issue #535 .
When complete, this will probably invalidate #552 .
This is likely to cause notable conflicts in any other significant un-merged
changes, such as PR#620.
5 years ago
Eric Haszlakiewicz
4a546e7b2f
In arraylist, use malloc instead of calloc, avoid clearing with memeset until we really need to, and micro-optimize array_list_add().
5 years ago
Eric Hawicz
fbe1543644
Merge pull request #622 from besser82/topic/besser82/doc_subdir
doc: Move Doxyfile into doc subdir.
5 years ago
Björn Esser
1e94da779a
CMake: Fix grammar: written -> wrote.
5 years ago
Björn Esser
61e2bae511
doc: Move Doxyfile into doc subdir
5 years ago
Eric Haszlakiewicz
fa6a7dccb9
With the change in cc80203, Doxyfile no longer needs to be updated for a release.
5 years ago
Eric Hawicz
cc802039a8
Merge pull request #619 from besser82/topic/besser82/doxygen_oot
CMake: Fix out-of-tree build for Doxygen documentation.
5 years ago
Eric Hawicz
12b2e1159d
Merge pull request #618 from besser82/topic/besser82/test_deep_copy
test_deep_copy: Fix assertion value.
5 years ago
Björn Esser
8f3592b3d5
CMake: Fix out-of-tree build for Doxygen documentation.
5 years ago
Björn Esser
3008401b2a
test_deep_copy: Fix assertion value.
5 years ago
Eric Hawicz
a8a0590921
Merge pull request #617 from besser82/topic/besser82/option_disable_tls
Add an option to disable the use of thread-local storage.
5 years ago
Björn Esser
a85d2395ff
README: Update configuration options for CMake.
5 years ago
Björn Esser
76dd99abb2
CMake: Re-format config-option block and re-order it alphabetically.
5 years ago