diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-09-26 20:30:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-26 20:30:14 +0200 |
commit | 50423d8c729ee133035e3bb1e244bfbd1bdc0ef0 (patch) | |
tree | 4605bc80aed2d0f729047697b23e709ade2510e5 /src/mods.cpp | |
parent | f7e57a0d20879e1d1956e36d782a3ab98aa84e38 (diff) | |
download | hax-minetest-server-50423d8c729ee133035e3bb1e244bfbd1bdc0ef0.tar.gz hax-minetest-server-50423d8c729ee133035e3bb1e244bfbd1bdc0ef0.zip |
Update JsonCPP to 1.8.3 (#6466)
* Update JsonCPP to 1.8.3
* Fix deprecated functions
Json::FastWriter, Json::StyledWriter and Json::Reader are marked deprecated since 1.1 and are deprecated in 0.8 but not shown at compilation time.
Use new methods to serialize/deserialize
Diffstat (limited to '')
-rw-r--r-- | src/mods.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mods.cpp b/src/mods.cpp index 405cf9c79..dae492339 100644 --- a/src/mods.cpp +++ b/src/mods.cpp @@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "subgame.h" #include "settings.h" #include "porting.h" +#include "convert_json.h" static bool parseDependsLine(std::istream &is, std::string &dep, std::set<char> &symbols) @@ -374,7 +375,7 @@ bool ModMetadata::save(const std::string &root_path) } bool w_ok = fs::safeWriteToFile(root_path + DIR_DELIM + m_mod_name, - Json::FastWriter().write(json)); + fastWriteJson(json)); if (w_ok) { m_modified = false; @@ -393,11 +394,14 @@ bool ModMetadata::load(const std::string &root_path) return false; } - Json::Reader reader; Json::Value root; - if (!reader.parse(is, root)) { + Json::CharReaderBuilder builder; + builder.settings_["collectComments"] = false; + std::string errs; + + if (!Json::parseFromStream(builder, is, &root, &errs)) { errorstream << "ModMetadata[" << m_mod_name << "]: failed read data " - "(Json decoding failure)." << std::endl; + "(Json decoding failure). Message: " << errs << std::endl; return false; } |