diff options
author | sfan5 <sfan5@live.de> | 2021-09-11 21:06:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-11 21:06:57 +0200 |
commit | 75bf9b75caba5fc876f20eabea3fabc142d1b51e (patch) | |
tree | c5a584838498760d0cb5e206795ead223d15527b /src/util/serialize.cpp | |
parent | 766e885a1b1c5afb7a62f11b427b6d135adeab87 (diff) | |
download | minetest-75bf9b75caba5fc876f20eabea3fabc142d1b51e.tar.gz minetest-75bf9b75caba5fc876f20eabea3fabc142d1b51e.tar.bz2 minetest-75bf9b75caba5fc876f20eabea3fabc142d1b51e.zip |
Make sure relevant std::stringstreams are set to binary
Diffstat (limited to 'src/util/serialize.cpp')
-rw-r--r-- | src/util/serialize.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/util/serialize.cpp b/src/util/serialize.cpp index d770101f2..281061229 100644 --- a/src/util/serialize.cpp +++ b/src/util/serialize.cpp @@ -248,7 +248,7 @@ std::string serializeJsonStringIfNeeded(const std::string &s) std::string deSerializeJsonStringIfNeeded(std::istream &is) { - std::ostringstream tmp_os; + std::stringstream tmp_os(std::ios_base::binary | std::ios_base::in | std::ios_base::out); bool expect_initial_quote = true; bool is_json = false; bool was_backslash = false; @@ -280,8 +280,7 @@ std::string deSerializeJsonStringIfNeeded(std::istream &is) expect_initial_quote = false; } if (is_json) { - std::istringstream tmp_is(tmp_os.str(), std::ios::binary); - return deSerializeJsonString(tmp_is); + return deSerializeJsonString(tmp_os); } return tmp_os.str(); |