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
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
Björn Esser
3008401b2a
test_deep_copy: Fix assertion value.
5 years ago
Björn Esser
dd040ba446
tests: Fix test_double_serializer without thread-local storage.
5 years ago
Tobias Stoeckmann
5385a566db
Prevent truncation on custom double formatters.
A custom double formatter can lead to truncation of the rest of the
JSON document.
If a custom formatter completely fills the buffer used by snprintf
with a trailing dot or comma and the formatting option
JSON_C_TO_STRING_NOZERO has been specified, then an iterator moves
past the ending '\0' (off-by-one buffer overflow) to set an
additional '\0' and adds the first '\0' into the printbuf.
Since '\0' will eventually be considered the terminating character
of the complete printbuf result, all trailing characters are lost.
This leads to an incomplete JSON string as can be seen with the
test case.
The off-by-one can be noticed if compiled with address sanitizer.
Since this is a very special case and a malformed formatter could
do way more harm and is the responsibility of the user of this
library, this is just a protective measure to keep json-c code as
robust as possible.
5 years ago
David McCann
add7b13a9a
Improved support for IBM operating systems
Fix compiler errors and warnings when building on IBM operating systems such as AIX and IBM i.
5 years ago
Pierce Lopez
003b58782b
fix json_parse_uint64() usage of errno
introduced in #542
fixes #601
5 years ago
Eric Haszlakiewicz
26f080997d
Fix snprintf on windows problem for test4.
5 years ago
Eric Haszlakiewicz
a59d5acfab
Re-format after recent change to fix linkhash.
5 years ago
Eric Haszlakiewicz
519dfe1591
Issue #599 : Fix the backwards check in lh_table_insert_w_hash() that was preventing adding more than 11 objects.
Add a test to check for this too.
5 years ago
Eric Haszlakiewicz
f6f76f9430
Add a JSON_TOKENER_ALLOW_TRAILING_CHARS flag for json_tokener_set_flags() to allow multiple objects to be parsed from input even when JSON_TOKENER_STRICT is set.
5 years ago
Eric Haszlakiewicz
05623b3a2e
Add an tok_flags field to explicitly specify tokener flags in test_parse and eliminate the previous bogus calls to json_tokener_set_flags()
5 years ago
Eric Haszlakiewicz
a9114392b4
Merge pull request #524 from dota17/addTestCase_obj_token
Increase coverage
5 years ago
dota17
b14363ae32
remove unsuitable case
5 years ago
dota17
2876fcc137
clang-format two test_util_file.c and test_object_iterator.c
5 years ago
chenguoping
8096125618
Increased the test coverage of json_util.c from 76% to 90.3%.
5 years ago
chenguoping
f56c5c1a60
Increased the test coverage of json_object_iterator.c from 0% to 100%
5 years ago
dota17
74bbe349c4
clang-format test1.c
5 years ago
chenguoping
110c60fcdd
fix valgrind errors
5 years ago
chenguoping
76e1472808
testcase for array_list
5 years ago
Björn Esser
5e699f7f73
Be verbose on failing json_c_version test.
5 years ago
Eric Haszlakiewicz
c58d56ab7c
Merge pull request #576 from besser82/topic/besser82/increase_coverage
Test coverage for json_c_version.
5 years ago
Björn Esser
d47fb12e85
Test coverage for json_c_version.
5 years ago
Björn Esser
73a2ed115a
Remove multiple trailing newlines at EOF.
5 years ago
Björn Esser
78cd37fb18
Clean trailing white-space.
5 years ago
Eric Haszlakiewicz
95737df9d4
Remove autoconf machinery, we're using cmake now. Update the release checklist to account for that, plus fill in other tasks and clean it up a bit.
5 years ago
dota17
8b162c4b89
clang-format the files
5 years ago
dota17
c117d8a8a8
add the disabling formatting coments and adjust the partial code manuly
5 years ago
dota17
3822177473
add test cases
5 years ago
Eric Haszlakiewicz
a8c9284f06
Merge pull request #547 from dota17/assert_test
modify json-c default build type, and fix up the assert() errors in t…
5 years ago
dota17
e56ab0146f
update testcase and delete debug -O0 build
5 years ago
dota17
2d44f865c3
modify json-c default build type, and fix up the assert() errors in testcase
5 years ago
dota17
6359b79847
update json_object.c and testcase, delete json_object_uint_inc()
5 years ago
dota17
9532f94fa4
modify partial functions and testcase, in order to support automatic conversion for int64/uint64
5 years ago
dota17
c816de212b
modify the json_object, replace c_int64/c_uint64 with struct{union{int64, uint64},...}
5 years ago
dota17
3c3b5920f7
add uint64 data to json-c
5 years ago
Eric Haszlakiewicz
4bf7ffa984
Issue #539 : be sure to clean up at the end of test_set_value.
5 years ago
Eric Haszlakiewicz
ae13ca524a
Issue #539 : reset the serializer when json_object_set_double() is called and the current serializer is the one that json_object_new_double_s() used.
5 years ago
Eric Haszlakiewicz
0ffdbb2395
Merge pull request #531 from dota17/utf8test
validate utf-8 string
5 years ago
dota17
010f33d460
add json_object_new_null
5 years ago
dota17
787a8b3f1c
update code
5 years ago
Po-Chuan Hsieh
bb5971ba2a
Fix make check
cc -DHAVE_CONFIG_H -I. -I.. -I.. -I../tests -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -Wall -Werror -Wcast-qual -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -D_GNU_SOURCE -D_REENTRANT -MT test_parse.o -MD -MP -MF .deps/test_parse.Tpo -c -o test_parse.o test_parse.c
test_parse.c:256:14: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]
{ "null123" + 4, 4, 3, json_tokener_success, 1 },
~~~~~~~~~~^~~
test_parse.c:256:14: note: use array indexing to silence this warning
{ "null123" + 4, 4, 3, json_tokener_success, 1 },
^
& [ ]
test_parse.c:258:12: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]
{ "nullx" + 4, 2, 0, json_tokener_error_parse_unexpected, 1 },
~~~~~~~~^~~
test_parse.c:258:12: note: use array indexing to silence this warning
{ "nullx" + 4, 2, 0, json_tokener_error_parse_unexpected, 1 },
^
& [ ]
test_parse.c:260:25: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]
{ "{\"a\":1}{\"b\":2}" + 7,
~~~~~~~~~~~~~~~~~~~~~^~~
test_parse.c:260:25: note: use array indexing to silence this warning
{ "{\"a\":1}{\"b\":2}" + 7,
^
& [ ]
3 errors generated.
*** Error code 1
Stop.
5 years ago
dota17
eca74dcccf
test utf8
5 years ago
Eric Haszlakiewicz
e651e96a5b
Merge pull request #526 from dota17/addTestCase_printbuf
Increased the test coverage of printbuf.c 82% to 92%.
5 years ago
Eric Haszlakiewicz
a255510cca
Merge pull request #525 from dota17/addPointerTestcase
update pointer test case
5 years ago
chenguoping
8c0cb0bd28
Increased the test coverage of printbuf.c 82% to 92%.
5 years ago
Eric Haszlakiewicz
0421772bbc
Merge pull request #523 from dota17/updatetestcase
update tsetcase for tokener_c
5 years ago
Eric Haszlakiewicz
4bfed6eb2f
Merge pull request #522 from dota17/addVisitTestcase
update json_visit testcase
5 years ago
dota17
5fe4448541
update tsetcase for tokener_c
5 years ago