зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1119980 - Use 'snprintf' instead of 'sprintf' to avoid a warning on Lollipop-based builds. r=froydnj
--HG-- extra : source : 7468f9a3aa03520a29e138d4df431f0b5d90967c
This commit is contained in:
Родитель
9ab4d5e2c1
Коммит
2e2a504271
|
@ -4,6 +4,7 @@
|
|||
* 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 "CrashReporterParent.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include <time.h>
|
||||
|
@ -126,7 +127,7 @@ CrashReporterParent::GenerateChildData(const AnnotationTable* processNotes)
|
|||
mNotes.Put(NS_LITERAL_CSTRING("ProcessType"), type);
|
||||
|
||||
char startTime[32];
|
||||
sprintf(startTime, "%lld", static_cast<long long>(mStartTime));
|
||||
snprintf_literal(startTime, "%lld", static_cast<long long>(mStartTime));
|
||||
mNotes.Put(NS_LITERAL_CSTRING("StartupTime"), nsDependentCString(startTime));
|
||||
|
||||
if (!mAppNotes.IsEmpty())
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "VideoUtils.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
#include <algorithm>
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "soundtouch/SoundTouch.h"
|
||||
|
@ -264,7 +265,7 @@ OpenDumpFile(AudioStream* aStream)
|
|||
if (!getenv("MOZ_DUMP_AUDIO"))
|
||||
return nullptr;
|
||||
char buf[100];
|
||||
sprintf(buf, "dumped-audio-%d.wav", gDumpedAudioCount);
|
||||
snprintf_literal(buf, "dumped-audio-%d.wav", gDumpedAudioCount);
|
||||
FILE* f = fopen(buf, "wb");
|
||||
if (!f)
|
||||
return nullptr;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "prinit.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
|
@ -177,10 +178,10 @@ int32_t WifiHotspotUtils::do_wifi_hostapd_get_stations()
|
|||
}
|
||||
stations++;
|
||||
|
||||
sprintf(cmd, "STA-NEXT %s", addr);
|
||||
snprintf_literal(cmd, "STA-NEXT %s", addr);
|
||||
while (sendCommand(ctrl_conn, cmd, addr, &addrLen) == 0) {
|
||||
stations++;
|
||||
sprintf(cmd, "STA-NEXT %s", addr);
|
||||
snprintf_literal(cmd, "STA-NEXT %s", addr);
|
||||
}
|
||||
|
||||
return stations;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "prmem.h"
|
||||
#include "prnetdb.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
@ -276,11 +277,12 @@ nsHttpNegotiateAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChanne
|
|||
LOG((" Sending a token of length %d\n", outTokenLen));
|
||||
|
||||
// allocate a buffer sizeof("Negotiate" + " " + b64output_token + "\0")
|
||||
*creds = (char *) moz_xmalloc(kNegotiateLen + 1 + strlen(encoded_token) + 1);
|
||||
const int bufsize = kNegotiateLen + 1 + strlen(encoded_token) + 1;
|
||||
*creds = (char *) moz_xmalloc(bufsize);
|
||||
if (MOZ_UNLIKELY(!*creds))
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
else
|
||||
sprintf(*creds, "%s %s", kNegotiate, encoded_token);
|
||||
snprintf(*creds, bufsize, "%s %s", kNegotiate, encoded_token);
|
||||
|
||||
PR_Free(encoded_token);
|
||||
return rv;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/BinarySearch.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIUUIDGenerator.h"
|
||||
|
@ -68,9 +69,10 @@ gfxSparseBitSet::Dump(const char* aPrefix, eGfxLog aWhichLog) const
|
|||
for (b = 0; b < numBlocks; b++) {
|
||||
Block *block = mBlocks[b];
|
||||
if (!block) continue;
|
||||
char outStr[256];
|
||||
const int BUFSIZE = 256;
|
||||
char outStr[BUFSIZE];
|
||||
int index = 0;
|
||||
index += sprintf(&outStr[index], "%s u+%6.6x [", aPrefix, (b << BLOCK_INDEX_SHIFT));
|
||||
index += snprintf(&outStr[index], BUFSIZE - index, "%s u+%6.6x [", aPrefix, (b << BLOCK_INDEX_SHIFT));
|
||||
for (int i = 0; i < 32; i += 4) {
|
||||
for (int j = i; j < i + 4; j++) {
|
||||
uint8_t bits = block->mBits[j];
|
||||
|
@ -78,11 +80,11 @@ gfxSparseBitSet::Dump(const char* aPrefix, eGfxLog aWhichLog) const
|
|||
uint8_t flip2 = ((flip1 & 0xcc) >> 2) | ((flip1 & 0x33) << 2);
|
||||
uint8_t flipped = ((flip2 & 0xf0) >> 4) | ((flip2 & 0x0f) << 4);
|
||||
|
||||
index += sprintf(&outStr[index], "%2.2x", flipped);
|
||||
index += snprintf(&outStr[index], BUFSIZE - index, "%2.2x", flipped);
|
||||
}
|
||||
if (i + 4 != 32) index += sprintf(&outStr[index], " ");
|
||||
if (i + 4 != 32) index += snprintf(&outStr[index], BUFSIZE - index, " ");
|
||||
}
|
||||
index += sprintf(&outStr[index], "]");
|
||||
index += snprintf(&outStr[index], BUFSIZE - index, "]");
|
||||
LOG(aWhichLog, ("%s", outStr));
|
||||
}
|
||||
}
|
||||
|
@ -1410,7 +1412,7 @@ gfxFontUtils::DecodeFontName(const char *aNameData, int32_t aByteLen,
|
|||
char warnBuf[128];
|
||||
if (aByteLen > 64)
|
||||
aByteLen = 64;
|
||||
sprintf(warnBuf, "skipping font name, unknown charset %d:%d:%d for <%.*s>",
|
||||
snprintf_literal(warnBuf, "skipping font name, unknown charset %d:%d:%d for <%.*s>",
|
||||
aPlatformCode, aScriptCode, aLangCode, aByteLen, aNameData);
|
||||
NS_WARNING(warnBuf);
|
||||
#endif
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "gfxHarfBuzzShaper.h"
|
||||
#include "gfxFontUtils.h"
|
||||
#include "gfxTextRun.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
#include "nsUnicodeProperties.h"
|
||||
#include "nsUnicodeScriptCodes.h"
|
||||
#include "nsUnicodeNormalizer.h"
|
||||
|
@ -901,7 +902,7 @@ gfxHarfBuzzShaper::GetHKerning(uint16_t aFirstGlyph,
|
|||
#if DEBUG
|
||||
{
|
||||
char buf[1024];
|
||||
sprintf(buf, "unknown kern subtable in %s: "
|
||||
snprintf_literal(buf, "unknown kern subtable in %s: "
|
||||
"ver 0 format %d\n",
|
||||
NS_ConvertUTF16toUTF8(mFont->GetName()).get(),
|
||||
format);
|
||||
|
@ -963,7 +964,7 @@ gfxHarfBuzzShaper::GetHKerning(uint16_t aFirstGlyph,
|
|||
#if DEBUG
|
||||
{
|
||||
char buf[1024];
|
||||
sprintf(buf, "unknown kern subtable in %s: "
|
||||
snprintf_literal(buf, "unknown kern subtable in %s: "
|
||||
"ver 0 format %d\n",
|
||||
NS_ConvertUTF16toUTF8(mFont->GetName()).get(),
|
||||
format);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "gfxUserFontSet.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/PathHelpers.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsILanguageAtomService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
@ -1902,7 +1903,7 @@ gfxFontGroup::GetDefaultFont()
|
|||
char msg[256]; // CHECK buffer length if revising message below
|
||||
nsAutoString families;
|
||||
mFamilyList.ToString(families);
|
||||
sprintf(msg, "unable to find a usable font (%.220s)",
|
||||
snprintf_literal(msg, "unable to find a usable font (%.220s)",
|
||||
NS_ConvertUTF16toUTF8(families).get());
|
||||
NS_RUNTIMEABORT(msg);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* 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 "mozilla/Snprintf.h"
|
||||
#include "nsILocaleService.h"
|
||||
#include "nsDateTimeFormatCID.h"
|
||||
#include "nsIDateTimeFormat.h"
|
||||
|
@ -113,7 +114,7 @@ NS_IMETHODIMP nsScriptableDateFormat::FormatDateTime(
|
|||
// if mktime fails (e.g. year <= 1970), then try NSPR.
|
||||
PRTime prtime;
|
||||
char string[32];
|
||||
sprintf(string, "%.2d/%.2d/%d %.2d:%.2d:%.2d", month, day, year, hour, minute, second);
|
||||
snprintf_literal(string, "%.2d/%.2d/%d %.2d:%.2d:%.2d", month, day, year, hour, minute, second);
|
||||
if (PR_SUCCESS != PR_ParseTimeString(string, false, &prtime))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "nsString.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
|
||||
#define NETD_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
|
||||
#define ICS_SYS_USB_RNDIS_MAC "/sys/class/android_usb/android0/f_rndis/ethaddr"
|
||||
|
@ -67,7 +68,7 @@ InitRndisAddress()
|
|||
address[i % (kEthernetAddressLength - 1) + 1] ^= serialno[i];
|
||||
}
|
||||
|
||||
sprintf(mac, "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
snprintf_literal(mac, "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
address[0], address[1], address[2],
|
||||
address[3], address[4], address[5]);
|
||||
length = strlen(mac);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "mozilla/dom/TabChild.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/TouchEvents.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
@ -1012,14 +1013,14 @@ LogTextPerfStats(gfxTextPerfMetrics* aTextPerf,
|
|||
|
||||
switch (aLogType) {
|
||||
case eLog_reflow:
|
||||
sprintf(prefix, "(textperf-reflow) %p time-ms: %7.0f", aPresShell, aTime);
|
||||
snprintf_literal(prefix, "(textperf-reflow) %p time-ms: %7.0f", aPresShell, aTime);
|
||||
break;
|
||||
case eLog_loaddone:
|
||||
sprintf(prefix, "(textperf-loaddone) %p time-ms: %7.0f", aPresShell, aTime);
|
||||
snprintf_literal(prefix, "(textperf-loaddone) %p time-ms: %7.0f", aPresShell, aTime);
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(aLogType == eLog_totals, "unknown textperf log type");
|
||||
sprintf(prefix, "(textperf-totals) %p", aPresShell);
|
||||
snprintf_literal(prefix, "(textperf-totals) %p", aPresShell);
|
||||
}
|
||||
|
||||
double hitRatio = 0.0;
|
||||
|
@ -10374,7 +10375,7 @@ void ReflowCountMgr::Add(const char * aName, nsIFrame * aFrame)
|
|||
nullptr != mIndiFrameCounts &&
|
||||
aFrame != nullptr) {
|
||||
char key[KEY_BUF_SIZE_FOR_PTR];
|
||||
sprintf(key, "%p", (void*)aFrame);
|
||||
snprintf_literal(key, "%p", (void*)aFrame);
|
||||
IndiReflowCounter * counter = (IndiReflowCounter *)PL_HashTableLookup(mIndiFrameCounts, key);
|
||||
if (counter == nullptr) {
|
||||
counter = new IndiReflowCounter(this);
|
||||
|
@ -10402,7 +10403,7 @@ void ReflowCountMgr::PaintCount(const char* aName,
|
|||
nullptr != mIndiFrameCounts &&
|
||||
aFrame != nullptr) {
|
||||
char key[KEY_BUF_SIZE_FOR_PTR];
|
||||
sprintf(key, "%p", (void*)aFrame);
|
||||
snprintf_literal(key, "%p", (void*)aFrame);
|
||||
IndiReflowCounter * counter =
|
||||
(IndiReflowCounter *)PL_HashTableLookup(mIndiFrameCounts, key);
|
||||
if (counter != nullptr && counter->mName.EqualsASCII(aName)) {
|
||||
|
@ -10426,7 +10427,7 @@ void ReflowCountMgr::PaintCount(const char* aName,
|
|||
aPresContext->GetTextPerfMetrics(), *getter_AddRefs(fm));
|
||||
|
||||
char buf[16];
|
||||
int len = sprintf(buf, "%d", counter->mCount);
|
||||
int len = snprintf_literal(buf, "%d", counter->mCount);
|
||||
nscoord x = 0, y = fm->MaxAscent();
|
||||
nscoord width, height = fm->MaxHeight();
|
||||
fm->SetTextRunRTL(false);
|
||||
|
@ -10547,7 +10548,7 @@ static void RecurseIndiTotals(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
char key[KEY_BUF_SIZE_FOR_PTR];
|
||||
sprintf(key, "%p", (void*)aParentFrame);
|
||||
snprintf_literal(key, "%p", (void*)aParentFrame);
|
||||
IndiReflowCounter * counter = (IndiReflowCounter *)PL_HashTableLookup(aHT, key);
|
||||
if (counter) {
|
||||
counter->mHasBeenOutput = true;
|
||||
|
|
|
@ -18,10 +18,12 @@
|
|||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsGridContainerFrame.h"
|
||||
|
||||
#include "mozilla/Snprintf.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "nsBlockFrame.h"
|
||||
|
||||
static void PrettyUC(nscoord aSize, char* aBuf)
|
||||
static void PrettyUC(nscoord aSize, char* aBuf, int aBufSize)
|
||||
{
|
||||
if (NS_UNCONSTRAINEDSIZE == aSize) {
|
||||
strcpy(aBuf, "UC");
|
||||
|
@ -29,7 +31,7 @@ static void PrettyUC(nscoord aSize, char* aBuf)
|
|||
if((int32_t)0xdeadbeef == aSize) {
|
||||
strcpy(aBuf, "deadbeef");
|
||||
} else {
|
||||
sprintf(aBuf, "%d", aSize);
|
||||
snprintf(aBuf, aBufSize, "%d", aSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -370,11 +372,11 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
|
|||
|
||||
char width[16];
|
||||
char height[16];
|
||||
PrettyUC(aReflowState.AvailableWidth(), width);
|
||||
PrettyUC(aReflowState.AvailableHeight(), height);
|
||||
PrettyUC(aReflowState.AvailableWidth(), width, 16);
|
||||
PrettyUC(aReflowState.AvailableHeight(), height, 16);
|
||||
printf(" a=%s,%s ", width, height);
|
||||
PrettyUC(aReflowState.ComputedWidth(), width);
|
||||
PrettyUC(aReflowState.ComputedHeight(), height);
|
||||
PrettyUC(aReflowState.ComputedWidth(), width, 16);
|
||||
PrettyUC(aReflowState.ComputedHeight(), height, 16);
|
||||
printf("c=%s,%s \n", width, height);
|
||||
}
|
||||
AutoNoisyIndenter indent(nsBlockFrame::gNoisy);
|
||||
|
|
|
@ -11,12 +11,13 @@
|
|||
#include <stdarg.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "gfx2DGlue.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/PathHelpers.h"
|
||||
#include "gfx2DGlue.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsFrameList.h"
|
||||
|
@ -9153,7 +9154,8 @@ struct DR_State
|
|||
bool GetNumber(char* aBuf,
|
||||
int32_t& aNumber);
|
||||
void PrettyUC(nscoord aSize,
|
||||
char* aBuf);
|
||||
char* aBuf,
|
||||
int aBufSize);
|
||||
void PrintMargin(const char* tag, const nsMargin* aMargin);
|
||||
void DisplayFrameTypeInfo(nsIFrame* aFrame,
|
||||
int32_t aIndent);
|
||||
|
@ -9646,7 +9648,8 @@ DR_FrameTreeNode* DR_State::CreateTreeNode(nsIFrame* aFrame,
|
|||
}
|
||||
|
||||
void DR_State::PrettyUC(nscoord aSize,
|
||||
char* aBuf)
|
||||
char* aBuf,
|
||||
int aBufSize)
|
||||
{
|
||||
if (NS_UNCONSTRAINEDSIZE == aSize) {
|
||||
strcpy(aBuf, "UC");
|
||||
|
@ -9657,7 +9660,7 @@ void DR_State::PrettyUC(nscoord aSize,
|
|||
strcpy(aBuf, "deadbeef");
|
||||
}
|
||||
else {
|
||||
sprintf(aBuf, "%d", aSize);
|
||||
snprintf(aBuf, aBufSize, "%d", aSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9666,10 +9669,10 @@ void DR_State::PrintMargin(const char *tag, const nsMargin* aMargin)
|
|||
{
|
||||
if (aMargin) {
|
||||
char t[16], r[16], b[16], l[16];
|
||||
PrettyUC(aMargin->top, t);
|
||||
PrettyUC(aMargin->right, r);
|
||||
PrettyUC(aMargin->bottom, b);
|
||||
PrettyUC(aMargin->left, l);
|
||||
PrettyUC(aMargin->top, t, 16);
|
||||
PrettyUC(aMargin->right, r, 16);
|
||||
PrettyUC(aMargin->bottom, b, 16);
|
||||
PrettyUC(aMargin->left, l, 16);
|
||||
printf(" %s=%s,%s,%s,%s", tag, t, r, b, l);
|
||||
} else {
|
||||
// use %p here for consistency with other null-pointer printouts
|
||||
|
@ -9715,12 +9718,12 @@ static void DisplayReflowEnterPrint(nsPresContext* aPresContext,
|
|||
char width[16];
|
||||
char height[16];
|
||||
|
||||
DR_state->PrettyUC(aReflowState.AvailableWidth(), width);
|
||||
DR_state->PrettyUC(aReflowState.AvailableHeight(), height);
|
||||
DR_state->PrettyUC(aReflowState.AvailableWidth(), width, 16);
|
||||
DR_state->PrettyUC(aReflowState.AvailableHeight(), height, 16);
|
||||
printf("Reflow a=%s,%s ", width, height);
|
||||
|
||||
DR_state->PrettyUC(aReflowState.ComputedWidth(), width);
|
||||
DR_state->PrettyUC(aReflowState.ComputedHeight(), height);
|
||||
DR_state->PrettyUC(aReflowState.ComputedWidth(), width, 16);
|
||||
DR_state->PrettyUC(aReflowState.ComputedHeight(), height, 16);
|
||||
printf("c=%s,%s ", width, height);
|
||||
|
||||
if (aFrame->GetStateBits() & NS_FRAME_IS_DIRTY)
|
||||
|
@ -9842,38 +9845,38 @@ void nsFrame::DisplayReflowExit(nsPresContext* aPresContext,
|
|||
char height[16];
|
||||
char x[16];
|
||||
char y[16];
|
||||
DR_state->PrettyUC(aMetrics.Width(), width);
|
||||
DR_state->PrettyUC(aMetrics.Height(), height);
|
||||
DR_state->PrettyUC(aMetrics.Width(), width, 16);
|
||||
DR_state->PrettyUC(aMetrics.Height(), height, 16);
|
||||
printf("Reflow d=%s,%s", width, height);
|
||||
|
||||
if (!NS_FRAME_IS_FULLY_COMPLETE(aStatus)) {
|
||||
printf(" status=0x%x", aStatus);
|
||||
}
|
||||
if (aFrame->HasOverflowAreas()) {
|
||||
DR_state->PrettyUC(aMetrics.VisualOverflow().x, x);
|
||||
DR_state->PrettyUC(aMetrics.VisualOverflow().y, y);
|
||||
DR_state->PrettyUC(aMetrics.VisualOverflow().width, width);
|
||||
DR_state->PrettyUC(aMetrics.VisualOverflow().height, height);
|
||||
DR_state->PrettyUC(aMetrics.VisualOverflow().x, x, 16);
|
||||
DR_state->PrettyUC(aMetrics.VisualOverflow().y, y, 16);
|
||||
DR_state->PrettyUC(aMetrics.VisualOverflow().width, width, 16);
|
||||
DR_state->PrettyUC(aMetrics.VisualOverflow().height, height, 16);
|
||||
printf(" vis-o=(%s,%s) %s x %s", x, y, width, height);
|
||||
|
||||
nsRect storedOverflow = aFrame->GetVisualOverflowRect();
|
||||
DR_state->PrettyUC(storedOverflow.x, x);
|
||||
DR_state->PrettyUC(storedOverflow.y, y);
|
||||
DR_state->PrettyUC(storedOverflow.width, width);
|
||||
DR_state->PrettyUC(storedOverflow.height, height);
|
||||
DR_state->PrettyUC(storedOverflow.x, x, 16);
|
||||
DR_state->PrettyUC(storedOverflow.y, y, 16);
|
||||
DR_state->PrettyUC(storedOverflow.width, width, 16);
|
||||
DR_state->PrettyUC(storedOverflow.height, height, 16);
|
||||
printf(" vis-sto=(%s,%s) %s x %s", x, y, width, height);
|
||||
|
||||
DR_state->PrettyUC(aMetrics.ScrollableOverflow().x, x);
|
||||
DR_state->PrettyUC(aMetrics.ScrollableOverflow().y, y);
|
||||
DR_state->PrettyUC(aMetrics.ScrollableOverflow().width, width);
|
||||
DR_state->PrettyUC(aMetrics.ScrollableOverflow().height, height);
|
||||
DR_state->PrettyUC(aMetrics.ScrollableOverflow().x, x, 16);
|
||||
DR_state->PrettyUC(aMetrics.ScrollableOverflow().y, y, 16);
|
||||
DR_state->PrettyUC(aMetrics.ScrollableOverflow().width, width, 16);
|
||||
DR_state->PrettyUC(aMetrics.ScrollableOverflow().height, height, 16);
|
||||
printf(" scr-o=(%s,%s) %s x %s", x, y, width, height);
|
||||
|
||||
storedOverflow = aFrame->GetScrollableOverflowRect();
|
||||
DR_state->PrettyUC(storedOverflow.x, x);
|
||||
DR_state->PrettyUC(storedOverflow.y, y);
|
||||
DR_state->PrettyUC(storedOverflow.width, width);
|
||||
DR_state->PrettyUC(storedOverflow.height, height);
|
||||
DR_state->PrettyUC(storedOverflow.x, x, 16);
|
||||
DR_state->PrettyUC(storedOverflow.y, y, 16);
|
||||
DR_state->PrettyUC(storedOverflow.width, width, 16);
|
||||
DR_state->PrettyUC(storedOverflow.height, height, 16);
|
||||
printf(" scr-sto=(%s,%s) %s x %s", x, y, width, height);
|
||||
}
|
||||
printf("\n");
|
||||
|
@ -9917,7 +9920,7 @@ void nsFrame::DisplayIntrinsicISizeExit(nsIFrame* aFrame,
|
|||
if (treeNode->mDisplay) {
|
||||
DR_state->DisplayFrameTypeInfo(aFrame, treeNode->mIndent);
|
||||
char width[16];
|
||||
DR_state->PrettyUC(aResult, width);
|
||||
DR_state->PrettyUC(aResult, width, 16);
|
||||
printf("Get%sWidth=%s\n", aType, width);
|
||||
}
|
||||
DR_state->DeleteTreeNode(*treeNode);
|
||||
|
@ -9939,8 +9942,8 @@ void nsFrame::DisplayIntrinsicSizeExit(nsIFrame* aFrame,
|
|||
|
||||
char width[16];
|
||||
char height[16];
|
||||
DR_state->PrettyUC(aResult.width, width);
|
||||
DR_state->PrettyUC(aResult.height, height);
|
||||
DR_state->PrettyUC(aResult.width, width, 16);
|
||||
DR_state->PrettyUC(aResult.height, height, 16);
|
||||
printf("Get%sSize=%s,%s\n", aType, width, height);
|
||||
}
|
||||
DR_state->DeleteTreeNode(*treeNode);
|
||||
|
@ -9991,12 +9994,12 @@ nsHTMLReflowState::DisplayInitConstraintsEnter(nsIFrame* aFrame,
|
|||
char width[16];
|
||||
char height[16];
|
||||
|
||||
DR_state->PrettyUC(aContainingBlockWidth, width);
|
||||
DR_state->PrettyUC(aContainingBlockHeight, height);
|
||||
DR_state->PrettyUC(aContainingBlockWidth, width, 16);
|
||||
DR_state->PrettyUC(aContainingBlockHeight, height, 16);
|
||||
printf(" cb=%s,%s", width, height);
|
||||
|
||||
DR_state->PrettyUC(aState->AvailableWidth(), width);
|
||||
DR_state->PrettyUC(aState->AvailableHeight(), height);
|
||||
DR_state->PrettyUC(aState->AvailableWidth(), width, 16);
|
||||
DR_state->PrettyUC(aState->AvailableHeight(), height, 16);
|
||||
printf(" as=%s,%s", width, height);
|
||||
|
||||
DR_state->PrintMargin("b", aBorder);
|
||||
|
@ -10021,12 +10024,12 @@ nsHTMLReflowState::DisplayInitConstraintsExit(nsIFrame* aFrame,
|
|||
if (treeNode->mDisplay) {
|
||||
DR_state->DisplayFrameTypeInfo(aFrame, treeNode->mIndent);
|
||||
char cmiw[16], cw[16], cmxw[16], cmih[16], ch[16], cmxh[16];
|
||||
DR_state->PrettyUC(aState->ComputedMinWidth(), cmiw);
|
||||
DR_state->PrettyUC(aState->ComputedWidth(), cw);
|
||||
DR_state->PrettyUC(aState->ComputedMaxWidth(), cmxw);
|
||||
DR_state->PrettyUC(aState->ComputedMinHeight(), cmih);
|
||||
DR_state->PrettyUC(aState->ComputedHeight(), ch);
|
||||
DR_state->PrettyUC(aState->ComputedMaxHeight(), cmxh);
|
||||
DR_state->PrettyUC(aState->ComputedMinWidth(), cmiw, 16);
|
||||
DR_state->PrettyUC(aState->ComputedWidth(), cw, 16);
|
||||
DR_state->PrettyUC(aState->ComputedMaxWidth(), cmxw, 16);
|
||||
DR_state->PrettyUC(aState->ComputedMinHeight(), cmih, 16);
|
||||
DR_state->PrettyUC(aState->ComputedHeight(), ch, 16);
|
||||
DR_state->PrettyUC(aState->ComputedMaxHeight(), cmxh, 16);
|
||||
printf("InitConstraints= cw=(%s <= %s <= %s) ch=(%s <= %s <= %s)",
|
||||
cmiw, cw, cmxw, cmih, ch, cmxh);
|
||||
DR_state->PrintMargin("co", &aState->ComputedPhysicalOffsets());
|
||||
|
@ -10057,8 +10060,8 @@ nsCSSOffsetState::DisplayInitOffsetsEnter(nsIFrame* aFrame,
|
|||
|
||||
char horizPctBasisStr[16];
|
||||
char vertPctBasisStr[16];
|
||||
DR_state->PrettyUC(aHorizontalPercentBasis, horizPctBasisStr);
|
||||
DR_state->PrettyUC(aVerticalPercentBasis, vertPctBasisStr);
|
||||
DR_state->PrettyUC(aHorizontalPercentBasis, horizPctBasisStr, 16);
|
||||
DR_state->PrettyUC(aVerticalPercentBasis, vertPctBasisStr, 16);
|
||||
printf("InitOffsets pct_basis=%s,%s", horizPctBasisStr, vertPctBasisStr);
|
||||
|
||||
DR_state->PrintMargin("b", aBorder);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/AsyncEventDispatcher.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
#include "nsCORSListenerProxy.h"
|
||||
#include "nsFontFaceLoader.h"
|
||||
#include "nsIConsoleService.h"
|
||||
|
@ -1081,7 +1082,7 @@ FontFaceSet::LogMessage(gfxUserFontEntry* aUserFontEntry,
|
|||
if (weightKeywordString.Length() > 0) {
|
||||
weightKeyword = weightKeywordString.get();
|
||||
} else {
|
||||
sprintf(weightKeywordBuf, "%u", aUserFontEntry->Weight());
|
||||
snprintf_literal(weightKeywordBuf, "%u", aUserFontEntry->Weight());
|
||||
weightKeyword = weightKeywordBuf;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mozilla/Snprintf.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
@ -453,7 +455,7 @@ OAES_RET oaes_sprintf(
|
|||
|
||||
for( _i = 0; _i < data_len; _i++ )
|
||||
{
|
||||
sprintf( _temp, "%02x ", data[_i] );
|
||||
snprintf( _temp, sizeof(_temp), "%02x ", data[_i] );
|
||||
strcat( buf, _temp );
|
||||
if( _i && 0 == ( _i + 1 ) % OAES_BLOCK_SIZE )
|
||||
strcat( buf, "\n" );
|
||||
|
|
|
@ -95,6 +95,7 @@
|
|||
#include "mozilla/double-conversion.h"
|
||||
#include "mozilla/IntegerPrintfMacros.h"
|
||||
#include "mozilla/PodOperations.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Vector.h"
|
||||
|
||||
|
@ -388,7 +389,7 @@ public:
|
|||
void IntProperty(const char* aName, int64_t aInt)
|
||||
{
|
||||
char buf[64];
|
||||
sprintf(buf, "%" PRId64, aInt);
|
||||
snprintf_literal(buf, "%" PRId64, aInt);
|
||||
Scalar(aName, buf);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/* -*- 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/. */
|
||||
|
||||
/* Polyfills snprintf() on platforms that don't provide it, and provides
|
||||
* related utilities. */
|
||||
|
||||
#ifndef mozilla_Snprintf_h_
|
||||
#define mozilla_Snprintf_h_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
// Older MSVC versions do not provide snprintf(), but they do provide
|
||||
// vsnprintf(), which has the same semantics except that if the number of
|
||||
// characters written equals the buffer size, it does not write a null
|
||||
// terminator, so we wrap it to do so.
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
#include "mozilla/Attributes.h"
|
||||
MOZ_ALWAYS_INLINE int snprintf(char* buffer, size_t n, const char* format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
int result = vsnprintf(buffer, n, format, args);
|
||||
va_end(args);
|
||||
buffer[n - 1] = '\0';
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
// In addition, in C++ code, on all platforms, provide an snprintf_literal()
|
||||
// function which uses template argument deduction to deduce the size of the
|
||||
// buffer, avoiding the need for the user to pass it in explicitly.
|
||||
#ifdef __cplusplus
|
||||
template <size_t N>
|
||||
int snprintf_literal(char (&buffer)[N], const char* format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
int result = vsnprintf(buffer, N, format, args);
|
||||
va_end(args);
|
||||
buffer[N - 1] = '\0';
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* mozilla_Snprintf_h_ */
|
|
@ -70,6 +70,7 @@ EXPORTS.mozilla = [
|
|||
'SegmentedVector.h',
|
||||
'SHA1.h',
|
||||
'SizePrintfMacros.h',
|
||||
'Snprintf.h',
|
||||
'SplayTree.h',
|
||||
'TaggedAnonymousMemory.h',
|
||||
'TemplateLib.h',
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/IntegerPrintfMacros.h" // this must pick up <stdint.h>
|
||||
#include "mozilla/Snprintf.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
@ -33,11 +34,11 @@ static void
|
|||
TestPrintSigned8()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRId8, int8_t(-17));
|
||||
snprintf_literal(gOutput, "%" PRId8, int8_t(-17));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-17"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIi8, int8_t(42));
|
||||
snprintf_literal(gOutput, "%" PRIi8, int8_t(42));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "42"));
|
||||
}
|
||||
|
||||
|
@ -45,11 +46,11 @@ static void
|
|||
TestPrintSigned16()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRId16, int16_t(-289));
|
||||
snprintf_literal(gOutput, "%" PRId16, int16_t(-289));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-289"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIi16, int16_t(728));
|
||||
snprintf_literal(gOutput, "%" PRIi16, int16_t(728));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "728"));
|
||||
}
|
||||
|
||||
|
@ -57,11 +58,11 @@ static void
|
|||
TestPrintSigned32()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRId32, int32_t(-342178));
|
||||
snprintf_literal(gOutput, "%" PRId32, int32_t(-342178));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-342178"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIi32, int32_t(5719283));
|
||||
snprintf_literal(gOutput, "%" PRIi32, int32_t(5719283));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "5719283"));
|
||||
}
|
||||
|
||||
|
@ -69,11 +70,11 @@ static void
|
|||
TestPrintSigned64()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRId64, int64_t(-INT64_C(432157943248732)));
|
||||
snprintf_literal(gOutput, "%" PRId64, int64_t(-INT64_C(432157943248732)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-432157943248732"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIi64, int64_t(INT64_C(325719232983)));
|
||||
snprintf_literal(gOutput, "%" PRIi64, int64_t(INT64_C(325719232983)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "325719232983"));
|
||||
}
|
||||
|
||||
|
@ -90,11 +91,11 @@ static void
|
|||
TestPrintSignedLeast8()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIdLEAST8, int_least8_t(-17));
|
||||
snprintf_literal(gOutput, "%" PRIdLEAST8, int_least8_t(-17));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-17"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIiLEAST8, int_least8_t(42));
|
||||
snprintf_literal(gOutput, "%" PRIiLEAST8, int_least8_t(42));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "42"));
|
||||
}
|
||||
|
||||
|
@ -102,11 +103,11 @@ static void
|
|||
TestPrintSignedLeast16()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIdLEAST16, int_least16_t(-289));
|
||||
snprintf_literal(gOutput, "%" PRIdLEAST16, int_least16_t(-289));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-289"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIiLEAST16, int_least16_t(728));
|
||||
snprintf_literal(gOutput, "%" PRIiLEAST16, int_least16_t(728));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "728"));
|
||||
}
|
||||
|
||||
|
@ -114,11 +115,11 @@ static void
|
|||
TestPrintSignedLeast32()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIdLEAST32, int_least32_t(-342178));
|
||||
snprintf_literal(gOutput, "%" PRIdLEAST32, int_least32_t(-342178));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-342178"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIiLEAST32, int_least32_t(5719283));
|
||||
snprintf_literal(gOutput, "%" PRIiLEAST32, int_least32_t(5719283));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "5719283"));
|
||||
}
|
||||
|
||||
|
@ -126,11 +127,11 @@ static void
|
|||
TestPrintSignedLeast64()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIdLEAST64, int_least64_t(-INT64_C(432157943248732)));
|
||||
snprintf_literal(gOutput, "%" PRIdLEAST64, int_least64_t(-INT64_C(432157943248732)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-432157943248732"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIiLEAST64, int_least64_t(INT64_C(325719232983)));
|
||||
snprintf_literal(gOutput, "%" PRIiLEAST64, int_least64_t(INT64_C(325719232983)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "325719232983"));
|
||||
}
|
||||
|
||||
|
@ -147,11 +148,11 @@ static void
|
|||
TestPrintSignedFast8()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIdFAST8, int_fast8_t(-17));
|
||||
snprintf_literal(gOutput, "%" PRIdFAST8, int_fast8_t(-17));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-17"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIiFAST8, int_fast8_t(42));
|
||||
snprintf_literal(gOutput, "%" PRIiFAST8, int_fast8_t(42));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "42"));
|
||||
}
|
||||
|
||||
|
@ -159,11 +160,11 @@ static void
|
|||
TestPrintSignedFast16()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIdFAST16, int_fast16_t(-289));
|
||||
snprintf_literal(gOutput, "%" PRIdFAST16, int_fast16_t(-289));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-289"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIiFAST16, int_fast16_t(728));
|
||||
snprintf_literal(gOutput, "%" PRIiFAST16, int_fast16_t(728));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "728"));
|
||||
}
|
||||
|
||||
|
@ -171,11 +172,11 @@ static void
|
|||
TestPrintSignedFast32()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIdFAST32, int_fast32_t(-342178));
|
||||
snprintf_literal(gOutput, "%" PRIdFAST32, int_fast32_t(-342178));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-342178"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIiFAST32, int_fast32_t(5719283));
|
||||
snprintf_literal(gOutput, "%" PRIiFAST32, int_fast32_t(5719283));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "5719283"));
|
||||
}
|
||||
|
||||
|
@ -183,11 +184,11 @@ static void
|
|||
TestPrintSignedFast64()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIdFAST64, int_fast64_t(-INT64_C(432157943248732)));
|
||||
snprintf_literal(gOutput, "%" PRIdFAST64, int_fast64_t(-INT64_C(432157943248732)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-432157943248732"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIiFAST64, int_fast64_t(INT64_C(325719232983)));
|
||||
snprintf_literal(gOutput, "%" PRIiFAST64, int_fast64_t(INT64_C(325719232983)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "325719232983"));
|
||||
}
|
||||
|
||||
|
@ -204,11 +205,11 @@ static void
|
|||
TestPrintSignedMax()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIdMAX, intmax_t(-INTMAX_C(432157943248732)));
|
||||
snprintf_literal(gOutput, "%" PRIdMAX, intmax_t(-INTMAX_C(432157943248732)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-432157943248732"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIiMAX, intmax_t(INTMAX_C(325719232983)));
|
||||
snprintf_literal(gOutput, "%" PRIiMAX, intmax_t(INTMAX_C(325719232983)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "325719232983"));
|
||||
}
|
||||
|
||||
|
@ -216,11 +217,11 @@ static void
|
|||
TestPrintSignedPtr()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIdPTR, intptr_t(reinterpret_cast<void*>(12345678)));
|
||||
snprintf_literal(gOutput, "%" PRIdPTR, intptr_t(reinterpret_cast<void*>(12345678)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "12345678"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIiPTR, intptr_t(reinterpret_cast<void*>(87654321)));
|
||||
snprintf_literal(gOutput, "%" PRIiPTR, intptr_t(reinterpret_cast<void*>(87654321)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "87654321"));
|
||||
}
|
||||
|
||||
|
@ -249,19 +250,19 @@ static void
|
|||
TestPrintUnsigned8()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIo8, uint8_t(042));
|
||||
snprintf_literal(gOutput, "%" PRIo8, uint8_t(042));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "42"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIu8, uint8_t(17));
|
||||
snprintf_literal(gOutput, "%" PRIu8, uint8_t(17));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "17"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIx8, uint8_t(0x2a));
|
||||
snprintf_literal(gOutput, "%" PRIx8, uint8_t(0x2a));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIX8, uint8_t(0xCD));
|
||||
snprintf_literal(gOutput, "%" PRIX8, uint8_t(0xCD));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CD"));
|
||||
}
|
||||
|
||||
|
@ -269,19 +270,19 @@ static void
|
|||
TestPrintUnsigned16()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIo16, uint16_t(04242));
|
||||
snprintf_literal(gOutput, "%" PRIo16, uint16_t(04242));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "4242"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIu16, uint16_t(1717));
|
||||
snprintf_literal(gOutput, "%" PRIu16, uint16_t(1717));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "1717"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIx16, uint16_t(0x2a2a));
|
||||
snprintf_literal(gOutput, "%" PRIx16, uint16_t(0x2a2a));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIX16, uint16_t(0xCDCD));
|
||||
snprintf_literal(gOutput, "%" PRIX16, uint16_t(0xCDCD));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCD"));
|
||||
}
|
||||
|
||||
|
@ -289,19 +290,19 @@ static void
|
|||
TestPrintUnsigned32()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIo32, uint32_t(0424242));
|
||||
snprintf_literal(gOutput, "%" PRIo32, uint32_t(0424242));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "424242"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIu32, uint32_t(171717));
|
||||
snprintf_literal(gOutput, "%" PRIu32, uint32_t(171717));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "171717"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIx32, uint32_t(0x2a2a2a));
|
||||
snprintf_literal(gOutput, "%" PRIx32, uint32_t(0x2a2a2a));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a2a"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIX32, uint32_t(0xCDCDCD));
|
||||
snprintf_literal(gOutput, "%" PRIX32, uint32_t(0xCDCDCD));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCDCD"));
|
||||
}
|
||||
|
||||
|
@ -309,19 +310,19 @@ static void
|
|||
TestPrintUnsigned64()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIo64, uint64_t(UINT64_C(0424242424242)));
|
||||
snprintf_literal(gOutput, "%" PRIo64, uint64_t(UINT64_C(0424242424242)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "424242424242"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIu64, uint64_t(UINT64_C(17171717171717171717)));
|
||||
snprintf_literal(gOutput, "%" PRIu64, uint64_t(UINT64_C(17171717171717171717)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "17171717171717171717"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIx64, uint64_t(UINT64_C(0x2a2a2a2a2a2a2a)));
|
||||
snprintf_literal(gOutput, "%" PRIx64, uint64_t(UINT64_C(0x2a2a2a2a2a2a2a)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a2a2a2a2a2a"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIX64, uint64_t(UINT64_C(0xCDCDCDCDCDCD)));
|
||||
snprintf_literal(gOutput, "%" PRIX64, uint64_t(UINT64_C(0xCDCDCDCDCDCD)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCDCDCDCDCD"));
|
||||
}
|
||||
|
||||
|
@ -338,19 +339,19 @@ static void
|
|||
TestPrintUnsignedLeast8()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIoLEAST8, uint_least8_t(042));
|
||||
snprintf_literal(gOutput, "%" PRIoLEAST8, uint_least8_t(042));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "42"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIuLEAST8, uint_least8_t(17));
|
||||
snprintf_literal(gOutput, "%" PRIuLEAST8, uint_least8_t(17));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "17"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIxLEAST8, uint_least8_t(0x2a));
|
||||
snprintf_literal(gOutput, "%" PRIxLEAST8, uint_least8_t(0x2a));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIXLEAST8, uint_least8_t(0xCD));
|
||||
snprintf_literal(gOutput, "%" PRIXLEAST8, uint_least8_t(0xCD));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CD"));
|
||||
}
|
||||
|
||||
|
@ -358,19 +359,19 @@ static void
|
|||
TestPrintUnsignedLeast16()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIoLEAST16, uint_least16_t(04242));
|
||||
snprintf_literal(gOutput, "%" PRIoLEAST16, uint_least16_t(04242));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "4242"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIuLEAST16, uint_least16_t(1717));
|
||||
snprintf_literal(gOutput, "%" PRIuLEAST16, uint_least16_t(1717));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "1717"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIxLEAST16, uint_least16_t(0x2a2a));
|
||||
snprintf_literal(gOutput, "%" PRIxLEAST16, uint_least16_t(0x2a2a));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIXLEAST16, uint_least16_t(0xCDCD));
|
||||
snprintf_literal(gOutput, "%" PRIXLEAST16, uint_least16_t(0xCDCD));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCD"));
|
||||
}
|
||||
|
||||
|
@ -378,19 +379,19 @@ static void
|
|||
TestPrintUnsignedLeast32()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIoLEAST32, uint_least32_t(0424242));
|
||||
snprintf_literal(gOutput, "%" PRIoLEAST32, uint_least32_t(0424242));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "424242"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIuLEAST32, uint_least32_t(171717));
|
||||
snprintf_literal(gOutput, "%" PRIuLEAST32, uint_least32_t(171717));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "171717"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIxLEAST32, uint_least32_t(0x2a2a2a));
|
||||
snprintf_literal(gOutput, "%" PRIxLEAST32, uint_least32_t(0x2a2a2a));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a2a"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIXLEAST32, uint_least32_t(0xCDCDCD));
|
||||
snprintf_literal(gOutput, "%" PRIXLEAST32, uint_least32_t(0xCDCDCD));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCDCD"));
|
||||
}
|
||||
|
||||
|
@ -398,20 +399,20 @@ static void
|
|||
TestPrintUnsignedLeast64()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIoLEAST64, uint_least64_t(UINT64_C(0424242424242)));
|
||||
snprintf_literal(gOutput, "%" PRIoLEAST64, uint_least64_t(UINT64_C(0424242424242)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "424242424242"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIuLEAST64,
|
||||
snprintf_literal(gOutput, "%" PRIuLEAST64,
|
||||
uint_least64_t(UINT64_C(17171717171717171717)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "17171717171717171717"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIxLEAST64, uint_least64_t(UINT64_C(0x2a2a2a2a2a2a2a)));
|
||||
snprintf_literal(gOutput, "%" PRIxLEAST64, uint_least64_t(UINT64_C(0x2a2a2a2a2a2a2a)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a2a2a2a2a2a"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIXLEAST64, uint_least64_t(UINT64_C(0xCDCDCDCDCDCD)));
|
||||
snprintf_literal(gOutput, "%" PRIXLEAST64, uint_least64_t(UINT64_C(0xCDCDCDCDCDCD)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCDCDCDCDCD"));
|
||||
}
|
||||
|
||||
|
@ -428,19 +429,19 @@ static void
|
|||
TestPrintUnsignedFast8()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIoFAST8, uint_fast8_t(042));
|
||||
snprintf_literal(gOutput, "%" PRIoFAST8, uint_fast8_t(042));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "42"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIuFAST8, uint_fast8_t(17));
|
||||
snprintf_literal(gOutput, "%" PRIuFAST8, uint_fast8_t(17));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "17"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIxFAST8, uint_fast8_t(0x2a));
|
||||
snprintf_literal(gOutput, "%" PRIxFAST8, uint_fast8_t(0x2a));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIXFAST8, uint_fast8_t(0xCD));
|
||||
snprintf_literal(gOutput, "%" PRIXFAST8, uint_fast8_t(0xCD));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CD"));
|
||||
}
|
||||
|
||||
|
@ -448,19 +449,19 @@ static void
|
|||
TestPrintUnsignedFast16()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIoFAST16, uint_fast16_t(04242));
|
||||
snprintf_literal(gOutput, "%" PRIoFAST16, uint_fast16_t(04242));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "4242"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIuFAST16, uint_fast16_t(1717));
|
||||
snprintf_literal(gOutput, "%" PRIuFAST16, uint_fast16_t(1717));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "1717"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIxFAST16, uint_fast16_t(0x2a2a));
|
||||
snprintf_literal(gOutput, "%" PRIxFAST16, uint_fast16_t(0x2a2a));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIXFAST16, uint_fast16_t(0xCDCD));
|
||||
snprintf_literal(gOutput, "%" PRIXFAST16, uint_fast16_t(0xCDCD));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCD"));
|
||||
}
|
||||
|
||||
|
@ -468,19 +469,19 @@ static void
|
|||
TestPrintUnsignedFast32()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIoFAST32, uint_fast32_t(0424242));
|
||||
snprintf_literal(gOutput, "%" PRIoFAST32, uint_fast32_t(0424242));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "424242"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIuFAST32, uint_fast32_t(171717));
|
||||
snprintf_literal(gOutput, "%" PRIuFAST32, uint_fast32_t(171717));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "171717"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIxFAST32, uint_fast32_t(0x2a2a2a));
|
||||
snprintf_literal(gOutput, "%" PRIxFAST32, uint_fast32_t(0x2a2a2a));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a2a"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIXFAST32, uint_fast32_t(0xCDCDCD));
|
||||
snprintf_literal(gOutput, "%" PRIXFAST32, uint_fast32_t(0xCDCDCD));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCDCD"));
|
||||
}
|
||||
|
||||
|
@ -488,20 +489,20 @@ static void
|
|||
TestPrintUnsignedFast64()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIoFAST64, uint_fast64_t(UINT64_C(0424242424242)));
|
||||
snprintf_literal(gOutput, "%" PRIoFAST64, uint_fast64_t(UINT64_C(0424242424242)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "424242424242"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIuFAST64,
|
||||
snprintf_literal(gOutput, "%" PRIuFAST64,
|
||||
uint_fast64_t(UINT64_C(17171717171717171717)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "17171717171717171717"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIxFAST64, uint_fast64_t(UINT64_C(0x2a2a2a2a2a2a2a)));
|
||||
snprintf_literal(gOutput, "%" PRIxFAST64, uint_fast64_t(UINT64_C(0x2a2a2a2a2a2a2a)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a2a2a2a2a2a"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIXFAST64, uint_fast64_t(UINT64_C(0xCDCDCDCDCDCD)));
|
||||
snprintf_literal(gOutput, "%" PRIXFAST64, uint_fast64_t(UINT64_C(0xCDCDCDCDCDCD)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCDCDCDCDCD"));
|
||||
}
|
||||
|
||||
|
@ -518,19 +519,19 @@ static void
|
|||
TestPrintUnsignedMax()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIoMAX, uintmax_t(UINTMAX_C(432157943248732)));
|
||||
snprintf_literal(gOutput, "%" PRIoMAX, uintmax_t(UINTMAX_C(432157943248732)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "14220563454333534"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIuMAX, uintmax_t(UINTMAX_C(325719232983)));
|
||||
snprintf_literal(gOutput, "%" PRIuMAX, uintmax_t(UINTMAX_C(325719232983)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "325719232983"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIxMAX, uintmax_t(UINTMAX_C(327281321873)));
|
||||
snprintf_literal(gOutput, "%" PRIxMAX, uintmax_t(UINTMAX_C(327281321873)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "4c337ca791"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIXMAX, uintmax_t(UINTMAX_C(912389523743523)));
|
||||
snprintf_literal(gOutput, "%" PRIXMAX, uintmax_t(UINTMAX_C(912389523743523)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "33DD03D75A323"));
|
||||
}
|
||||
|
||||
|
@ -538,19 +539,19 @@ static void
|
|||
TestPrintUnsignedPtr()
|
||||
{
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIoPTR, uintptr_t(reinterpret_cast<void*>(12345678)));
|
||||
snprintf_literal(gOutput, "%" PRIoPTR, uintptr_t(reinterpret_cast<void*>(12345678)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "57060516"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIuPTR, uintptr_t(reinterpret_cast<void*>(87654321)));
|
||||
snprintf_literal(gOutput, "%" PRIuPTR, uintptr_t(reinterpret_cast<void*>(87654321)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "87654321"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIxPTR, uintptr_t(reinterpret_cast<void*>(0x4c3a791)));
|
||||
snprintf_literal(gOutput, "%" PRIxPTR, uintptr_t(reinterpret_cast<void*>(0x4c3a791)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "4c3a791"));
|
||||
|
||||
PoisonOutput();
|
||||
sprintf(gOutput, "%" PRIXPTR, uintptr_t(reinterpret_cast<void*>(0xF328DB)));
|
||||
snprintf_literal(gOutput, "%" PRIXPTR, uintptr_t(reinterpret_cast<void*>(0xF328DB)));
|
||||
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "F328DB"));
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "nsSerializationHelper.h"
|
||||
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
#include <algorithm>
|
||||
|
@ -1140,7 +1141,7 @@ nsDiskCacheMap::GetFileForDiskCacheRecord(nsDiskCacheRecord * record,
|
|||
int16_t generation = record->Generation();
|
||||
char name[32];
|
||||
// Cut the beginning of the hash that was used in the path
|
||||
::sprintf(name, "%05X%c%02X", hash & 0xFFFFF, (meta ? 'm' : 'd'),
|
||||
::snprintf_literal(name, "%05X%c%02X", hash & 0xFFFFF, (meta ? 'm' : 'd'),
|
||||
generation);
|
||||
rv = file->AppendNative(nsDependentCString(name));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -1178,7 +1179,7 @@ nsDiskCacheMap::GetBlockFileForIndex(uint32_t index, nsIFile ** result)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
char name[32];
|
||||
::sprintf(name, "_CACHE_%03d_", index + 1);
|
||||
::snprintf_literal(name, "_CACHE_%03d_", index + 1);
|
||||
rv = file->AppendNative(nsDependentCString(name));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include "ASessionDescription.h"
|
||||
|
||||
#include "mozilla/Snprintf.h"
|
||||
|
||||
#include <media/stagefright/foundation/ADebug.h>
|
||||
#include <media/stagefright/foundation/AString.h>
|
||||
|
||||
|
@ -214,7 +216,7 @@ bool ASessionDescription::getFormatType(
|
|||
*PT = x;
|
||||
|
||||
char key[20];
|
||||
sprintf(key, "a=rtpmap:%lu", x);
|
||||
snprintf_literal(key, "a=rtpmap:%lu", x);
|
||||
|
||||
if (!findAttribute(index, key, desc)) {
|
||||
// We only support dynamic payload type assignment for now.
|
||||
|
@ -223,7 +225,7 @@ bool ASessionDescription::getFormatType(
|
|||
return false;
|
||||
}
|
||||
|
||||
sprintf(key, "a=fmtp:%lu", x);
|
||||
snprintf_literal(key, "a=fmtp:%lu", x);
|
||||
if (!findAttribute(index, key, params)) {
|
||||
params->clear();
|
||||
}
|
||||
|
@ -238,7 +240,7 @@ bool ASessionDescription::getDimensions(
|
|||
*height = 0;
|
||||
|
||||
char key[20];
|
||||
sprintf(key, "a=framesize:%lu", PT);
|
||||
snprintf_literal(key, "a=framesize:%lu", PT);
|
||||
AString value;
|
||||
if (!findAttribute(index, key, &value)) {
|
||||
return false;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "TestCommon.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsIPersistentProperties2.h"
|
||||
|
@ -76,7 +77,7 @@ main(int argc, char* argv[])
|
|||
while (1) {
|
||||
char name[16];
|
||||
name[0] = 0;
|
||||
sprintf(name, "%d", i);
|
||||
snprintf_literal(name, "%d", i);
|
||||
nsAutoString v;
|
||||
ret = props->GetStringProperty(nsDependentCString(name), v);
|
||||
if (NS_FAILED(ret) || (!v.Length())) {
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "ssl.h"
|
||||
#include "sslproto.h"
|
||||
#include "plhash.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::psm;
|
||||
|
@ -514,7 +515,7 @@ bool AdjustWebSocketHost(relayBuffer& buffer, connection_info_t *ci)
|
|||
char newhost[40];
|
||||
PR_NetAddrToString(&inet_addr, newhost, sizeof(newhost));
|
||||
assert(strlen(newhost) < sizeof(newhost) - 7);
|
||||
sprintf(newhost, "%s:%d", newhost, PR_ntohs(inet_addr.inet.port));
|
||||
snprintf_literal(newhost, "%s:%d", newhost, PR_ntohs(inet_addr.inet.port));
|
||||
|
||||
int diff = strlen(newhost) - (endhost-host);
|
||||
if (diff > 0)
|
||||
|
@ -784,7 +785,8 @@ void HandleConnection(void* data)
|
|||
LOG_DEBUG((" accepted CONNECT request with redirection, "
|
||||
"sending location and 302 to the client\n"));
|
||||
client_done = true;
|
||||
sprintf(buffers[s2].buffer,
|
||||
snprintf(buffers[s2].buffer,
|
||||
buffers[s2].bufferend - buffers[s2].buffer,
|
||||
"HTTP/1.1 302 Moved\r\n"
|
||||
"Location: https://%s/\r\n"
|
||||
"Connection: close\r\n\r\n",
|
||||
|
@ -794,7 +796,9 @@ void HandleConnection(void* data)
|
|||
{
|
||||
LOG_ERRORD((" could not read the connect request, closing connection with %d", response));
|
||||
client_done = true;
|
||||
sprintf(buffers[s2].buffer, "HTTP/1.1 %d ERROR\r\nConnection: close\r\n\r\n", response);
|
||||
snprintf(buffers[s2].buffer,
|
||||
buffers[s2].bufferend - buffers[s2].buffer,
|
||||
"HTTP/1.1 %d ERROR\r\nConnection: close\r\n\r\n", response);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "mozilla/Services.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
#include "mozilla/SyncRunnable.h"
|
||||
|
||||
#include "nsThreadUtils.h"
|
||||
|
@ -1437,7 +1438,7 @@ InitInstallTime(nsACString& aInstallTime)
|
|||
{
|
||||
time_t t = time(nullptr);
|
||||
char buf[16];
|
||||
sprintf(buf, "%ld", t);
|
||||
snprintf_literal(buf, "%ld", t);
|
||||
aInstallTime = buf;
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "nsReadableUtils.h"
|
||||
#include "nsNativeCharsetUtils.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -969,13 +970,15 @@ nsToolkitProfileService::Flush()
|
|||
++pCount;
|
||||
|
||||
uint32_t length;
|
||||
nsAutoArrayPtr<char> buffer (new char[100+MAXPATHLEN*pCount]);
|
||||
const int bufsize = 100+MAXPATHLEN*pCount;
|
||||
nsAutoArrayPtr<char> buffer (new char[bufsize]);
|
||||
|
||||
NS_ENSURE_TRUE(buffer, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
char *end = buffer;
|
||||
char *pos = buffer;
|
||||
char *end = buffer + bufsize;
|
||||
|
||||
end += sprintf(end,
|
||||
pos += snprintf(pos, end - pos,
|
||||
"[General]\n"
|
||||
"StartWithLastProfile=%s\n\n",
|
||||
mStartWithLast ? "1" : "0");
|
||||
|
@ -997,7 +1000,7 @@ nsToolkitProfileService::Flush()
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
end += sprintf(end,
|
||||
pos += snprintf(pos, end - pos,
|
||||
"[Profile%u]\n"
|
||||
"Name=%s\n"
|
||||
"IsRelative=%s\n"
|
||||
|
@ -1008,10 +1011,10 @@ nsToolkitProfileService::Flush()
|
|||
nsCOMPtr<nsIToolkitProfile> profile;
|
||||
rv = this->GetDefaultProfile(getter_AddRefs(profile));
|
||||
if (NS_SUCCEEDED(rv) && profile == cur) {
|
||||
end += sprintf(end, "Default=1\n");
|
||||
pos += snprintf(pos, end - pos, "Default=1\n");
|
||||
}
|
||||
|
||||
end += sprintf(end, "\n");
|
||||
pos += snprintf(pos, end - pos, "\n");
|
||||
|
||||
cur = cur->mNext;
|
||||
++pCount;
|
||||
|
@ -1022,7 +1025,7 @@ nsToolkitProfileService::Flush()
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (buffer) {
|
||||
length = end - buffer;
|
||||
length = pos - buffer;
|
||||
|
||||
if (fwrite(buffer, sizeof(char), length, writeFile) != length) {
|
||||
fclose(writeFile);
|
||||
|
|
|
@ -51,10 +51,12 @@
|
|||
#include <string>
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
|
||||
#include "LulCommonExt.h"
|
||||
#include "LulDwarfInt.h"
|
||||
|
||||
|
||||
// Set this to 1 for verbose logging
|
||||
#define DEBUG_DWARF 0
|
||||
|
||||
|
@ -1663,7 +1665,7 @@ bool CallFrameInfo::ReportIncomplete(Entry *entry) {
|
|||
void CallFrameInfo::Reporter::Incomplete(uint64 offset,
|
||||
CallFrameInfo::EntryKind kind) {
|
||||
char buf[300];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"%s: CFI %s at offset 0x%llx in '%s': entry ends early\n",
|
||||
filename_.c_str(), CallFrameInfo::KindName(kind), offset,
|
||||
section_.c_str());
|
||||
|
@ -1672,7 +1674,7 @@ void CallFrameInfo::Reporter::Incomplete(uint64 offset,
|
|||
|
||||
void CallFrameInfo::Reporter::EarlyEHTerminator(uint64 offset) {
|
||||
char buf[300];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"%s: CFI at offset 0x%llx in '%s': saw end-of-data marker"
|
||||
" before end of section contents\n",
|
||||
filename_.c_str(), offset, section_.c_str());
|
||||
|
@ -1682,7 +1684,7 @@ void CallFrameInfo::Reporter::EarlyEHTerminator(uint64 offset) {
|
|||
void CallFrameInfo::Reporter::CIEPointerOutOfRange(uint64 offset,
|
||||
uint64 cie_offset) {
|
||||
char buf[300];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"%s: CFI frame description entry at offset 0x%llx in '%s':"
|
||||
" CIE pointer is out of range: 0x%llx\n",
|
||||
filename_.c_str(), offset, section_.c_str(), cie_offset);
|
||||
|
@ -1691,7 +1693,7 @@ void CallFrameInfo::Reporter::CIEPointerOutOfRange(uint64 offset,
|
|||
|
||||
void CallFrameInfo::Reporter::BadCIEId(uint64 offset, uint64 cie_offset) {
|
||||
char buf[300];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"%s: CFI frame description entry at offset 0x%llx in '%s':"
|
||||
" CIE pointer does not point to a CIE: 0x%llx\n",
|
||||
filename_.c_str(), offset, section_.c_str(), cie_offset);
|
||||
|
@ -1700,7 +1702,7 @@ void CallFrameInfo::Reporter::BadCIEId(uint64 offset, uint64 cie_offset) {
|
|||
|
||||
void CallFrameInfo::Reporter::UnrecognizedVersion(uint64 offset, int version) {
|
||||
char buf[300];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"%s: CFI frame description entry at offset 0x%llx in '%s':"
|
||||
" CIE specifies unrecognized version: %d\n",
|
||||
filename_.c_str(), offset, section_.c_str(), version);
|
||||
|
@ -1710,7 +1712,7 @@ void CallFrameInfo::Reporter::UnrecognizedVersion(uint64 offset, int version) {
|
|||
void CallFrameInfo::Reporter::UnrecognizedAugmentation(uint64 offset,
|
||||
const string &aug) {
|
||||
char buf[300];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"%s: CFI frame description entry at offset 0x%llx in '%s':"
|
||||
" CIE specifies unrecognized augmentation: '%s'\n",
|
||||
filename_.c_str(), offset, section_.c_str(), aug.c_str());
|
||||
|
@ -1720,7 +1722,7 @@ void CallFrameInfo::Reporter::UnrecognizedAugmentation(uint64 offset,
|
|||
void CallFrameInfo::Reporter::InvalidPointerEncoding(uint64 offset,
|
||||
uint8 encoding) {
|
||||
char buf[300];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"%s: CFI common information entry at offset 0x%llx in '%s':"
|
||||
" 'z' augmentation specifies invalid pointer encoding: 0x%02x\n",
|
||||
filename_.c_str(), offset, section_.c_str(), encoding);
|
||||
|
@ -1730,7 +1732,7 @@ void CallFrameInfo::Reporter::InvalidPointerEncoding(uint64 offset,
|
|||
void CallFrameInfo::Reporter::UnusablePointerEncoding(uint64 offset,
|
||||
uint8 encoding) {
|
||||
char buf[300];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"%s: CFI common information entry at offset 0x%llx in '%s':"
|
||||
" 'z' augmentation specifies a pointer encoding for which"
|
||||
" we have no base address: 0x%02x\n",
|
||||
|
@ -1740,7 +1742,7 @@ void CallFrameInfo::Reporter::UnusablePointerEncoding(uint64 offset,
|
|||
|
||||
void CallFrameInfo::Reporter::RestoreInCIE(uint64 offset, uint64 insn_offset) {
|
||||
char buf[300];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"%s: CFI common information entry at offset 0x%llx in '%s':"
|
||||
" the DW_CFA_restore instruction at offset 0x%llx"
|
||||
" cannot be used in a common information entry\n",
|
||||
|
@ -1752,7 +1754,7 @@ void CallFrameInfo::Reporter::BadInstruction(uint64 offset,
|
|||
CallFrameInfo::EntryKind kind,
|
||||
uint64 insn_offset) {
|
||||
char buf[300];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"%s: CFI %s at offset 0x%llx in section '%s':"
|
||||
" the instruction at offset 0x%llx is unrecognized\n",
|
||||
filename_.c_str(), CallFrameInfo::KindName(kind),
|
||||
|
@ -1764,7 +1766,7 @@ void CallFrameInfo::Reporter::NoCFARule(uint64 offset,
|
|||
CallFrameInfo::EntryKind kind,
|
||||
uint64 insn_offset) {
|
||||
char buf[300];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"%s: CFI %s at offset 0x%llx in section '%s':"
|
||||
" the instruction at offset 0x%llx assumes that a CFA rule has"
|
||||
" been set, but none has been set\n",
|
||||
|
@ -1777,7 +1779,7 @@ void CallFrameInfo::Reporter::EmptyStateStack(uint64 offset,
|
|||
CallFrameInfo::EntryKind kind,
|
||||
uint64 insn_offset) {
|
||||
char buf[300];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"%s: CFI %s at offset 0x%llx in section '%s':"
|
||||
" the DW_CFA_restore_state instruction at offset 0x%llx"
|
||||
" should pop a saved state from the stack, but the stack is empty\n",
|
||||
|
@ -1790,7 +1792,7 @@ void CallFrameInfo::Reporter::ClearingCFARule(uint64 offset,
|
|||
CallFrameInfo::EntryKind kind,
|
||||
uint64 insn_offset) {
|
||||
char buf[300];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"%s: CFI %s at offset 0x%llx in section '%s':"
|
||||
" the DW_CFA_restore_state instruction at offset 0x%llx"
|
||||
" would clear the CFA rule in effect\n",
|
||||
|
@ -1890,7 +1892,7 @@ const UniqueString* DwarfCFIToModule::RegisterName(int i) {
|
|||
return usu_->ToUniqueString(".ra");
|
||||
|
||||
char buf[30];
|
||||
sprintf(buf, "dwarf_reg_%u", reg);
|
||||
snprintf_literal(buf, "dwarf_reg_%u", reg);
|
||||
return usu_->ToUniqueString(buf);
|
||||
}
|
||||
|
||||
|
@ -1963,7 +1965,7 @@ void DwarfCFIToModule::Reporter::UndefinedNotSupported(
|
|||
size_t offset,
|
||||
const UniqueString* reg) {
|
||||
char buf[300];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"DwarfCFIToModule::Reporter::UndefinedNotSupported()\n");
|
||||
log_(buf);
|
||||
//BPLOG(INFO) << file_ << ", section '" << section_
|
||||
|
@ -1993,7 +1995,7 @@ void DwarfCFIToModule::Reporter::ExpressionsNotSupported(
|
|||
if (!is_power_of_2(n_complaints))
|
||||
return;
|
||||
char buf[300];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"DwarfCFIToModule::Reporter::"
|
||||
"ExpressionsNotSupported(shown %llu times)\n",
|
||||
(unsigned long long int)n_complaints);
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/MemoryChecking.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/MemoryChecking.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
|
||||
#include "LulCommonExt.h"
|
||||
#include "LulElfExt.h"
|
||||
|
@ -84,11 +85,11 @@ ShowRule(const char* aNewReg, LExpr aExpr)
|
|||
res += "Unknown";
|
||||
break;
|
||||
case LExpr::NODEREF:
|
||||
sprintf(buf, "%s+%d", NameOf_DW_REG(aExpr.mReg), (int)aExpr.mOffset);
|
||||
snprintf_literal(buf, "%s+%d", NameOf_DW_REG(aExpr.mReg), (int)aExpr.mOffset);
|
||||
res += buf;
|
||||
break;
|
||||
case LExpr::DEREF:
|
||||
sprintf(buf, "*(%s+%d)", NameOf_DW_REG(aExpr.mReg), (int)aExpr.mOffset);
|
||||
snprintf_literal(buf, "*(%s+%d)", NameOf_DW_REG(aExpr.mReg), (int)aExpr.mOffset);
|
||||
res += buf;
|
||||
break;
|
||||
default:
|
||||
|
@ -102,7 +103,7 @@ void
|
|||
RuleSet::Print(void(*aLog)(const char*))
|
||||
{
|
||||
char buf[96];
|
||||
sprintf(buf, "[%llx .. %llx]: let ",
|
||||
snprintf_literal(buf, "[%llx .. %llx]: let ",
|
||||
(unsigned long long int)mAddr,
|
||||
(unsigned long long int)(mAddr + mLen - 1));
|
||||
string res = string(buf);
|
||||
|
@ -329,7 +330,7 @@ SecMap::PrepareRuleSets(uintptr_t aStart, size_t aLen)
|
|||
mSummaryMaxAddr = mRuleSets[n-1].mAddr + mRuleSets[n-1].mLen - 1;
|
||||
}
|
||||
char buf[150];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"PrepareRuleSets: %d entries, smin/smax 0x%llx, 0x%llx\n",
|
||||
(int)n, (unsigned long long int)mSummaryMinAddr,
|
||||
(unsigned long long int)mSummaryMaxAddr);
|
||||
|
@ -533,7 +534,7 @@ class PriMap {
|
|||
mSecMaps.insert(iter, aSecMap);
|
||||
}
|
||||
char buf[100];
|
||||
snprintf(buf, sizeof(buf), "AddSecMap: now have %d SecMaps\n",
|
||||
snprintf_literal(buf, "AddSecMap: now have %d SecMaps\n",
|
||||
(int)mSecMaps.size());
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
mLog(buf);
|
||||
|
@ -806,7 +807,7 @@ class PriMap {
|
|||
#define LUL_LOG(_str) \
|
||||
do { \
|
||||
char buf[200]; \
|
||||
snprintf(buf, sizeof(buf), \
|
||||
snprintf_literal(buf, \
|
||||
"LUL: pid %d tid %d lul-obj %p: %s", \
|
||||
getpid(), gettid(), this, (_str)); \
|
||||
buf[sizeof(buf)-1] = 0; \
|
||||
|
@ -850,7 +851,7 @@ LUL::MaybeShowStats()
|
|||
uint32_t n_new_Scanned = mStats.mScanned - mStatsPrevious.mScanned;
|
||||
mStatsPrevious = mStats;
|
||||
char buf[200];
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"LUL frame stats: TOTAL %5u"
|
||||
" CTX %4u CFI %4u SCAN %4u",
|
||||
n_new, n_new_Context, n_new_CFI, n_new_Scanned);
|
||||
|
@ -881,7 +882,7 @@ LUL::NotifyAfterMap(uintptr_t aRXavma, size_t aSize,
|
|||
|
||||
mLog(":\n");
|
||||
char buf[200];
|
||||
snprintf(buf, sizeof(buf), "NotifyMap %llx %llu %s\n",
|
||||
snprintf_literal(buf, "NotifyMap %llx %llu %s\n",
|
||||
(unsigned long long int)aRXavma, (unsigned long long int)aSize,
|
||||
aFileName);
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
|
@ -909,7 +910,7 @@ LUL::NotifyAfterMap(uintptr_t aRXavma, size_t aSize,
|
|||
|
||||
smap->PrepareRuleSets(aRXavma, aSize);
|
||||
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"NotifyMap got %lld entries\n", (long long int)smap->Size());
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
mLog(buf);
|
||||
|
@ -932,7 +933,7 @@ LUL::NotifyExecutableArea(uintptr_t aRXavma, size_t aSize)
|
|||
|
||||
mLog(":\n");
|
||||
char buf[200];
|
||||
snprintf(buf, sizeof(buf), "NotifyExecutableArea %llx %llu\n",
|
||||
snprintf_literal(buf, "NotifyExecutableArea %llx %llu\n",
|
||||
(unsigned long long int)aRXavma, (unsigned long long int)aSize);
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
mLog(buf);
|
||||
|
@ -954,7 +955,7 @@ LUL::NotifyBeforeUnmap(uintptr_t aRXavmaMin, uintptr_t aRXavmaMax)
|
|||
|
||||
mLog(":\n");
|
||||
char buf[100];
|
||||
snprintf(buf, sizeof(buf), "NotifyUnmap %016llx-%016llx\n",
|
||||
snprintf_literal(buf, "NotifyUnmap %016llx-%016llx\n",
|
||||
(unsigned long long int)aRXavmaMin,
|
||||
(unsigned long long int)aRXavmaMax);
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
|
@ -970,7 +971,7 @@ LUL::NotifyBeforeUnmap(uintptr_t aRXavmaMin, uintptr_t aRXavmaMax)
|
|||
// contains valid code.
|
||||
mSegArray->add(aRXavmaMin, aRXavmaMax, false);
|
||||
|
||||
snprintf(buf, sizeof(buf), "NotifyUnmap: now have %d SecMaps\n",
|
||||
snprintf_literal(buf, "NotifyUnmap: now have %d SecMaps\n",
|
||||
(int)mPriMap->CountSecMaps());
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
mLog(buf);
|
||||
|
@ -1143,7 +1144,7 @@ LUL::Unwind(/*OUT*/uintptr_t* aFramePCs,
|
|||
char buf[300];
|
||||
mLog("\n");
|
||||
#if defined(LUL_ARCH_x64) || defined(LUL_ARCH_x86)
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"LoopTop: rip %d/%llx rsp %d/%llx rbp %d/%llx\n",
|
||||
(int)regs.xip.Valid(), (unsigned long long int)regs.xip.Value(),
|
||||
(int)regs.xsp.Valid(), (unsigned long long int)regs.xsp.Value(),
|
||||
|
@ -1151,7 +1152,7 @@ LUL::Unwind(/*OUT*/uintptr_t* aFramePCs,
|
|||
buf[sizeof(buf)-1] = 0;
|
||||
mLog(buf);
|
||||
#elif defined(LUL_ARCH_arm)
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"LoopTop: r15 %d/%llx r7 %d/%llx r11 %d/%llx"
|
||||
" r12 %d/%llx r13 %d/%llx r14 %d/%llx\n",
|
||||
(int)regs.r15.Valid(), (unsigned long long int)regs.r15.Value(),
|
||||
|
@ -1224,7 +1225,7 @@ LUL::Unwind(/*OUT*/uintptr_t* aFramePCs,
|
|||
RuleSet* ruleset = mPriMap->Lookup(ia.Value());
|
||||
if (DEBUG_MAIN) {
|
||||
char buf[100];
|
||||
snprintf(buf, sizeof(buf), "ruleset for 0x%llx = %p\n",
|
||||
snprintf_literal(buf, "ruleset for 0x%llx = %p\n",
|
||||
(unsigned long long int)ia.Value(), ruleset);
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
mLog(buf);
|
||||
|
@ -1624,10 +1625,10 @@ bool GetAndCheckStackTrace(LUL* aLUL, const char* dstring)
|
|||
|
||||
// Show the results.
|
||||
char buf[200];
|
||||
snprintf(buf, sizeof(buf), "LULUnitTest: dstring = %s\n", dstring);
|
||||
snprintf_literal(buf, "LULUnitTest: dstring = %s\n", dstring);
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
aLUL->mLog(buf);
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf_literal(buf,
|
||||
"LULUnitTest: %d consistent, %d in dstring: %s\n",
|
||||
(int)nConsistent, (int)strlen(dstring),
|
||||
passed ? "PASS" : "FAIL");
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "mozilla/layers/InputAPZContext.h"
|
||||
#include "mozilla/layers/APZCCallbackHelper.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "TouchEvents.h"
|
||||
#include "WritingModes.h"
|
||||
|
@ -77,6 +78,7 @@ static int32_t gNumWidgets;
|
|||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
static nsRefPtrHashtable<nsVoidPtrHashKey, nsIWidget>* sPluginWidgetList;
|
||||
#endif
|
||||
|
||||
nsIRollupListener* nsBaseWidget::gRollupListener = nullptr;
|
||||
|
||||
using namespace mozilla::layers;
|
||||
|
@ -1970,7 +1972,7 @@ case _value: eventName.AssignLiteral(_name) ; break
|
|||
{
|
||||
char buf[32];
|
||||
|
||||
sprintf(buf,"UNKNOWN: %d",aGuiEvent->message);
|
||||
snprintf_literal(buf,"UNKNOWN: %d",aGuiEvent->message);
|
||||
|
||||
CopyASCIItoUTF16(buf, eventName);
|
||||
}
|
||||
|
|
|
@ -15,10 +15,6 @@
|
|||
|
||||
#include "nsStackWalk.h"
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
// This class is used to print details about code locations.
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#define KP_START_USEC p_ustart_usec
|
||||
#endif
|
||||
|
||||
#include "mozilla/Snprintf.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsCRT.h"
|
||||
#include "prprf.h"
|
||||
|
@ -271,7 +272,7 @@ ComputeProcessUptimeThread(void* aTime)
|
|||
}
|
||||
|
||||
char threadStat[40];
|
||||
sprintf(threadStat, "/proc/self/task/%d/stat", (pid_t)syscall(__NR_gettid));
|
||||
snprintf_literal(threadStat, "/proc/self/task/%d/stat", (pid_t)syscall(__NR_gettid));
|
||||
|
||||
uint64_t threadJiffies = JiffiesSinceBoot(threadStat);
|
||||
uint64_t selfJiffies = JiffiesSinceBoot("/proc/self/stat");
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "mozilla/Snprintf.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include <io.h>
|
||||
#include <windows.h>
|
||||
|
@ -312,8 +314,9 @@ copy_stderr_to_file(const char* aFile)
|
|||
if (sStderrCopy) {
|
||||
return;
|
||||
}
|
||||
char* buf = (char*)malloc(strlen(aFile) + 16);
|
||||
sprintf(buf, "%s.%u", aFile, (uint32_t)getpid());
|
||||
size_t buflen = strlen(aFile) + 16;
|
||||
char* buf = (char*)malloc(buflen);
|
||||
snprintf(buf, buflen, "%s.%u", aFile, (uint32_t)getpid());
|
||||
sStderrCopy = fopen(buf, "w");
|
||||
free(buf);
|
||||
set_stderr_callback(stderr_to_file);
|
||||
|
|
Загрузка…
Ссылка в новой задаче