Commit Graph

34 Commits

Author SHA1 Message Date
Max Bruckner 65541b900c Update space requirements of cJSON_PrintPreallocated 2017-04-08 03:42:44 +02:00
Max Bruckner be0951dfa4 Move parse tests from test.c -> parse_example.c 2017-02-07 21:35:20 +01:00
Max Bruckner 86be961bb5 test.c: remove file related code 2017-02-07 21:35:19 +01:00
Max Bruckner f09bdef15e Revert "test.c: Fix buffer overrun found by coverity"
This reverts commit c866abd842.

The length of this buffer was intentional. This looks like a false
positive.
2017-02-07 21:22:40 +01:00
Max Bruckner c866abd842 test.c: Fix buffer overrun found by coverity 2017-02-07 20:59:55 +01:00
Max Bruckner 3d3bfc6a4d Compiler flag -Wconversion
Makes type conversions explicit, if they alter a value
2017-02-03 18:36:13 +01:00
Max Bruckner c49ffbfba8 cJSON_Version: returns a version string
This is useful to programmatically find out the version of cJSON that
has been used (useful in case of scripting language bindings for
example).
2017-01-12 20:37:29 +01:00
Max Bruckner 3d6ae11340 Make cJSON C++ compatible 2016-12-28 12:33:20 +01:00
Max Bruckner d992cd46e6 test: Handle cJSON_PrintPreallocated return values correctly 2016-12-06 08:47:44 +07:00
Max Bruckner f10e2f884a test: exit on malloc failure 2016-12-06 08:41:51 +07:00
Stephan Gatzka 345d57e9e5 Make print_preallocated static.
Otherwise compilation failes due to missing prototypes.
2016-11-28 20:21:38 +01:00
Max Bruckner bf17703012 Merge branch 'print_preallocated' 2016-11-28 23:08:25 +07:00
Kyle Chisholm 3917fb5255 use print_preallocated function to test printout of JSON 2016-11-28 22:59:55 +07:00
Kyle Chisholm 99896d879c function to print and compare to preallocated buffer 2016-11-28 22:59:55 +07:00
Kyle Chisholm de93d76d0b changed to cJSON_PrintPreallocated, added flag in printbuffer 2016-11-28 22:59:53 +07:00
Stephan Gatzka a8e1368697 Make function static when possible.
This is a prerequisite to later enable -Wmissing-prototypes.
2016-11-27 18:20:58 +01:00
Max Bruckner b88da9b0de Initialize all variables 2016-11-19 17:29:21 +07:00
Max Bruckner 9e31049159 test and test_utils: Make compliant with ANSI C 2016-11-08 00:57:58 +07:00
Max Bruckner 8ac1ba416e test: Fix unescaped quote 2016-11-08 00:57:57 +07:00
Max Bruckner fcbeb1c36b reformatting: test.c 2016-10-11 00:34:19 +07:00
Irwan Djajadi 224c2a8485 Fix compiler error when it encountered 1.0/0.0. It does not want to deal
with division by 0.
Tricked the compiler to use volatile local variable zero instead, so it
does not know for sure whether or not it's going to be zero.
2016-04-22 14:27:20 -05:00
Christian Schulze 52d7d14f6c fixed segfault when the lib tries to parse HTML with embedded CSS; provided test case 2016-03-06 16:43:53 +01:00
Linus Wallgren e4b96fa820 Handle invalid numbers
Previously cJSON generated invalid JSON when a number was infinite or
similar. This patch changes the behaviour to match javascript, that is
to render such a number as null.
2015-10-01 17:27:59 +02:00
Anton Sergeev 74793934ad Merge latest upstream code (r73) into github fork.
Signed-off-by: Anton Sergeev <Anton.Sergeev@elecard.ru>

Conflicts:
	cJSON.c
	test.c
2015-07-28 03:48:06 +06:00
DongwenHuang 4132e9301d Update test.c 2015-06-12 12:44:42 +08:00
Dave Gamble 1d9b70e706 Fix comment style for proper ansi c compliance.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@69 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2015-02-13 19:07:29 +00:00
Dave Gamble 46e3724aa8 clean up test.c
git-svn-id: http://svn.code.sf.net/p/cjson/code@54 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2013-02-09 12:57:04 +00:00
Dave Gamble 6a58ba5285 Include some analysis so that you can debug a failed parse.
You really oughtn't go too far with this, because it's only loose information; as I've said before, cJSON +isn't+ a validating parser. But this might give you enough info to save yourself on some rare occasion ;)



git-svn-id: http://svn.code.sf.net/p/cjson/code@38 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2011-03-02 21:22:57 +00:00
Dave Gamble 02d86ef778 Update to permit compilation with gcc -ansi flag
(changed all C++ // comments to C /* */ comments).



git-svn-id: http://svn.code.sf.net/p/cjson/code@34 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2011-03-02 19:09:43 +00:00
Dave Gamble 69dca155a9 comment these out for clarity...
git-svn-id: http://svn.code.sf.net/p/cjson/code@16 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2009-11-11 00:14:51 +00:00
Dave Gamble 6b51f927e9 two bizarre tweaks to demonstrate the replace functionality.
git-svn-id: http://svn.code.sf.net/p/cjson/code@15 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2009-11-10 23:51:15 +00:00
Dave Gamble 5bd220c8dc add macros. tighten code.
git-svn-id: http://svn.code.sf.net/p/cjson/code@3 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2009-08-26 04:27:07 +00:00
Dave Gamble a4a4e7cbff make these PROPERLY ansi-c compliant ;)
git-svn-id: http://svn.code.sf.net/p/cjson/code@2 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2009-08-26 03:57:15 +00:00
Dave Gamble 805b652e51 here it is, cJSON 1.0
git-svn-id: http://svn.code.sf.net/p/cjson/code@1 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2009-08-26 03:55:20 +00:00