Commit Graph

116 Commits

Author SHA1 Message Date
Eric Haszlakiewicz
66d91fdf86 The split of json_object into type-specific sub-structures is now functionally complete.
Remove all of the temporary defines, structures, old compat fuctions, extra fields, etc... that were needed during the conversion to a split set of json_object_* structures.
2020-06-07 17:23:56 +00:00
Eric Haszlakiewicz
853b4b5dee Start splitting struct json_object into multiple sub-types, as descibed at https://github.com/json-c/json-c/wiki/Proposal:-struct-json_object-split
The current changes split out _only_ json_type_object, and thus have a number of hacks
 to allow the code to continue to build and work.

Originally  mentioned in issue #535.
When complete, this will probably invalidate #552.
This is likely to cause notable conflicts in any other significant un-merged
changes, such as PR#620.
2020-05-25 03:18:36 +00:00
Björn Esser
d0dc3489dc Enforce strict prototypes. 2020-04-13 11:29:52 +02:00
Björn Esser
78cd37fb18 Clean trailing white-space. 2020-04-11 09:41:04 +02:00
Eric Haszlakiewicz
19bbf2c069 Add includes and split off json_types.h to help ensure that headers can be included in any order. 2020-04-06 13:55:27 +00:00
dota17
8b162c4b89 clang-format the files 2020-04-03 11:39:30 +08:00
dota17
6359b79847 update json_object.c and testcase, delete json_object_uint_inc() 2020-02-28 17:51:56 +08:00
dota17
9532f94fa4 modify partial functions and testcase, in order to support automatic conversion for int64/uint64 2020-02-28 09:25:02 +08:00
dota17
c816de212b modify the json_object, replace c_int64/c_uint64 with struct{union{int64, uint64},...} 2020-02-27 10:26:27 +08:00
dota17
3c3b5920f7 add uint64 data to json-c 2020-02-25 14:51:35 +08:00
Eric Haszlakiewicz
518f337ce8 Issue #539: use a internal-only serializer function in json_object_new_double_s() to avoid potential conflicts with user code that uses the json_object_userdata_to_json_string serializer. Also, document the serializer-resetting behavior of json_object_set_double(). 2020-02-14 03:48:02 +00:00
dota17
7ad72b81c5 update comment 2020-01-22 09:56:52 +08:00
dota17
010f33d460 add json_object_new_null 2020-01-20 16:46:46 +08:00
Eric Haszlakiewicz
7f30afc6e5 Fix some Windows compile issues, add JSON_EXPORT's, fix bogus character escapes, define __func__ and omit unistd.h if needed. 2019-11-23 20:31:14 -05:00
Eric Haszlakiewicz
eae040a84a Issue #488: use JSON_EXPORT on functions so they are properly exported on Windows. 2019-09-08 22:42:36 -04:00
andy5995
2942870325 remove [in] from params description
Keeping this would be inconsistent with the other documentation
2018-11-28 16:55:19 -06:00
andy5995
3b108935d0 json_object.h:document json_object_new_string_len()
I also added a couple trivial, but related, suggestions.

closes #460
2018-11-27 11:35:45 -06:00
Eric Haszlakiewicz
c1c71097a1 Issue #419: document that NULL may be passed to json_object_put(). 2018-06-12 23:16:31 -04:00
janczer
8bd62177e7 Fixed typos 2018-04-24 16:00:38 +02:00
Jonathan Wiens
cdc4e9f64b Avoid uninitialized variable warnings
Fix json_object_object_foreach to avoid uninitialized variable warnings
using ANSI C or MSC.
2018-01-17 15:57:52 +01:00
Eric Haszlakiewicz
0992aac61f Remove the TRUE and FALSE defines. 2017-12-23 09:42:17 -05:00
Rikard Falkeborn
84dcc01da1 Fix non-GNUC define for JSON_C_CONST_FUNCTION 2017-12-13 22:29:16 +01:00
Eric Haszlakiewicz
5b6d62259a Apply gcc's "const" attribute to the json_c_object_sizeof() function as an optimizer hint. Also, rename that function from json_object_sizeof(). 2017-12-12 18:26:51 -05:00
Björn Esser
c123a1c21b json_object: Add size_t json_object_sizeof() 2017-12-11 16:16:15 +01:00
Eric Haszlakiewicz
d582d3ae5a Undeprecate the array_list, lh_table and printbuf typedefs, but move each to the corresponding header files. 2017-12-06 23:58:33 -05:00
Eric Haszlakiewicz
8c82f0e5c3 Squash doxygen warnings, and make a few slight improvements to the docs. 2017-12-06 23:53:12 -05:00
Eric Haszlakiewicz
f2f103b986 Add a brief overview of each file to the docs. 2017-12-06 00:20:59 -05:00
Eric Haszlakiewicz
11ab365324 Deprecated a few typedefs, add docs on json_object_iter, move json_number_chars and json_hex-chars to json_object_private.h. 2017-12-05 09:20:59 -05:00
Eric Haszlakiewicz
aedd36ac8b Make sure to include the "*" on function pointer arguments to avoid a warnings from VS2015. See also PR#384. 2017-12-04 18:17:52 -05:00
ssrlive
7709cb1355 Fix a VS 2015 compiler warning.
In VS 2015, the warning text is "warning C4550: expression evaluates to a function which is missing an argument list".
2017-12-04 14:43:25 +08:00
Eric Haszlakiewicz
5dae561d33 In json_object_deep_copy(), copy over _userdata, at least for json_type_string's with the default serializer set, and provide a way for people using custom serializers to provide a custom shallow_copy method. 2017-11-29 23:35:38 -05:00
Eric Haszlakiewicz
4dd92180c6 Merge branch 'json_deep_copy' of https://github.com/commodo/json-c into commodo-json_deep_copy 2017-11-29 09:12:59 -05:00
Eric Haszlakiewicz
3628f16dd6 Rename json_object_add_int() to json_object_int_inc() and eliminate the "int64" variant since we store 64-bit values internally anyway. 2017-11-27 17:57:36 -05:00
Alexandru Ardelean
bf80d5ad0e json_object: implement json_object_deep_copy()
Because doing `json_tokener_parse(json_object_get_string(src))`
feels sloppy, dirty, and makes me want to cry at night
sometimes.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2017-11-27 16:17:48 +02:00
Eric Haszlakiewicz
91662a5b69 Merge pull request #363 from jvijtiuk/integer_addition
Issue #338, add json_object_add_int functions
2017-11-27 09:06:39 -05:00
Eric Haszlakiewicz
ac09581cc2 Issue #370: work around Clang-on-windows oddities by rearranging ifdefs. 2017-10-22 22:19:41 -04:00
Juraj Vijtiuk
1110e84cce Add json_object_add_int functions 2017-09-14 09:36:12 -04:00
Eric Haszlakiewicz
4ac47a0219 Issue#353: attempt to fix or ignore a few -Wdocumentation messages from Clang. 2017-09-07 22:22:25 -04:00
Eric Haszlakiewicz
4deed587e7 Merge pull request #319 from Dashlane/visual-studio-build
Windows: Fix dynamic library build with Visual Studio
2017-07-08 21:24:55 -04:00
Eric Haszlakiewicz
1a94c70336 Add a json_c_set_serialization_double_format() function to set the *library-wide* format for how doubles are written to a serialized JSON output. 2017-06-18 18:12:07 +00:00
David Henot
a9f265d166 Fix library build with Visual Studio 2017-04-26 14:11:17 +02:00
Stoian Ivanov
e518b22b72 string set and tests 2016-10-07 00:51:24 +03:00
Stoian Ivanov
05f025c075 some basic set 2016-10-05 23:55:46 +03:00
Stoian Ivanov
fae09456ae json_object_set_boolean for upstream style check 2016-09-21 01:31:00 +03:00
Eric Haszlakiewicz
ea1499a372 Issue #263: add const so the prototype for json_object_object_add_ex() matches the definition. 2016-08-24 23:41:22 -04:00
Eric Haszlakiewicz
c4d060bf80 json_object_object_add_ex() should have shared code with json_object_object_add(), and been changed to return int at the same time the latter was. Do that now.
Also correct a couple of calls to _to_json_string to check the return value.
2016-08-20 22:42:59 -04:00
jobol
344009bf26 Add method 'json_object_to_json_string_length'
This new method allows to also
get the length of the generated string.

Fix #165

Change-Id: Iea91404027f143ca3d29a4c58d7c07ae53556110
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-07-27 14:45:25 +02:00
Eric Haszlakiewicz
595891729e Issue #236: Add -Wcast-qual and fix casts to retain constness.
To better distinguish between entry->k and entry->v being const within linkhash, but non-const outside, add lh_entry_v() and lh_entry_k() accessors.
Make lh_entry->k const.
2016-06-11 18:19:39 +00:00
Eric Haszlakiewicz
e61eb409fd Merge pull request #233 from NeoRaider/size_t3
Include stddef.h in json_object.h
2016-06-06 22:55:44 -04:00
Matthias Schiffer
f87e378d48 Add public API to get and set userdata
Also, json_object_set_serializer is changed to respect the userdata
and user_delete parameters when to_string_func is NULL.
2016-05-29 11:24:55 +02:00