diff --git a/accessible/atk/AccessibleWrap.cpp b/accessible/atk/AccessibleWrap.cpp index 82dd6a17e6123..3019fce4048f5 100644 --- a/accessible/atk/AccessibleWrap.cpp +++ b/accessible/atk/AccessibleWrap.cpp @@ -19,7 +19,6 @@ #include "nsMai.h" #include "nsMaiHyperlink.h" #include "nsString.h" -#include "prprf.h" #include "nsStateMap.h" #include "mozilla/a11y/Platform.h" #include "Relation.h" @@ -28,6 +27,7 @@ #include "nsISimpleEnumerator.h" #include "mozilla/ArrayUtils.h" +#include "mozilla/Snprintf.h" #include "nsXPCOMStrings.h" #include "nsComponentManagerUtils.h" #include "nsIPersistentProperties2.h" @@ -436,8 +436,7 @@ GetUniqueMaiAtkTypeName(uint16_t interfacesBits) static gchar namePrefix[] = "MaiAtkType"; /* size = 10 */ static gchar name[MAI_ATK_TYPE_NAME_LEN + 1]; - PR_snprintf(name, MAI_ATK_TYPE_NAME_LEN, "%s%x", namePrefix, - interfacesBits); + snprintf_literal(name, "%s%x", namePrefix, interfacesBits); name[MAI_ATK_TYPE_NAME_LEN] = '\0'; return name; diff --git a/browser/components/shell/nsGNOMEShellService.cpp b/browser/components/shell/nsGNOMEShellService.cpp index cd1244faf815a..2986f483a9c58 100644 --- a/browser/components/shell/nsGNOMEShellService.cpp +++ b/browser/components/shell/nsGNOMEShellService.cpp @@ -27,7 +27,7 @@ #include "nsIImageLoadingContent.h" #include "imgIRequest.h" #include "imgIContainer.h" -#include "prprf.h" +#include "mozilla/Snprintf.h" #if defined(MOZ_WIDGET_GTK) #include "nsIImageToPixbuf.h" #endif @@ -516,7 +516,7 @@ ColorToCString(uint32_t aColor, nsCString& aResult) uint16_t green = COLOR_8_TO_16_BIT((aColor >> 8) & 0xff); uint16_t blue = COLOR_8_TO_16_BIT(aColor & 0xff); - PR_snprintf(buf, 14, "#%04x%04x%04x", red, green, blue); + snprintf(buf, 14, "#%04x%04x%04x", red, green, blue); } NS_IMETHODIMP diff --git a/image/decoders/icon/nsIconURI.cpp b/image/decoders/icon/nsIconURI.cpp index 59bf8f4888b1b..ab67cf9040329 100644 --- a/image/decoders/icon/nsIconURI.cpp +++ b/image/decoders/icon/nsIconURI.cpp @@ -9,11 +9,11 @@ #include "mozilla/ArrayUtils.h" #include "mozilla/ipc/URIUtils.h" +#include "mozilla/Snprintf.h" #include "nsIIOService.h" #include "nsIURL.h" #include "nsNetUtil.h" -#include "prprf.h" #include "plstr.h" #include @@ -94,7 +94,7 @@ nsMozIconURI::GetSpec(nsACString& aSpec) aSpec += kSizeStrings[mIconSize]; } else { char buf[20]; - PR_snprintf(buf, sizeof(buf), "%d", mSize); + snprintf_literal(buf, "%d", mSize); aSpec.Append(buf); } diff --git a/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp b/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp index 9639d5f4fd020..856134ace176c 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp @@ -9,9 +9,9 @@ #include "nsTArray.h" #include "nsReadableUtils.h" #include "plbase64.h" -#include "prprf.h" #include "nsPrintfCString.h" #include "safebrowsing.pb.h" +#include "mozilla/Snprintf.h" #define DEFAULT_PROTOCOL_VERSION "2.2" @@ -484,7 +484,7 @@ nsUrlClassifierUtils::CanonicalNum(const nsACString& num, while (bytes--) { char buf[20]; - PR_snprintf(buf, sizeof(buf), "%u", val & 0xff); + snprintf_literal(buf, "%u", val & 0xff); if (_retval.IsEmpty()) { _retval.Assign(buf); } else { diff --git a/tools/profiler/core/ProfilerMarkers.cpp b/tools/profiler/core/ProfilerMarkers.cpp index 8a258402b0a33..cb8c50806c86e 100644 --- a/tools/profiler/core/ProfilerMarkers.cpp +++ b/tools/profiler/core/ProfilerMarkers.cpp @@ -10,7 +10,7 @@ #ifndef SPS_STANDALONE #include "gfxASurface.h" #include "Layers.h" -#include "prprf.h" +#include "mozilla/Snprintf.h" #endif ProfilerMarkerPayload::ProfilerMarkerPayload(ProfilerBacktrace* aStack) @@ -174,7 +174,7 @@ LayerTranslationPayload::StreamPayload(SpliceableJSONWriter& aWriter, { const size_t bufferSize = 32; char buffer[bufferSize]; - PR_snprintf(buffer, bufferSize, "%p", mLayer); + snprintf_literal(buffer, "%p", mLayer); aWriter.StringProperty("layer", buffer); aWriter.IntProperty("x", mPoint.x); diff --git a/widget/xremoteclient/XRemoteClient.cpp b/widget/xremoteclient/XRemoteClient.cpp index 6dc824566fbf3..43d409004dec9 100644 --- a/widget/xremoteclient/XRemoteClient.cpp +++ b/widget/xremoteclient/XRemoteClient.cpp @@ -7,9 +7,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/ArrayUtils.h" +#include "mozilla/Snprintf.h" #include "XRemoteClient.h" #include "prmem.h" -#include "prprf.h" #include "plstr.h" #include "prsystem.h" #include "mozilla/Logging.h" @@ -293,7 +293,7 @@ XRemoteClient::GetLock(Window aWindow, bool *aDestroyed) char pidstr[32]; char sysinfobuf[SYS_INFO_BUFFER_LENGTH]; - PR_snprintf(pidstr, sizeof(pidstr), "pid%d@", getpid()); + snprintf_literal(pidstr, "pid%d@", getpid()); PRStatus status; status = PR_GetSystemInfo(PR_SI_HOSTNAME, sysinfobuf, SYS_INFO_BUFFER_LENGTH); diff --git a/xpfe/appshell/nsXULWindow.cpp b/xpfe/appshell/nsXULWindow.cpp index f5ca05ee30966..3983ae67bdfd1 100644 --- a/xpfe/appshell/nsXULWindow.cpp +++ b/xpfe/appshell/nsXULWindow.cpp @@ -14,10 +14,10 @@ #include "nsPrintfCString.h" #include "nsString.h" #include "nsWidgetsCID.h" -#include "prprf.h" #include "nsThreadUtils.h" #include "nsNetCID.h" #include "nsQueryObject.h" +#include "mozilla/Snprintf.h" //Interfaces needed to be included #include "nsIAppShell.h" @@ -1601,8 +1601,7 @@ NS_IMETHODIMP nsXULWindow::SavePersistentAttributes() // (only for size elements which are persisted) if ((mPersistentAttributesDirty & PAD_POSITION) && gotRestoredBounds) { if (persistString.Find("screenX") >= 0) { - PR_snprintf(sizeBuf, sizeof(sizeBuf), "%d", - NSToIntRound(rect.x / posScale.scale)); + snprintf_literal(sizeBuf, "%d", NSToIntRound(rect.x / posScale.scale)); sizeString.AssignWithConversion(sizeBuf); docShellElement->SetAttribute(SCREENX_ATTRIBUTE, sizeString, rv); if (shouldPersist) { @@ -1610,8 +1609,7 @@ NS_IMETHODIMP nsXULWindow::SavePersistentAttributes() } } if (persistString.Find("screenY") >= 0) { - PR_snprintf(sizeBuf, sizeof(sizeBuf), "%d", - NSToIntRound(rect.y / posScale.scale)); + snprintf_literal(sizeBuf, "%d", NSToIntRound(rect.y / posScale.scale)); sizeString.AssignWithConversion(sizeBuf); docShellElement->SetAttribute(SCREENY_ATTRIBUTE, sizeString, rv); if (shouldPersist) { @@ -1622,8 +1620,7 @@ NS_IMETHODIMP nsXULWindow::SavePersistentAttributes() if ((mPersistentAttributesDirty & PAD_SIZE) && gotRestoredBounds) { if (persistString.Find("width") >= 0) { - PR_snprintf(sizeBuf, sizeof(sizeBuf), "%d", - NSToIntRound(rect.width / sizeScale.scale)); + snprintf_literal(sizeBuf, "%d", NSToIntRound(rect.width / sizeScale.scale)); sizeString.AssignWithConversion(sizeBuf); docShellElement->SetAttribute(WIDTH_ATTRIBUTE, sizeString, rv); if (shouldPersist) { @@ -1631,8 +1628,7 @@ NS_IMETHODIMP nsXULWindow::SavePersistentAttributes() } } if (persistString.Find("height") >= 0) { - PR_snprintf(sizeBuf, sizeof(sizeBuf), "%d", - NSToIntRound(rect.height / sizeScale.scale)); + snprintf_literal(sizeBuf, "%d", NSToIntRound(rect.height / sizeScale.scale)); sizeString.AssignWithConversion(sizeBuf); docShellElement->SetAttribute(HEIGHT_ATTRIBUTE, sizeString, rv); if (shouldPersist) { @@ -1661,7 +1657,7 @@ NS_IMETHODIMP nsXULWindow::SavePersistentAttributes() nsCOMPtr mediator(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID)); if (mediator) { mediator->GetZLevel(this, &zLevel); - PR_snprintf(sizeBuf, sizeof(sizeBuf), "%lu", (unsigned long)zLevel); + snprintf_literal(sizeBuf, "%" PRIu32, zLevel); sizeString.AssignWithConversion(sizeBuf); docShellElement->SetAttribute(ZLEVEL_ATTRIBUTE, sizeString, rv); if (shouldPersist) {