Commit Graph

326 Commits

Author SHA1 Message Date
Kevin Branigan
a6a75645e4 Merge pull request #26 from nagamalli9999/master
Using values in powers of two for cJSON_* constants
2016-03-06 20:10:15 +00:00
Kevin Branigan
dbf16a0eb8 Merge pull request #31 from ChristianSch/master
fixed segmentation fault for non-json input / provided test case
2016-03-06 20:09:02 +00: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
Kevin Branigan
e70366a65a Merge pull request #29 from schmidtw/master
Publish the libraries and headers to the right directories during 'make install'.
2016-02-16 17:33:32 +00:00
Weston Schmidt
a5c60cd223 Improve the locations so the destination is correct as well as the include path. 2016-02-15 06:36:21 -08:00
Weston Schmidt
2cac21e156 Add install targets. 2016-02-15 06:21:48 -08:00
Kevin Branigan
53b7e74c9c Merge pull request #27 from nagamalli9999/makefile-uninstall
Added uninstall rule to Makefile
2016-02-11 13:09:29 -05:00
Eswar Yaganti
5daac864a3 Added uninstall rule to Makefile 2016-02-11 18:26:54 +05:30
Eswar Yaganti
8d94ecec75 Merge branch 'master' of https://github.com/nagamalli9999/cJSON 2016-02-10 10:01:03 +05:30
Eswar Yaganti
ce546b54d8 Changed the #define values of cJSON* data types
We can use bitops to check if the parsed JSON is of a particular types
using OR
2016-02-10 09:58:13 +05:30
Eswar Yaganti
51371c899e Changed the #define values of cJSON* data types
We can use bitops to check if the parsed JSON is of a particular types
using OR
2016-02-09 22:52:10 +05:30
Kevin Branigan
e95313adad Merge pull request #24 from FSMaxB/fix_code_order
Fix printing of empty string pointers
2015-10-25 23:48:38 -04:00
Max Bruckner
8222e9b8c4 Fix printing of empty string pointers
Once the check if str is NULL is reached, str has already been
derereferenced in the for loop, so in the case that the if clause would
be entered, the program has already crashed due to a null pointer
dereference.

By checking the content of str before dereferencing, the code in the if
clause is actually useful.

for (ptr=str;*ptr;ptr++) flag|=((*ptr>0 && *ptr<32)||(*ptr=='\"')||(*ptr=='\\'))?1:0;

...

if (!str)
...
2015-10-26 03:08:47 +01:00
Kevin Branigan
d4906be4f0 Merge pull request #23 from FSMaxB/format_fix
Fix format problem with empty objects
2015-10-25 22:02:33 -04:00
Max Bruckner
9cc37a2844 Fix format problem with empty objects
When printing empty objects, the closing curly brace was missing one
indentation level.

Example from the output of test_utils:

BEFORE FIX:
{
	"foo":	"bar",
	"child":	{
		"grandchild":	{
	}
	}
}

AFTER FIX:
{
	"foo":	"bar",
	"child":	{
		"grandchild":	{
		}
	}
}
2015-10-26 02:43:44 +01:00
Kevin Branigan
361b9a58cb Merge pull request #19 from FSMaxB/fix_boolean
fix boolean expression
2015-10-18 17:03:47 -04:00
Kevin Branigan
99c46e7661 Merge pull request #20 from FSMaxB/fix_memory_leaks
fix memory leaks
2015-10-18 17:03:25 -04:00
Kevin Branigan
c7241f5314 Merge pull request #22 from FSMaxB/unreachable_line
Remove line that will never be executed
2015-10-18 17:03:03 -04:00
Max Bruckner
7c25dc9135 Remove line that will never be executed 2015-10-16 15:01:24 +02:00
Max Bruckner
58bc383b28 fix memory leaks 2015-10-14 11:02:56 +02:00
Max Bruckner
ec71726ef8 fix boolean expression
This expression was always false.
2015-10-13 20:33:37 +02:00
Kevin Branigan
1a20eb8494 Fixed linux compile to support fpclassify (issue #18) 2015-10-05 13:46:14 -04:00
Kevin Branigan
8865d869db cJSON_HasObjectItem didn’t compile 2015-10-01 12:03:27 -04:00
Kevin Branigan
322e440e78 Merge pull request #16 from npi3pak/patch-1
README.md: fixed formatting
2015-10-01 11:38:53 -04:00
Kevin Branigan
11fb0d0215 Merge pull request #15 from dieyushi/master
add new macro for iterating over an array
2015-10-01 11:38:33 -04:00
Kevin Branigan
1e1de63244 Merge pull request #13 from rmeertens/master
added cJSON_HasObjectItem
2015-10-01 11:37:44 -04:00
Kevin Branigan
11b8c97f41 Merge pull request #17 from Scypho/master
Handle invalid numbers
2015-10-01 11:36:19 -04: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
IvanVoid
0b807e21a4 README.md: fixed formatting 2015-09-25 19:14:39 +03:00
root
0da343068e add new macro for iterating over an array 2015-09-16 21:28:01 +08:00
Roland Meertens
b175877d8b +usefull function 2015-09-15 02:40:27 +02:00
Kevin Branigan
affedd65ba Merge pull request #11 from etodd/win-math-lib-fix
Remove "m" library dependency on Windows.
2015-08-20 12:35:07 -04:00
Evan Todd
ebd06067a4 Remove "m" library dependency on Windows. 2015-08-19 23:03:08 -04:00
Kevin Branigan
a819694712 Merge pull request #10 from ajaybhargav/master
Update gitignore to avoid tracking unwanted files
2015-08-12 11:10:06 -04:00
Ajay Bhargav
acff70b22d Update gitignore to avoid tracking unwanted files
.gitignore updated to avoid tracking files generated after build. Following list
of files are added:
*.o
*.a
*.so
*.swp
*.patch
tags

Signed-off-by: Ajay Bhargav <ajay.bhargav@einfochips.com>
2015-08-12 12:53:33 +05:30
Kevin Branigan
f86b9bdfcf Merge pull request #9 from anton-sergeev/master
Merge latest upstream code (svn rev. 73) into github fork
2015-07-27 21:33:42 -04:00
Anton Sergeev
956129116f Support cJSON_Utils library in CMakeLists.txt
Signed-off-by: Anton Sergeev <Anton.Sergeev@elecard.ru>
2015-07-28 03:48:28 +06: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
Kevin Branigan
2bd1e80f6c Merge pull request #8 from anton-sergeev/master
Add CMakeLists.txt
2015-07-15 10:34:08 -04:00
Anton Sergeev
262189428e Add CMakeLists.txt
Signed-off-by: Anton Sergeev <Anton.Sergeev@elecard.ru>
2015-07-15 14:08:45 +06:00
Kevin Branigan
7632993ebe Merge pull request #7 from DongwenHuang/master
Update cJSON.c
2015-06-15 10:59:20 -04:00
DongwenHuang
10b888be54 Update cJSON.c 2015-06-15 17:13:22 +08:00
Kevin Branigan
0fd1435f4b Merge pull request #6 from DongwenHuang/master
Update test.c
2015-06-12 14:25:52 -04:00
DongwenHuang
4132e9301d Update test.c 2015-06-12 12:44:42 +08:00
Dave Gamble
8004ed3115 Fix bug with the sort.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@73 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2015-02-13 20:33:06 +00:00
Dave Gamble
174c62902c Since we anticipate repeated comparisons, add in a test for sorted lists, which can reduce
cost for sorted objects to O(N)


git-svn-id: svn://svn.code.sf.net/p/cjson/code@72 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2015-02-13 20:31:33 +00:00
Dave Gamble
491cf029b2 Rework cJSON_Utils object compare functions to use an O(N) algorithm on sorted lists.
It's a bit of a shame to use the sorts, because cJSON is otherwise incredibly stable (json->cJSON->json is unmodified modulo formatting),
but it means we get usable performance, rather than O(N^2) which will make CPUs cry.


git-svn-id: svn://svn.code.sf.net/p/cjson/code@71 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2015-02-13 19:53:27 +00:00
Dave Gamble
c4ddd7aaa3 Correct comment and variable declaration style to be more compatible. Added cJSONUtils_SortObject for sorting the members of an object alphabetically.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@70 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2015-02-13 19:19:26 +00: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
9d0a4cbf2a adjust the test very slightly
git-svn-id: svn://svn.code.sf.net/p/cjson/code@68 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2015-02-11 11:34:01 +00:00