Skip to content

Commit

Permalink
Revert "Use fixed-width format specifiers in serializeStructToString"
Browse files Browse the repository at this point in the history
This reverts commit 875f132.
Fixed width format specifiers are only officially availale in C99 and C++11.
  • Loading branch information
ShadowNinja committed Mar 14, 2014
1 parent 875f132 commit d753d35
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/util/serialize.cpp
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d753d35

Please sign in to comment.