diff options
author | ShadowNinja <shadowninja@minetest.net> | 2014-03-14 11:20:52 -0400 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2014-03-14 12:13:30 -0400 |
commit | d753d352f15ac3586a80b42dd4da6aca518c8ec8 (patch) | |
tree | 850dbc1b655c26df0662a9ff3b05ae1dbdf793c3 /src/util | |
parent | 875f1327a47f78d783c3abc7f7acc3977dc286ec (diff) | |
download | minetest-d753d352f15ac3586a80b42dd4da6aca518c8ec8.tar.gz minetest-d753d352f15ac3586a80b42dd4da6aca518c8ec8.tar.bz2 minetest-d753d352f15ac3586a80b42dd4da6aca518c8ec8.zip |
Revert "Use fixed-width format specifiers in serializeStructToString"
This reverts commit 875f1327a47f78d783c3abc7f7acc3977dc286ec.
Fixed width format specifiers are only officially availale in C99 and C++11.
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/serialize.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/util/serialize.cpp b/src/util/serialize.cpp index 170daa0f8..069ec5385 100644 --- a/src/util/serialize.cpp +++ b/src/util/serialize.cpp @@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "../exceptions.h" #include "../irrlichttypes.h" -#include <inttypes.h> // For PRIxN, cinttypes is C++11-only #include <sstream> #include <iomanip> #include <vector> @@ -417,20 +416,20 @@ bool serializeStructToString(std::string *outstr, if (width == 16) { bufpos += PADDING(bufpos, u16); nprinted = snprintf(sbuf + pos, sbuflen, - is_unsigned ? "%" PRIu16 ", " : "%" PRIi16 ", ", + is_unsigned ? "%u, " : "%d, ", *((u16 *)bufpos)); bufpos += sizeof(u16); } else if (width == 32) { bufpos += PADDING(bufpos, u32); nprinted = snprintf(sbuf + pos, sbuflen, - is_unsigned ? "%" PRIu32 ", " : "%" PRIi32 ", ", + is_unsigned ? "%u, " : "%d, ", *((u32 *)bufpos)); bufpos += sizeof(u32); } else if (width == 64) { bufpos += PADDING(bufpos, u64); nprinted = snprintf(sbuf + pos, sbuflen, - is_unsigned ? "%" PRIu64 ", " : "%" PRIi64 ", ", - *((u64 *)bufpos)); + is_unsigned ? "%llu, " : "%lli, ", + (unsigned long long)*((u64 *)bufpos)); bufpos += sizeof(u64); } break; |