Commit Graph

465 Commits

Author SHA1 Message Date
Eric Haszlakiewicz
f3db59d990 Merge branch 'issue-165' of https://github.com/jobol/json-c into jobol-issue-165
Conflicts:
	tests/test_util_file.c
2016-08-09 07:36:54 -04:00
Eric Haszlakiewicz
bc3e691a1e Merge pull request #253 from RyDroid/cppcheck-travis
Adding a test with cppcheck for Travis CI
2016-08-08 22:57:56 -04:00
Eric Haszlakiewicz
51b011ce24 Merge pull request #249 from RyDroid/readme
Improving README
2016-08-08 22:53:33 -04:00
Eric Haszlakiewicz
d758f4a8a7 Add a brief style guide. Address Issue #257. 2016-08-08 22:50:23 -04:00
Eric Haszlakiewicz
33ae9f5d44 Merge pull request #250 from RyDroid/gitignore
Improving .gitignore
2016-08-08 18:42:01 +00:00
Nicola Spanti (RyDroid)
ab1d761865 Improving .gitignore 2016-08-08 15:29:47 +02:00
Nicola Spanti (RyDroid)
f2e7dda910 Improving README 2016-08-08 15:25:31 +02:00
Nicola Spanti (RyDroid)
36b4003118 Adding a test with cppcheck for Travis CI 2016-08-08 15:23:27 +02:00
Eric Haszlakiewicz
9688f343a5 Issue #246: Include xlocale.h too, to get locale_t defined, since not all OSes include that in locale.h 2016-08-02 22:25:05 -04:00
José Bollo
1fceb2207a test: add test of 'json_object_to_json_string_length'
The test is implied in test1.

The idea is to check that the returned lengths and strings
are identical to what is expected to return the already
tested function 'json_object_to_json_string_ext'.

Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-08-01 15:04:54 +02:00
Eric Haszlakiewicz
fa76e4a8c9 Issue #195: Actually call uselocale() in the new locale handling code in json_tokener.
Also, be sure the right locale_t is freed if we fail on the second uselocale.
Finally, fix test_locale so it *doesn't* use json_object_to_json_string as
 that will simple re-emit the original parsed string values.
2016-07-31 14:43:14 -04:00
Eric Haszlakiewicz
4091b9c87e Issue #195: use uselocale() instead of setlocale() in json_tokener to behave better in threaded environments. 2016-07-30 21:34:58 -04:00
Eric Haszlakiewicz
7d637362b7 Linux's %p format doesn't return "0x0" for NULL pointers, so switch to using %lx for consistency. 2016-07-30 15:09:51 -04:00
Eric Haszlakiewicz
deb9fa482d Issue #240: add arbitrary use of val's in foreach loops to squash warnings about unused variables. 2016-07-30 18:27:53 +00: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
José Bollo
54ae254537 Fix a compiling error
The function fstat isn't declared without this include
on debian strect/sid and Fedora-23

Change-Id: I660a32ff173dcba04674aed51ed855b4fa55ac67
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2016-07-27 14:42:25 +02:00
Eric Haszlakiewicz
b366750e11 Merge pull request #239 from ploxiln/printbuf_empty
initialize null terminator of new printbuf
2016-07-16 13:49:08 -04:00
Pierce Lopez
868b20ce4e initialize null terminator of new printbuf
It's possible (e.g. by using json_object_from_file() on an empty file)
to get json-c to try to use a printbuf that has never had anything
written to it. Before this change, it could access a string that
should be length zero, but was never initialized, and could
theoretically have an unexpected string.
2016-07-16 00:30:31 -04:00
Eric Haszlakiewicz
2b255d0ebf Fix absolute paths in test_util_file that vary depending on where it is run. 2016-06-27 04:30:10 +00:00
Eric Haszlakiewicz
b1d65b62db Issue #113: Add more files to EXTRA_DIST and a dist-hook to get distcheck to at least not fail. 2016-06-27 04:30:04 +00:00
Eric Haszlakiewicz
1071385896 Issue #113: add "new" files to appropriate variables in Makefile, and note the need to run "make distcheck" as part of the release process.
Fix issues with the test script so it works under distcheck too.
2016-06-27 04:15:30 +00:00
Eric Haszlakiewicz
29005ef7b1 Merge pull request #238 from nagamalli9999/master
linkhash.c: optimised the table_free path
2016-06-26 23:09:42 -04:00
Eric Haszlakiewicz
29ef73f21d Issue #189: Eliminate use of MC_ERROR from json_util.c, and add a json_util_get_last_err() function to retrieve the error for those callers that care about it.
Add tests and descriptions for the functions in json_util.c
2016-06-26 02:20:33 +00:00
Eswar Yaganti
78cf6e63ff linkhash.h: removed redundant params from comments 2016-06-25 23:05:41 +05:30
Eswar Yaganti
5fb63a09f9 linkhash.c: optimised the table_free path 2016-06-25 22:50:36 +05:30
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
f285c0a2e5 Issue #175: disable the fast-and-loose code in hashlittle() when running with AddressSanitizer. 2016-06-08 03:24:59 +00:00
Eric Haszlakiewicz
ae66b24369 Mention that we're aiming to follow RFC 7159 now.
Cause README.md to show up in Doxygen output as the main page.
2016-06-08 02:37:15 +00:00
Eric Haszlakiewicz
40de3c67cd Merge pull request #232 from NeoRaider/size_t2
tests/tests1: fix printf format for size_t arguments
2016-06-07 16:47:40 -04:00
Matthias Schiffer
d13cfe10f6 tests/tests1: fix printf format for size_t arguments
Change %d to %llu and add cast to unsigned long long for size_t arguments,
otherwise compilation will fail with errors like:

test1.c:70:15: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t {aka long unsigned int}’ [-Werror=format=]

%zu is avoided to stay compatible with old libc versions (like old Visual
Studio).
2016-06-07 10:49:42 +02:00
Eric Haszlakiewicz
a42caac805 Copy over note about the 0.12.1 release to the master branch. 2016-06-07 04:13:15 +00:00
Eric Haszlakiewicz
0539191d18 Check the __GCC_HAVE_SYNC_COMPARE_AND_SWAP_{2,4,8} defines to decide whether to use __sync_val_compare_and_swap(), as described at https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
Also, fix the types of the variables when building on Windows.
Also, should address issue #214.
2016-06-07 03:26:46 +00:00
Eric Haszlakiewicz
1eb5a700f9 Merge pull request #230 from ebassi/master
Use stdint.h to check for size_t size
2016-06-06 22:59:38 -04: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
Eric Haszlakiewicz
ce7ad480f4 Merge pull request #234 from NeoRaider/userdata
Add public API to use userdata independently of custom serializer
2016-06-06 22:54:40 -04:00
Michael Clark
0e1a057449 Remove reference to svn.metaparadigm.com
svn.metaparadigm.com no longer exists so it is not possible to use source from there.
2016-06-07 08:11:16 +12: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
Matthias Schiffer
c2b004ba0e Make default double serializer ignore userdata again
The user might want to use the userdata for something different, so the
serializer should ignore it by default.

Explicitly setting the serializer to json_object_double_to_json_string will
still make it interpret the userdata as a format string.
2016-05-29 11:24:55 +02:00
Matthias Schiffer
22fdcfc71a Include stddef.h in json_object.h
It is needed for size_t.
2016-05-29 05:19:50 +02:00
Emmanuele Bassi
28c1ca1240 Use stdint.h to check for size_t size
If we use json_inttypes.h we are going to fail when builddir != srcdir,
and since JSON_C_HAVE_INTTYPES_H is defined after the configure script
has run, including json_inttypes.h would be the equivalent on including
stdint.h anyway.

This fixes the build of json-c in the GNOME Continuous builder.
2016-05-23 10:20:48 +01:00
Eric Haszlakiewicz
7ae5c3f7a6 Issue #142: un-deprecate json_object_object_get(), but note why you might want to use json_object_object_get_ex() instead. 2016-05-23 03:02:34 +00:00
Eric Haszlakiewicz
5e4e5f7d9d Issue #205: use _strdup instead of strdup on Windows. 2016-05-23 02:37:09 +00:00
Eric Haszlakiewicz
f4ca1325ae Merge branch 'doctaweeks-fixes-for-upstream' 2016-05-23 02:12:51 +00:00
Eric Haszlakiewicz
996be85843 Fix a few places that needed adjustment for the size_t changes, including updating the range checks to use a calculated SIZE_T_MAX. 2016-05-23 02:10:58 +00:00
Eric Haszlakiewicz
9a2915ce66 Merge branch 'fixes-for-upstream' of https://github.com/doctaweeks/json-c into doctaweeks-fixes-for-upstream 2016-05-23 02:08:28 +00:00
Eric Haszlakiewicz
b2c5969aff Merge pull request #193 from jplitza/master
Make serialization format of doubles configurable
2016-05-18 16:10:27 -04:00
Jan-Philipp Litza
21dc5dc92b Export json_object_double_to_json_string() and use custom format string 2016-05-06 16:12:44 +02:00
Jan-Philipp Litza
2200ffa8b0 Fix code in docs for json_object_new_double_s() 2016-05-06 16:12:19 +02:00
Eric Haszlakiewicz
3345b25962 Add tests for the json_object_array_del_idx() function. 2016-04-30 19:09:45 +00:00
Eric Haszlakiewicz
9edf2418e0 Merge branch 'Protovision-master' 2016-04-30 18:53:16 +00:00