Yurii Rashkovskii
3cc0c47221
Problem: cmake 3.25.1 warns about CMP0042 not being set
Solution: set it explictly to OLD behavior
2 years ago
Yurii Rashkovskii
7b971b52aa
Problem: confusing error message in snprintf_compat.h
Solution: fix it to reflect what's happening properly
2 years ago
Yurii Rashkovskii
debe8b70b7
Problem: modern CMake warns about version 2.8
The warning is as follows:
```
Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.
```
Solution: set it at 2.8.12
2 years ago
Eric Hawicz
79c147203e
Merge pull request #796 from fedefrancescon/test-add-int-get
Added Test for get int functions
2 years ago
Federico Francescon
1a2fdc49e7
Fixed `test_int_get` expected output
2 years ago
Federico Francescon
b1fb1508ee
Added basic tests for `json_object_get_int`, `json_object_get_int64`, `json_object_get_uint64`
2 years ago
Eric Haszlakiewicz
bc35549f90
Update expected output for test_parse, missed in the previous commit.
2 years ago
Eric Haszlakiewicz
d6f46ae104
Explicitly check for integer overflow/underflow when parsing integers with JSON_TOKENER_STRICT.
2 years ago
Eric Haszlakiewicz
c50bf9df9c
Apply same EINVAL handling to json_parse_uint64() as was done for json_parse_int64(). Document that overflow/underflow for these functions is not an error, but sets errno=ERANGE.
2 years ago
Eric Haszlakiewicz
57bef5edc4
Issue #792 - set errno=EINVAL if parsing the string in json_parse_int64 fails, to match the docs for json_object_get_int.
2 years ago
Eric Hawicz
777dd06be8
Merge pull request #790 from Sarcares/patch-1
Small update to README file
3 years ago
Luca Mannella
84248a7884
Small update to README file
it could be necessary to execute make install
3 years ago
Eric Hawicz
81f0807b63
Merge pull request #784 from rouault/get_time_seed_coverity_scan_silence
get_time_seed(): silence warning emitted by Coverity Scan static analyzer
3 years ago
Even Rouault
57ea393004
get_time_seed(): silence warning emitted by Coverity Scan static analyzer
It warns about the return of time() being truncated to 32 bit, which is
not an issue here.
(this warning was emitted because of the https://github.com/OSGeo/gdal
project embedding a copy of libjson-c and running Coverity Scan
analysis)
3 years ago
Eric Hawicz
9417f4e726
Merge pull request #783 from kraj/master
Fix build with clang-15+
3 years ago
Khem Raj
257b29c991
json_pointer.c: Move idx_val declaration to top of function
This helps compiling with MS compiler, error seems to be
due to defining a variable within the body of the function
its allowed in c99 but not in c89. This should fix build with
MSVC 16.0.40219.1 compiler from Visual Studio 14 2015
Signed-off-by: Khem Raj <raj.khem@gmail.com>
3 years ago
Khem Raj
d1deed499f
json_inttypes.h: Define ssize_t on windows platforms
Signed-off-by: Khem Raj <raj.khem@gmail.com>
3 years ago
Khem Raj
6eca65617a
Fix build with clang-15+
Fixes
json_util.c:63:35: error: a function declaration without a prototype is deprecated in all versions of C [-We
rror,-Wstrict-prototypes]
const char *json_util_get_last_err()
^
void
Signed-off-by: Khem Raj <raj.khem@gmail.com>
3 years ago
Eric Hawicz
ac4dfa44cb
Merge pull request #782 from DimitriPapadopoulos/codespell
Fix typos found by codespell
3 years ago
Dimitri Papadopoulos
9462c0a7b5
Fix typos found by codespell
Do not fix typos from past commits found in release notes.
3 years ago
Eric Haszlakiewicz
bdd5e03d6e
Apply some of the fixes from PR #740 , although by using size_t instead of castings.
3 years ago
Eric Hawicz
4b0c6de760
Merge pull request #757 from c3h2-ctf/big
json_object_from_fd_ex: fail if file is too large
3 years ago
Eric Haszlakiewicz
253a5fa99d
Issue #705 : disable locale handling when building for a uClibc system because its duplocale() function (intentionally) crashes.
3 years ago
Eric Haszlakiewicz
9749b0cb66
When serializing with JSON_C_TO_STRING_PRETTY set, keep the opening and closing curly or square braces on same line for empty objects or arrays. Issue #778 .
3 years ago
Eric Haszlakiewicz
2e9b7456a5
Update Travis links to point at travis-ci.com instead of travis-ci.org
3 years ago
Eric Haszlakiewicz
5282e73600
Entirely drop mode bits from open(O_RDONLY) to avoid warnings on certain platforms. Fixes issue #779 .
3 years ago
Eric Haszlakiewicz
8b35a78d29
Trim a few travis builds, update others to more recent toolchains.
3 years ago
Eric Haszlakiewicz
22773b1e51
Fix the expected output for test_set_serializer.
3 years ago
Eric Haszlakiewicz
16208fc01a
Add test to check for the memory leak mentioned in issue #781
3 years ago
Eric Hawicz
2a2d861bc0
Merge pull request #781 from dddaniel/master
Fix memory leak with emtpy strings in json_object_set_string
3 years ago
Daniel Danzberger
213bb5caa1
Fix memory leak with emtpy strings in json_object_set_string
When a json string object is updated with a bigger string, a new
malloc'ed buffer is used to store the new string and it's size is made
negative to indicate that an external buffer is in use.
When that same json string object get's updated again with an empty
stirng (size = 0), the new external malloc'ed buffer is still used.
But the fact that the new size value is not negative removes the
indicator that the externally malloc'ed buffer is used.
This becomes a problem when the object get's updated again with any
other string, because a new buffer will be malloced and linked to the
object while to old one won't be free'd.
This causes a memory leak when updating a json string with
json_object_set_stirng() which has previously been updated
with an empty string.
Example:
--
obj = json_object_new_string("data");
json_object_set_string(obj, "more data");
json_object_set_string(obj, "");
json_object_set_string(obj, "other data"); /* leaks */
--
This commit fixes the issue by free'ing the external buffer when an
empty string is set and use the internal one again.
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
3 years ago
Eric Haszlakiewicz
d28ac67dde
Fix issue #775 - use a loop instead of list(TRANSFORM ...) to support cmake < 3.12.
3 years ago
Eric Hawicz
5d98f7825a
Merge pull request #776 from stoeckmann/typo
Fix typo
3 years ago
Tobias Stoeckmann
f63573460c
Fix typo
3 years ago
Eric Haszlakiewicz
6ee0a35a20
Fix #771/#768 by marking usage() as "noreturn" instead of using "FALLTHRU" in the case statement where it'd called.
3 years ago
Eric Hawicz
11546bfd07
Merge pull request #769 from An7ar35/issue-768
Issue #768
3 years ago
An7ar35
5d00384e0d
missing 'FALLTHRU' added to sort out error messages when using "-Werror=implicit-fallthrough" flag
3 years ago
Eric Haszlakiewicz
49c3721a5a
Unset NDEBUG so assert() is enabled in all tests. One more fix there when building with -DCMAKE_BUILD_TYPE=release.
3 years ago
Eric Haszlakiewicz
2f0942bdd7
Specify dependent libraries, including -lbsd, in a more consistent way so linking against a static json-c works better. Related issue #766
Use target_link_libraries, plus fill in Libs.private in json-c.pc so pkg-config --static --libs works appropriately.
Also, only link against libbsd when arc4random is actually found there.
3 years ago
Eric Haszlakiewicz
6ba1adf8ef
Include the tests and apps directories at the _end_, since order in the
cmake rules matters, and fix compile warnings now that we're building
those sources with all the regular flags.
3 years ago
Eric Haszlakiewicz
86b46cac07
Add --disable-static and --disable-dynamic options to the cmake-configure script.
3 years ago
Eric Haszlakiewicz
f2fc1ca00a
Note the DSIABLE_JSON_POINTER and DISABLE_EXTRA_LIBS build options on the README
3 years ago
Eric Haszlakiewicz
acccefd770
Add a "Getting Help" section to the README.
3 years ago
Eric Haszlakiewicz
de5a64888a
Update the master branch to version 16.99
3 years ago
Eric Haszlakiewicz
7e3eba72db
Clarify how to set the uploaded release tarballs to be publically readable.
3 years ago
Eric Haszlakiewicz
7d303478a4
Update the ChangeLog with recent changes, in preparation for a 0.16 release.
Add a list of issues closed for this release.
3 years ago
Eric Haszlakiewicz
66dcdf549e
Add new authors since the 0.15 release, tweak instructions for how to update that list.
3 years ago
Eric Hawicz
4902f9cb87
Merge pull request #765 from jvoisin/patch-1
Improve a bit the coverage of the fuzzer
3 years ago
Julien Voisin
558d48a6f3
Improve a bit the coverage of the fuzzer
3 years ago
Eric Haszlakiewicz
46b58ad9e7
Fix issue #764 : adjust test_util_file to match new output (changed in 6e53347
)
3 years ago