diff options
author | Rogier-5 <Rogier-5@users.noreply.github.com> | 2016-08-10 12:10:00 +0200 |
---|---|---|
committer | est31 <est31@users.noreply.github.com> | 2016-08-10 12:10:00 +0200 |
commit | 4503b5097f99d2806763650f33d8ef3b49f77ce4 (patch) | |
tree | d682a8b3ac13c79ece798ae05b9546ecfa770382 /src | |
parent | 058a869b70072aba8baea47e359c45e82daaf152 (diff) | |
download | minetest-4503b5097f99d2806763650f33d8ef3b49f77ce4.tar.gz minetest-4503b5097f99d2806763650f33d8ef3b49f77ce4.tar.bz2 minetest-4503b5097f99d2806763650f33d8ef3b49f77ce4.zip |
Fixes for compiling with a newer (system) jsoncpp (#4429)
* Move included json code to jsoncpp subdirectory
This is needed to avoid having to specify the minetest src directory
as a system include when fixing the json includes.
* Fix json includes
They used "", so that the compiler searches the project's directory
first. The result was that when compiling with a system jsoncpp,
the project's own version of json.h was still included, instead of
the system version.
The includes now use <>, so a system location, or one specified with
'-Ilocation' is searched only.
* Fix for jsoncpp deprecated function warning
When compiling with a newer version of jsoncpp (and
ENABLE_SYSTEM_JSONCPP=true), jsoncpp emits a warning
about a deprecated function that minetest uses.
Diffstat (limited to 'src')
-rw-r--r-- | src/convert_json.h | 2 | ||||
-rw-r--r-- | src/jsoncpp/json/CMakeLists.txt (renamed from src/json/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | src/jsoncpp/json/UPDATING (renamed from src/json/UPDATING) | 0 | ||||
-rw-r--r-- | src/jsoncpp/json/json.h (renamed from src/json/json.h) | 0 | ||||
-rw-r--r-- | src/jsoncpp/json/jsoncpp.cpp (renamed from src/json/jsoncpp.cpp) | 0 | ||||
-rw-r--r-- | src/mods.h | 2 | ||||
-rw-r--r-- | src/script/common/c_content.cpp | 7 | ||||
-rw-r--r-- | src/script/lua_api/l_util.cpp | 2 | ||||
-rw-r--r-- | src/serverlist.cpp | 2 | ||||
-rw-r--r-- | src/serverlist.h | 2 |
10 files changed, 11 insertions, 6 deletions
diff --git a/src/convert_json.h b/src/convert_json.h index 6732fcfa3..55321af5f 100644 --- a/src/convert_json.h +++ b/src/convert_json.h @@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef __CONVERT_JSON_H__ #define __CONVERT_JSON_H__ -#include "json/json.h" +#include <json/json.h> struct ModStoreMod; struct ModStoreModDetails; diff --git a/src/json/CMakeLists.txt b/src/jsoncpp/json/CMakeLists.txt index 9056e4b6d..9056e4b6d 100644 --- a/src/json/CMakeLists.txt +++ b/src/jsoncpp/json/CMakeLists.txt diff --git a/src/json/UPDATING b/src/jsoncpp/json/UPDATING index d00076601..d00076601 100644 --- a/src/json/UPDATING +++ b/src/jsoncpp/json/UPDATING diff --git a/src/json/json.h b/src/jsoncpp/json/json.h index 396aafa82..396aafa82 100644 --- a/src/json/json.h +++ b/src/jsoncpp/json/json.h diff --git a/src/json/jsoncpp.cpp b/src/jsoncpp/json/jsoncpp.cpp index 7a04736de..7a04736de 100644 --- a/src/json/jsoncpp.cpp +++ b/src/jsoncpp/json/jsoncpp.cpp diff --git a/src/mods.h b/src/mods.h index 12576516d..af7777d18 100644 --- a/src/mods.h +++ b/src/mods.h @@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <vector> #include <string> #include <map> -#include "json/json.h" +#include <json/json.h> #include "config.h" #define MODNAME_ALLOWED_CHARS "abcdefghijklmnopqrstuvwxyz0123456789_" diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index 06e20c2a0..c664101ea 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "porting.h" #include "mg_schematic.h" #include "noise.h" -#include "json/json.h" +#include <json/json.h> struct EnumString es_TileAnimationType[] = { @@ -1250,8 +1250,13 @@ static bool push_json_value_helper(lua_State *L, const Json::Value &value, lua_newtable(L); for (Json::Value::const_iterator it = value.begin(); it != value.end(); ++it) { +#ifndef JSONCPP_STRING const char *str = it.memberName(); lua_pushstring(L, str ? str : ""); +#else + std::string str = it.name(); + lua_pushstring(L, str.c_str()); +#endif push_json_value_helper(L, *it, nullindex); lua_rawset(L, -3); } diff --git a/src/script/lua_api/l_util.cpp b/src/script/lua_api/l_util.cpp index 95a5fc4d1..13c0d702f 100644 --- a/src/script/lua_api/l_util.cpp +++ b/src/script/lua_api/l_util.cpp @@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "common/c_content.h" #include "cpp_api/s_async.h" #include "serialization.h" -#include "json/json.h" +#include <json/json.h> #include "cpp_api/s_security.h" #include "porting.h" #include "debug.h" diff --git a/src/serverlist.cpp b/src/serverlist.cpp index de7962a68..87ca5dc04 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -29,7 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "porting.h" #include "log.h" #include "network/networkprotocol.h" -#include "json/json.h" +#include <json/json.h> #include "convert_json.h" #include "httpfetch.h" #include "util/string.h" diff --git a/src/serverlist.h b/src/serverlist.h index 8ffea44cc..0747c3920 100644 --- a/src/serverlist.h +++ b/src/serverlist.h @@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <iostream> #include "config.h" #include "mods.h" -#include "json/json.h" +#include <json/json.h> #ifndef SERVERLIST_HEADER #define SERVERLIST_HEADER |