Commit Graph

970 Commits

Author SHA1 Message Date
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
Dave Gamble
b44a338c6d Optimise out escapable array.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@67 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2015-02-11 11:31:35 +00:00
Dave Gamble
060e6563c0 Add more patch functionality and some more utils.
Also add a new #define to cJSON.h for SetNumberValue.


git-svn-id: svn://svn.code.sf.net/p/cjson/code@66 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2015-02-11 01:29:40 +00:00
Dave Gamble
3c6b3cc617 start of JSON Patch implementation. cJSON gained a cJSON_InsertItemToArray which pushes elements up by one.
This is needed for JSON Patch. Everything but Test is implemented for ApplyPatches.


git-svn-id: svn://svn.code.sf.net/p/cjson/code@65 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2015-02-10 14:17:59 +00:00
Dave Gamble
858671cc7f rework cJSONUtils_GetPointer to avoid malloc/free by using strcmp with pointer-encoding awareness.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@64 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2015-02-10 12:14:59 +00:00
Dave Gamble
c0f5e2056b add cJSON_Utils which includes JSON Pointer implementation
git-svn-id: svn://svn.code.sf.net/p/cjson/code@63 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2015-02-09 18:29:05 +00:00
Dave Gamble
2abfb716d1 fix formatting.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@62 e3330c51-1366-4df0-8b21-3ccf24e3d50e
2015-02-09 17:38:18 +00:00