1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

JsonCPP: restore '1.0.0+' compatibility (#15368)

Previously, compiling on Ubuntu 20.04 would fail with the system-provided JsonCPP
version (1.7.4). Which would satisfy the documented requirement of "1.0.0+".
This commit is contained in:
SmallJoker 2024-11-03 15:10:39 +01:00 committed by GitHub
parent 3064f3ccb7
commit c884e7181f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 11 deletions

View file

@ -13,10 +13,17 @@
#include <array>
#include <optional>
#include <limits>
#include <memory> // unique_ptr
#include <stdexcept>
#include <unordered_map>
#include <unordered_set>
#if JSONCPP_VERSION_HEXA < 0x01090000 /* 1.9.0 */
namespace Json {
using String = JSONCPP_STRING; // Polyfill
}
#endif
namespace tiniergltf {
static inline void check(bool cond) {
@ -1381,7 +1388,7 @@ static Json::Value readJson(Span<const char> span) {
Json::CharReaderBuilder builder;
const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
Json::Value json;
JSONCPP_STRING err;
Json::String err;
if (!reader->parse(span.ptr, span.end(), &json, &err))
throw std::runtime_error(std::string("invalid JSON: ") + err);
return json;