Skip to content

Commit

Permalink
Bug 1197331 - remove PR_snprintf calls in miscellaneous directories. …
Browse files Browse the repository at this point in the history
…r=nfroyd
  • Loading branch information
ipalmieri committed Aug 4, 2016
1 parent 19aa62a commit 4b8e3c0
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 23 deletions.
5 changes: 2 additions & 3 deletions accessible/atk/AccessibleWrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -28,6 +27,7 @@
#include "nsISimpleEnumerator.h"

#include "mozilla/ArrayUtils.h"
#include "mozilla/Snprintf.h"
#include "nsXPCOMStrings.h"
#include "nsComponentManagerUtils.h"
#include "nsIPersistentProperties2.h"
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions browser/components/shell/nsGNOMEShellService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions image/decoders/icon/nsIconURI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdlib.h>

Expand Down Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions toolkit/components/url-classifier/nsUrlClassifierUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions tools/profiler/core/ProfilerMarkers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions widget/xremoteclient/XRemoteClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down
16 changes: 6 additions & 10 deletions xpfe/appshell/nsXULWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -1601,17 +1601,15 @@ 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) {
ownerXULDoc->Persist(windowElementId, SCREENX_ATTRIBUTE);
}
}
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) {
Expand All @@ -1622,17 +1620,15 @@ 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) {
ownerXULDoc->Persist(windowElementId, WIDTH_ATTRIBUTE);
}
}
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) {
Expand Down Expand Up @@ -1661,7 +1657,7 @@ NS_IMETHODIMP nsXULWindow::SavePersistentAttributes()
nsCOMPtr<nsIWindowMediator> 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) {
Expand Down

0 comments on commit 4b8e3c0

Please sign in to comment.