Bug 1197315 - remove PR_snprintf calls in gfx/; r=froydnj

This commit is contained in:
Aniket Vyas 2015-10-12 14:06:19 -07:00
parent b3a0fe89f9
commit eef4977b53
2 changed files with 7 additions and 7 deletions

View File

@ -18,7 +18,7 @@
#include "nsRect.h" // for mozilla::gfx::IntRect
#include "nsIFile.h" // for nsIFile
#include "nsDirectoryServiceDefs.h" // for NS_OS_TMP_DIR
#include "prprf.h" // for PR_snprintf
#include "mozilla/Snprintf.h"
#include "FPSCounter.h"
namespace mozilla {
@ -209,7 +209,7 @@ FPSCounter::WriteFrameTimeStamps(PRFileDesc* fd)
{
const int bufferSize = 256;
char buffer[bufferSize];
int writtenCount = PR_snprintf(buffer, bufferSize, "FPS Data for: %s\n", mFPSName);
int writtenCount = snprintf_literal(buffer, "FPS Data for: %s\n", mFPSName);
MOZ_ASSERT(writtenCount >= 0);
PR_Write(fd, buffer, writtenCount);
@ -224,7 +224,7 @@ FPSCounter::WriteFrameTimeStamps(PRFileDesc* fd)
while (HasNext(startTimeStamp)) {
TimeDuration duration = previousSample - nextTimeStamp;
writtenCount = PR_snprintf(buffer, bufferSize, "%f,\n", duration.ToMilliseconds());
writtenCount = snprintf_literal(buffer, "%f,\n", duration.ToMilliseconds());
MOZ_ASSERT(writtenCount >= 0);
PR_Write(fd, buffer, writtenCount);
@ -309,8 +309,8 @@ FPSCounter::PrintHistogram(std::map<int, int>& aHistogram)
int fps = iter->first;
int count = iter->second;
length += PR_snprintf(buffer + length, kBufferLength - length,
"FPS: %d = %d. ", fps, count);
length += snprintf(buffer + length, kBufferLength - length,
"FPS: %d = %d. ", fps, count);
NS_ASSERTION(length >= kBufferLength, "Buffer overrun while printing FPS histogram.");
}

View File

@ -8,7 +8,7 @@
#include <string.h>
#include "nsColor.h"
#include "nsColorNames.h"
#include "prprf.h"
#include "mozilla/Snprintf.h"
#include "nsString.h"
#include "mozilla/ArrayUtils.h"
@ -71,7 +71,7 @@ void RunColorTests() {
rgb = NS_RGB(r, g, b);
}
char cbuf[50];
PR_snprintf(cbuf, sizeof(cbuf), "%02x%02x%02x", r, g, b);
snprintf_literal(cbuf, "%02x%02x%02x", r, g, b);
nscolor hexrgb;
ASSERT_TRUE(NS_HexToRGB(NS_ConvertASCIItoUTF16(cbuf), &hexrgb)) <<
"hex conversion to color of '" << cbuf << "'";