Bug 1197324 - Fix new warnings. r=froydnj
authorTom Schuster <evilpies@gmail.com>
Wed, 03 Aug 2016 14:37:31 +0200
changeset 349223 4b7261f08cce99380890a829387fc23d33f2c38a
parent 349222 0b04df0234b582610ce3c3f21644ba004710532c
child 349224 ac0f19e5a50adc926767ad421ac73c375b5bd0a9
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1197324
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1197324 - Fix new warnings. r=froydnj
dom/bindings/BindingUtils.cpp
layout/generic/nsBlockFrame.cpp
security/manager/ssl/nsNSSCertHelper.cpp
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -4,20 +4,21 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "BindingUtils.h"
 
 #include <algorithm>
 #include <stdarg.h>
 
+#include "mozilla/Assertions.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/FloatingPoint.h"
-#include "mozilla/Assertions.h"
 #include "mozilla/Preferences.h"
+#include "mozilla/SizePrintfMacros.h"
 #include "mozilla/unused.h"
 #include "mozilla/UseCounter.h"
 
 #include "AccessCheck.h"
 #include "jsfriendapi.h"
 #include "nsContentUtils.h"
 #include "nsGlobalWindow.h"
 #include "nsIDocShell.h"
@@ -2527,17 +2528,17 @@ ConvertJSValueToByteString(JSContext* cx
 
     if (foundBadChar) {
       MOZ_ASSERT(badCharIndex < length);
       MOZ_ASSERT(badChar > 255);
       // The largest unsigned 64 bit number (18,446,744,073,709,551,615) has
       // 20 digits, plus one more for the null terminator.
       char index[21];
       static_assert(sizeof(size_t) <= 8, "index array too small");
-      snprintf_literal(index, "%d", badCharIndex);
+      snprintf_literal(index, "%" PRIuSIZE, badCharIndex);
       // A char16_t is 16 bits long.  The biggest unsigned 16 bit
       // number (65,535) has 5 digits, plus one more for the null
       // terminator.
       char badCharArray[6];
       static_assert(sizeof(char16_t) <= 2, "badCharArray too small");
       snprintf_literal(badCharArray, "%d", badChar);
       ThrowErrorMessage(cx, MSG_INVALID_BYTESTRING, index, badCharArray);
       return false;
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -54,16 +54,18 @@
 #include "nsISelection.h"
 #include "mozilla/dom/HTMLDetailsElement.h"
 #include "mozilla/dom/HTMLSummaryElement.h"
 #include "mozilla/StyleSetHandle.h"
 #include "mozilla/StyleSetHandleInlines.h"
 
 #include "nsBidiPresUtils.h"
 
+#include <inttypes.h>
+
 static const int MIN_LINES_NEEDING_CURSOR = 20;
 
 static const char16_t kDiscCharacter = 0x2022;
 
 using namespace mozilla;
 using namespace mozilla::css;
 using namespace mozilla::dom;
 using namespace mozilla::layout;
@@ -1441,17 +1443,17 @@ nsBlockFrame::Reflow(nsPresContext*     
     PRTime delta, perLineDelta, lines;
     lines = int64_t(numLines);
     delta = end - start;
     perLineDelta = delta / lines;
 
     ListTag(stdout);
     char buf[400];
     snprintf_literal(buf,
-                     ": %lld elapsed (%lld per line) (%d lines; %d new lines)",
+                     ": %" PRId64 " elapsed (%" PRId64 " per line) (%d lines; %d new lines)",
                      delta, perLineDelta, numLines, ectc - ctc);
     printf("%s\n", buf);
   }
 #endif
 
   NS_FRAME_SET_TRUNCATION(aStatus, (*reflowInput), aMetrics);
 }
 
@@ -6619,17 +6621,17 @@ nsBlockFrame::BuildDisplayList(nsDisplay
     PRTime lines, deltaPerLine, delta;
     lines = int64_t(numLines);
     delta = end - start;
     deltaPerLine = delta / lines;
 
     ListTag(stdout);
     char buf[400];
     snprintf_literal(buf,
-                     ": %lld elapsed (%lld per line) lines=%d drawn=%d skip=%d",
+                     ": %" PRId64 " elapsed (%" PRId64 " per line) lines=%d drawn=%d skip=%d",
                      delta, deltaPerLine,
                      numLines, drawnLines, numLines - drawnLines);
     printf("%s\n", buf);
   }
 #endif
 }
 
 #ifdef ACCESSIBILITY
--- a/security/manager/ssl/nsNSSCertHelper.cpp
+++ b/security/manager/ssl/nsNSSCertHelper.cpp
@@ -1194,17 +1194,17 @@ ProcessUserNotice(SECItem* derNotice, ns
       break;
     }
     text.AppendLiteral(" - ");
     SECItem** itemList = notice->noticeReference.noticeNumbers;
     while (*itemList) {
       unsigned long number;
       char buffer[60];
       if (SEC_ASN1DecodeInteger(*itemList, &number) == SECSuccess) {
-        snprintf_literal(buffer, "#%d", number);
+        snprintf_literal(buffer, "#%lu", number);
         if (itemList != notice->noticeReference.noticeNumbers)
           text.AppendLiteral(", ");
         AppendASCIItoUTF16(buffer, text);
       }
       itemList++;
     }
   }
   if (notice->displayText.len != 0) {
@@ -1483,17 +1483,17 @@ ProcessMSCAVersion(SECItem  *extData,
   unsigned long version;
   if (SEC_ASN1DecodeInteger(&decoded, &version) != SECSuccess) {
     /* Value out of range, display raw bytes */
     return ProcessRawBytes(nssComponent, extData, text);
   }
 
   /* Apparently, the encoding is <minor><major>, with 16 bits each */
   char buf[50];
-  if (snprintf_literal(buf, "%d.%d", version & 0xFFFF, version >> 16) <= 0) {
+  if (snprintf_literal(buf, "%lu.%lu", version & 0xFFFF, version >> 16) <= 0) {
     return NS_ERROR_FAILURE;
   }
 
   text.AppendASCII(buf);
   return NS_OK;
 }
 
 static nsresult