Back out 3 changesets (bug 1119980) for emulator-l bustage

CLOSED TREE

Backed out changeset 12ce98475c6e (bug 1119980)
Backed out changeset bdb8d05f8870 (bug 1119980)
Backed out changeset a68a18840492 (bug 1119980)
This commit is contained in:
Phil Ringnalda 2015-05-25 18:48:51 -07:00
Родитель cf6fc1cfe2
Коммит 49dd872168
35 изменённых файлов: 333 добавлений и 416 удалений

Просмотреть файл

@ -60,8 +60,11 @@ MOZ_B2G=1
if test "$OS_TARGET" = "Android"; then
MOZ_NUWA_PROCESS=1
MOZ_B2G_LOADER=1
# Warnings-as-errors cannot be enabled on Lollipop until bug 1119980 is fixed.
if test "$PLATFORM_SDK_VERSION" -lt 21; then
MOZ_ENABLE_WARNINGS_AS_ERRORS=1
fi
fi
MOZ_JSDOWNLOADS=1

Просмотреть файл

@ -4,7 +4,6 @@
* 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>
@ -127,7 +126,7 @@ CrashReporterParent::GenerateChildData(const AnnotationTable* processNotes)
mNotes.Put(NS_LITERAL_CSTRING("ProcessType"), type);
char startTime[32];
snprintf_literal(startTime, "%lld", static_cast<long long>(mStartTime));
sprintf(startTime, "%lld", static_cast<long long>(mStartTime));
mNotes.Put(NS_LITERAL_CSTRING("StartupTime"), nsDependentCString(startTime));
if (!mAppNotes.IsEmpty())

Просмотреть файл

@ -12,7 +12,6 @@
#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"
@ -265,7 +264,7 @@ OpenDumpFile(AudioStream* aStream)
if (!getenv("MOZ_DUMP_AUDIO"))
return nullptr;
char buf[100];
snprintf_literal(buf, "dumped-audio-%d.wav", gDumpedAudioCount);
sprintf(buf, "dumped-audio-%d.wav", gDumpedAudioCount);
FILE* f = fopen(buf, "wb");
if (!f)
return nullptr;

Просмотреть файл

@ -14,7 +14,6 @@
#include "prinit.h"
#include "mozilla/Assertions.h"
#include "mozilla/Snprintf.h"
#include "nsDebug.h"
#include "nsPrintfCString.h"
@ -178,10 +177,10 @@ int32_t WifiHotspotUtils::do_wifi_hostapd_get_stations()
}
stations++;
snprintf_literal(cmd, "STA-NEXT %s", addr);
sprintf(cmd, "STA-NEXT %s", addr);
while (sendCommand(ctrl_conn, cmd, addr, &addrLen) == 0) {
stations++;
snprintf_literal(cmd, "STA-NEXT %s", addr);
sprintf(cmd, "STA-NEXT %s", addr);
}
return stations;

Просмотреть файл

@ -37,7 +37,6 @@
#include "prmem.h"
#include "prnetdb.h"
#include "mozilla/Likely.h"
#include "mozilla/Snprintf.h"
//-----------------------------------------------------------------------------
@ -277,12 +276,11 @@ nsHttpNegotiateAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChanne
LOG((" Sending a token of length %d\n", outTokenLen));
// allocate a buffer sizeof("Negotiate" + " " + b64output_token + "\0")
const int bufsize = kNegotiateLen + 1 + strlen(encoded_token) + 1;
*creds = (char *) moz_xmalloc(bufsize);
*creds = (char *) moz_xmalloc(kNegotiateLen + 1 + strlen(encoded_token) + 1);
if (MOZ_UNLIKELY(!*creds))
rv = NS_ERROR_OUT_OF_MEMORY;
else
snprintf(*creds, bufsize, "%s %s", kNegotiate, encoded_token);
sprintf(*creds, "%s %s", kNegotiate, encoded_token);
PR_Free(encoded_token);
return rv;

Просмотреть файл

@ -15,7 +15,6 @@
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "mozilla/BinarySearch.h"
#include "mozilla/Snprintf.h"
#include "nsCOMPtr.h"
#include "nsIUUIDGenerator.h"
@ -69,10 +68,9 @@ gfxSparseBitSet::Dump(const char* aPrefix, eGfxLog aWhichLog) const
for (b = 0; b < numBlocks; b++) {
Block *block = mBlocks[b];
if (!block) continue;
const int BUFSIZE = 256;
char outStr[BUFSIZE];
char outStr[256];
int index = 0;
index += snprintf(&outStr[index], BUFSIZE - index, "%s u+%6.6x [", aPrefix, (b << BLOCK_INDEX_SHIFT));
index += sprintf(&outStr[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];
@ -80,11 +78,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 += snprintf(&outStr[index], BUFSIZE - index, "%2.2x", flipped);
index += sprintf(&outStr[index], "%2.2x", flipped);
}
if (i + 4 != 32) index += snprintf(&outStr[index], BUFSIZE - index, " ");
if (i + 4 != 32) index += sprintf(&outStr[index], " ");
}
index += snprintf(&outStr[index], BUFSIZE - index, "]");
index += sprintf(&outStr[index], "]");
LOG(aWhichLog, ("%s", outStr));
}
}
@ -1412,8 +1410,8 @@ gfxFontUtils::DecodeFontName(const char *aNameData, int32_t aByteLen,
char warnBuf[128];
if (aByteLen > 64)
aByteLen = 64;
snprintf_literal(warnBuf, "skipping font name, unknown charset %d:%d:%d for <%.*s>",
aPlatformCode, aScriptCode, aLangCode, aByteLen, aNameData);
sprintf(warnBuf, "skipping font name, unknown charset %d:%d:%d for <%.*s>",
aPlatformCode, aScriptCode, aLangCode, aByteLen, aNameData);
NS_WARNING(warnBuf);
#endif
return false;

Просмотреть файл

@ -9,7 +9,6 @@
#include "gfxHarfBuzzShaper.h"
#include "gfxFontUtils.h"
#include "gfxTextRun.h"
#include "mozilla/Snprintf.h"
#include "nsUnicodeProperties.h"
#include "nsUnicodeScriptCodes.h"
#include "nsUnicodeNormalizer.h"
@ -902,10 +901,10 @@ gfxHarfBuzzShaper::GetHKerning(uint16_t aFirstGlyph,
#if DEBUG
{
char buf[1024];
snprintf_literal(buf, "unknown kern subtable in %s: "
"ver 0 format %d\n",
NS_ConvertUTF16toUTF8(mFont->GetName()).get(),
format);
sprintf(buf, "unknown kern subtable in %s: "
"ver 0 format %d\n",
NS_ConvertUTF16toUTF8(mFont->GetName()).get(),
format);
NS_WARNING(buf);
}
#endif
@ -964,10 +963,10 @@ gfxHarfBuzzShaper::GetHKerning(uint16_t aFirstGlyph,
#if DEBUG
{
char buf[1024];
snprintf_literal(buf, "unknown kern subtable in %s: "
"ver 0 format %d\n",
NS_ConvertUTF16toUTF8(mFont->GetName()).get(),
format);
sprintf(buf, "unknown kern subtable in %s: "
"ver 0 format %d\n",
NS_ConvertUTF16toUTF8(mFont->GetName()).get(),
format);
NS_WARNING(buf);
}
#endif

Просмотреть файл

@ -9,7 +9,6 @@
#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"
@ -1903,8 +1902,8 @@ gfxFontGroup::GetDefaultFont()
char msg[256]; // CHECK buffer length if revising message below
nsAutoString families;
mFamilyList.ToString(families);
snprintf_literal(msg, "unable to find a usable font (%.220s)",
NS_ConvertUTF16toUTF8(families).get());
sprintf(msg, "unable to find a usable font (%.220s)",
NS_ConvertUTF16toUTF8(families).get());
NS_RUNTIMEABORT(msg);
}

Просмотреть файл

@ -3,7 +3,6 @@
* 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"
@ -114,7 +113,7 @@ NS_IMETHODIMP nsScriptableDateFormat::FormatDateTime(
// if mktime fails (e.g. year <= 1970), then try NSPR.
PRTime prtime;
char string[32];
snprintf_literal(string, "%.2d/%.2d/%d %.2d:%.2d:%.2d", month, day, year, hour, minute, second);
sprintf(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,7 +17,6 @@
#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"
@ -68,9 +67,9 @@ InitRndisAddress()
address[i % (kEthernetAddressLength - 1) + 1] ^= serialno[i];
}
snprintf_literal(mac, "%02x:%02x:%02x:%02x:%02x:%02x",
address[0], address[1], address[2],
address[3], address[4], address[5]);
sprintf(mac, "%02x:%02x:%02x:%02x:%02x:%02x",
address[0], address[1], address[2],
address[3], address[4], address[5]);
length = strlen(mac);
ret = write(fd.get(), mac, length);
if (ret != length) {

Просмотреть файл

@ -30,7 +30,6 @@
#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"
@ -1013,14 +1012,14 @@ LogTextPerfStats(gfxTextPerfMetrics* aTextPerf,
switch (aLogType) {
case eLog_reflow:
snprintf_literal(prefix, "(textperf-reflow) %p time-ms: %7.0f", aPresShell, aTime);
sprintf(prefix, "(textperf-reflow) %p time-ms: %7.0f", aPresShell, aTime);
break;
case eLog_loaddone:
snprintf_literal(prefix, "(textperf-loaddone) %p time-ms: %7.0f", aPresShell, aTime);
sprintf(prefix, "(textperf-loaddone) %p time-ms: %7.0f", aPresShell, aTime);
break;
default:
MOZ_ASSERT(aLogType == eLog_totals, "unknown textperf log type");
snprintf_literal(prefix, "(textperf-totals) %p", aPresShell);
sprintf(prefix, "(textperf-totals) %p", aPresShell);
}
double hitRatio = 0.0;
@ -10375,7 +10374,7 @@ void ReflowCountMgr::Add(const char * aName, nsIFrame * aFrame)
nullptr != mIndiFrameCounts &&
aFrame != nullptr) {
char key[KEY_BUF_SIZE_FOR_PTR];
snprintf_literal(key, "%p", (void*)aFrame);
sprintf(key, "%p", (void*)aFrame);
IndiReflowCounter * counter = (IndiReflowCounter *)PL_HashTableLookup(mIndiFrameCounts, key);
if (counter == nullptr) {
counter = new IndiReflowCounter(this);
@ -10403,7 +10402,7 @@ void ReflowCountMgr::PaintCount(const char* aName,
nullptr != mIndiFrameCounts &&
aFrame != nullptr) {
char key[KEY_BUF_SIZE_FOR_PTR];
snprintf_literal(key, "%p", (void*)aFrame);
sprintf(key, "%p", (void*)aFrame);
IndiReflowCounter * counter =
(IndiReflowCounter *)PL_HashTableLookup(mIndiFrameCounts, key);
if (counter != nullptr && counter->mName.EqualsASCII(aName)) {
@ -10427,7 +10426,7 @@ void ReflowCountMgr::PaintCount(const char* aName,
aPresContext->GetTextPerfMetrics(), *getter_AddRefs(fm));
char buf[16];
int len = snprintf_literal(buf, "%d", counter->mCount);
int len = sprintf(buf, "%d", counter->mCount);
nscoord x = 0, y = fm->MaxAscent();
nscoord width, height = fm->MaxHeight();
fm->SetTextRunRTL(false);
@ -10548,7 +10547,7 @@ static void RecurseIndiTotals(nsPresContext* aPresContext,
}
char key[KEY_BUF_SIZE_FOR_PTR];
snprintf_literal(key, "%p", (void*)aParentFrame);
sprintf(key, "%p", (void*)aParentFrame);
IndiReflowCounter * counter = (IndiReflowCounter *)PL_HashTableLookup(aHT, key);
if (counter) {
counter->mHasBeenOutput = true;

Просмотреть файл

@ -18,12 +18,10 @@
#include "nsCSSFrameConstructor.h"
#include "nsGridContainerFrame.h"
#include "mozilla/Snprintf.h"
#ifdef DEBUG
#include "nsBlockFrame.h"
static void PrettyUC(nscoord aSize, char* aBuf, int aBufSize)
static void PrettyUC(nscoord aSize, char* aBuf)
{
if (NS_UNCONSTRAINEDSIZE == aSize) {
strcpy(aBuf, "UC");
@ -31,7 +29,7 @@ static void PrettyUC(nscoord aSize, char* aBuf, int aBufSize)
if((int32_t)0xdeadbeef == aSize) {
strcpy(aBuf, "deadbeef");
} else {
snprintf(aBuf, aBufSize, "%d", aSize);
sprintf(aBuf, "%d", aSize);
}
}
}
@ -372,11 +370,11 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
char width[16];
char height[16];
PrettyUC(aReflowState.AvailableWidth(), width, 16);
PrettyUC(aReflowState.AvailableHeight(), height, 16);
PrettyUC(aReflowState.AvailableWidth(), width);
PrettyUC(aReflowState.AvailableHeight(), height);
printf(" a=%s,%s ", width, height);
PrettyUC(aReflowState.ComputedWidth(), width, 16);
PrettyUC(aReflowState.ComputedHeight(), height, 16);
PrettyUC(aReflowState.ComputedWidth(), width);
PrettyUC(aReflowState.ComputedHeight(), height);
printf("c=%s,%s \n", width, height);
}
AutoNoisyIndenter indent(nsBlockFrame::gNoisy);

Просмотреть файл

@ -11,13 +11,12 @@
#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 "mozilla/Snprintf.h"
#include "gfx2DGlue.h"
#include "nsCOMPtr.h"
#include "nsFrameList.h"
@ -9154,8 +9153,7 @@ struct DR_State
bool GetNumber(char* aBuf,
int32_t& aNumber);
void PrettyUC(nscoord aSize,
char* aBuf,
int aBufSize);
char* aBuf);
void PrintMargin(const char* tag, const nsMargin* aMargin);
void DisplayFrameTypeInfo(nsIFrame* aFrame,
int32_t aIndent);
@ -9648,8 +9646,7 @@ DR_FrameTreeNode* DR_State::CreateTreeNode(nsIFrame* aFrame,
}
void DR_State::PrettyUC(nscoord aSize,
char* aBuf,
int aBufSize)
char* aBuf)
{
if (NS_UNCONSTRAINEDSIZE == aSize) {
strcpy(aBuf, "UC");
@ -9660,7 +9657,7 @@ void DR_State::PrettyUC(nscoord aSize,
strcpy(aBuf, "deadbeef");
}
else {
snprintf(aBuf, aBufSize, "%d", aSize);
sprintf(aBuf, "%d", aSize);
}
}
}
@ -9669,10 +9666,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, 16);
PrettyUC(aMargin->right, r, 16);
PrettyUC(aMargin->bottom, b, 16);
PrettyUC(aMargin->left, l, 16);
PrettyUC(aMargin->top, t);
PrettyUC(aMargin->right, r);
PrettyUC(aMargin->bottom, b);
PrettyUC(aMargin->left, l);
printf(" %s=%s,%s,%s,%s", tag, t, r, b, l);
} else {
// use %p here for consistency with other null-pointer printouts
@ -9718,12 +9715,12 @@ static void DisplayReflowEnterPrint(nsPresContext* aPresContext,
char width[16];
char height[16];
DR_state->PrettyUC(aReflowState.AvailableWidth(), width, 16);
DR_state->PrettyUC(aReflowState.AvailableHeight(), height, 16);
DR_state->PrettyUC(aReflowState.AvailableWidth(), width);
DR_state->PrettyUC(aReflowState.AvailableHeight(), height);
printf("Reflow a=%s,%s ", width, height);
DR_state->PrettyUC(aReflowState.ComputedWidth(), width, 16);
DR_state->PrettyUC(aReflowState.ComputedHeight(), height, 16);
DR_state->PrettyUC(aReflowState.ComputedWidth(), width);
DR_state->PrettyUC(aReflowState.ComputedHeight(), height);
printf("c=%s,%s ", width, height);
if (aFrame->GetStateBits() & NS_FRAME_IS_DIRTY)
@ -9845,38 +9842,38 @@ void nsFrame::DisplayReflowExit(nsPresContext* aPresContext,
char height[16];
char x[16];
char y[16];
DR_state->PrettyUC(aMetrics.Width(), width, 16);
DR_state->PrettyUC(aMetrics.Height(), height, 16);
DR_state->PrettyUC(aMetrics.Width(), width);
DR_state->PrettyUC(aMetrics.Height(), height);
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, 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);
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);
printf(" vis-o=(%s,%s) %s x %s", x, y, width, height);
nsRect storedOverflow = aFrame->GetVisualOverflowRect();
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);
DR_state->PrettyUC(storedOverflow.x, x);
DR_state->PrettyUC(storedOverflow.y, y);
DR_state->PrettyUC(storedOverflow.width, width);
DR_state->PrettyUC(storedOverflow.height, height);
printf(" vis-sto=(%s,%s) %s x %s", x, y, width, 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);
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);
printf(" scr-o=(%s,%s) %s x %s", x, y, width, height);
storedOverflow = aFrame->GetScrollableOverflowRect();
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);
DR_state->PrettyUC(storedOverflow.x, x);
DR_state->PrettyUC(storedOverflow.y, y);
DR_state->PrettyUC(storedOverflow.width, width);
DR_state->PrettyUC(storedOverflow.height, height);
printf(" scr-sto=(%s,%s) %s x %s", x, y, width, height);
}
printf("\n");
@ -9920,7 +9917,7 @@ void nsFrame::DisplayIntrinsicISizeExit(nsIFrame* aFrame,
if (treeNode->mDisplay) {
DR_state->DisplayFrameTypeInfo(aFrame, treeNode->mIndent);
char width[16];
DR_state->PrettyUC(aResult, width, 16);
DR_state->PrettyUC(aResult, width);
printf("Get%sWidth=%s\n", aType, width);
}
DR_state->DeleteTreeNode(*treeNode);
@ -9942,8 +9939,8 @@ void nsFrame::DisplayIntrinsicSizeExit(nsIFrame* aFrame,
char width[16];
char height[16];
DR_state->PrettyUC(aResult.width, width, 16);
DR_state->PrettyUC(aResult.height, height, 16);
DR_state->PrettyUC(aResult.width, width);
DR_state->PrettyUC(aResult.height, height);
printf("Get%sSize=%s,%s\n", aType, width, height);
}
DR_state->DeleteTreeNode(*treeNode);
@ -9994,12 +9991,12 @@ nsHTMLReflowState::DisplayInitConstraintsEnter(nsIFrame* aFrame,
char width[16];
char height[16];
DR_state->PrettyUC(aContainingBlockWidth, width, 16);
DR_state->PrettyUC(aContainingBlockHeight, height, 16);
DR_state->PrettyUC(aContainingBlockWidth, width);
DR_state->PrettyUC(aContainingBlockHeight, height);
printf(" cb=%s,%s", width, height);
DR_state->PrettyUC(aState->AvailableWidth(), width, 16);
DR_state->PrettyUC(aState->AvailableHeight(), height, 16);
DR_state->PrettyUC(aState->AvailableWidth(), width);
DR_state->PrettyUC(aState->AvailableHeight(), height);
printf(" as=%s,%s", width, height);
DR_state->PrintMargin("b", aBorder);
@ -10024,12 +10021,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, 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);
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);
printf("InitConstraints= cw=(%s <= %s <= %s) ch=(%s <= %s <= %s)",
cmiw, cw, cmxw, cmih, ch, cmxh);
DR_state->PrintMargin("co", &aState->ComputedPhysicalOffsets());
@ -10060,8 +10057,8 @@ nsCSSOffsetState::DisplayInitOffsetsEnter(nsIFrame* aFrame,
char horizPctBasisStr[16];
char vertPctBasisStr[16];
DR_state->PrettyUC(aHorizontalPercentBasis, horizPctBasisStr, 16);
DR_state->PrettyUC(aVerticalPercentBasis, vertPctBasisStr, 16);
DR_state->PrettyUC(aHorizontalPercentBasis, horizPctBasisStr);
DR_state->PrettyUC(aVerticalPercentBasis, vertPctBasisStr);
printf("InitOffsets pct_basis=%s,%s", horizPctBasisStr, vertPctBasisStr);
DR_state->PrintMargin("b", aBorder);

Просмотреть файл

@ -16,7 +16,6 @@
#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"
@ -1082,7 +1081,7 @@ FontFaceSet::LogMessage(gfxUserFontEntry* aUserFontEntry,
if (weightKeywordString.Length() > 0) {
weightKeyword = weightKeywordString.get();
} else {
snprintf_literal(weightKeywordBuf, "%u", aUserFontEntry->Weight());
sprintf(weightKeywordBuf, "%u", aUserFontEntry->Weight());
weightKeyword = weightKeywordBuf;
}

Просмотреть файл

@ -33,8 +33,6 @@
#include <time.h>
#include <string.h>
#include "mozilla/Snprintf.h"
#ifdef WIN32
#include <process.h>
#endif
@ -455,7 +453,7 @@ OAES_RET oaes_sprintf(
for( _i = 0; _i < data_len; _i++ )
{
snprintf( _temp, sizeof(_temp), "%02x ", data[_i] );
sprintf( _temp, "%02x ", data[_i] );
strcat( buf, _temp );
if( _i && 0 == ( _i + 1 ) % OAES_BLOCK_SIZE )
strcat( buf, "\n" );

Просмотреть файл

@ -95,7 +95,6 @@
#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"
@ -389,7 +388,7 @@ public:
void IntProperty(const char* aName, int64_t aInt)
{
char buf[64];
snprintf_literal(buf, "%" PRId64, aInt);
sprintf(buf, "%" PRId64, aInt);
Scalar(aName, buf);
}

Просмотреть файл

@ -1,50 +0,0 @@
/* -*- 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,7 +70,6 @@ EXPORTS.mozilla = [
'SegmentedVector.h',
'SHA1.h',
'SizePrintfMacros.h',
'Snprintf.h',
'SplayTree.h',
'TaggedAnonymousMemory.h',
'TemplateLib.h',

Просмотреть файл

@ -6,7 +6,6 @@
#include "mozilla/Assertions.h"
#include "mozilla/IntegerPrintfMacros.h" // this must pick up <stdint.h>
#include "mozilla/Snprintf.h"
#include <stddef.h>
#include <stdio.h>
@ -34,11 +33,11 @@ static void
TestPrintSigned8()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRId8, int8_t(-17));
sprintf(gOutput, "%" PRId8, int8_t(-17));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-17"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIi8, int8_t(42));
sprintf(gOutput, "%" PRIi8, int8_t(42));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "42"));
}
@ -46,11 +45,11 @@ static void
TestPrintSigned16()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRId16, int16_t(-289));
sprintf(gOutput, "%" PRId16, int16_t(-289));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-289"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIi16, int16_t(728));
sprintf(gOutput, "%" PRIi16, int16_t(728));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "728"));
}
@ -58,11 +57,11 @@ static void
TestPrintSigned32()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRId32, int32_t(-342178));
sprintf(gOutput, "%" PRId32, int32_t(-342178));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-342178"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIi32, int32_t(5719283));
sprintf(gOutput, "%" PRIi32, int32_t(5719283));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "5719283"));
}
@ -70,11 +69,11 @@ static void
TestPrintSigned64()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRId64, int64_t(-INT64_C(432157943248732)));
sprintf(gOutput, "%" PRId64, int64_t(-INT64_C(432157943248732)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-432157943248732"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIi64, int64_t(INT64_C(325719232983)));
sprintf(gOutput, "%" PRIi64, int64_t(INT64_C(325719232983)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "325719232983"));
}
@ -91,11 +90,11 @@ static void
TestPrintSignedLeast8()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIdLEAST8, int_least8_t(-17));
sprintf(gOutput, "%" PRIdLEAST8, int_least8_t(-17));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-17"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIiLEAST8, int_least8_t(42));
sprintf(gOutput, "%" PRIiLEAST8, int_least8_t(42));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "42"));
}
@ -103,11 +102,11 @@ static void
TestPrintSignedLeast16()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIdLEAST16, int_least16_t(-289));
sprintf(gOutput, "%" PRIdLEAST16, int_least16_t(-289));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-289"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIiLEAST16, int_least16_t(728));
sprintf(gOutput, "%" PRIiLEAST16, int_least16_t(728));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "728"));
}
@ -115,11 +114,11 @@ static void
TestPrintSignedLeast32()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIdLEAST32, int_least32_t(-342178));
sprintf(gOutput, "%" PRIdLEAST32, int_least32_t(-342178));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-342178"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIiLEAST32, int_least32_t(5719283));
sprintf(gOutput, "%" PRIiLEAST32, int_least32_t(5719283));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "5719283"));
}
@ -127,11 +126,11 @@ static void
TestPrintSignedLeast64()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIdLEAST64, int_least64_t(-INT64_C(432157943248732)));
sprintf(gOutput, "%" PRIdLEAST64, int_least64_t(-INT64_C(432157943248732)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-432157943248732"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIiLEAST64, int_least64_t(INT64_C(325719232983)));
sprintf(gOutput, "%" PRIiLEAST64, int_least64_t(INT64_C(325719232983)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "325719232983"));
}
@ -148,11 +147,11 @@ static void
TestPrintSignedFast8()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIdFAST8, int_fast8_t(-17));
sprintf(gOutput, "%" PRIdFAST8, int_fast8_t(-17));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-17"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIiFAST8, int_fast8_t(42));
sprintf(gOutput, "%" PRIiFAST8, int_fast8_t(42));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "42"));
}
@ -160,11 +159,11 @@ static void
TestPrintSignedFast16()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIdFAST16, int_fast16_t(-289));
sprintf(gOutput, "%" PRIdFAST16, int_fast16_t(-289));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-289"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIiFAST16, int_fast16_t(728));
sprintf(gOutput, "%" PRIiFAST16, int_fast16_t(728));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "728"));
}
@ -172,11 +171,11 @@ static void
TestPrintSignedFast32()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIdFAST32, int_fast32_t(-342178));
sprintf(gOutput, "%" PRIdFAST32, int_fast32_t(-342178));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-342178"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIiFAST32, int_fast32_t(5719283));
sprintf(gOutput, "%" PRIiFAST32, int_fast32_t(5719283));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "5719283"));
}
@ -184,11 +183,11 @@ static void
TestPrintSignedFast64()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIdFAST64, int_fast64_t(-INT64_C(432157943248732)));
sprintf(gOutput, "%" PRIdFAST64, int_fast64_t(-INT64_C(432157943248732)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-432157943248732"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIiFAST64, int_fast64_t(INT64_C(325719232983)));
sprintf(gOutput, "%" PRIiFAST64, int_fast64_t(INT64_C(325719232983)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "325719232983"));
}
@ -205,11 +204,11 @@ static void
TestPrintSignedMax()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIdMAX, intmax_t(-INTMAX_C(432157943248732)));
sprintf(gOutput, "%" PRIdMAX, intmax_t(-INTMAX_C(432157943248732)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "-432157943248732"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIiMAX, intmax_t(INTMAX_C(325719232983)));
sprintf(gOutput, "%" PRIiMAX, intmax_t(INTMAX_C(325719232983)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "325719232983"));
}
@ -217,11 +216,11 @@ static void
TestPrintSignedPtr()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIdPTR, intptr_t(reinterpret_cast<void*>(12345678)));
sprintf(gOutput, "%" PRIdPTR, intptr_t(reinterpret_cast<void*>(12345678)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "12345678"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIiPTR, intptr_t(reinterpret_cast<void*>(87654321)));
sprintf(gOutput, "%" PRIiPTR, intptr_t(reinterpret_cast<void*>(87654321)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "87654321"));
}
@ -250,19 +249,19 @@ static void
TestPrintUnsigned8()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIo8, uint8_t(042));
sprintf(gOutput, "%" PRIo8, uint8_t(042));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "42"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIu8, uint8_t(17));
sprintf(gOutput, "%" PRIu8, uint8_t(17));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "17"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIx8, uint8_t(0x2a));
sprintf(gOutput, "%" PRIx8, uint8_t(0x2a));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIX8, uint8_t(0xCD));
sprintf(gOutput, "%" PRIX8, uint8_t(0xCD));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CD"));
}
@ -270,19 +269,19 @@ static void
TestPrintUnsigned16()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIo16, uint16_t(04242));
sprintf(gOutput, "%" PRIo16, uint16_t(04242));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "4242"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIu16, uint16_t(1717));
sprintf(gOutput, "%" PRIu16, uint16_t(1717));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "1717"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIx16, uint16_t(0x2a2a));
sprintf(gOutput, "%" PRIx16, uint16_t(0x2a2a));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIX16, uint16_t(0xCDCD));
sprintf(gOutput, "%" PRIX16, uint16_t(0xCDCD));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCD"));
}
@ -290,19 +289,19 @@ static void
TestPrintUnsigned32()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIo32, uint32_t(0424242));
sprintf(gOutput, "%" PRIo32, uint32_t(0424242));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "424242"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIu32, uint32_t(171717));
sprintf(gOutput, "%" PRIu32, uint32_t(171717));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "171717"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIx32, uint32_t(0x2a2a2a));
sprintf(gOutput, "%" PRIx32, uint32_t(0x2a2a2a));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a2a"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIX32, uint32_t(0xCDCDCD));
sprintf(gOutput, "%" PRIX32, uint32_t(0xCDCDCD));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCDCD"));
}
@ -310,19 +309,19 @@ static void
TestPrintUnsigned64()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIo64, uint64_t(UINT64_C(0424242424242)));
sprintf(gOutput, "%" PRIo64, uint64_t(UINT64_C(0424242424242)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "424242424242"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIu64, uint64_t(UINT64_C(17171717171717171717)));
sprintf(gOutput, "%" PRIu64, uint64_t(UINT64_C(17171717171717171717)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "17171717171717171717"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIx64, uint64_t(UINT64_C(0x2a2a2a2a2a2a2a)));
sprintf(gOutput, "%" PRIx64, uint64_t(UINT64_C(0x2a2a2a2a2a2a2a)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a2a2a2a2a2a"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIX64, uint64_t(UINT64_C(0xCDCDCDCDCDCD)));
sprintf(gOutput, "%" PRIX64, uint64_t(UINT64_C(0xCDCDCDCDCDCD)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCDCDCDCDCD"));
}
@ -339,19 +338,19 @@ static void
TestPrintUnsignedLeast8()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIoLEAST8, uint_least8_t(042));
sprintf(gOutput, "%" PRIoLEAST8, uint_least8_t(042));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "42"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIuLEAST8, uint_least8_t(17));
sprintf(gOutput, "%" PRIuLEAST8, uint_least8_t(17));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "17"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIxLEAST8, uint_least8_t(0x2a));
sprintf(gOutput, "%" PRIxLEAST8, uint_least8_t(0x2a));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIXLEAST8, uint_least8_t(0xCD));
sprintf(gOutput, "%" PRIXLEAST8, uint_least8_t(0xCD));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CD"));
}
@ -359,19 +358,19 @@ static void
TestPrintUnsignedLeast16()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIoLEAST16, uint_least16_t(04242));
sprintf(gOutput, "%" PRIoLEAST16, uint_least16_t(04242));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "4242"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIuLEAST16, uint_least16_t(1717));
sprintf(gOutput, "%" PRIuLEAST16, uint_least16_t(1717));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "1717"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIxLEAST16, uint_least16_t(0x2a2a));
sprintf(gOutput, "%" PRIxLEAST16, uint_least16_t(0x2a2a));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIXLEAST16, uint_least16_t(0xCDCD));
sprintf(gOutput, "%" PRIXLEAST16, uint_least16_t(0xCDCD));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCD"));
}
@ -379,19 +378,19 @@ static void
TestPrintUnsignedLeast32()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIoLEAST32, uint_least32_t(0424242));
sprintf(gOutput, "%" PRIoLEAST32, uint_least32_t(0424242));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "424242"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIuLEAST32, uint_least32_t(171717));
sprintf(gOutput, "%" PRIuLEAST32, uint_least32_t(171717));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "171717"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIxLEAST32, uint_least32_t(0x2a2a2a));
sprintf(gOutput, "%" PRIxLEAST32, uint_least32_t(0x2a2a2a));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a2a"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIXLEAST32, uint_least32_t(0xCDCDCD));
sprintf(gOutput, "%" PRIXLEAST32, uint_least32_t(0xCDCDCD));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCDCD"));
}
@ -399,20 +398,20 @@ static void
TestPrintUnsignedLeast64()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIoLEAST64, uint_least64_t(UINT64_C(0424242424242)));
sprintf(gOutput, "%" PRIoLEAST64, uint_least64_t(UINT64_C(0424242424242)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "424242424242"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIuLEAST64,
sprintf(gOutput, "%" PRIuLEAST64,
uint_least64_t(UINT64_C(17171717171717171717)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "17171717171717171717"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIxLEAST64, uint_least64_t(UINT64_C(0x2a2a2a2a2a2a2a)));
sprintf(gOutput, "%" PRIxLEAST64, uint_least64_t(UINT64_C(0x2a2a2a2a2a2a2a)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a2a2a2a2a2a"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIXLEAST64, uint_least64_t(UINT64_C(0xCDCDCDCDCDCD)));
sprintf(gOutput, "%" PRIXLEAST64, uint_least64_t(UINT64_C(0xCDCDCDCDCDCD)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCDCDCDCDCD"));
}
@ -429,19 +428,19 @@ static void
TestPrintUnsignedFast8()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIoFAST8, uint_fast8_t(042));
sprintf(gOutput, "%" PRIoFAST8, uint_fast8_t(042));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "42"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIuFAST8, uint_fast8_t(17));
sprintf(gOutput, "%" PRIuFAST8, uint_fast8_t(17));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "17"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIxFAST8, uint_fast8_t(0x2a));
sprintf(gOutput, "%" PRIxFAST8, uint_fast8_t(0x2a));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIXFAST8, uint_fast8_t(0xCD));
sprintf(gOutput, "%" PRIXFAST8, uint_fast8_t(0xCD));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CD"));
}
@ -449,19 +448,19 @@ static void
TestPrintUnsignedFast16()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIoFAST16, uint_fast16_t(04242));
sprintf(gOutput, "%" PRIoFAST16, uint_fast16_t(04242));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "4242"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIuFAST16, uint_fast16_t(1717));
sprintf(gOutput, "%" PRIuFAST16, uint_fast16_t(1717));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "1717"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIxFAST16, uint_fast16_t(0x2a2a));
sprintf(gOutput, "%" PRIxFAST16, uint_fast16_t(0x2a2a));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIXFAST16, uint_fast16_t(0xCDCD));
sprintf(gOutput, "%" PRIXFAST16, uint_fast16_t(0xCDCD));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCD"));
}
@ -469,19 +468,19 @@ static void
TestPrintUnsignedFast32()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIoFAST32, uint_fast32_t(0424242));
sprintf(gOutput, "%" PRIoFAST32, uint_fast32_t(0424242));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "424242"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIuFAST32, uint_fast32_t(171717));
sprintf(gOutput, "%" PRIuFAST32, uint_fast32_t(171717));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "171717"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIxFAST32, uint_fast32_t(0x2a2a2a));
sprintf(gOutput, "%" PRIxFAST32, uint_fast32_t(0x2a2a2a));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a2a"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIXFAST32, uint_fast32_t(0xCDCDCD));
sprintf(gOutput, "%" PRIXFAST32, uint_fast32_t(0xCDCDCD));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCDCD"));
}
@ -489,20 +488,20 @@ static void
TestPrintUnsignedFast64()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIoFAST64, uint_fast64_t(UINT64_C(0424242424242)));
sprintf(gOutput, "%" PRIoFAST64, uint_fast64_t(UINT64_C(0424242424242)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "424242424242"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIuFAST64,
sprintf(gOutput, "%" PRIuFAST64,
uint_fast64_t(UINT64_C(17171717171717171717)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "17171717171717171717"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIxFAST64, uint_fast64_t(UINT64_C(0x2a2a2a2a2a2a2a)));
sprintf(gOutput, "%" PRIxFAST64, uint_fast64_t(UINT64_C(0x2a2a2a2a2a2a2a)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "2a2a2a2a2a2a2a"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIXFAST64, uint_fast64_t(UINT64_C(0xCDCDCDCDCDCD)));
sprintf(gOutput, "%" PRIXFAST64, uint_fast64_t(UINT64_C(0xCDCDCDCDCDCD)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "CDCDCDCDCDCD"));
}
@ -519,19 +518,19 @@ static void
TestPrintUnsignedMax()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIoMAX, uintmax_t(UINTMAX_C(432157943248732)));
sprintf(gOutput, "%" PRIoMAX, uintmax_t(UINTMAX_C(432157943248732)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "14220563454333534"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIuMAX, uintmax_t(UINTMAX_C(325719232983)));
sprintf(gOutput, "%" PRIuMAX, uintmax_t(UINTMAX_C(325719232983)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "325719232983"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIxMAX, uintmax_t(UINTMAX_C(327281321873)));
sprintf(gOutput, "%" PRIxMAX, uintmax_t(UINTMAX_C(327281321873)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "4c337ca791"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIXMAX, uintmax_t(UINTMAX_C(912389523743523)));
sprintf(gOutput, "%" PRIXMAX, uintmax_t(UINTMAX_C(912389523743523)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "33DD03D75A323"));
}
@ -539,19 +538,19 @@ static void
TestPrintUnsignedPtr()
{
PoisonOutput();
snprintf_literal(gOutput, "%" PRIoPTR, uintptr_t(reinterpret_cast<void*>(12345678)));
sprintf(gOutput, "%" PRIoPTR, uintptr_t(reinterpret_cast<void*>(12345678)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "57060516"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIuPTR, uintptr_t(reinterpret_cast<void*>(87654321)));
sprintf(gOutput, "%" PRIuPTR, uintptr_t(reinterpret_cast<void*>(87654321)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "87654321"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIxPTR, uintptr_t(reinterpret_cast<void*>(0x4c3a791)));
sprintf(gOutput, "%" PRIxPTR, uintptr_t(reinterpret_cast<void*>(0x4c3a791)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "4c3a791"));
PoisonOutput();
snprintf_literal(gOutput, "%" PRIXPTR, uintptr_t(reinterpret_cast<void*>(0xF328DB)));
sprintf(gOutput, "%" PRIXPTR, uintptr_t(reinterpret_cast<void*>(0xF328DB)));
MOZ_RELEASE_ASSERT(!strcmp(gOutput, "F328DB"));
}

7
netwerk/cache/nsDiskCacheMap.cpp поставляемый
Просмотреть файл

@ -18,7 +18,6 @@
#include "nsSerializationHelper.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Snprintf.h"
#include "mozilla/Telemetry.h"
#include "mozilla/VisualEventTracer.h"
#include <algorithm>
@ -1141,8 +1140,8 @@ nsDiskCacheMap::GetFileForDiskCacheRecord(nsDiskCacheRecord * record,
int16_t generation = record->Generation();
char name[32];
// Cut the beginning of the hash that was used in the path
::snprintf_literal(name, "%05X%c%02X", hash & 0xFFFFF, (meta ? 'm' : 'd'),
generation);
::sprintf(name, "%05X%c%02X", hash & 0xFFFFF, (meta ? 'm' : 'd'),
generation);
rv = file->AppendNative(nsDependentCString(name));
if (NS_FAILED(rv)) return rv;
@ -1179,7 +1178,7 @@ nsDiskCacheMap::GetBlockFileForIndex(uint32_t index, nsIFile ** result)
if (NS_FAILED(rv)) return rv;
char name[32];
::snprintf_literal(name, "_CACHE_%03d_", index + 1);
::sprintf(name, "_CACHE_%03d_", index + 1);
rv = file->AppendNative(nsDependentCString(name));
if (NS_FAILED(rv)) return rv;

Просмотреть файл

@ -19,8 +19,6 @@
#include "ASessionDescription.h"
#include "mozilla/Snprintf.h"
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AString.h>
@ -216,7 +214,7 @@ bool ASessionDescription::getFormatType(
*PT = x;
char key[20];
snprintf_literal(key, "a=rtpmap:%lu", x);
sprintf(key, "a=rtpmap:%lu", x);
if (!findAttribute(index, key, desc)) {
// We only support dynamic payload type assignment for now.
@ -225,7 +223,7 @@ bool ASessionDescription::getFormatType(
return false;
}
snprintf_literal(key, "a=fmtp:%lu", x);
sprintf(key, "a=fmtp:%lu", x);
if (!findAttribute(index, key, params)) {
params->clear();
}
@ -240,7 +238,7 @@ bool ASessionDescription::getDimensions(
*height = 0;
char key[20];
snprintf_literal(key, "a=framesize:%lu", PT);
sprintf(key, "a=framesize:%lu", PT);
AString value;
if (!findAttribute(index, key, &value)) {
return false;

Просмотреть файл

@ -4,7 +4,6 @@
* 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"
@ -77,7 +76,7 @@ main(int argc, char* argv[])
while (1) {
char name[16];
name[0] = 0;
snprintf_literal(name, "%d", i);
sprintf(name, "%d", i);
nsAutoString v;
ret = props->GetStringProperty(nsDependentCString(name), v);
if (NS_FAILED(ret) || (!v.Length())) {

Просмотреть файл

@ -10,7 +10,6 @@
#include "mozilla/Services.h"
#include "nsIObserverService.h"
#include "mozilla/unused.h"
#include "mozilla/Snprintf.h"
#include "mozilla/SyncRunnable.h"
#include "nsThreadUtils.h"
@ -1438,7 +1437,7 @@ InitInstallTime(nsACString& aInstallTime)
{
time_t t = time(nullptr);
char buf[16];
snprintf_literal(buf, "%ld", t);
sprintf(buf, "%ld", t);
aInstallTime = buf;
return NS_OK;

Просмотреть файл

@ -40,7 +40,6 @@
#include "nsReadableUtils.h"
#include "nsNativeCharsetUtils.h"
#include "mozilla/Attributes.h"
#include "mozilla/Snprintf.h"
using namespace mozilla;
@ -970,18 +969,16 @@ nsToolkitProfileService::Flush()
++pCount;
uint32_t length;
const int bufsize = 100+MAXPATHLEN*pCount;
nsAutoArrayPtr<char> buffer (new char[bufsize]);
nsAutoArrayPtr<char> buffer (new char[100+MAXPATHLEN*pCount]);
NS_ENSURE_TRUE(buffer, NS_ERROR_OUT_OF_MEMORY);
char *pos = buffer;
char *end = buffer + bufsize;
char *end = buffer;
pos += snprintf(pos, end - pos,
"[General]\n"
"StartWithLastProfile=%s\n\n",
mStartWithLast ? "1" : "0");
end += sprintf(end,
"[General]\n"
"StartWithLastProfile=%s\n\n",
mStartWithLast ? "1" : "0");
nsAutoCString path;
cur = mFirst;
@ -1000,21 +997,21 @@ nsToolkitProfileService::Flush()
NS_ENSURE_SUCCESS(rv, rv);
}
pos += snprintf(pos, end - pos,
"[Profile%u]\n"
"Name=%s\n"
"IsRelative=%s\n"
"Path=%s\n",
pCount, cur->mName.get(),
isRelative ? "1" : "0", path.get());
end += sprintf(end,
"[Profile%u]\n"
"Name=%s\n"
"IsRelative=%s\n"
"Path=%s\n",
pCount, cur->mName.get(),
isRelative ? "1" : "0", path.get());
nsCOMPtr<nsIToolkitProfile> profile;
rv = this->GetDefaultProfile(getter_AddRefs(profile));
if (NS_SUCCEEDED(rv) && profile == cur) {
pos += snprintf(pos, end - pos, "Default=1\n");
end += sprintf(end, "Default=1\n");
}
pos += snprintf(pos, end - pos, "\n");
end += sprintf(end, "\n");
cur = cur->mNext;
++pCount;
@ -1025,7 +1022,7 @@ nsToolkitProfileService::Flush()
NS_ENSURE_SUCCESS(rv, rv);
if (buffer) {
length = pos - buffer;
length = end - buffer;
if (fwrite(buffer, sizeof(char), length, writeFile) != length) {
fclose(writeFile);

Просмотреть файл

@ -51,12 +51,10 @@
#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
@ -1665,88 +1663,88 @@ bool CallFrameInfo::ReportIncomplete(Entry *entry) {
void CallFrameInfo::Reporter::Incomplete(uint64 offset,
CallFrameInfo::EntryKind kind) {
char buf[300];
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());
snprintf(buf, sizeof(buf),
"%s: CFI %s at offset 0x%llx in '%s': entry ends early\n",
filename_.c_str(), CallFrameInfo::KindName(kind), offset,
section_.c_str());
log_(buf);
}
void CallFrameInfo::Reporter::EarlyEHTerminator(uint64 offset) {
char buf[300];
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());
snprintf(buf, sizeof(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());
log_(buf);
}
void CallFrameInfo::Reporter::CIEPointerOutOfRange(uint64 offset,
uint64 cie_offset) {
char buf[300];
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);
snprintf(buf, sizeof(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);
log_(buf);
}
void CallFrameInfo::Reporter::BadCIEId(uint64 offset, uint64 cie_offset) {
char buf[300];
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);
snprintf(buf, sizeof(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);
log_(buf);
}
void CallFrameInfo::Reporter::UnrecognizedVersion(uint64 offset, int version) {
char buf[300];
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);
snprintf(buf, sizeof(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);
log_(buf);
}
void CallFrameInfo::Reporter::UnrecognizedAugmentation(uint64 offset,
const string &aug) {
char buf[300];
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());
snprintf(buf, sizeof(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());
log_(buf);
}
void CallFrameInfo::Reporter::InvalidPointerEncoding(uint64 offset,
uint8 encoding) {
char buf[300];
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);
snprintf(buf, sizeof(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);
log_(buf);
}
void CallFrameInfo::Reporter::UnusablePointerEncoding(uint64 offset,
uint8 encoding) {
char buf[300];
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",
filename_.c_str(), offset, section_.c_str(), encoding);
snprintf(buf, sizeof(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",
filename_.c_str(), offset, section_.c_str(), encoding);
log_(buf);
}
void CallFrameInfo::Reporter::RestoreInCIE(uint64 offset, uint64 insn_offset) {
char buf[300];
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",
filename_.c_str(), offset, section_.c_str(), insn_offset);
snprintf(buf, sizeof(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",
filename_.c_str(), offset, section_.c_str(), insn_offset);
log_(buf);
}
@ -1754,11 +1752,11 @@ void CallFrameInfo::Reporter::BadInstruction(uint64 offset,
CallFrameInfo::EntryKind kind,
uint64 insn_offset) {
char buf[300];
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),
offset, section_.c_str(), insn_offset);
snprintf(buf, sizeof(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),
offset, section_.c_str(), insn_offset);
log_(buf);
}
@ -1766,12 +1764,12 @@ void CallFrameInfo::Reporter::NoCFARule(uint64 offset,
CallFrameInfo::EntryKind kind,
uint64 insn_offset) {
char buf[300];
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",
filename_.c_str(), CallFrameInfo::KindName(kind), offset,
section_.c_str(), insn_offset);
snprintf(buf, sizeof(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",
filename_.c_str(), CallFrameInfo::KindName(kind), offset,
section_.c_str(), insn_offset);
log_(buf);
}
@ -1779,12 +1777,12 @@ void CallFrameInfo::Reporter::EmptyStateStack(uint64 offset,
CallFrameInfo::EntryKind kind,
uint64 insn_offset) {
char buf[300];
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",
filename_.c_str(), CallFrameInfo::KindName(kind), offset,
section_.c_str(), insn_offset);
snprintf(buf, sizeof(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",
filename_.c_str(), CallFrameInfo::KindName(kind), offset,
section_.c_str(), insn_offset);
log_(buf);
}
@ -1792,12 +1790,12 @@ void CallFrameInfo::Reporter::ClearingCFARule(uint64 offset,
CallFrameInfo::EntryKind kind,
uint64 insn_offset) {
char buf[300];
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",
filename_.c_str(), CallFrameInfo::KindName(kind), offset,
section_.c_str(), insn_offset);
snprintf(buf, sizeof(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",
filename_.c_str(), CallFrameInfo::KindName(kind), offset,
section_.c_str(), insn_offset);
log_(buf);
}
@ -1892,7 +1890,7 @@ const UniqueString* DwarfCFIToModule::RegisterName(int i) {
return usu_->ToUniqueString(".ra");
char buf[30];
snprintf_literal(buf, "dwarf_reg_%u", reg);
sprintf(buf, "dwarf_reg_%u", reg);
return usu_->ToUniqueString(buf);
}
@ -1965,8 +1963,8 @@ void DwarfCFIToModule::Reporter::UndefinedNotSupported(
size_t offset,
const UniqueString* reg) {
char buf[300];
snprintf_literal(buf,
"DwarfCFIToModule::Reporter::UndefinedNotSupported()\n");
snprintf(buf, sizeof(buf),
"DwarfCFIToModule::Reporter::UndefinedNotSupported()\n");
log_(buf);
//BPLOG(INFO) << file_ << ", section '" << section_
// << "': the call frame entry at offset 0x"
@ -1995,10 +1993,10 @@ void DwarfCFIToModule::Reporter::ExpressionsNotSupported(
if (!is_power_of_2(n_complaints))
return;
char buf[300];
snprintf_literal(buf,
"DwarfCFIToModule::Reporter::"
"ExpressionsNotSupported(shown %llu times)\n",
(unsigned long long int)n_complaints);
snprintf(buf, sizeof(buf),
"DwarfCFIToModule::Reporter::"
"ExpressionsNotSupported(shown %llu times)\n",
(unsigned long long int)n_complaints);
log_(buf);
//BPLOG(INFO) << file_ << ", section '" << section_
// << "': the call frame entry at offset 0x"

Просмотреть файл

@ -15,9 +15,8 @@
#include "mozilla/Assertions.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/MemoryChecking.h"
#include "mozilla/Snprintf.h"
#include "mozilla/DebugOnly.h"
#include "LulCommonExt.h"
#include "LulElfExt.h"
@ -85,11 +84,11 @@ ShowRule(const char* aNewReg, LExpr aExpr)
res += "Unknown";
break;
case LExpr::NODEREF:
snprintf_literal(buf, "%s+%d", NameOf_DW_REG(aExpr.mReg), (int)aExpr.mOffset);
sprintf(buf, "%s+%d", NameOf_DW_REG(aExpr.mReg), (int)aExpr.mOffset);
res += buf;
break;
case LExpr::DEREF:
snprintf_literal(buf, "*(%s+%d)", NameOf_DW_REG(aExpr.mReg), (int)aExpr.mOffset);
sprintf(buf, "*(%s+%d)", NameOf_DW_REG(aExpr.mReg), (int)aExpr.mOffset);
res += buf;
break;
default:
@ -103,9 +102,9 @@ void
RuleSet::Print(void(*aLog)(const char*))
{
char buf[96];
snprintf_literal(buf, "[%llx .. %llx]: let ",
(unsigned long long int)mAddr,
(unsigned long long int)(mAddr + mLen - 1));
sprintf(buf, "[%llx .. %llx]: let ",
(unsigned long long int)mAddr,
(unsigned long long int)(mAddr + mLen - 1));
string res = string(buf);
res += ShowRule("cfa", mCfaExpr);
res += " in";
@ -330,10 +329,10 @@ SecMap::PrepareRuleSets(uintptr_t aStart, size_t aLen)
mSummaryMaxAddr = mRuleSets[n-1].mAddr + mRuleSets[n-1].mLen - 1;
}
char buf[150];
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);
snprintf(buf, sizeof(buf),
"PrepareRuleSets: %d entries, smin/smax 0x%llx, 0x%llx\n",
(int)n, (unsigned long long int)mSummaryMinAddr,
(unsigned long long int)mSummaryMaxAddr);
buf[sizeof(buf)-1] = 0;
mLog(buf);
@ -534,8 +533,8 @@ class PriMap {
mSecMaps.insert(iter, aSecMap);
}
char buf[100];
snprintf_literal(buf, "AddSecMap: now have %d SecMaps\n",
(int)mSecMaps.size());
snprintf(buf, sizeof(buf), "AddSecMap: now have %d SecMaps\n",
(int)mSecMaps.size());
buf[sizeof(buf)-1] = 0;
mLog(buf);
}
@ -807,9 +806,9 @@ class PriMap {
#define LUL_LOG(_str) \
do { \
char buf[200]; \
snprintf_literal(buf, \
"LUL: pid %d tid %d lul-obj %p: %s", \
getpid(), gettid(), this, (_str)); \
snprintf(buf, sizeof(buf), \
"LUL: pid %d tid %d lul-obj %p: %s", \
getpid(), gettid(), this, (_str)); \
buf[sizeof(buf)-1] = 0; \
mLog(buf); \
} while (0)
@ -851,10 +850,10 @@ LUL::MaybeShowStats()
uint32_t n_new_Scanned = mStats.mScanned - mStatsPrevious.mScanned;
mStatsPrevious = mStats;
char buf[200];
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);
snprintf(buf, sizeof(buf),
"LUL frame stats: TOTAL %5u"
" CTX %4u CFI %4u SCAN %4u",
n_new, n_new_Context, n_new_CFI, n_new_Scanned);
buf[sizeof(buf)-1] = 0;
mLog(buf);
}
@ -882,9 +881,9 @@ LUL::NotifyAfterMap(uintptr_t aRXavma, size_t aSize,
mLog(":\n");
char buf[200];
snprintf_literal(buf, "NotifyMap %llx %llu %s\n",
(unsigned long long int)aRXavma, (unsigned long long int)aSize,
aFileName);
snprintf(buf, sizeof(buf), "NotifyMap %llx %llu %s\n",
(unsigned long long int)aRXavma, (unsigned long long int)aSize,
aFileName);
buf[sizeof(buf)-1] = 0;
mLog(buf);
@ -910,8 +909,8 @@ LUL::NotifyAfterMap(uintptr_t aRXavma, size_t aSize,
smap->PrepareRuleSets(aRXavma, aSize);
snprintf_literal(buf,
"NotifyMap got %lld entries\n", (long long int)smap->Size());
snprintf(buf, sizeof(buf),
"NotifyMap got %lld entries\n", (long long int)smap->Size());
buf[sizeof(buf)-1] = 0;
mLog(buf);
@ -933,8 +932,8 @@ LUL::NotifyExecutableArea(uintptr_t aRXavma, size_t aSize)
mLog(":\n");
char buf[200];
snprintf_literal(buf, "NotifyExecutableArea %llx %llu\n",
(unsigned long long int)aRXavma, (unsigned long long int)aSize);
snprintf(buf, sizeof(buf), "NotifyExecutableArea %llx %llu\n",
(unsigned long long int)aRXavma, (unsigned long long int)aSize);
buf[sizeof(buf)-1] = 0;
mLog(buf);
@ -955,9 +954,9 @@ LUL::NotifyBeforeUnmap(uintptr_t aRXavmaMin, uintptr_t aRXavmaMax)
mLog(":\n");
char buf[100];
snprintf_literal(buf, "NotifyUnmap %016llx-%016llx\n",
(unsigned long long int)aRXavmaMin,
(unsigned long long int)aRXavmaMax);
snprintf(buf, sizeof(buf), "NotifyUnmap %016llx-%016llx\n",
(unsigned long long int)aRXavmaMin,
(unsigned long long int)aRXavmaMax);
buf[sizeof(buf)-1] = 0;
mLog(buf);
@ -971,8 +970,8 @@ LUL::NotifyBeforeUnmap(uintptr_t aRXavmaMin, uintptr_t aRXavmaMax)
// contains valid code.
mSegArray->add(aRXavmaMin, aRXavmaMax, false);
snprintf_literal(buf, "NotifyUnmap: now have %d SecMaps\n",
(int)mPriMap->CountSecMaps());
snprintf(buf, sizeof(buf), "NotifyUnmap: now have %d SecMaps\n",
(int)mPriMap->CountSecMaps());
buf[sizeof(buf)-1] = 0;
mLog(buf);
}
@ -1144,23 +1143,23 @@ LUL::Unwind(/*OUT*/uintptr_t* aFramePCs,
char buf[300];
mLog("\n");
#if defined(LUL_ARCH_x64) || defined(LUL_ARCH_x86)
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(),
(int)regs.xbp.Valid(), (unsigned long long int)regs.xbp.Value());
snprintf(buf, sizeof(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(),
(int)regs.xbp.Valid(), (unsigned long long int)regs.xbp.Value());
buf[sizeof(buf)-1] = 0;
mLog(buf);
#elif defined(LUL_ARCH_arm)
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(),
(int)regs.r7.Valid(), (unsigned long long int)regs.r7.Value(),
(int)regs.r11.Valid(), (unsigned long long int)regs.r11.Value(),
(int)regs.r12.Valid(), (unsigned long long int)regs.r12.Value(),
(int)regs.r13.Valid(), (unsigned long long int)regs.r13.Value(),
(int)regs.r14.Valid(), (unsigned long long int)regs.r14.Value());
snprintf(buf, sizeof(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(),
(int)regs.r7.Valid(), (unsigned long long int)regs.r7.Value(),
(int)regs.r11.Valid(), (unsigned long long int)regs.r11.Value(),
(int)regs.r12.Valid(), (unsigned long long int)regs.r12.Value(),
(int)regs.r13.Valid(), (unsigned long long int)regs.r13.Value(),
(int)regs.r14.Valid(), (unsigned long long int)regs.r14.Value());
buf[sizeof(buf)-1] = 0;
mLog(buf);
#else
@ -1225,8 +1224,8 @@ LUL::Unwind(/*OUT*/uintptr_t* aFramePCs,
RuleSet* ruleset = mPriMap->Lookup(ia.Value());
if (DEBUG_MAIN) {
char buf[100];
snprintf_literal(buf, "ruleset for 0x%llx = %p\n",
(unsigned long long int)ia.Value(), ruleset);
snprintf(buf, sizeof(buf), "ruleset for 0x%llx = %p\n",
(unsigned long long int)ia.Value(), ruleset);
buf[sizeof(buf)-1] = 0;
mLog(buf);
}
@ -1625,13 +1624,13 @@ bool GetAndCheckStackTrace(LUL* aLUL, const char* dstring)
// Show the results.
char buf[200];
snprintf_literal(buf, "LULUnitTest: dstring = %s\n", dstring);
snprintf(buf, sizeof(buf), "LULUnitTest: dstring = %s\n", dstring);
buf[sizeof(buf)-1] = 0;
aLUL->mLog(buf);
snprintf_literal(buf,
"LULUnitTest: %d consistent, %d in dstring: %s\n",
(int)nConsistent, (int)strlen(dstring),
passed ? "PASS" : "FAIL");
snprintf(buf, sizeof(buf),
"LULUnitTest: %d consistent, %d in dstring: %s\n",
(int)nConsistent, (int)strlen(dstring),
passed ? "PASS" : "FAIL");
buf[sizeof(buf)-1] = 0;
aLUL->mLog(buf);

Просмотреть файл

@ -516,7 +516,7 @@ sp<NativeHandle> GonkBufferQueueConsumer::getSidebandStream() const {
return mCore->mSidebandStream;
}
void GonkBufferQueueConsumer::dumpToString(String8& result, const char* prefix) const {
void GonkBufferQueueConsumer::dump(String8& result, const char* prefix) const {
mCore->dump(result, prefix);
}

Просмотреть файл

@ -137,7 +137,7 @@ public:
virtual sp<NativeHandle> getSidebandStream() const;
// dump our state in a String
virtual void dumpToString(String8& result, const char* prefix) const;
virtual void dump(String8& result, const char* prefix) const;
// Added by mozilla
virtual mozilla::TemporaryRef<GonkBufferSlot::TextureClient> getTextureClientFromBuffer(ANativeWindowBuffer* buffer);

Просмотреть файл

@ -166,7 +166,7 @@ void GonkConsumerBase::dumpLocked(String8& result, const char* prefix) const {
result.appendFormat("%smAbandoned=%d\n", prefix, int(mAbandoned));
if (!mAbandoned) {
mConsumer->dumpToString(result, prefix);
mConsumer->dump(result, prefix);
}
}

Просмотреть файл

@ -405,7 +405,7 @@ public:
return stream;
}
virtual void dumpToString(String8& result, const char* prefix) const {
virtual void dump(String8& result, const char* prefix) const {
Parcel data, reply;
data.writeInterfaceToken(IGonkGraphicBufferConsumer::getInterfaceDescriptor());
data.writeString8(result);
@ -554,7 +554,7 @@ status_t BnGonkGraphicBufferConsumer::onTransact(
CHECK_INTERFACE(IGonkGraphicBufferConsumer, data, reply);
String8 result = data.readString8();
String8 prefix = data.readString8();
static_cast<IGonkGraphicBufferConsumer*>(this)->dumpToString(result, prefix);
static_cast<IGonkGraphicBufferConsumer*>(this)->dump(result, prefix);
reply->writeString8(result);
return NO_ERROR;
}

Просмотреть файл

@ -308,7 +308,7 @@ public:
virtual sp<NativeHandle> getSidebandStream() const = 0;
// dump state into a string
virtual void dumpToString(String8& result, const char* prefix) const = 0;
virtual void dump(String8& result, const char* prefix) const = 0;
// Added by mozilla
virtual mozilla::TemporaryRef<mozilla::layers::TextureClient>

Просмотреть файл

@ -52,7 +52,6 @@
#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"
@ -78,7 +77,6 @@ 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;
@ -1972,7 +1970,7 @@ case _value: eventName.AssignLiteral(_name) ; break
{
char buf[32];
snprintf_literal(buf,"UNKNOWN: %d",aGuiEvent->message);
sprintf(buf,"UNKNOWN: %d",aGuiEvent->message);
CopyASCIItoUTF16(buf, eventName);
}

Просмотреть файл

@ -15,6 +15,10 @@
#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,7 +46,6 @@
#define KP_START_USEC p_ustart_usec
#endif
#include "mozilla/Snprintf.h"
#include "mozilla/TimeStamp.h"
#include "nsCRT.h"
#include "prprf.h"
@ -272,7 +271,7 @@ ComputeProcessUptimeThread(void* aTime)
}
char threadStat[40];
snprintf_literal(threadStat, "/proc/self/task/%d/stat", (pid_t)syscall(__NR_gettid));
sprintf(threadStat, "/proc/self/task/%d/stat", (pid_t)syscall(__NR_gettid));
uint64_t threadJiffies = JiffiesSinceBoot(threadStat);
uint64_t selfJiffies = JiffiesSinceBoot("/proc/self/stat");

Просмотреть файл

@ -14,8 +14,6 @@
#include <stdio.h>
#include <stdarg.h>
#include "mozilla/Snprintf.h"
#ifdef XP_WIN
#include <io.h>
#include <windows.h>
@ -314,9 +312,8 @@ copy_stderr_to_file(const char* aFile)
if (sStderrCopy) {
return;
}
size_t buflen = strlen(aFile) + 16;
char* buf = (char*)malloc(buflen);
snprintf(buf, buflen, "%s.%u", aFile, (uint32_t)getpid());
char* buf = (char*)malloc(strlen(aFile) + 16);
sprintf(buf, "%s.%u", aFile, (uint32_t)getpid());
sStderrCopy = fopen(buf, "w");
free(buf);
set_stderr_callback(stderr_to_file);