]> git.ipfire.org Git - thirdparty/json-c.git/log
thirdparty/json-c.git
5 days agoAlthough CMAKE_C_COMPILER_FRONTEND_VARIANT is defined, it's not always set to some... master
Eric Haszlakiewicz [Sun, 28 Apr 2024 17:15:42 +0000 (17:15 +0000)] 
Although CMAKE_C_COMPILER_FRONTEND_VARIANT is defined, it's not always set to some value.  Fix builds for cases when it's blank.

12 days agoIssue #857: fix a few places where json_tokener should have been returning json_token...
Eric Hawicz [Sun, 21 Apr 2024 14:37:16 +0000 (10:37 -0400)] 
Issue #857: fix a few places where json_tokener should have been returning json_tokener_error_memory but wasn't.

2 weeks agoMerge pull request #858 from alurm/master
Eric Hawicz [Tue, 16 Apr 2024 15:23:09 +0000 (11:23 -0400)] 
Merge pull request #858 from alurm/master

json_tokener.h: json_tokener_parse_verbose: fix typo

2 weeks agojson_tokener.h: json_tokener_parse_verbose: fix typo 858/head
Alan Urmancheev [Tue, 16 Apr 2024 14:56:00 +0000 (14:56 +0000)] 
json_tokener.h: json_tokener_parse_verbose: fix typo

5 weeks agoIssue #829: attempt to detect clang-cl.exe and pass MSVC-compatile command line argum...
Eric Hawicz [Sat, 30 Mar 2024 02:40:45 +0000 (22:40 -0400)] 
Issue #829: attempt to detect clang-cl.exe and pass MSVC-compatile command line arguments.

5 weeks agoIssue #850: fill in & adjust the "@returns" docs for several functions.
Eric Hawicz [Fri, 29 Mar 2024 22:46:05 +0000 (18:46 -0400)] 
Issue #850: fill in & adjust the "@returns" docs for several functions.

5 weeks agodoxygen can't handle html on heading, split that to separate lines
Eric Hawicz [Fri, 29 Mar 2024 22:45:22 +0000 (18:45 -0400)] 
doxygen can't handle html on heading, split that to separate lines
https://github.com/doxygen/doxygen/issues/10466

5 weeks agoFix issue #854: Set error=json_tokener_error_memory in json_tokener_parser_verbose...
Eric Hawicz [Fri, 29 Mar 2024 22:09:12 +0000 (18:09 -0400)] 
Fix issue #854: Set error=json_tokener_error_memory in json_tokener_parser_verbose() when allocating the tokener fails.

2 months agoMerge pull request #852 from fedefrancescon/docs/micro-typo-fix
Eric Hawicz [Sat, 2 Mar 2024 22:31:24 +0000 (17:31 -0500)] 
Merge pull request #852 from fedefrancescon/docs/micro-typo-fix

docs: micro typo in json_object_put doc

2 months agodocs: micro typo in json_object_get doc 852/head
Federico Francescon [Sat, 2 Mar 2024 21:41:10 +0000 (22:41 +0100)] 
docs: micro typo in json_object_get doc

2 months agoMerge pull request #831 from neheb/1
Eric Hawicz [Thu, 8 Feb 2024 13:11:57 +0000 (08:11 -0500)] 
Merge pull request #831 from neheb/1

rename WIN32 to _WIN32

2 months agorename WIN32 to _WIN32 831/head
Rosen Penev [Thu, 14 Sep 2023 03:51:49 +0000 (20:51 -0700)] 
rename WIN32 to _WIN32

The latter is the proper macro defined by Windows headers.

Fixes compilation under at least clang-cl which mandates function
declarations.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 months agoMerge pull request #849 from rouault/random_seed_toctou
Eric Hawicz [Mon, 8 Jan 2024 17:45:39 +0000 (12:45 -0500)] 
Merge pull request #849 from rouault/random_seed_toctou

random_seed.c: add a Coverity Scan suppression

3 months agorandom_seed.c: add a Coverity Scan suppression 849/head
Even Rouault [Sun, 7 Jan 2024 19:55:35 +0000 (20:55 +0100)] 
random_seed.c: add a Coverity Scan suppression

Coverity Scan warns about the use of open() after stat() being a
potential TOCTOU (Time of check time of use) issue. But here there is no
such issue.

4 months agoMerge pull request #846 from evo-i/CMP0153
Eric Hawicz [Sun, 17 Dec 2023 12:23:07 +0000 (07:23 -0500)] 
Merge pull request #846 from evo-i/CMP0153

Use execute_process instead of exec_program

4 months agoUpdate CMakeLists.txt 846/head
evo [Sun, 17 Dec 2023 08:19:20 +0000 (11:19 +0300)] 
Update CMakeLists.txt

Replace with `execute_process` available on v3.0+

4 months agoUpdate CMakeLists.txt
evo [Sat, 16 Dec 2023 21:32:21 +0000 (00:32 +0300)] 
Update CMakeLists.txt

Now saved to variable.

4 months agoFix ECHO_OUTPUT_VARIABLE
evo [Sat, 16 Dec 2023 21:23:51 +0000 (00:23 +0300)] 
Fix ECHO_OUTPUT_VARIABLE

4 months ago[CMP0153](https://cmake.org/cmake/help/latest/policy/CMP0153.html) 845/head
evo [Tue, 12 Dec 2023 13:28:41 +0000 (16:28 +0300)] 
[CMP0153](https://cmake.org/cmake/help/latest/policy/CMP0153.html)

5 months agoIssue #842 - fix one particular sign conversion warning.
Eric Haszlakiewicz [Thu, 30 Nov 2023 13:59:13 +0000 (13:59 +0000)] 
Issue #842 - fix one particular sign conversion warning.
There are many others that show up if we were to add -Wsign-conversions,
but this is the only one using a literal constant.

5 months agoMerge pull request #839 from ffontaine/master
Eric Hawicz [Wed, 8 Nov 2023 23:11:13 +0000 (18:11 -0500)] 
Merge pull request #839 from ffontaine/master

json_pointer.c: initialize idx

5 months agojson_pointer.c: initialize idx 839/head
Fabrice Fontaine [Wed, 8 Nov 2023 21:42:48 +0000 (22:42 +0100)] 
json_pointer.c: initialize idx

Fix the following build failure with gcc 5:

/home/thomas/autobuild/instance-2/output-1/build/json-c-0.17/json_pointer.c: In function 'json_pointer_result_get_recursive':
/home/thomas/autobuild/instance-2/output-1/build/json-c-0.17/json_pointer.c:193:25: error: 'idx' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    res->index_in_parent = idx;
                         ^

Fixes:
 - http://autobuild.buildroot.org/results/523b35a979d59121fe4e18c38171792b06233940/

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
6 months agoMerge pull request #837 from HansolChoe/fix-tokener-parse-ex-fuzzer
Eric Hawicz [Thu, 19 Oct 2023 11:49:32 +0000 (07:49 -0400)] 
Merge pull request #837 from HansolChoe/fix-tokener-parse-ex-fuzzer

Add type checking for parsed objects in tokener_parse_ex_fuzzer

6 months agotokener_parse_ex_fuzzer: add type checking for parsed object 837/head
HansolChoe [Thu, 19 Oct 2023 07:33:01 +0000 (16:33 +0900)] 
tokener_parse_ex_fuzzer: add type checking for parsed object

7 months agoTake 2 fixing the placement of json_tokener_error_memory in the enum. (json_tokener_...
Eric Hawicz [Sat, 23 Sep 2023 02:26:21 +0000 (22:26 -0400)] 
Take 2 fixing the placement of json_tokener_error_memory in the enum.  (json_tokener_error_size is an actual error, *not* a measure of the size of the enum!)

7 months agoMerge pull request #827 from robert-pang/master
Eric Hawicz [Sun, 10 Sep 2023 22:13:45 +0000 (00:13 +0200)] 
Merge pull request #827 from robert-pang/master

Resolve build issue in tokener_parse_ex_fuzzer.c

7 months agoMerge pull request #826 from emlix/cmake-policies
Eric Hawicz [Sun, 10 Sep 2023 22:10:55 +0000 (00:10 +0200)] 
Merge pull request #826 from emlix/cmake-policies

CMake: remove needless policy setting

7 months agoFix variable and API names in tokener_parse_ex_fuzzer.cc to resolve build issue. 827/head
Robert Pang [Tue, 5 Sep 2023 20:58:51 +0000 (13:58 -0700)] 
Fix variable and API names in tokener_parse_ex_fuzzer.cc to resolve build issue.

7 months agoCMake: request all policies up to CMake 3.12 being set to NEW 826/head
Rolf Eike Beer [Tue, 5 Sep 2023 12:31:24 +0000 (14:31 +0200)] 
CMake: request all policies up to CMake 3.12 being set to NEW

7 months agoCMake: request consistent minimum version
Rolf Eike Beer [Tue, 5 Sep 2023 12:27:27 +0000 (14:27 +0200)] 
CMake: request consistent minimum version

7 months agoCMake: remove needless policy setting
Rolf Eike Beer [Tue, 5 Sep 2023 10:14:46 +0000 (12:14 +0200)] 
CMake: remove needless policy setting

These policies were all introduced before CMake 3.9, so they will automatically
be initialized to the new behavior when requesting a minimum version of 3.9.

8 months agoUpdate the master branch to version 0.17.99
Eric Haszlakiewicz [Sat, 12 Aug 2023 19:08:59 +0000 (19:08 +0000)] 
Update the master branch to version 0.17.99

8 months agoAdd an abi-check.sh script that shows how to run the abi-compliance-checker, update...
Eric Hawicz [Sat, 12 Aug 2023 18:34:35 +0000 (14:34 -0400)] 
Add an abi-check.sh script that shows how to run the abi-compliance-checker, update release creation steps slightly.

8 months agoAlso fix messages returned from json_tokener_error_desc() (broke due to the ordering...
Eric Haszlakiewicz [Sat, 12 Aug 2023 18:52:32 +0000 (18:52 +0000)] 
Also fix messages returned from json_tokener_error_desc() (broke due to the ordering change of enum json_tokener_error)

8 months agoMove the json_tokener_error_memory entry to the end of enum json_tokener_error to...
Eric Hawicz [Sat, 12 Aug 2023 17:54:50 +0000 (13:54 -0400)] 
Move the json_tokener_error_memory entry to the end of enum json_tokener_error to restore binary compatibility with 0.16

8 months agoUpdate the AUTHORS file and add issues_closed_for_0.17.md for the upcoming 0.17 release
Eric Hawicz [Sat, 12 Aug 2023 17:53:27 +0000 (13:53 -0400)] 
Update the AUTHORS file and add issues_closed_for_0.17.md for the upcoming 0.17 release

8 months agoUpdate the ChangeLog for 0.17 based on notable commits since 0.16
Eric Hawicz [Tue, 8 Aug 2023 21:31:38 +0000 (17:31 -0400)] 
Update the ChangeLog for 0.17 based on notable commits since 0.16

8 months agoFix issue #823: add back json_number_chars, but only because it's part of the public...
Eric Hawicz [Sun, 6 Aug 2023 19:35:04 +0000 (15:35 -0400)] 
Fix issue #823: add back json_number_chars, but only because it's part of the public API.

8 months agoMerge pull request #679 from GitMensch/patch-1
Eric Hawicz [Sun, 6 Aug 2023 02:32:37 +0000 (22:32 -0400)] 
Merge pull request #679 from GitMensch/patch-1

Let json-c be used with obsolete compilers

8 months agoPR #679: add workaround for old compilers w/o stdint.h (i.e. VS2008 and earlier) 679/head
Eric Hawicz [Sun, 6 Aug 2023 02:11:30 +0000 (22:11 -0400)] 
PR #679: add workaround for old compilers w/o stdint.h (i.e. VS2008 and earlier)

8 months agoMerge pull request #822 from SSharshunov/master
Eric Hawicz [Fri, 4 Aug 2023 15:47:23 +0000 (11:47 -0400)] 
Merge pull request #822 from SSharshunov/master

Added option to disable app build

9 months agoAdded option to disable app build 822/head
Sergey Sharshunov [Fri, 4 Aug 2023 14:46:50 +0000 (19:46 +0500)] 
Added option to disable app build

9 months agoMerge pull request #702 from commodo/json_patch
Eric Hawicz [Tue, 1 Aug 2023 02:19:30 +0000 (22:19 -0400)] 
Merge pull request #702 from commodo/json_patch

json_patch: add first implementation only with patch application

9 months agoDon't export json_pointer_get_internal, move json_object_array_insert_idx and json_pa... 702/head
Eric Hawicz [Sun, 30 Jul 2023 01:45:16 +0000 (21:45 -0400)] 
Don't export json_pointer_get_internal, move json_object_array_insert_idx and json_patch_apply to the JSONC_0.17 section in json-c.sym

9 months agoWork around a somewhat misleading warning about "a function declaration without a...
Eric Hawicz [Sat, 29 Jul 2023 15:22:12 +0000 (11:22 -0400)] 
Work around a somewhat misleading warning about "a function declaration without a prototype is deprecated in all versions of C" in test1.c

9 months agoFix json_patch_apply handling of removing the whole document (i.e. "path":"").
Eric Hawicz [Sat, 29 Jul 2023 02:12:51 +0000 (22:12 -0400)] 
Fix json_patch_apply handling of removing the whole document (i.e. "path":"").
Enable all disabled tests, add a few more including some with null documents.

9 months agoAdjust the behavior of the args passed to json_patch_apply to make it easier to do...
Eric Hawicz [Thu, 27 Jul 2023 02:01:04 +0000 (22:01 -0400)] 
Adjust the behavior of the args passed to json_patch_apply to make it easier to do in place modifications, and add a struct json_patch_error to report more details on failures.

9 months agoFix an uninitialized memory access in json_pointer.
Eric Hawicz [Wed, 26 Jul 2023 22:15:07 +0000 (18:15 -0400)] 
Fix an uninitialized memory access in json_pointer.
Add comments describing when the fields of the internal struct json_pointer_get_result are valid.

9 months agoCreate a json_pointer_private.h and move a few things there, fix test warnings, note...
Eric Hawicz [Sun, 16 Jul 2023 14:48:20 +0000 (10:48 -0400)] 
Create a json_pointer_private.h and move a few things there, fix test warnings, note array_list_insert_idx is private.

9 months agotests: test_json_patch: add test suite for JSON patch
Alexandru Ardelean [Tue, 20 Apr 2021 12:47:18 +0000 (15:47 +0300)] 
tests: test_json_patch: add test suite for JSON patch

Essentially, this change adds the test cases from this repo:
   https://github.com/json-patch/json-patch-tests

Specifically:
   https://github.com/json-patch/json-patch-tests/blob/master/spec_tests.json
   https://github.com/json-patch/json-patch-tests/blob/master/tests.json

The files were taken at the date of this commit, at git hash
  ea3af85790cb72893d0676597814b7532019c24e

Some tests may not have an 'expected' or 'error' field. Those are ignored.
One test was disabled manually via "disabled_in_json_c", because it tries
an impossible test, i.e. to add 2 "op" fields in the same patch entry,
something which is impossible in a JSON object.

For the 'error' cases, right now we only test that an error happens.
Later, we can extend this to check the error codes.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 months agojson_patch: add first implementation only with patch application
Alexandru Ardelean [Sat, 24 Apr 2021 14:00:13 +0000 (17:00 +0300)] 
json_patch: add first implementation only with patch application

Initially I wanted to also do a function that generates the JSON patch from
two JSON documents, but even just applying the JSON patch was a bit of
work, especially when needing to satisfy all the test-cases.

This change defines all the operation in the RFC6902. The addition isn't
too big (for the json_patch_apply() function), as part of the heavy lifting
is also done by JSON pointer logic.

All the ops were tested with the test-cases defined at:
  https://github.com/json-patch/json-patch-tests

RFC6902: https://tools.ietf.org/html/rfc6902

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 months agojson_pointer: split json_pointer_set_with_array_cb()
Alexandru Ardelean [Fri, 23 Apr 2021 18:56:29 +0000 (21:56 +0300)] 
json_pointer: split json_pointer_set_with_array_cb()

JSON patch is a bit more clear on how some array operations should be
handled. Unfortunately, handling them on a case-by-case is a bit tricky
because it's difficult to satisfy properly an 'add' operating with a 'move'
operation and the basic json_pointer_set().

With json_pointer_set{f}() we use json_object_array_put_idx() to insert a
value at a certain index.

With JSON patch:
* for the 'add' operation, we need to insert a value at a given index,
  which means shifting existing values by one to the right
  - also, we cannot allow values to be inserted/added outside the bounds of
    the array
* a 'move' operation, is described as a 'remove' and then an 'add';
  for arrays this complicates things, because when we want to a move a
  value within the array, we have to remove it first (during which the size
  of the array is reduced by one); when the size of the array is reduced by
  one, we can't add it to the last position in the array (before the
  remove)

The only sane method to handle this (after a few considerations) is to
provide a callback to the function that does the final put/insert into
the array. That way, we can do some final checks where these are needed to
handle each corner-case.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 months agojson_pointer: move array out-of-bounds check outside of is_valid_index()
Alexandru Ardelean [Fri, 23 Apr 2021 18:19:49 +0000 (21:19 +0300)] 
json_pointer: move array out-of-bounds check outside of is_valid_index()

The out-of-bounds check is useful when trying to index/obtain a value from
an array.
However, when we set a value to a specific JSON pointer, we can allow
values that are outside the length of the current array.
The RFC6901 doc isn't clear on that aspect, and doing so is a bit more
in-line with how json_object_array_{put,insert}_idx() functions behave.

This changes the behavior of json_pointer_set{f}() because now a value can
be set anywhere in the array.

Also, added a test-case for this behavior change.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 months agojson_pointer: introduce json_pointer_get_internal() for internal usage
Alexandru Ardelean [Tue, 20 Apr 2021 13:23:47 +0000 (16:23 +0300)] 
json_pointer: introduce json_pointer_get_internal() for internal usage

For JSON patch, we require that we get access to the parent of a JSON
object as well in order to do some operations via the API.

For example, given the object:
{
  "foo": "bar",
  "array", [ 1, 2, 3]
}

Using JSON pointer with the path
 * '/foo' will return 'bar' of type string
 * '/array/0' will return '1', of type integer

The problem is, that if we do 'json_object_put()' on any of the objects
above, this will not detach them from the parent, because there is no
information back to the parent.

One way to fix this, is to introduce links back to the parent, and have
these links be made by 'json_object_array_{put,insert}_idx()' and
'json_object_object_add{_ex}()'[1].

[1] For json_object_object_add_ex() we would need to de-constify the second
parameter, as we need to change it's internal state when being added to a
parent object. It may break some applications, but who knows.

But, since this information is needed mostly for JSON patch, another way to
address this, is to also retrieve the parent of an object via JSON pointer
and use json_object_object_del() and json_object_array_del_idx() on the
object's parent.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 months agojson_pointer: convert index to size_t type
Alexandru Ardelean [Sat, 24 Apr 2021 14:06:17 +0000 (17:06 +0300)] 
json_pointer: convert index to size_t type

The index cannot be negative when parsing in is_valid_index(), because we
don't allow the '-' character in a string before we get to the strtol()
function.

So, might as well remove the negative check (for idx) in is_valid_index()
and convert it to size_t. That may allow for higher values for the index
(which can be insane, but some people may want to try it).

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 months agotests: test1: add test cases for json_object_array_insert_idx()
Alexandru Ardelean [Tue, 20 Apr 2021 13:07:26 +0000 (16:07 +0300)] 
tests: test1: add test cases for json_object_array_insert_idx()

This change adds a few test cases to test the behavior of the new
json_object_array_insert_idx() function, to make sure it behaves according
to specification in doc-string.

This test uses assert() vs the old method of comparing outputs.
This will cause the test to fail because the outputs won't match, since the
assert() will kick in.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 months agojson_object: introduce json_object_array_insert_idx() API function
Alexandru Ardelean [Fri, 16 Apr 2021 13:12:22 +0000 (16:12 +0300)] 
json_object: introduce json_object_array_insert_idx() API function

The behavior of the json_object_array_put_idx() is that, if a user wants to
insert an element inside a JSON array, the element will be replaced.

For some cases, a user would want to insert an element into the JSON array
and shift the elements to the right.

For indexes that are outside the length of the current array this behaves
like json_object_array_put_idx().
If a user wants to enforce that the JSON array is not expanded, then the
json_object_array_length() function can be used to guard against that.

The main driver for this change is JSON patch, where the 'add' operation in
an array means inserting a value at a certain index and shifting everything
by one.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 months agojson_pointer: fix comments about printf() variants of set/get()
Alexandru Ardelean [Thu, 22 Apr 2021 08:19:07 +0000 (11:19 +0300)] 
json_pointer: fix comments about printf() variants of set/get()

These were wrong. Some details about the json_pointer_setf() &
json_pointer_getf() were added in the json_pointer_set() &
json_pointer_get() doc-strings.

This change removes them.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 months agoIssue #668: add the option to specify "cmake -DUSELOCALE_NEEDS_FREELOCALE=1" to work...
Eric Hawicz [Sun, 30 Jul 2023 17:38:15 +0000 (13:38 -0400)] 
Issue #668: add the option to specify "cmake -DUSELOCALE_NEEDS_FREELOCALE=1" to work around a bug in older versions of FreeBSD (<12.4).

9 months agoIssue #808: turn off -Wshorten-64-to-32 for clang builds (aka iOS builds) to workarou...
Eric Hawicz [Sun, 30 Jul 2023 15:38:01 +0000 (11:38 -0400)] 
Issue #808: turn off -Wshorten-64-to-32 for clang builds (aka iOS builds) to workaround "implicit conversion loses integer precision" warnings.

9 months agoMerge pull request #772 from cosmo-ray/color
Eric Hawicz [Thu, 13 Jul 2023 22:04:48 +0000 (18:04 -0400)] 
Merge pull request #772 from cosmo-ray/color

add JSON_C_TO_STRING_COLOR option

9 months agoadd JSON_C_TO_STRING_COLOR option 772/head
Matthias Gatto [Thu, 2 Jun 2022 15:10:21 +0000 (17:10 +0200)] 
add JSON_C_TO_STRING_COLOR option

This option enable color in json_object_to_json_string_ext.
I've try to made something similar to jq output,
but I've color true/false and null in purple,
as it's what is common color scheme used in programing language in emacs.

also add a '-c' option into json_parser to test it.

note: that I could have done a color() function similar to
what is done with indent(), but as the code is pretty small
I've keep it as it. so if you want  me to use a subfunction
tell me and I'll do it.

Signed-off-by: Matthias Gatto <matthias.gatto@protonmail.com>
9 months agoSkip apps when we're included in someone else's build. Inspired by ssrlive in PR...
Eric Hawicz [Fri, 7 Jul 2023 00:56:49 +0000 (20:56 -0400)] 
Skip apps when we're included in someone else's build.  Inspired by ssrlive in PR #813.

10 months agoFix the -f option to apps/json_parse, add a -F <arg> option to specify arbitrary...
Eric Hawicz [Tue, 4 Jul 2023 16:00:31 +0000 (12:00 -0400)] 
Fix the -f option to apps/json_parse, add a -F <arg> option to specify arbitrary flags to pass to json_object_to_json_string_ext().

10 months agoMerge pull request #759 from c3h2-ctf/truncation
Eric Hawicz [Tue, 4 Jul 2023 15:45:57 +0000 (11:45 -0400)] 
Merge pull request #759 from c3h2-ctf/truncation

json_tokener_parse_ex: handle out of memory errors

10 months agoIssue #688: Only exclude generated doc/* files, keep the CMakeLists.txt, etc... so...
Eric Haszlakiewicz [Sat, 1 Jul 2023 18:02:00 +0000 (18:02 +0000)] 
Issue #688: Only exclude generated doc/* files, keep the CMakeLists.txt, etc... so the nodoc tarball can still be built.

13 months agoStop linking a copy of _json_c_strerror() (strerror_override.c) into the tests.
Eric Haszlakiewicz [Tue, 28 Mar 2023 23:08:39 +0000 (23:08 +0000)] 
Stop linking a copy of _json_c_strerror() (strerror_override.c) into the tests.
That hasn't been needed since since commit 6068d3f, which changed that code to
 check an env var instead ("_JSON_C_STRERROR_ENABLE").
Fixes issue #812, about dup symbols in static builds with clang.

13 months agoMerge pull request #810 from dijonkitchen/patch-1
Eric Hawicz [Fri, 10 Mar 2023 19:54:44 +0000 (14:54 -0500)] 
Merge pull request #810 from dijonkitchen/patch-1

docs: update to Internet Standard reference

13 months agodocs: update to Internet Standard reference 810/head
JC (Jonathan Chen) [Fri, 10 Mar 2023 16:10:29 +0000 (11:10 -0500)] 
docs: update to Internet Standard reference

14 months agoBump up the minimum cmake version to 3.9.
Eric Haszlakiewicz [Thu, 23 Feb 2023 01:01:14 +0000 (01:01 +0000)] 
Bump up the minimum cmake version to 3.9.
This gets us up to a version that supports features we're already using
(i.e. add_compile_options), but stops short of a cmake that requires
c++11, which some OSes still don't support.
Closes issue #774

15 months agoIssue #570: note brief instructions for building on Android.
Eric Haszlakiewicz [Thu, 5 Jan 2023 00:25:09 +0000 (00:25 +0000)] 
Issue #570: note brief instructions for building on Android.

16 months agoMerge pull request #804 from yrashk/cmp-0042
Eric Hawicz [Tue, 27 Dec 2022 14:32:33 +0000 (09:32 -0500)] 
Merge pull request #804 from yrashk/cmp-0042

Problem: cmake 3.25.1 warns about CMP0042 not being set

16 months agoMerge pull request #803 from yrashk/patch-2
Eric Hawicz [Tue, 27 Dec 2022 14:26:30 +0000 (09:26 -0500)] 
Merge pull request #803 from yrashk/patch-2

Problem: confusing error message in snprintf_compat.h

16 months agoMerge pull request #802 from yrashk/patch-1
Eric Hawicz [Tue, 27 Dec 2022 14:25:58 +0000 (09:25 -0500)] 
Merge pull request #802 from yrashk/patch-1

Problem: modern CMake warns about version 2.8

16 months agoProblem: cmake 3.25.1 warns about CMP0042 not being set 804/head
Yurii Rashkovskii [Fri, 23 Dec 2022 22:59:59 +0000 (14:59 -0800)] 
Problem: cmake 3.25.1 warns about CMP0042 not being set

Solution: set it explictly to OLD behavior

16 months agoProblem: confusing error message in snprintf_compat.h 803/head
Yurii Rashkovskii [Fri, 23 Dec 2022 22:35:36 +0000 (14:35 -0800)] 
Problem: confusing error message in snprintf_compat.h

Solution: fix it to reflect what's happening properly

16 months agoProblem: modern CMake warns about version 2.8 802/head
Yurii Rashkovskii [Fri, 23 Dec 2022 22:33:31 +0000 (14:33 -0800)] 
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

17 months agoMerge pull request #796 from fedefrancescon/test-add-int-get
Eric Hawicz [Thu, 17 Nov 2022 03:23:11 +0000 (22:23 -0500)] 
Merge pull request #796 from fedefrancescon/test-add-int-get

Added Test for get int functions

17 months agoFixed `test_int_get` expected output 796/head
Federico Francescon [Wed, 16 Nov 2022 00:33:02 +0000 (01:33 +0100)] 
Fixed `test_int_get` expected output

17 months agoAdded basic tests for `json_object_get_int`, `json_object_get_int64`, `json_object_ge...
Federico Francescon [Tue, 15 Nov 2022 23:49:18 +0000 (00:49 +0100)] 
Added basic tests for `json_object_get_int`, `json_object_get_int64`, `json_object_get_uint64`

18 months agoUpdate expected output for test_parse, missed in the previous commit.
Eric Haszlakiewicz [Sun, 30 Oct 2022 19:42:42 +0000 (19:42 +0000)] 
Update expected output for test_parse, missed in the previous commit.

18 months agoExplicitly check for integer overflow/underflow when parsing integers with JSON_TOKEN...
Eric Haszlakiewicz [Sun, 30 Oct 2022 19:29:15 +0000 (19:29 +0000)] 
Explicitly check for integer overflow/underflow when parsing integers with JSON_TOKENER_STRICT.

18 months agoApply same EINVAL handling to json_parse_uint64() as was done for json_parse_int64...
Eric Haszlakiewicz [Sun, 30 Oct 2022 03:25:32 +0000 (03:25 +0000)] 
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.

18 months agoIssue #792 - set errno=EINVAL if parsing the string in json_parse_int64 fails, to...
Eric Haszlakiewicz [Wed, 26 Oct 2022 02:19:38 +0000 (02:19 +0000)] 
Issue #792 - set errno=EINVAL if parsing the string in json_parse_int64 fails, to match the docs for json_object_get_int.

19 months agoMerge pull request #790 from Sarcares/patch-1
Eric Hawicz [Wed, 14 Sep 2022 02:15:48 +0000 (22:15 -0400)] 
Merge pull request #790 from Sarcares/patch-1

Small update to README file

19 months agoSmall update to README file 790/head
Luca Mannella [Mon, 12 Sep 2022 15:29:47 +0000 (17:29 +0200)] 
Small update to README file

it could be necessary to execute make install

20 months agoMerge pull request #784 from rouault/get_time_seed_coverity_scan_silence
Eric Hawicz [Tue, 16 Aug 2022 22:10:06 +0000 (18:10 -0400)] 
Merge pull request #784 from rouault/get_time_seed_coverity_scan_silence

get_time_seed(): silence warning emitted by Coverity Scan static analyzer

20 months agoget_time_seed(): silence warning emitted by Coverity Scan static analyzer 784/head
Even Rouault [Tue, 16 Aug 2022 09:11:55 +0000 (11:11 +0200)] 
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)

20 months agoMerge pull request #783 from kraj/master
Eric Hawicz [Sun, 14 Aug 2022 12:19:19 +0000 (08:19 -0400)] 
Merge pull request #783 from kraj/master

Fix build with clang-15+

20 months agojson_pointer.c: Move idx_val declaration to top of function 783/head
Khem Raj [Sun, 14 Aug 2022 07:46:28 +0000 (00:46 -0700)] 
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>
20 months agojson_inttypes.h: Define ssize_t on windows platforms
Khem Raj [Sun, 14 Aug 2022 04:45:11 +0000 (21:45 -0700)] 
json_inttypes.h: Define ssize_t on windows platforms

Signed-off-by: Khem Raj <raj.khem@gmail.com>
20 months agoFix build with clang-15+
Khem Raj [Sun, 14 Aug 2022 03:37:03 +0000 (20:37 -0700)] 
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>
20 months agoMerge pull request #782 from DimitriPapadopoulos/codespell
Eric Hawicz [Sat, 13 Aug 2022 13:43:50 +0000 (09:43 -0400)] 
Merge pull request #782 from DimitriPapadopoulos/codespell

Fix typos found by codespell

20 months agoFix typos found by codespell 782/head
Dimitri Papadopoulos [Sat, 13 Aug 2022 12:47:40 +0000 (15:47 +0300)] 
Fix typos found by codespell

Do not fix typos from past commits found in release notes.

21 months agoApply some of the fixes from PR #740, although by using size_t instead of castings.
Eric Haszlakiewicz [Sun, 31 Jul 2022 19:26:12 +0000 (19:26 +0000)] 
Apply some of the fixes from PR #740, although by using size_t instead of castings.

21 months agoMerge pull request #757 from c3h2-ctf/big
Eric Hawicz [Sun, 31 Jul 2022 18:27:32 +0000 (14:27 -0400)] 
Merge pull request #757 from c3h2-ctf/big

json_object_from_fd_ex: fail if file is too large

21 months agoIssue #705: disable locale handling when building for a uClibc system because its...
Eric Haszlakiewicz [Sat, 30 Jul 2022 20:27:35 +0000 (20:27 +0000)] 
Issue #705: disable locale handling when building for a uClibc system because its duplocale() function (intentionally) crashes.

21 months agoWhen serializing with JSON_C_TO_STRING_PRETTY set, keep the opening and closing curly...
Eric Haszlakiewicz [Sat, 30 Jul 2022 19:27:14 +0000 (19:27 +0000)] 
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.

21 months agoUpdate Travis links to point at travis-ci.com instead of travis-ci.org
Eric Haszlakiewicz [Tue, 26 Jul 2022 23:47:58 +0000 (23:47 +0000)] 
Update Travis links to point at travis-ci.com instead of travis-ci.org

21 months agoEntirely drop mode bits from open(O_RDONLY) to avoid warnings on certain platforms...
Eric Haszlakiewicz [Tue, 26 Jul 2022 23:43:30 +0000 (23:43 +0000)] 
Entirely drop mode bits from open(O_RDONLY) to avoid warnings on certain platforms.  Fixes issue #779.