Bug 1232113 - "Make the format specifiers in JS_snprintf() invocations more portable". r=nicolas.b.pierron
authorWei Wu <lazyparser>
Sat, 12 Dec 2015 19:59:00 +0100
changeset 316898 2569a9980921096604c0cd605609bb575f1e0291
parent 316897 c99c2040f54c70bb87a3b5fe833fb583e799994d
child 316899 b4daad853e4da2d770579cd184b9370e969a3b76
push id8629
push userjlorenzo@mozilla.com
push dateTue, 22 Dec 2015 11:12:02 +0000
reviewersnicolas.b.pierron
bugs1232113
milestone46.0a1
Bug 1232113 - "Make the format specifiers in JS_snprintf() invocations more portable". r=nicolas.b.pierron
js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -7,16 +7,17 @@
 /* JS shell. */
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/GuardObjects.h"
 #include "mozilla/mozalloc.h"
 #include "mozilla/PodOperations.h"
+#include "mozilla/SizePrintfMacros.h"
 
 #ifdef XP_WIN
 # include <direct.h>
 # include <process.h>
 #endif
 #include <errno.h>
 #include <fcntl.h>
 #if defined(XP_WIN)
@@ -1415,19 +1416,19 @@ Evaluate(JSContext* cx, unsigned argc, V
     }
 
     if (saveBytecode) {
         // If we are both loading and saving, we assert that we are going to
         // replace the current bytecode by the same stream of bytes.
         if (loadBytecode && assertEqBytecode) {
             if (saveLength != loadLength) {
                 char loadLengthStr[16];
-                JS_snprintf(loadLengthStr, sizeof(loadLengthStr), "%u", loadLength);
+                JS_snprintf(loadLengthStr, sizeof(loadLengthStr), "%" PRIu32, loadLength);
                 char saveLengthStr[16];
-                JS_snprintf(saveLengthStr, sizeof(saveLengthStr), "%u", saveLength);
+                JS_snprintf(saveLengthStr, sizeof(saveLengthStr), "%" PRIu32, saveLength);
 
                 JS_ReportErrorNumber(cx, my_GetErrorMessage, nullptr, JSSMSG_CACHE_EQ_SIZE_FAILED,
                                      loadLengthStr, saveLengthStr);
                 return false;
             }
 
             if (!PodEqual(loadBuffer, saveBuffer.get(), loadLength)) {
                 JS_ReportErrorNumber(cx, my_GetErrorMessage, nullptr,