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
9 years ago
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
9 years ago
Kevin Branigan
e95313adad
Merge pull request #24 from FSMaxB/fix_code_order
Fix printing of empty string pointers
9 years ago
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)
...
9 years ago
Kevin Branigan
d4906be4f0
Merge pull request #23 from FSMaxB/format_fix
Fix format problem with empty objects
9 years ago
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": {
}
}
}
9 years ago
Kevin Branigan
361b9a58cb
Merge pull request #19 from FSMaxB/fix_boolean
fix boolean expression
9 years ago
Kevin Branigan
99c46e7661
Merge pull request #20 from FSMaxB/fix_memory_leaks
fix memory leaks
9 years ago
Kevin Branigan
c7241f5314
Merge pull request #22 from FSMaxB/unreachable_line
Remove line that will never be executed
9 years ago
Max Bruckner
7c25dc9135
Remove line that will never be executed
9 years ago
Max Bruckner
58bc383b28
fix memory leaks
9 years ago
Max Bruckner
ec71726ef8
fix boolean expression
This expression was always false.
9 years ago
Kevin Branigan
1a20eb8494
Fixed linux compile to support fpclassify (issue #18 )
9 years ago
Kevin Branigan
8865d869db
cJSON_HasObjectItem didn’t compile
9 years ago
Kevin Branigan
322e440e78
Merge pull request #16 from npi3pak/patch-1
README.md: fixed formatting
9 years ago
Kevin Branigan
11fb0d0215
Merge pull request #15 from dieyushi/master
add new macro for iterating over an array
9 years ago
Kevin Branigan
1e1de63244
Merge pull request #13 from rmeertens/master
added cJSON_HasObjectItem
9 years ago
Kevin Branigan
11b8c97f41
Merge pull request #17 from Scypho/master
Handle invalid numbers
9 years ago
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.
9 years ago
IvanVoid
0b807e21a4
README.md: fixed formatting
9 years ago
root
0da343068e
add new macro for iterating over an array
9 years ago
Roland Meertens
b175877d8b
+usefull function
9 years ago
Kevin Branigan
affedd65ba
Merge pull request #11 from etodd/win-math-lib-fix
Remove "m" library dependency on Windows.
9 years ago
Evan Todd
ebd06067a4
Remove "m" library dependency on Windows.
9 years ago
Kevin Branigan
a819694712
Merge pull request #10 from ajaybhargav/master
Update gitignore to avoid tracking unwanted files
9 years ago
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>
9 years ago
Kevin Branigan
f86b9bdfcf
Merge pull request #9 from anton-sergeev/master
Merge latest upstream code (svn rev. 73) into github fork
9 years ago
Anton Sergeev
956129116f
Support cJSON_Utils library in CMakeLists.txt
Signed-off-by: Anton Sergeev <Anton.Sergeev@elecard.ru>
9 years ago
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
9 years ago
Kevin Branigan
2bd1e80f6c
Merge pull request #8 from anton-sergeev/master
Add CMakeLists.txt
9 years ago
Anton Sergeev
262189428e
Add CMakeLists.txt
Signed-off-by: Anton Sergeev <Anton.Sergeev@elecard.ru>
9 years ago
Kevin Branigan
7632993ebe
Merge pull request #7 from DongwenHuang/master
Update cJSON.c
10 years ago
DongwenHuang
10b888be54
Update cJSON.c
10 years ago
Kevin Branigan
0fd1435f4b
Merge pull request #6 from DongwenHuang/master
Update test.c
10 years ago
DongwenHuang
4132e9301d
Update test.c
10 years ago
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
10 years ago
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
10 years ago
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
10 years ago
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
10 years ago
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
10 years ago
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
10 years ago
Dave Gamble
b44a338c6d
Optimise out escapable array.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@67 e3330c51-1366-4df0-8b21-3ccf24e3d50e
10 years ago
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
10 years ago
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
10 years ago
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
10 years ago
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
10 years ago
Dave Gamble
2abfb716d1
fix formatting.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@62 e3330c51-1366-4df0-8b21-3ccf24e3d50e
10 years ago
Dave Gamble
d9fc81e6c8
Added buffered printing methods for faster printing.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@61 e3330c51-1366-4df0-8b21-3ccf24e3d50e
10 years ago
Dave Gamble
70984d47e9
patch to optimise array/object printing.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@60 e3330c51-1366-4df0-8b21-3ccf24e3d50e
10 years ago
Dave Gamble
575724a15f
optimises for number/string print
git-svn-id: svn://svn.code.sf.net/p/cjson/code@59 e3330c51-1366-4df0-8b21-3ccf24e3d50e
10 years ago