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.
2020-05-14 15:39:35 +01:00
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.
2020-04-21 03:53:44 +00:00
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()
2020-04-21 03:53:44 +00:00
dota17
8b162c4b89
clang-format the files
2020-04-03 11:39:30 +08:00
dota17
c117d8a8a8
add the disabling formatting coments and adjust the partial code manuly
2020-04-03 11:28:04 +08:00
dota17
3c3b5920f7
add uint64 data to json-c
2020-02-25 14:51:35 +08:00
Eric Haszlakiewicz
0ffdbb2395
Merge pull request #531 from dota17/utf8test
...
validate utf-8 string
2020-02-05 21:56:06 -05:00
dota17
787a8b3f1c
update code
2020-01-20 10:41:24 +08:00
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.
2020-01-11 07:20:44 +00:00
dota17
eca74dcccf
test utf8
2020-01-10 18:33:14 +08:00
dota17
5fe4448541
update tsetcase for tokener_c
2020-01-02 19:19:12 +08:00
chenguoping
1446572997
add testcases of object and token
2019-12-27 15:07:00 +08:00
Eric Haszlakiewicz
25aedddcdf
Fix memory leaks in test_double_serializer, and make sure all tests return 0 at the end of main().
2019-11-23 12:05:28 -05:00
Eric Haszlakiewicz
05b41b159e
Add a json_tokener_get_parse_end() function to replace direct access of tok->char_offset.
2019-09-08 21:35:37 -04:00
Eric Haszlakiewicz
da4b34355d
Add an parse test for content starting with a UTF8 BOM, which is _not_ a valid start to a JSON message.
2018-03-25 18:23:42 -04:00
Eric Haszlakiewicz
11ab365324
Deprecated a few typedefs, add docs on json_object_iter, move json_number_chars and json_hex-chars to json_object_private.h.
2017-12-05 09:20:59 -05:00
Eric Haszlakiewicz
31a6c2fac8
Add a few more tests to the partial parse to cover bytes after "Infinity".
2017-11-27 00:18:55 -05:00
Eric Haszlakiewicz
48f7e389fb
Fix parsing of "-Infinity" when the "-" and "Infinity" are split across multiple calls.
...
Add several additional test cases for partial parsing of infinity values.
2017-11-27 00:04:33 -05:00
Eric Haszlakiewicz
4d1e0b4409
Issue #371 : fix parsing of "-Infinity" (although in a somewhat different location than PR#372 used), and add a case to test_parse to check for this.
2017-11-26 22:44:39 -05:00
Eric Haszlakiewicz
2a22858fe7
Add a few extra cases to test_parse to show how trailing bytes are handled, especially for parsing "Infinity".
2017-11-26 22:34:43 -05:00
Eric Haszlakiewicz
b8738dd623
Rewrite test_basic_parse() to factor out a single_basic_parse() to avoid lots of duplicate boiler plate code.
...
Also, emit the input string in the output so it's easier to see what's going on.
2017-11-26 22:33:36 -05:00
Eric Haszlakiewicz
8c86207258
Add a few more cases to test_parse to provide some examples of how parsing works; should help address the questions raised in Issue #302 .
2017-02-26 16:22:45 +00:00
Eric Haszlakiewicz
33339ae595
Use json_visit() to clear the serializer data set when parsing so the output from test_parse reflects the actual values parsed.
2016-10-29 15:13:16 -04:00
Eric Haszlakiewicz
36a28fcb0c
Issue #275 : fix out of bounds read when handling unicode surrogate pairs.
2016-10-05 23:15:51 -04:00
Nicola Spanti (RyDroid)
8215c0ac0e
Very minor changes to some tests
2016-08-13 00:53:33 +02:00
Eric Haszlakiewicz
316da85818
Fix issue #201 : add a JSON_C_TO_STRING_NOSLASHESCAPE flag to turn off escaping of forward slashes.
2015-11-28 20:00:30 -06:00
chl
99d8fc975e
Tightening the number parsing algorithm
...
Some badly formated "numbers" could get partly parsed,
resulting in truncated results instead of raising an
error.
Examples :
'1.2.3' -> (double)1.2
'2015-01-15' -> (int)2015
This patch is not perfect (ex: input can still end with a 'E', which
is forbidden by json.org doc) but should avoid non-sensically
formated input.
Tests added.
2015-02-05 01:50:37 +01:00
Eric Haszlakiewicz
05da316b9c
Issue #103 : allow Infinity and -Infinity to be parsed.
2014-03-22 17:28:40 -04:00
Eric Haszlakiewicz
0eedf3802f
Issue#102 - add support for parsing "NaN".
2014-03-09 16:41:33 -04:00
Eric Haszlakiewicz
e8161a11bb
Issue #15 : add a way to set a JSON_TOKENER_STRICT flag to forbid commas at the end of arrays and objects.
2013-03-31 20:05:36 -05:00
Eric Haszlakiewicz
ca8b27d183
Enable -Werror and fix a number of minor warnings that existed.
2013-02-09 16:35:24 -06:00
Eric Haszlakiewicz
c3068bfd09
Reformat the test sources. No functional change.
2012-09-16 20:43:29 -05:00
Eric Haszlakiewicz
92f31bd99a
Handle the \f escape sequence (the two characters: backslash followed by an f, not a literal formfeed) and extend the test_parse test to check all valid escape sequences.
2012-07-29 12:31:07 -05:00
Eric Haszlakiewicz
c1b8891a13
Move the rest of the tests into the tests subdirectory.
2012-04-22 10:33:41 -05:00