Skip to content

Commit 424560d

Browse files
patrikjuvonenqaisjp
authored andcommitted
json-c: update from 0.12 to 0.13.1 (#269)
1 parent 2918d95 commit 424560d

File tree

221 files changed

+42761
-5575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+42761
-5575
lines changed

Client/mods/deathmatch/logic/lua/CLuaArguments.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -656,15 +656,15 @@ bool CLuaArguments::ReadFromJSONString(const char* szJSON)
656656
}
657657

658658
json_object* object = json_tokener_parse(szJSON);
659-
if (!is_error(object))
659+
if (object)
660660
{
661661
if (json_object_get_type(object) == json_type_array)
662662
{
663663
bool bSuccess = true;
664664

665665
std::vector<CLuaArguments*> knownTables;
666666

667-
for (int i = 0; i < json_object_array_length(object); i++)
667+
for (uint i = 0; i < json_object_array_length(object); i++)
668668
{
669669
json_object* arrayObject = json_object_array_get_idx(object, i);
670670
CLuaArgument* pArgument = new CLuaArgument();
@@ -697,7 +697,7 @@ bool CLuaArguments::ReadFromJSONString(const char* szJSON)
697697

698698
bool CLuaArguments::ReadFromJSONObject(json_object* object, std::vector<CLuaArguments*>* pKnownTables)
699699
{
700-
if (!is_error(object))
700+
if (object)
701701
{
702702
if (json_object_get_type(object) == json_type_object)
703703
{
@@ -735,7 +735,7 @@ bool CLuaArguments::ReadFromJSONObject(json_object* object, std::vector<CLuaArgu
735735

736736
bool CLuaArguments::ReadFromJSONArray(json_object* object, std::vector<CLuaArguments*>* pKnownTables)
737737
{
738-
if (!is_error(object))
738+
if (object)
739739
{
740740
if (json_object_get_type(object) == json_type_array)
741741
{
@@ -749,7 +749,7 @@ bool CLuaArguments::ReadFromJSONArray(json_object* object, std::vector<CLuaArgum
749749
pKnownTables->push_back(this);
750750

751751
bool bSuccess = true;
752-
for (int i = 0; i < json_object_array_length(object); i++)
752+
for (uint i = 0; i < json_object_array_length(object); i++)
753753
{
754754
json_object* arrayObject = json_object_array_get_idx(object, i);
755755
CLuaArgument* pArgument = new CLuaArgument();

Server/mods/deathmatch/logic/lua/CLuaArguments.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -702,15 +702,15 @@ bool CLuaArguments::ReadFromJSONString(const char* szJSON)
702702
}
703703

704704
json_object* object = json_tokener_parse(szJSON);
705-
if (!is_error(object))
705+
if (object)
706706
{
707707
if (json_object_get_type(object) == json_type_array)
708708
{
709709
bool bSuccess = true;
710710

711711
std::vector<CLuaArguments*> knownTables;
712712

713-
for (int i = 0; i < json_object_array_length(object); i++)
713+
for (uint i = 0; i < json_object_array_length(object); i++)
714714
{
715715
json_object* arrayObject = json_object_array_get_idx(object, i);
716716
CLuaArgument* pArgument = new CLuaArgument();
@@ -743,7 +743,7 @@ bool CLuaArguments::ReadFromJSONString(const char* szJSON)
743743

744744
bool CLuaArguments::ReadFromJSONObject(json_object* object, std::vector<CLuaArguments*>* pKnownTables)
745745
{
746-
if (!is_error(object))
746+
if (object)
747747
{
748748
if (json_object_get_type(object) == json_type_object)
749749
{
@@ -781,7 +781,7 @@ bool CLuaArguments::ReadFromJSONObject(json_object* object, std::vector<CLuaArgu
781781

782782
bool CLuaArguments::ReadFromJSONArray(json_object* object, std::vector<CLuaArguments*>* pKnownTables)
783783
{
784-
if (!is_error(object))
784+
if (object)
785785
{
786786
if (json_object_get_type(object) == json_type_array)
787787
{
@@ -795,7 +795,7 @@ bool CLuaArguments::ReadFromJSONArray(json_object* object, std::vector<CLuaArgum
795795
pKnownTables->push_back(this);
796796

797797
bool bSuccess = true;
798-
for (int i = 0; i < json_object_array_length(object); i++)
798+
for (uint i = 0; i < json_object_array_length(object); i++)
799799
{
800800
json_object* arrayObject = json_object_array_get_idx(object, i);
801801
CLuaArgument* pArgument = new CLuaArgument();

vendor/json-c/Android.configure.mk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
# This file is the top android makefile for all sub-modules.
2+
#
3+
# Suggested settings to build for Android:
4+
#
5+
# export PATH=$PATH:/opt/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/
6+
# export SYSROOT=/opt/android-ndk/platforms/android-9/arch-arm/usr/
7+
# export LD=arm-linux-androideabi-ld
8+
# export CC="arm-linux-androideabi-gcc --sysroot=/opt/android-ndk/platforms/android-9/arch-arm"
9+
#
10+
# Then run autogen.sh, configure and make.
11+
#
212

313
LOCAL_PATH := $(call my-dir)
414
include $(CLEAR_VARS)

vendor/json-c/CMakeLists.txt

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
2+
3+
cmake_minimum_required(VERSION 2.8.7)
4+
cmake_policy(SET CMP0048 NEW)
5+
project(json-c VERSION 0.13.1)
6+
7+
8+
include(CheckSymbolExists)
9+
10+
check_symbol_exists(strtoll "stdlib.h" HAVE_STRTOLL)
11+
12+
set(cmake_strtoll "strtoll")
13+
if (NOT HAVE_STRTOLL)
14+
# Use _strtoi64 if strtoll is not available.
15+
check_symbol_exists(_strtoi64 stdlib.h have_strtoi64)
16+
if (have_strtoi64)
17+
set(HAVE_STRTOLL 1)
18+
set(cmake_strtoll "_strtoi64")
19+
# could do the same for strtoull, if needed
20+
endif ()
21+
endif ()
22+
23+
24+
25+
if(MSVC)
26+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4100 /wd4996 /wd4244 /wd4706 /wd4702 /wd4127 /wd4701")
27+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4100 /wd4996 /wd4244 /wd4706 /wd4702 /wd4127 /wd4701")
28+
set(cmake_create_config 1)
29+
elseif(MINGW)
30+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -D_GNU_SOURCE=1")
31+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -D_GNU_SOURCE=1")
32+
if (MSYS OR CMAKE_GENERATOR STREQUAL "Unix Makefiles")
33+
execute_process(COMMAND echo ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
34+
execute_process(COMMAND sh autogen.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
35+
execute_process(COMMAND sh ./configure WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
36+
file(COPY ./config.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/)
37+
file(COPY ./json_config.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/)
38+
else()
39+
set(cmake_create_config 1)
40+
endif()
41+
elseif(UNIX)
42+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
43+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -D_GNU_SOURCE")
44+
execute_process(COMMAND echo ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
45+
execute_process(COMMAND sh autogen.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
46+
execute_process(COMMAND ./configure WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
47+
file(COPY ./config.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/)
48+
file(COPY ./json_config.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/)
49+
endif()
50+
51+
if (cmake_create_config)
52+
file(REMOVE ./config.h) # make sure any stale one is gone
53+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.win32 ${CMAKE_CURRENT_BINARY_DIR}/include/config.h)
54+
file(COPY ./json_config.h.win32 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/)
55+
file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/include/json_config.h.win32 ${CMAKE_CURRENT_BINARY_DIR}/include/json_config.h)
56+
endif ()
57+
58+
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
59+
60+
set(JSON_C_PUBLIC_HEADERS
61+
./json.h
62+
${CMAKE_CURRENT_BINARY_DIR}/include/config.h
63+
${CMAKE_CURRENT_BINARY_DIR}/include/json_config.h
64+
./arraylist.h
65+
./debug.h
66+
./json_c_version.h
67+
./json_inttypes.h
68+
./json_object.h
69+
./json_pointer.h
70+
./json_tokener.h
71+
./json_util.h
72+
./linkhash.h
73+
./printbuf.h
74+
)
75+
set(JSON_C_HEADERS
76+
${JSON_C_PUBLIC_HEADERS}
77+
./json_object_private.h
78+
./random_seed.h
79+
./strerror_override.h
80+
./strerror_override_private.h
81+
./math_compat.h
82+
./snprintf_compat.h
83+
./strdup_compat.h
84+
./vasprintf_compat.h
85+
)
86+
87+
set(JSON_C_SOURCES
88+
./arraylist.c
89+
./debug.c
90+
./json_c_version.c
91+
./json_object.c
92+
./json_object_iterator.c
93+
./json_pointer.c
94+
./json_tokener.c
95+
./json_util.c
96+
./json_visit.c
97+
./linkhash.c
98+
./printbuf.c
99+
./random_seed.c
100+
./strerror_override.c
101+
)
102+
103+
add_library(json-c
104+
SHARED
105+
${JSON_C_SOURCES}
106+
${JSON_C_HEADERS}
107+
)
108+
109+
add_library(json-c-static
110+
STATIC
111+
${JSON_C_SOURCES}
112+
${JSON_C_HEADERS}
113+
)
114+
115+
set_property(TARGET json-c PROPERTY C_STANDARD 99)
116+
set_property(TARGET json-c-static PROPERTY C_STANDARD 99)
117+
set_target_properties(json-c-static PROPERTIES OUTPUT_NAME json-c)
118+
119+
install(TARGETS json-c json-c-static
120+
RUNTIME DESTINATION bin
121+
LIBRARY DESTINATION lib
122+
ARCHIVE DESTINATION lib
123+
)
124+
125+
install(FILES ${JSON_C_PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/json-c )
126+
127+
if (UNIX)
128+
set(prefix ${CMAKE_INSTALL_PREFIX})
129+
set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin)
130+
set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
131+
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
132+
set(VERSION ${PROJECT_VERSION})
133+
configure_file(json-c.pc.in json-c.pc @ONLY)
134+
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
135+
install(FILES ${CMAKE_BINARY_DIR}/json-c.pc DESTINATION "${INSTALL_PKGCONFIG_DIR}")
136+
endif ()

0 commit comments

Comments
 (0)