diff -Nru json-c-0.16/abi-check.sh json-c-0.17/abi-check.sh --- json-c-0.16/abi-check.sh 1970-01-01 00:00:00.000000000 +0000 +++ json-c-0.17/abi-check.sh 2023-08-12 19:00:16.000000000 +0000 @@ -0,0 +1,42 @@ +#!/bin/sh + +prev=0.16 +release=0.17 + +# ... clone json-c, abi-compliance-checker, abi-dumper + +mkdir build +cd build +CFLAGS=-Og cmake -DCMAKE_INSTALL_PREFIX=~/json-c-installs/json-c-${release} .. +make && make test && make install + +# Assume the old version has already been built + +cd ~/abi-compliance-checker +mkxml() +{ + ver="$1" +cat < json-c-${ver}.xml + + + ${ver} + + + +../json-c-installs/json-c-${ver}/include/json-c + + + +../json-c-installs/json-c-${ver}/lib64/libjson-c.so + + +EOF +} +mkxml ${release} +mkxml ${prev} + +perl abi-compliance-checker.pl -lib json-c -dump json-c-${prev}.xml -dump-path ./ABI-${prev}.dump +perl abi-compliance-checker.pl -lib json-c -dump json-c-${release}.xml -dump-path ./ABI-${release}.dump +perl abi-compliance-checker.pl -l json-c -old ABI-${prev}.dump -new ABI-${release}.dump + +echo "look in compat_reports/json-c/..." diff -Nru json-c-0.16/apps/json_parse.c json-c-0.17/apps/json_parse.c --- json-c-0.16/apps/json_parse.c 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/apps/json_parse.c 2023-08-12 19:00:16.000000000 +0000 @@ -22,16 +22,30 @@ #include #endif -static int formatted_output = 0; +#ifndef JSON_NORETURN +#if defined(_MSC_VER) +#define JSON_NORETURN __declspec(noreturn) +#elif defined(__OS400__) +#define JSON_NORETURN +#else +/* 'cold' attribute is for optimization, telling the computer this code + * path is unlikely. + */ +#define JSON_NORETURN __attribute__((noreturn, cold)) +#endif +#endif + +static int formatted_output = JSON_C_TO_STRING_SPACED; static int show_output = 1; static int strict_mode = 0; +static int color = 0; static const char *fname = NULL; #ifndef HAVE_JSON_TOKENER_GET_PARSE_END #define json_tokener_get_parse_end(tok) ((tok)->char_offset) #endif -static void usage(const char *argv0, int exitval, const char *errmsg); +JSON_NORETURN static void usage(const char *argv0, int exitval, const char *errmsg); static void showmem(void); static int parseit(int fd, int (*callback)(struct json_object *)); static int showobj(struct json_object *new_obj); @@ -42,7 +56,7 @@ struct rusage rusage; memset(&rusage, 0, sizeof(rusage)); getrusage(RUSAGE_SELF, &rusage); - printf("maxrss: %ld KB\n", rusage.ru_maxrss); + fprintf(stderr, "maxrss: %ld KB\n", rusage.ru_maxrss); #endif } @@ -50,7 +64,7 @@ { struct json_object *obj; char buf[32768]; - int ret; + ssize_t ret; int depth = JSON_TOKENER_DEFAULT_DEPTH; json_tokener *tok; @@ -73,20 +87,21 @@ size_t total_read = 0; while ((ret = read(fd, buf, sizeof(buf))) > 0) { - total_read += ret; - int start_pos = 0; - while (start_pos != ret) + size_t retu = (size_t)ret; // We know it's positive + total_read += retu; + size_t start_pos = 0; + while (start_pos != retu) { - obj = json_tokener_parse_ex(tok, &buf[start_pos], ret - start_pos); + obj = json_tokener_parse_ex(tok, &buf[start_pos], retu - start_pos); enum json_tokener_error jerr = json_tokener_get_error(tok); - int parse_end = json_tokener_get_parse_end(tok); + size_t parse_end = json_tokener_get_parse_end(tok); if (obj == NULL && jerr != json_tokener_continue) { - char *aterr = (start_pos + parse_end < sizeof(buf)) ? + const char *aterr = (start_pos + parse_end < (int)sizeof(buf)) ? &buf[start_pos + parse_end] : ""; fflush(stdout); - int fail_offset = total_read - ret + start_pos + parse_end; - fprintf(stderr, "Failed at offset %d: %s %c\n", fail_offset, + size_t fail_offset = total_read - retu + start_pos + parse_end; + fprintf(stderr, "Failed at offset %lu: %s %c\n", (unsigned long)fail_offset, json_tokener_error_desc(jerr), aterr[0]); json_tokener_free(tok); return 1; @@ -102,7 +117,7 @@ } } start_pos += json_tokener_get_parse_end(tok); - assert(start_pos <= ret); + assert(start_pos <= retu); } } if (ret < 0) @@ -122,15 +137,12 @@ return 1; } - printf("Successfully parsed object from %s\n", fname); + fprintf(stderr, "Successfully parsed object from %s\n", fname); if (show_output) { const char *output; - if (formatted_output) - output = json_object_to_json_string(new_obj); - else - output = json_object_to_json_string_ext(new_obj, JSON_C_TO_STRING_PRETTY); + output = json_object_to_json_string_ext(new_obj, formatted_output | color); printf("%s\n", output); } @@ -145,11 +157,14 @@ fp = stderr; if (errmsg != NULL) fprintf(fp, "ERROR: %s\n\n", errmsg); - fprintf(fp, "Usage: %s [-f] [-n] [-s]\n", argv0); - fprintf(fp, " -f - Format the output with JSON_C_TO_STRING_PRETTY\n"); + fprintf(fp, "Usage: %s [-f|-F ] [-n] [-s]\n", argv0); + fprintf(fp, " -f - Format the output to stdout with JSON_C_TO_STRING_PRETTY (default is JSON_C_TO_STRING_SPACED)\n"); + fprintf(fp, " -F - Format the output to stdout with , e.g. 0 for JSON_C_TO_STRING_PLAIN\n"); fprintf(fp, " -n - No output\n"); + fprintf(fp, " -c - color\n"); fprintf(fp, " -s - Parse in strict mode, flags:\n"); fprintf(fp, " JSON_TOKENER_STRICT|JSON_TOKENER_ALLOW_TRAILING_CHARS\n"); + fprintf(fp, " Diagnostic information will be emitted to stderr\n"); fprintf(fp, "\nWARNING WARNING WARNING\n"); fprintf(fp, "This is a prototype, it may change or be removed at any time!\n"); @@ -158,16 +173,17 @@ int main(int argc, char **argv) { - json_object *new_obj; int opt; - while ((opt = getopt(argc, argv, "fhns")) != -1) + while ((opt = getopt(argc, argv, "fF:hnsc")) != -1) { switch (opt) { - case 'f': formatted_output = 1; break; + case 'f': formatted_output = JSON_C_TO_STRING_PRETTY; break; + case 'F': formatted_output = atoi(optarg); break; case 'n': show_output = 0; break; case 's': strict_mode = 1; break; + case 'c': color = JSON_C_TO_STRING_COLOR; break; case 'h': usage(argv[0], 0, NULL); default: /* '?' */ usage(argv[0], EXIT_FAILURE, "Unknown arguments"); } diff -Nru json-c-0.16/arraylist.c json-c-0.17/arraylist.c --- json-c-0.16/arraylist.c 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/arraylist.c 2023-08-12 19:00:16.000000000 +0000 @@ -125,6 +125,27 @@ return 0; } +int array_list_insert_idx(struct array_list *arr, size_t idx, void *data) +{ + size_t move_amount; + + if (idx >= arr->length) + return array_list_put_idx(arr, idx, data); + + /* we're at full size, what size_t can support */ + if (arr->length == SIZE_T_MAX) + return -1; + + if (array_list_expand_internal(arr, arr->length + 1)) + return -1; + + move_amount = (arr->length - idx) * sizeof(void *); + memmove(arr->array + idx + 1, arr->array + idx, move_amount); + arr->array[idx] = data; + arr->length++; + return 0; +} + //static inline int _array_list_put_idx(struct array_list *arr, size_t idx, void *data) int array_list_put_idx(struct array_list *arr, size_t idx, void *data) { diff -Nru json-c-0.16/arraylist.h json-c-0.17/arraylist.h --- json-c-0.16/arraylist.h 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/arraylist.h 2023-08-12 19:00:16.000000000 +0000 @@ -62,6 +62,8 @@ extern void *array_list_get_idx(struct array_list *al, size_t i); +extern int array_list_insert_idx(struct array_list *al, size_t i, void *data); + extern int array_list_put_idx(struct array_list *al, size_t i, void *data); extern int array_list_add(struct array_list *al, void *data); diff -Nru json-c-0.16/AUTHORS json-c-0.17/AUTHORS --- json-c-0.16/AUTHORS 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/AUTHORS 2023-08-12 19:00:16.000000000 +0000 @@ -1,6 +1,7 @@ Alan Coopersmith Alexander Dahl Alexandru Ardelean +An7ar35 andy5995 Aram Poghosyan Björn Esser @@ -11,13 +12,16 @@ Christopher Head Chris Wolfe C. Watford (christopher.watford@gmail.com) +Daniel Danzberger Darjan Krijan David McCann DeX77 +Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> dota17 Eric Haszlakiewicz Eric Hawicz Even Rouault +Federico Francescon Gianluigi Tiesi grdowns Hex052 @@ -27,6 +31,7 @@ Jaap Keuter Jakov Smolic janczer +JC (Jonathan Chen) Jehan Jehiah Czebotar Jonathan Wiens @@ -34,10 +39,13 @@ José Bollo Juuso Alasuutari Keith Holman +Khem Raj Kizuna-Meraki Leon Gross Liang, Gao +Luca Mannella Marc <34656315+MarcT512@users.noreply.github.com> +Matthias Gatto max Micah Snyder Michael Clark @@ -53,9 +61,11 @@ Robert Rosen Penev Rubasri Kalidas +Sergey Sharshunov Simon McVittie ssrlive <30760636+ssrlive@users.noreply.github.com> Tobias Nießen Tobias Stoeckmann Tudor Brindus Unmanned Player <36690541+unmanned-player@users.noreply.github.com> +Yurii Rashkovskii diff -Nru json-c-0.16/ChangeLog json-c-0.17/ChangeLog --- json-c-0.16/ChangeLog 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/ChangeLog 2023-08-12 19:00:16.000000000 +0000 @@ -1,4 +1,39 @@ +0.17 (up to commit 077661f, 2023-08-08) +======================================== + +Deprecated and removed features: +-------------------------------- +* None + +New features +------------ +* json_patch: add first implementation only with patch application +* Add --disable-static and --disable-dynamic options to the cmake-configure script. +* Add -DBUILD_APPS=NO option to disable app build +* Minimum cmake version is now 3.9 + +Significant changes and bug fixes +--------------------------------- +* 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. +* Disable locale handling when targeting a uClibc system due to problems + with its duplocale() function. +* When parsing with JSON_TOKENER_STRICT set, integer overflow/underflow + now result in a json_tokener_error_parse_number. Without that flag + values are capped at INT64_MIN/UINT64_MAX. +* Fix memory leak with emtpy strings in json_object_set_string +* json_object_from_fd_ex: fail if file is too large (>=INT_MAX bytes) +* Add back json_number_chars, but only because it's part of the public API. +* Entirely drop mode bits from open(O_RDONLY) to avoid warnings on certain + platforms. +* Specify dependent libraries, including -lbsd, in a more consistent way so + linking against a static json-c works better +* Fix a variety of build problems and add & improve tests +* Update RFC reference to https://www.rfc-editor.org/rfc/rfc8259 + +*** + 0.16 (up to commit 66dcdf5, 2022-04-13) ======================================== diff -Nru json-c-0.16/cmake/config.h.in json-c-0.17/cmake/config.h.in --- json-c-0.16/cmake/config.h.in 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/cmake/config.h.in 2023-08-12 19:00:16.000000000 +0000 @@ -137,6 +137,9 @@ /* Define to 1 if you have the `uselocale' function. */ #cmakedefine HAVE_USELOCALE +/* Define to 1 if newlocale() needs freelocale() called on it's `base` argument */ +#cmakedefine NEWLOCALE_NEEDS_FREELOCALE + /* Define to 1 if you have the `vasprintf' function. */ #cmakedefine HAVE_VASPRINTF diff -Nru json-c-0.16/cmake/json_config.h.in json-c-0.17/cmake/json_config.h.in --- json-c-0.16/cmake/json_config.h.in 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/cmake/json_config.h.in 2023-08-12 19:00:16.000000000 +0000 @@ -1,2 +1,5 @@ /* Define to 1 if you have the header file. */ #cmakedefine JSON_C_HAVE_INTTYPES_H @JSON_C_HAVE_INTTYPES_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine JSON_C_HAVE_STDINT_H @JSON_C_HAVE_STDINT_H@ diff -Nru json-c-0.16/cmake-configure json-c-0.17/cmake-configure --- json-c-0.16/cmake-configure 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/cmake-configure 2023-08-12 19:00:16.000000000 +0000 @@ -65,9 +65,15 @@ --enable-shared) FLAGS+=(-DBUILD_SHARED_LIBS=ON) ;; + --disable-shared) + FLAGS+=(-DBUILD_SHARED_LIBS=OFF) + ;; --enable-static) FLAGS+=(-DBUILD_STATIC_LIBS=ON) ;; + --disable-static) + FLAGS+=(-DBUILD_STATIC_LIBS=OFF) + ;; --disable-Bsymbolic) FLAGS+=(-DDISABLE_BSYMBOLIC=ON) ;; diff -Nru json-c-0.16/CMakeLists.txt json-c-0.17/CMakeLists.txt --- json-c-0.16/CMakeLists.txt 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/CMakeLists.txt 2023-08-12 19:00:16.000000000 +0000 @@ -1,31 +1,26 @@ -# Many projects still are stuck using CMake 2.8 is several places so it's good to provide backward support too. This is -# specially true in old embedded systems (OpenWRT and friends) where CMake isn't necessarily upgraded. -cmake_minimum_required(VERSION 2.8) +# CMake 3.9 was released in 2017/07 +# As of 2023, many versions of Linux, NetBSD and FreeBSD provide, +# and many OpenWRT packages require, much newer CMake packages. +# We're stopping before 3.10 because that version starts requiring +# c++11, which isn't available on e.g HPUX. +cmake_minimum_required(VERSION 3.9) -if(POLICY CMP0048) - cmake_policy(SET CMP0048 NEW) -endif() +# The project() command manages VERSION variables. +cmake_policy(SET CMP0048 NEW) # JSON-C library is C only project. -if (CMAKE_VERSION VERSION_LESS 3.0) - project(json-c) - set(PROJECT_VERSION_MAJOR "0") - set(PROJECT_VERSION_MINOR "16") - set(PROJECT_VERSION_PATCH "0") - set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") -else() - project(json-c LANGUAGES C VERSION 0.16) -endif() +# PROJECT_VERSION{,_MAJOR,_MINOR,_PATCH} set by project(): +project(json-c LANGUAGES C VERSION 0.17) -# If we've got 3.0 then it's good, let's provide support. Otherwise, leave it be. -if(POLICY CMP0038) - # Policy CMP0038 introduced was in CMake 3.0 - cmake_policy(SET CMP0038 NEW) -endif() +# Targets may not link directly to themselves. +cmake_policy(SET CMP0038 NEW) -if(POLICY CMP0054) - cmake_policy(SET CMP0054 NEW) -endif() +# MACOSX_RPATH is enabled by default. +# We set it explicitly to avoid the warning +cmake_policy(SET CMP0042 NEW) + +# Only interpret if() arguments as variables or keywords when unquoted. +cmake_policy(SET CMP0054 NEW) # set default build type if not specified by user if(NOT CMAKE_BUILD_TYPE) @@ -36,22 +31,13 @@ # Include file check macros honor CMAKE_REQUIRED_LIBRARIES # i.e. the check_include_file() calls will include -lm when checking. +# New in version 3.12. if(POLICY CMP0075) cmake_policy(SET CMP0075 NEW) endif() include(CTest) -if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING AND - (NOT MSVC OR NOT (MSVC_VERSION LESS 1800)) # Tests need at least VS2013 - ) -add_subdirectory(tests) -endif() - -if (NOT MSVC) # cmd line apps don't built on Windows currently. -add_subdirectory(apps) -endif() - # Set some packaging variables. set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") @@ -102,7 +88,10 @@ option(ENABLE_THREADING "Enable partial threading support." OFF) option(OVERRIDE_GET_RANDOM_SEED "Override json_c_get_random_seed() with custom code." OFF) option(DISABLE_EXTRA_LIBS "Avoid linking against extra libraries, such as libbsd." OFF) -option(DISABLE_JSON_POINTER "Disable JSON pointer (RFC6901) support." OFF) +option(DISABLE_JSON_POINTER "Disable JSON pointer (RFC6901) and JSON patch support." OFF) +option(DISABLE_JSON_PATCH "Disable JSON patch (RFC6902) support." OFF) +option(NEWLOCALE_NEEDS_FREELOCALE "Work around newlocale bugs in old FreeBSD by calling freelocale" OFF) +option(BUILD_APPS "Default to building apps" ON) if (UNIX OR MINGW OR CYGWIN) @@ -154,11 +143,14 @@ check_include_file(sys/stat.h HAVE_SYS_STAT_H) check_include_file(xlocale.h HAVE_XLOCALE_H) +# Set json-c specific vars to stamp into json_config.h +# in a way that hopefully won't conflict with other +# projects that use json-c. if (HAVE_INTTYPES_H) - # Set a json-c specific var to stamp into json_config.h - # in a way that hopefully won't conflict with other - # projects that use json-c. - set(JSON_C_HAVE_INTTYPES_H 1) + set(JSON_C_HAVE_INTTYPES_H 1) +endif() +if (HAVE_STDINT_H) + set(JSON_C_HAVE_STDINT_H 1) endif() check_symbol_exists(_isnan "float.h" HAVE_DECL__ISNAN) @@ -183,10 +175,12 @@ if (NOT HAVE_ARC4RANDOM AND DISABLE_EXTRA_LIBS STREQUAL "OFF") check_include_file(bsd/stdlib.h HAVE_BSD_STDLIB_H) if (HAVE_BSD_STDLIB_H) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-lbsd") - link_libraries(bsd) + list(APPEND CMAKE_REQUIRED_LIBRARIES "bsd") unset(HAVE_ARC4RANDOM CACHE) check_symbol_exists(arc4random "bsd/stdlib.h" HAVE_ARC4RANDOM) + if (NOT HAVE_ARC4RANDOM) + list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "bsd") + endif() endif() endif() @@ -200,6 +194,18 @@ check_symbol_exists(setlocale "locale.h" HAVE_SETLOCALE) check_symbol_exists(uselocale "locale.h" HAVE_USELOCALE) endif() + +# uClibc *intentionally* crashes in duplocale(), at least as of: +# https://github.com/ffainelli/uClibc/blob/266bdc1/libc/misc/locale/locale.c#L1322 +# So, if it looks like we're compiling for a system like that just disable +# locale handling entirely. +exec_program(${CMAKE_C_COMPILER} ARGS -dumpmachine OUTPUT_VARIABLE CMAKE_GNU_C_MACHINE) +if (CMAKE_GNU_C_MACHINE MATCHES "uclibc") + message(STATUS "Detected uClibc compiler, disabling locale handling") + set(HAVE_SETLOCALE 0) + set(HAVE_USELOCALE 0) +endif() + if (HAVE_STRINGS_H) check_symbol_exists(strcasecmp "strings.h" HAVE_STRCASECMP) check_symbol_exists(strncasecmp "strings.h" HAVE_STRNCASECMP) @@ -305,6 +311,11 @@ endif() add_definitions(-D_GNU_SOURCE) + + if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") + # Remove this for 1.0 when we can bump the ABI and actually fix these warnings. + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-shorten-64-to-32") + endif() elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DEBUG") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4100") @@ -396,9 +407,9 @@ set(JSON_C_HEADERS ${JSON_C_PUBLIC_HEADERS} ${PROJECT_SOURCE_DIR}/json_object_private.h + ${PROJECT_SOURCE_DIR}/json_pointer_private.h ${PROJECT_SOURCE_DIR}/random_seed.h ${PROJECT_SOURCE_DIR}/strerror_override.h - ${PROJECT_SOURCE_DIR}/strerror_override_private.h ${PROJECT_SOURCE_DIR}/math_compat.h ${PROJECT_SOURCE_DIR}/snprintf_compat.h ${PROJECT_SOURCE_DIR}/strdup_compat.h @@ -424,8 +435,15 @@ set(JSON_C_PUBLIC_HEADERS ${JSON_C_PUBLIC_HEADERS} ${PROJECT_SOURCE_DIR}/json_pointer.h) set(JSON_C_SOURCES ${JSON_C_SOURCES} ${PROJECT_SOURCE_DIR}/json_pointer.c) set(JSON_H_JSON_POINTER "#include \"json_pointer.h\"") + + if (NOT DISABLE_JSON_PATCH) + set(JSON_C_PUBLIC_HEADERS ${JSON_C_PUBLIC_HEADERS} ${PROJECT_SOURCE_DIR}/json_patch.h) + set(JSON_C_SOURCES ${JSON_C_SOURCES} ${PROJECT_SOURCE_DIR}/json_patch.c) + set(JSON_H_JSON_PATCH "#include \"json_patch.h\"") + endif() else() set(JSON_H_JSON_POINTER "") + set(JSON_H_JSON_PATCH "") endif() configure_file(json.h.cmakein ${PROJECT_BINARY_DIR}/json.h @ONLY) @@ -454,7 +472,7 @@ ${JSON_C_HEADERS} ) set_target_properties(${PROJECT_NAME} PROPERTIES - VERSION 5.2.0 + VERSION 5.3.0 SOVERSION 5) list(APPEND CMAKE_TARGETS ${PROJECT_NAME}) # If json-c is used as subroject it set to target correct interface -I flags and allow @@ -465,6 +483,8 @@ $ ) +target_link_libraries(${PROJECT_NAME} PUBLIC ${CMAKE_REQUIRED_LIBRARIES}) + # Allow to build static and shared libraries at the same time if (BUILD_STATIC_LIBS AND BUILD_SHARED_LIBS) set(STATIC_LIB ${PROJECT_NAME}-static) @@ -478,6 +498,8 @@ $ ) + target_link_libraries(${PROJECT_NAME}-static PUBLIC ${CMAKE_REQUIRED_LIBRARIES}) + # rename the static library if (NOT MSVC) set_target_properties(${STATIC_LIB} PROPERTIES @@ -531,6 +553,23 @@ SET(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) SET(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}) SET(VERSION ${PROJECT_VERSION}) + + # Linking against the static json-c requires + # dependent packages to include additional libs: + SET(LIBS_LIST ${CMAKE_REQUIRED_LIBRARIES}) + + # Note: We would need cmake >= 3.12 in order to use list(TRANSFORM ...) + function(list_transform_prepend var prefix) + set(temp "") + foreach(f ${${var}}) + list(APPEND temp "${prefix}${f}") + endforeach() + set(${var} "${temp}" PARENT_SCOPE) + endfunction() + list_transform_prepend(LIBS_LIST "-l") + + string(REPLACE ";" " " LIBS "${LIBS_LIST}") + configure_file(json-c.pc.in json-c.pc @ONLY) set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") install(FILES ${PROJECT_BINARY_DIR}/json-c.pc DESTINATION "${INSTALL_PKGCONFIG_DIR}") @@ -538,3 +577,16 @@ install(FILES ${JSON_C_PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/json-c) +if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING AND + (NOT MSVC OR NOT (MSVC_VERSION LESS 1800)) # Tests need at least VS2013 + ) +add_subdirectory(tests) +endif() + +if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_APPS) +# skip apps when we're included in someone else's build +if (NOT MSVC) # cmd line apps don't built on Windows currently. +add_subdirectory(apps) +endif() +endif() + diff -Nru json-c-0.16/debian/changelog json-c-0.17/debian/changelog --- json-c-0.16/debian/changelog 2023-07-27 01:18:13.000000000 +0000 +++ json-c-0.17/debian/changelog 2023-09-27 19:08:27.000000000 +0000 @@ -1,4 +1,4 @@ -json-c (0.16-2~18.04.sav0) bionic; urgency=low +json-c (0.17-1~18.04.sav0) bionic; urgency=low * Backport to Bionic * debian/libjson-c-dev.links: Add dh-exec shebang, chmod +x (for multiarch) @@ -7,7 +7,19 @@ * debian/rules: Add override_dh_auto_configure target with multiarch config CMAKE_INSTALL_LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH) (compat level < 12) - -- Rob Savoury Thu, 27 Jul 2023 11:18:13 +1000 + -- Rob Savoury Wed, 27 Sep 2023 12:08:27 -0700 + +json-c (0.17-1) unstable; urgency=medium + + * New upstream version + * Update std-version to 4.6.2 + * d/symbols: update symbols file + * d/patches: remove patch 0001-CMakeLists-use-GNUInstallDirs.patch + no longer required + * d/patches: refresh patches 0003-config-h.patch and 0002-doxygen.patch + * d/.gitlab-ci.yml: add gitlab ci script for salsa + + -- Nicolas Mora Tue, 15 Aug 2023 16:13:54 -0400 json-c (0.16-2) unstable; urgency=medium diff -Nru json-c-0.16/debian/control json-c-0.17/debian/control --- json-c-0.16/debian/control 2023-07-27 01:18:13.000000000 +0000 +++ json-c-0.17/debian/control 2023-09-27 19:08:27.000000000 +0000 @@ -5,7 +5,7 @@ cmake, dh-exec, doxygen, -Standards-Version: 4.6.1 +Standards-Version: 4.6.2 Section: libs Homepage: https://github.com/json-c/json-c/wiki Vcs-Git: https://salsa.debian.org/debian/json-c.git diff -Nru json-c-0.16/debian/.gitlab-ci.yml json-c-0.17/debian/.gitlab-ci.yml --- json-c-0.16/debian/.gitlab-ci.yml 1970-01-01 00:00:00.000000000 +0000 +++ json-c-0.17/debian/.gitlab-ci.yml 2023-08-15 20:13:54.000000000 +0000 @@ -0,0 +1,9 @@ +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml +reprotest: + extends: .test-reprotest + variables: + REPROTEST_EXTRA_ARGS: '--variations=+all,-kernel' +variables: + RELEASE: experimental diff -Nru json-c-0.16/debian/libjson-c5.symbols json-c-0.17/debian/libjson-c5.symbols --- json-c-0.16/debian/libjson-c5.symbols 2022-08-23 13:25:14.000000000 +0000 +++ json-c-0.17/debian/libjson-c5.symbols 2023-08-15 20:13:54.000000000 +0000 @@ -4,7 +4,9 @@ JSONC_0.14@JSONC_0.14 0.15 JSONC_0.15@JSONC_0.15 0.15 JSONC_0.16@JSONC_0.16 0.16 + JSONC_0.17@JSONC_0.17 0.17 JSONC_PRIVATE@JSONC_PRIVATE 0.15 + _json_c_strerror@JSONC_PRIVATE 0.17 array_list_add@JSONC_PRIVATE 0.15 array_list_bsearch@JSONC_0.14 0.15 array_list_del_idx@JSONC_PRIVATE 0.15 @@ -25,10 +27,12 @@ json_c_visit@JSONC_0.14 0.15 json_global_set_string_hash@JSONC_0.14 0.15 json_hex_chars@JSONC_PRIVATE 0.15 + json_number_chars@JSONC_0.14 0.17 json_object_array_add@JSONC_0.14 0.15 json_object_array_bsearch@JSONC_0.14 0.15 json_object_array_del_idx@JSONC_0.14 0.15 json_object_array_get_idx@JSONC_0.14 0.15 + json_object_array_insert_idx@JSONC_0.17 0.17 json_object_array_length@JSONC_0.14 0.15 json_object_array_put_idx@JSONC_0.14 0.15 json_object_array_shrink@JSONC_0.15 0.15 @@ -99,6 +103,7 @@ json_parse_double@JSONC_PRIVATE 0.15 json_parse_int64@JSONC_PRIVATE 0.15 json_parse_uint64@JSONC_PRIVATE 0.15 + json_patch_apply@JSONC_0.17 0.17 json_pointer_get@JSONC_0.14 0.15 json_pointer_getf@JSONC_0.14 0.15 json_pointer_set@JSONC_0.14 0.15 diff -Nru json-c-0.16/debian/patches/0002-doxygen.patch json-c-0.17/debian/patches/0002-doxygen.patch --- json-c-0.16/debian/patches/0002-doxygen.patch 2022-08-23 13:25:14.000000000 +0000 +++ json-c-0.17/debian/patches/0002-doxygen.patch 2023-08-15 20:13:54.000000000 +0000 @@ -3,20 +3,19 @@ Subject: Doxygen files: remove privacy-breach-generic Forwarded: not-needed ---- --- a/README.md +++ b/README.md -@@ -27,13 +27,6 @@ if you already have json-c installed and ready to use. - - Home page for json-c: https://github.com/json-c/json-c/wiki +@@ -53,13 +53,6 @@ + If you already have json-c installed, see [Linking to `libjson-c`](#linking) + for how to build and link your program against it. -Build Status -* [AppVeyor Build](https://ci.appveyor.com/project/hawicz/json-c) ![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/json-c/json-c?branch=master&svg=true) --* [Travis Build](https://travis-ci.org/json-c/json-c) ![Travis Build Status](https://travis-ci.org/json-c/json-c.svg?branch=master) +-* [Travis Build](https://app.travis-ci.com/github/json-c/json-c) ![Travis Build Status](https://api.travis-ci.com/json-c/json-c.svg?branch=master) - -Test Status -* [Coveralls](https://coveralls.io/github/json-c/json-c?branch=master) [![Coverage Status](https://coveralls.io/repos/github/json-c/json-c/badge.svg?branch=master)](https://coveralls.io/github/json-c/json-c?branch=master) - - Building on Unix with `git`, `gcc` and `cmake` - -------------------------------------------------- + ### Prerequisites: + - `gcc`, `clang`, or another C compiler diff -Nru json-c-0.16/debian/patches/0003-config-h.patch json-c-0.17/debian/patches/0003-config-h.patch --- json-c-0.16/debian/patches/0003-config-h.patch 2022-08-23 13:25:14.000000000 +0000 +++ json-c-0.17/debian/patches/0003-config-h.patch 2023-08-15 20:13:54.000000000 +0000 @@ -6,7 +6,7 @@ --- --- a/cmake/config.h.in +++ b/cmake/config.h.in -@@ -180,7 +180,9 @@ +@@ -183,7 +183,9 @@ #define PACKAGE_BUGREPORT "@JSON_C_BUGREPORT@" /* Define to the full name of this package. */ diff -Nru json-c-0.16/debian/patches/series json-c-0.17/debian/patches/series --- json-c-0.16/debian/patches/series 2022-08-23 13:25:14.000000000 +0000 +++ json-c-0.17/debian/patches/series 2023-08-15 20:13:54.000000000 +0000 @@ -1,3 +1,3 @@ 0003-config-h.patch 0002-doxygen.patch -0001-CMakeLists-use-GNUInstallDirs.patch +#0001-CMakeLists-use-GNUInstallDirs.patch diff -Nru json-c-0.16/doc/Doxyfile.in json-c-0.17/doc/Doxyfile.in --- json-c-0.16/doc/Doxyfile.in 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/doc/Doxyfile.in 2023-08-12 19:00:16.000000000 +0000 @@ -1103,7 +1103,7 @@ # cascading style sheets that are included after the standard style sheets # created by doxygen. Using this option one can overrule certain style aspects. # This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefor more robust against future updates. +# standard style sheet and is therefore more robust against future updates. # Doxygen will copy the style sheet files to the output directory. # Note: The order of the extra stylesheet files is of importance (e.g. the last # stylesheet in the list overrules the setting of the previous ones in the diff -Nru json-c-0.16/doc/html/annotated.html json-c-0.17/doc/html/annotated.html --- json-c-0.16/doc/html/annotated.html 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/doc/html/annotated.html 2023-08-12 19:00:16.000000000 +0000 @@ -17,7 +17,7 @@
json-c -  0.16 +  0.17
@@ -51,17 +51,19 @@ oCarray_list oCjson_object_iter oCjson_object_iterator -oCjson_tokener -oCjson_tokener_srec -oClh_entry -oClh_table -\Cprintbuf +oCjson_patch_error +oCjson_pointer_get_result +oCjson_tokener +oCjson_tokener_srec +oClh_entry +oClh_table +\Cprintbuf diff -Nru json-c-0.16/doc/html/arraylist_8h.html json-c-0.17/doc/html/arraylist_8h.html --- json-c-0.16/doc/html/arraylist_8h.html 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/doc/html/arraylist_8h.html 2023-08-12 19:00:16.000000000 +0000 @@ -17,7 +17,7 @@
json-c -  0.16 +  0.17
@@ -82,6 +82,8 @@   void * array_list_get_idx (struct array_list *al, size_t i)   +int array_list_insert_idx (struct array_list *al, size_t i, void *data) +  int array_list_put_idx (struct array_list *al, size_t i, void *data)   int array_list_add (struct array_list *al, void *data) @@ -270,6 +272,38 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
int array_list_insert_idx (struct array_listal,
size_t i,
void * data 
)
+
+ +
+
@@ -441,7 +475,7 @@
diff -Nru json-c-0.16/doc/html/classes.html json-c-0.17/doc/html/classes.html --- json-c-0.16/doc/html/classes.html 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/doc/html/classes.html 2023-08-12 19:00:16.000000000 +0000 @@ -17,7 +17,7 @@
json-c -  0.16 +  0.17
@@ -49,22 +49,22 @@
A | J | L | P
- + - + - - + + +
  A  
-
json_object_iterator   lh_table   
json_tokener   
  P  
+
json_object_iterator   json_tokener_srec   lh_table   
json_patch_error   
  L  
+
  P  
array_list   json_tokener_srec   
array_list   json_pointer_get_result   
  J  
-
  L  
-
printbuf   
json_object_iter   lh_entry   
json_tokener   lh_entry   printbuf   
json_object_iter   
A | J | L | P
diff -Nru json-c-0.16/doc/html/deprecated.html json-c-0.17/doc/html/deprecated.html --- json-c-0.16/doc/html/deprecated.html 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/doc/html/deprecated.html 2023-08-12 19:00:16.000000000 +0000 @@ -17,7 +17,7 @@
json-c -  0.16 +  0.17
@@ -87,7 +87,7 @@ diff -Nru json-c-0.16/doc/html/dir_b62156a74b5a818be0c2ef9f85294b95.html json-c-0.17/doc/html/dir_b62156a74b5a818be0c2ef9f85294b95.html --- json-c-0.16/doc/html/dir_b62156a74b5a818be0c2ef9f85294b95.html 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/doc/html/dir_b62156a74b5a818be0c2ef9f85294b95.html 2023-08-12 19:00:16.000000000 +0000 @@ -17,7 +17,7 @@
json-c -  0.16 +  0.17
@@ -54,7 +54,7 @@ diff -Nru json-c-0.16/doc/html/files.html json-c-0.17/doc/html/files.html --- json-c-0.16/doc/html/files.html 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/doc/html/files.html 2023-08-12 19:00:16.000000000 +0000 @@ -17,7 +17,7 @@
json-c -  0.16 +  0.17
@@ -55,19 +55,21 @@ o*json_inttypes.hDo not use, json-c internal, may be changed or removed at any time o*json_object.hCore json-c API. Start here, or with json_tokener.h o*json_object_iterator.hAn API for iterating over json_type_object objects, styled to be familiar to C++ programmers. Unlike json_object_object_foreach() and json_object_object_foreachC(), this avoids the need to expose json-c internals like lh_entry -o*json_pointer.hJSON Pointer (RFC 6901) implementation for retrieving objects from a json-c object tree -o*json_tokener.hMethods to parse an input string into a tree of json_object objects -o*json_types.hBasic types used in a few places in json-c, but you should include "json_object.h" instead -o*json_util.hMiscllaneous utility functions and macros -o*json_visit.hMethods for walking a tree of objects -o*linkhash.hInternal methods for working with json_type_object objects. Although this is exposed by the json_object_get_object() function and within the json_object_iter type, it is not recommended for direct use -\*printbuf.hInternal string buffer handling. Unless you're writing a json_object_to_json_string_fn implementation for use with json_object_set_serializer() direct use of this is not recommended +o*json_patch.hJSON Patch (RFC 6902) implementation for manipulating JSON objects +o*json_pointer.hJSON Pointer (RFC 6901) implementation for retrieving objects from a json-c object tree +o*json_pointer_private.hDo not use, json-c internal, may be changed or removed at any time +o*json_tokener.hMethods to parse an input string into a tree of json_object objects +o*json_types.hBasic types used in a few places in json-c, but you should include "json_object.h" instead +o*json_util.hMiscllaneous utility functions and macros +o*json_visit.hMethods for walking a tree of objects +o*linkhash.hInternal methods for working with json_type_object objects. Although this is exposed by the json_object_get_object() function and within the json_object_iter type, it is not recommended for direct use +\*printbuf.hInternal string buffer handling. Unless you're writing a json_object_to_json_string_fn implementation for use with json_object_set_serializer() direct use of this is not recommended diff -Nru json-c-0.16/doc/html/functions.html json-c-0.17/doc/html/functions.html --- json-c-0.16/doc/html/functions.html 2022-04-14 01:12:43.000000000 +0000 +++ json-c-0.17/doc/html/functions.html 2023-08-12 19:00:16.000000000 +0000 @@ -17,7 +17,7 @@
json-c -  0.16 +  0.17
@@ -120,6 +120,12 @@
  • err : json_tokener
  • +
  • errmsg +: json_patch_error +
  • +
  • errno_code +: json_patch_error +
  • @@ -148,6 +154,9 @@

    - i -

    @@ -190,7 +202,8 @@

    - o -