Bug 1197309 - remove PR_snprintf calls in intl/; r=froydnj
authorAniket Vyas <vyas45@mozilla.com>
Thu, 15 Oct 2015 21:43:53 -0400
changeset 289259 361424714ab2ba27d855f6c489628e163d2c4e27
parent 289258 63e8108c623ff51ecf585d1032027cac3da46ca6
child 289260 5e0eae94d1cc4c484e9cf210f47279d52a8bbf4a
push id8654
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:48:40 +0000
treeherdermozilla-aurora@bc4551debe17 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1197309
milestone44.0a1
Bug 1197309 - remove PR_snprintf calls in intl/; r=froydnj
intl/locale/unix/nsPosixLocale.cpp
intl/unicharutil/nsSaveAsCharset.cpp
--- a/intl/locale/unix/nsPosixLocale.cpp
+++ b/intl/locale/unix/nsPosixLocale.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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 "nscore.h"
 #include "nsString.h"
 #include "nsPosixLocale.h"
-#include "prprf.h"
+#include "mozilla/Snprintf.h"
 #include "plstr.h"
 #include "nsReadableUtils.h"
 
 static bool
 ParseLocaleString(const char* locale_string, char* language, char* country, char* extra, char separator);
 
 nsresult 
 nsPosixLocale::GetPlatformLocale(const nsAString& locale, nsACString& posixLocale)
@@ -26,28 +26,28 @@ nsPosixLocale::GetPlatformLocale(const n
     if (!ParseLocaleString(xp_locale.get(),lang_code,country_code,extra,'-')) {
 //      strncpy(posixLocale,"C",length);
       posixLocale = xp_locale;  // use xp locale if parse failed
       return NS_OK;
     }
 
     if (*country_code) {
       if (*extra) {
-        PR_snprintf(posix_locale,sizeof(posix_locale),"%s_%s.%s",lang_code,country_code,extra);
+        snprintf_literal(posix_locale,"%s_%s.%s",lang_code,country_code,extra);
       }
       else {
-        PR_snprintf(posix_locale,sizeof(posix_locale),"%s_%s",lang_code,country_code);
+        snprintf_literal(posix_locale,"%s_%s",lang_code,country_code);
       }
     }
     else {
       if (*extra) {
-        PR_snprintf(posix_locale,sizeof(posix_locale),"%s.%s",lang_code,extra);
+        snprintf_literal(posix_locale,"%s.%s",lang_code,extra);
       }
       else {
-        PR_snprintf(posix_locale,sizeof(posix_locale),"%s",lang_code);
+        snprintf_literal(posix_locale,"%s",lang_code);
       }
     }
 
     posixLocale = posix_locale;
     return NS_OK;
   }
 
   return NS_ERROR_FAILURE;
@@ -75,20 +75,20 @@ nsPosixLocale::GetXPLocale(const char* p
 
     // Special case: substitute "nb" (Norwegian Bokmal) for macrolanguage
     // code "no" (Norwegian)
     if (nsDependentCString(lang_code).LowerCaseEqualsLiteral("no")) {
       lang_code[1] = 'b';
     }
 
     if (*country_code) {
-      PR_snprintf(posix_locale,sizeof(posix_locale),"%s-%s",lang_code,country_code);
+      snprintf_literal(posix_locale,"%s-%s",lang_code,country_code);
     } 
     else {
-      PR_snprintf(posix_locale,sizeof(posix_locale),"%s",lang_code);
+      snprintf_literal(posix_locale,"%s",lang_code);
     }
 
     CopyASCIItoUTF16(nsDependentCString(posix_locale), locale);
     return NS_OK;
 
   }
 
     return NS_ERROR_FAILURE;
--- a/intl/unicharutil/nsSaveAsCharset.cpp
+++ b/intl/unicharutil/nsSaveAsCharset.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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 "prmem.h"
-#include "prprf.h"
+#include "mozilla/Snprintf.h"
 #include "nsSaveAsCharset.h"
 #include "nsWhitespaceTokenizer.h"
 #include "nsIUnicodeEncoder.h"
 #include "mozilla/dom/EncodingUtils.h"
 #include "nsComponentManagerUtils.h"
 
 using mozilla::dom::EncodingUtils;
 
@@ -299,25 +299,25 @@ nsSaveAsCharset::DoConversionFallBack(ui
       *outString='\0';
       rv = NS_OK;
     } else {
       rv = NS_ERROR_FAILURE;
     }
     break;
   case attr_FallbackEscapeU:
     if (inUCS4 & 0xff0000)
-      rv = (PR_snprintf(outString, bufferLength, "\\u%.6x", inUCS4) > 0) ? NS_OK : NS_ERROR_FAILURE;
+      rv = (snprintf(outString, bufferLength, "\\u%.6x", inUCS4) > 0) ? NS_OK : NS_ERROR_FAILURE;
     else
-      rv = (PR_snprintf(outString, bufferLength, "\\u%.4x", inUCS4) > 0) ? NS_OK : NS_ERROR_FAILURE;
+      rv = (snprintf(outString, bufferLength, "\\u%.4x", inUCS4) > 0) ? NS_OK : NS_ERROR_FAILURE;
     break;
   case attr_FallbackDecimalNCR:
-    rv = ( PR_snprintf(outString, bufferLength, "&#%u;", inUCS4) > 0) ? NS_OK : NS_ERROR_FAILURE;
+    rv = (snprintf(outString, bufferLength, "&#%u;", inUCS4) > 0) ? NS_OK : NS_ERROR_FAILURE;
     break;
   case attr_FallbackHexNCR:
-    rv = (PR_snprintf(outString, bufferLength, "&#x%x;", inUCS4) > 0) ? NS_OK : NS_ERROR_FAILURE;
+    rv = (snprintf(outString, bufferLength, "&#x%x;", inUCS4) > 0) ? NS_OK : NS_ERROR_FAILURE;
     break;
   case attr_FallbackNone:
     rv = NS_OK;
     break;
   default:
     rv = NS_ERROR_ILLEGAL_VALUE;
     break;
   }