Skip to content

Commit d753d35

Browse files
committedMar 14, 2014
Revert "Use fixed-width format specifiers in serializeStructToString"
This reverts commit 875f132. Fixed width format specifiers are only officially availale in C99 and C++11.
1 parent 875f132 commit d753d35

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed
 

‎src/util/serialize.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2424
#include "../exceptions.h"
2525
#include "../irrlichttypes.h"
2626

27-
#include <inttypes.h> // For PRIxN, cinttypes is C++11-only
2827
#include <sstream>
2928
#include <iomanip>
3029
#include <vector>
@@ -417,20 +416,20 @@ bool serializeStructToString(std::string *outstr,
417416
if (width == 16) {
418417
bufpos += PADDING(bufpos, u16);
419418
nprinted = snprintf(sbuf + pos, sbuflen,
420-
is_unsigned ? "%" PRIu16 ", " : "%" PRIi16 ", ",
419+
is_unsigned ? "%u, " : "%d, ",
421420
*((u16 *)bufpos));
422421
bufpos += sizeof(u16);
423422
} else if (width == 32) {
424423
bufpos += PADDING(bufpos, u32);
425424
nprinted = snprintf(sbuf + pos, sbuflen,
426-
is_unsigned ? "%" PRIu32 ", " : "%" PRIi32 ", ",
425+
is_unsigned ? "%u, " : "%d, ",
427426
*((u32 *)bufpos));
428427
bufpos += sizeof(u32);
429428
} else if (width == 64) {
430429
bufpos += PADDING(bufpos, u64);
431430
nprinted = snprintf(sbuf + pos, sbuflen,
432-
is_unsigned ? "%" PRIu64 ", " : "%" PRIi64 ", ",
433-
*((u64 *)bufpos));
431+
is_unsigned ? "%llu, " : "%lli, ",
432+
(unsigned long long)*((u64 *)bufpos));
434433
bufpos += sizeof(u64);
435434
}
436435
break;

0 commit comments

Comments
 (0)
Please sign in to comment.