Commit Graph

163 Commits

Author SHA1 Message Date
Krzysztof Gabis
7ead2102b8 Merge pull request #29 from i-rinat/fixups
Handle failures.
2015-04-29 21:49:51 +01:00
Rinat Ibragimov
9782447a74 free temporary JSON_Value's on failure 2015-04-29 22:44:17 +03:00
Rinat Ibragimov
717e551cb2 free memory after json_value_init_string_no_copy() failure 2015-04-29 21:46:18 +03:00
Rinat Ibragimov
33b77673cb check if ftell() returns -1 2015-04-29 21:27:41 +03:00
Krzysztof Gabis
2b4d17b337 Replaced strlen in process_string with pointer arithmetic. 2015-04-25 18:31:35 +01:00
Krzysztof Gabis
4a4cf7d795 Not parsing strings in json_value_init_string and *{set,dotset,replace,append}_string functions. 2015-04-06 10:12:04 +02:00
Krzysztof Gabis
0d5ac45286 Added additional null checks and tests. 2015-04-05 15:26:58 +02:00
Krzysztof Gabis
81c2fd0186 Merge pull request #23 from michaelsproul/no-exec-perms
Mark various files as not executable.
2015-03-01 09:36:38 +00:00
Michael Sproul
fcf0b810ba Marked various files as not executable.
Also updated the .gitignore file to ignore object code,
which is particularly useful when using this project as a
git submodule.
2015-02-28 20:33:17 -08:00
Krzysztof Gabis
1058e3b2c0 Fixed bug in example code. 2014-11-24 21:04:15 +01:00
Krzysztof Gabis
f57f2d94bb No longer escaping '/' when serializing. 2014-11-23 20:13:39 +01:00
Krzysztof Gabis
c88c775d23 Fixed floating point number comparison in tests (using fabs). 2014-11-23 12:39:47 +01:00
Krzysztof Gabis
69927e1612 Merge pull request #18 from gageas/master
Fix compile error on C++ compiler.
2014-11-12 13:40:06 +00:00
@gageas
775b2b21d0 Fix compile error on C++ compiler. (mismatch between char* and const char*) 2014-11-12 19:32:09 +09:00
Krzysztof Gabis
e4ac46318e Fixed memory leak in example. 2014-10-08 14:45:39 +02:00
Krzysztof Gabis
638190d6a0 Merged changes from parson-devel (serialization, copying, comparing, validation, creating values). 2014-10-07 21:11:29 +02:00
Krzysztof Gabis
55856a2eab Changes to readme. 2014-07-29 21:27:19 +02:00
Krzysztof Gabis
6e9e934b5a Bugfix in parsing escaped characters (+ additional tests to prevent this bug in future).
Thanks to Joseph Werle for bringing attention to it.
2014-06-10 20:59:35 +02:00
Krzysztof Gabis
c707051778 Added surrogate pairs support (JSON support is full now), removed PARSON_VERSION macro. 2014-04-10 17:00:40 +02:00
Krzysztof Gabis
19a0d79db4 Merge pull request #13 from indutny/fix/handling-files-with-whitespace
Skip whitespace at the start of string/file
2014-04-03 21:18:15 +02:00
Fedor Indutny
ce73431753 Skip whitespace at the start of string/file 2014-04-03 14:59:03 +04:00
Krzysztof Gabis
148e0ccbef Merge pull request #12 from stephenmathieson/fix/memory-leak
Fix memory leak
2013-12-06 12:32:21 -08:00
Stephen Mathieson
4413910346 Fix memory leak
If `fread` fails, `file_contents` is leaked.  I’m just freeing the memory allocated :)
2013-12-06 14:31:18 -05:00
Krzysztof Gabis
08a4396b32 Fixed warnings and error resulting in printing string without comments (old debug statement). 2013-11-30 20:35:55 +01:00
Krzysztof Gabis
d901014d55 New lines after flow control statements are now consistent. 2013-11-30 20:28:55 +01:00
Krzysztof Gabis
d5adf4e291 Added functions to parse file with comments and new tests.
json_parse_value_with_comments and json_parse_string_with_comments replace comments with whitespaces before parsing. Supported comments are: /* */ and //
2013-11-30 20:22:16 +01:00
Krzysztof Gabis
080325e566 Merge pull request #11 from stephenmathieson/add/package.json
Adds a package.json file.
2013-11-25 13:45:45 -08:00
Stephen Mathieson
18fe24a8c0 adding a package.json file 2013-11-24 23:14:48 -05:00
Krzysztof Gabis
a8c04faa39 Merge pull request #10 from spt5007/master
Check ferror if fread call fails in json_parse_file
2013-10-25 13:09:38 -07:00
Sean Turley
3585c6d030 Check ferror if fread call fails in json_parse_file 2013-10-25 15:18:35 -04:00
Krzysztof Gabis
713b563375 Merge pull request #8 from sylvain-miermont/master
Warning when compiling with -O2
2013-10-10 10:35:18 -07:00
Sylvain Miermont
cbb51719cf Checking that fread *actually* succeeds, fix the warning bellow when compiling with -O1, -O2 or -O3.
"warning: ignoring return value of 'fread', declared with attribute warn_unused_result"
2013-10-10 14:29:03 +02:00
Krzysztof Gabis
a024f1197c Merge pull request #6 from spotmx/macrobug
Fix macro argument bug.
2013-07-02 09:26:10 -07:00
Erik Dubbelboer
7ee068b7a6 Fix macro argument bug 2013-07-02 18:01:20 +02:00
Krzysztof Gabis
9dfee46821 Merge pull request #5 from 9re/master
Allow utf-8 encoded strings.
2013-02-07 00:27:28 -08:00
Taro Kobayashi
155f7f0639 added test that will fails on android 2013-02-07 17:23:57 +09:00
Taro Kobayashi
cfbf517166 ignore only 0x00-0x19 to support utf-8 characters 2013-02-07 15:37:27 +09:00
Krzysztof Gabis
29595c80ec Accepting DEL characters in strings.
DEL characters are allowed according to JSON's specification (http://www.ietf.org/rfc/rfc4627.txt). Thanks to Fulvio Esposito for pointing this out.
2012-12-12 20:28:35 +01:00
Krzysztof Gabis
c4af3f9583 Changed object's and array's initlalization to be lazy.
Now object's names and values and array's items are allocated (with starting capacity) only after first item is added.
This will prevent wasting memory when parsing empty objects and arrays.
2012-12-11 11:47:18 +01:00
Krzysztof Gabis
d1ca0ed4f3 Readme file update. 2012-12-02 22:23:39 +01:00
Krzysztof Gabis
f48d84bc2c Makefile update. 2012-12-02 18:40:13 +01:00
Krzysztof Gabis
c24b1a1ad0 Fixed type mismatch in array indexing variables, updated readme file.
Also removed trailing whitespace.
2012-12-02 18:33:00 +01:00
Krzysztof Gabis
962d9f13ba Added makefile. 2012-12-02 18:16:12 +01:00
Krzysztof Gabis
b2dbaece40 Fixed issue with MSVC and unicode characters.
Functions in MSVC's ctype.h create runtime error when passed negative char value.
2012-12-02 11:15:48 +01:00
Krzysztof Gabis
457fa1100f Small code cleanup, narrower example code in tests and readme. 2012-11-24 20:59:16 +01:00
Krzysztof Gabis
5eb66d2b31 New test case.
"object_empty" should  ensure no more bugs in nget function.
2012-11-07 23:08:23 +01:00
Krzysztof Gabis
f7f11572c9 Fixed bug in nget function, added 2 functions to API, improved memory allocs.
Details:
- Fixed bug, where json_object_nget_value returned wrong values.
- json_object_get_count returns a number of object's name-value pairs.
- json_object_get_name returns a name at a specific index.
- Both functions allow iterating over every value in a object.
- Changed max capacity for JSON_Array and JSON_Object (they're not equal anymore).
- Added functions to resize object and array, which are also used after parsing to "trim" them to their real lengths.
- Added try_realloc function.
- Added SUCCESS and ERROR macros to make code more readable.
- Code cleanup.
2012-11-07 22:51:03 +01:00
Krzysztof Gabis
aaf1d45f16 Code refractoring.
Details:
- Increased STARTING_CAPACITY from 10 to 15.
- Added 2 macros: skip_char and skip_whitespaces.
- Added json_object_nget_value function, which removes neccessity to allocate new string when using dotget functions.
- Removed parson_strdup function, it was called only once and could be easilly replaced with appropriate call to parson_strndup.
- Renamed skip_string to skip_quotes, which is a more appropriate name, and made it work on a passed pointer to a string, which is much like skip_char and skip_whitespaces.
- Removed copy_and_remove_whitespaces, it was unncessary, and could be easily replaced with skip_whitepsaces macro.
- Merged parse_escaped_characters and get_string to get_processed_string, which makes more sense.
- Changed is_decimal implementation, to avoid unncessary string duplicating.
- Removed string copying in parse_number value and json_parse_string, since it was unncessary.
2012-11-04 17:45:52 +01:00
Krzysztof Gabis
202f16cc5c Additional code cleanup.
Removed redundant typedefs, renamed JSON_value_t to JSON_Value_Type and JSON_value_value to JSON_Value_Value to make names more consistent across project. Added project's name and url above license.
2012-11-03 19:52:49 +01:00
Krzysztof Gabis
ede8ea497a Merge pull request #1 from sduclos/master
Code Clean UP
2012-11-03 11:30:13 -07:00