aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorLoïc Blot <loic.blot@unix-experience.fr>2017-08-21 16:07:39 +0200
committerSmallJoker <mk939@ymail.com>2018-06-03 17:31:59 +0200
commitd9c7af109ada1e45074d4615b50b8aab2886c2e3 (patch)
treea609907446839ae34a68e2112f94a3fef5f525c1 /src/util
parent12562be393215487280b597b53157c94901e750d (diff)
downloadminetest-d9c7af109ada1e45074d4615b50b8aab2886c2e3.tar.gz
minetest-d9c7af109ada1e45074d4615b50b8aab2886c2e3.tar.bz2
minetest-d9c7af109ada1e45074d4615b50b8aab2886c2e3.zip
serialize: use a temporary for SerializeException Exception must always use temporary instead of global copied exception instances, it's not recommended and should have undefined issues
Diffstat (limited to 'src/util')
-rw-r--r--src/util/serialize.cpp2
-rw-r--r--src/util/serialize.h6
2 files changed, 2 insertions, 6 deletions
diff --git a/src/util/serialize.cpp b/src/util/serialize.cpp
index 61d369bc4..a1e6790f4 100644
--- a/src/util/serialize.cpp
+++ b/src/util/serialize.cpp
@@ -28,8 +28,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <iomanip>
#include <vector>
-SerializationError eof_ser_err("Attempted read past end of data");
-
////
//// BufReader
////
diff --git a/src/util/serialize.h b/src/util/serialize.h
index e22434191..a864d21ab 100644
--- a/src/util/serialize.h
+++ b/src/util/serialize.h
@@ -429,8 +429,6 @@ bool deSerializeStringToStruct(std::string valstr,
//// BufReader
////
-extern SerializationError eof_ser_err;
-
#define MAKE_BUFREADER_GETNOEX_FXN(T, N, S) \
inline bool get ## N ## NoEx(T *val) \
{ \
@@ -446,7 +444,7 @@ extern SerializationError eof_ser_err;
{ \
T val; \
if (!get ## N ## NoEx(&val)) \
- throw eof_ser_err; \
+ throw SerializationError("Attempted read past end of data"); \
return val; \
}
@@ -504,7 +502,7 @@ public:
inline void getRawData(void *val, size_t len)
{
if (!getRawDataNoEx(val, len))
- throw eof_ser_err;
+ throw SerializationError("Attempted read past end of data");
}
inline size_t remaining()