mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
Bug 1251364 - Remove our custom printf implementation (jsprf.cpp). r=tromey
This commit is contained in:
parent
5800e6b7d7
commit
c955774058
@ -119,7 +119,7 @@ AstDecodeFail(AstDecodeContext& c, const char* str)
|
||||
{
|
||||
uint32_t offset = c.d.currentOffset();
|
||||
char offsetStr[sizeof "4294967295"];
|
||||
JS_snprintf(offsetStr, sizeof offsetStr, "%" PRIu32, offset);
|
||||
snprintf(offsetStr, sizeof offsetStr, "%" PRIu32, offset);
|
||||
JS_ReportErrorNumber(c.cx, GetErrorMessage, nullptr, JSMSG_WASM_DECODE_FAIL, offsetStr, str);
|
||||
return false;
|
||||
}
|
||||
|
@ -129,11 +129,11 @@ ErrorBadArgs(JSContext* cx)
|
||||
}
|
||||
|
||||
static inline bool
|
||||
ErrorWrongTypeArg(JSContext* cx, size_t argIndex, Handle<TypeDescr*> typeDescr)
|
||||
ErrorWrongTypeArg(JSContext* cx, unsigned argIndex, Handle<TypeDescr*> typeDescr)
|
||||
{
|
||||
MOZ_ASSERT(argIndex < 10);
|
||||
char charArgIndex[2];
|
||||
JS_snprintf(charArgIndex, sizeof charArgIndex, "%d", argIndex);
|
||||
snprintf(charArgIndex, sizeof charArgIndex, "%u", argIndex);
|
||||
|
||||
HeapSlot& typeNameSlot = typeDescr->getReservedSlotRef(JS_DESCR_SLOT_STRING_REPR);
|
||||
char* typeNameStr = JS_EncodeString(cx, typeNameSlot.toString());
|
||||
|
@ -318,8 +318,8 @@ GC(JSContext* cx, unsigned argc, Value* vp)
|
||||
|
||||
char buf[256] = { '\0' };
|
||||
#ifndef JS_MORE_DETERMINISTIC
|
||||
JS_snprintf(buf, sizeof(buf), "before %" PRIuSIZE ", after %" PRIuSIZE "\n",
|
||||
preBytes, cx->runtime()->gc.usage.gcBytes());
|
||||
snprintf(buf, sizeof(buf), "before %" PRIuSIZE ", after %" PRIuSIZE "\n",
|
||||
preBytes, cx->runtime()->gc.usage.gcBytes());
|
||||
#endif
|
||||
JSString* str = JS_NewStringCopyZ(cx, buf);
|
||||
if (!str)
|
||||
@ -2401,7 +2401,7 @@ ObjectAddress(JSContext* cx, unsigned argc, Value* vp)
|
||||
#else
|
||||
void* ptr = js::UncheckedUnwrap(&args[0].toObject(), true);
|
||||
char buffer[64];
|
||||
JS_snprintf(buffer, sizeof(buffer), "%p", ptr);
|
||||
snprintf(buffer, sizeof(buffer), "%p", ptr);
|
||||
|
||||
JSString* str = JS_NewStringCopyZ(cx, buffer);
|
||||
if (!str)
|
||||
@ -2442,7 +2442,7 @@ SharedAddress(JSContext* cx, unsigned argc, Value* vp)
|
||||
}
|
||||
char buffer[64];
|
||||
uint32_t nchar =
|
||||
JS_snprintf(buffer, sizeof(buffer), "%p",
|
||||
snprintf(buffer, sizeof(buffer), "%p",
|
||||
obj->as<SharedArrayBufferObject>().dataPointerShared().unwrap(/*safeish*/));
|
||||
|
||||
JSString* str = JS_NewStringCopyN(cx, buffer, nchar);
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/SizePrintfMacros.h"
|
||||
#include "mozilla/Vector.h"
|
||||
|
||||
#include <limits>
|
||||
@ -62,7 +63,6 @@ GetDeflatedUTF8StringLength(JSContext* maybecx, const CharT* chars,
|
||||
size_t nbytes;
|
||||
const CharT* end;
|
||||
unsigned c, c2;
|
||||
char buffer[10];
|
||||
|
||||
nbytes = nchars;
|
||||
for (end = chars + nchars; chars != end; chars++) {
|
||||
@ -94,7 +94,8 @@ GetDeflatedUTF8StringLength(JSContext* maybecx, const CharT* chars,
|
||||
bad_surrogate:
|
||||
if (maybecx) {
|
||||
js::gc::AutoSuppressGC suppress(maybecx);
|
||||
JS_snprintf(buffer, 10, "0x%x", c);
|
||||
char buffer[10];
|
||||
snprintf(buffer, sizeof(buffer), "0x%x", c);
|
||||
JS_ReportErrorFlagsAndNumber(maybecx, JSREPORT_ERROR, GetErrorMessage,
|
||||
nullptr, JSMSG_BAD_SURROGATE_CHAR, buffer);
|
||||
}
|
||||
@ -1120,7 +1121,7 @@ ConvError(JSContext* cx, const char* expectedStr, HandleValue actual,
|
||||
MOZ_ASSERT(!funObj);
|
||||
|
||||
char indexStr[16];
|
||||
JS_snprintf(indexStr, 16, "%u", arrIndex);
|
||||
snprintf(indexStr, sizeof(indexStr), "%u", arrIndex);
|
||||
|
||||
AutoString arrSource;
|
||||
JSAutoByteString arrBytes;
|
||||
@ -1177,7 +1178,7 @@ ConvError(JSContext* cx, const char* expectedStr, HandleValue actual,
|
||||
MOZ_ASSERT(funObj);
|
||||
|
||||
char indexStr[16];
|
||||
JS_snprintf(indexStr, 16, "%u", argIndex + 1);
|
||||
snprintf(indexStr, sizeof(indexStr), "%u", argIndex + 1);
|
||||
|
||||
AutoString funSource;
|
||||
JSAutoByteString funBytes;
|
||||
@ -1260,7 +1261,7 @@ ArgumentConvError(JSContext* cx, HandleValue actual, const char* funStr,
|
||||
return false;
|
||||
|
||||
char indexStr[16];
|
||||
JS_snprintf(indexStr, 16, "%u", argIndex + 1);
|
||||
snprintf(indexStr, sizeof(indexStr), "%u", argIndex + 1);
|
||||
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
CTYPESMSG_CONV_ERROR_ARG, valStr, indexStr, funStr);
|
||||
@ -1289,9 +1290,9 @@ ArrayLengthMismatch(JSContext* cx, unsigned expectedLength, HandleObject arrObj,
|
||||
return false;
|
||||
|
||||
char expectedLengthStr[16];
|
||||
JS_snprintf(expectedLengthStr, 16, "%u", expectedLength);
|
||||
snprintf(expectedLengthStr, sizeof(expectedLengthStr), "%u", expectedLength);
|
||||
char actualLengthStr[16];
|
||||
JS_snprintf(actualLengthStr, 16, "%u", actualLength);
|
||||
snprintf(actualLengthStr, sizeof(actualLengthStr), "%u", actualLength);
|
||||
|
||||
AutoString arrSource;
|
||||
JSAutoByteString arrBytes;
|
||||
@ -1319,9 +1320,9 @@ ArrayLengthOverflow(JSContext* cx, unsigned expectedLength, HandleObject arrObj,
|
||||
return false;
|
||||
|
||||
char expectedLengthStr[16];
|
||||
JS_snprintf(expectedLengthStr, 16, "%u", expectedLength);
|
||||
snprintf(expectedLengthStr, sizeof(expectedLengthStr), "%u", expectedLength);
|
||||
char actualLengthStr[16];
|
||||
JS_snprintf(actualLengthStr, 16, "%u", actualLength);
|
||||
snprintf(actualLengthStr, sizeof(actualLengthStr), "%u", actualLength);
|
||||
|
||||
AutoString arrSource;
|
||||
JSAutoByteString arrBytes;
|
||||
@ -1426,9 +1427,9 @@ FieldCountMismatch(JSContext* cx,
|
||||
return false;
|
||||
|
||||
char expectedCountStr[16];
|
||||
JS_snprintf(expectedCountStr, 16, "%u", expectedCount);
|
||||
snprintf(expectedCountStr, sizeof(expectedCountStr), "%u", expectedCount);
|
||||
char actualCountStr[16];
|
||||
JS_snprintf(actualCountStr, 16, "%u", actualCount);
|
||||
snprintf(actualCountStr, sizeof(actualCountStr), "%u", actualCount);
|
||||
|
||||
JSAutoByteString posBytes;
|
||||
const char* posStr;
|
||||
@ -1459,7 +1460,7 @@ FieldDescriptorCountError(JSContext* cx, Value val, size_t length)
|
||||
return false;
|
||||
|
||||
char lengthStr[16];
|
||||
JS_snprintf(lengthStr, 16, "%u", length);
|
||||
snprintf(lengthStr, sizeof(lengthStr), "%" PRIuSIZE, length);
|
||||
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
CTYPESMSG_FIELD_DESC_COUNT, valStr, lengthStr);
|
||||
@ -1594,9 +1595,9 @@ FunctionArgumentLengthMismatch(JSContext* cx,
|
||||
return false;
|
||||
|
||||
char expectedCountStr[16];
|
||||
JS_snprintf(expectedCountStr, 16, "%u", expectedCount);
|
||||
snprintf(expectedCountStr, sizeof(expectedCountStr), "%u", expectedCount);
|
||||
char actualCountStr[16];
|
||||
JS_snprintf(actualCountStr, 16, "%u", actualCount);
|
||||
snprintf(actualCountStr, sizeof(actualCountStr), "%u", actualCount);
|
||||
|
||||
const char* variadicStr = isVariadic ? " or more": "";
|
||||
|
||||
@ -1617,7 +1618,7 @@ FunctionArgumentTypeError(JSContext* cx,
|
||||
return false;
|
||||
|
||||
char indexStr[16];
|
||||
JS_snprintf(indexStr, 16, "%u", index + 1);
|
||||
snprintf(indexStr, sizeof(indexStr), "%u", index + 1);
|
||||
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
CTYPESMSG_ARG_TYPE_ERROR, indexStr, reason, valStr);
|
||||
@ -1723,10 +1724,10 @@ static bool
|
||||
InvalidIndexRangeError(JSContext* cx, size_t index, size_t length)
|
||||
{
|
||||
char indexStr[16];
|
||||
JS_snprintf(indexStr, 16, "%u", index);
|
||||
snprintf(indexStr, sizeof(indexStr), "%" PRIuSIZE, index);
|
||||
|
||||
char lengthStr[16];
|
||||
JS_snprintf(lengthStr, 16, "%u", length);
|
||||
snprintf(lengthStr, sizeof(lengthStr), "%" PRIuSIZE, length);
|
||||
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
CTYPESMSG_INVALID_RANGE, indexStr, lengthStr);
|
||||
@ -1883,8 +1884,8 @@ SizeMismatchCastError(JSContext* cx,
|
||||
|
||||
char sourceSizeStr[16];
|
||||
char targetSizeStr[16];
|
||||
JS_snprintf(sourceSizeStr, 16, "%u", sourceSize);
|
||||
JS_snprintf(targetSizeStr, 16, "%u", targetSize);
|
||||
snprintf(sourceSizeStr, sizeof(sourceSizeStr), "%" PRIuSIZE, sourceSize);
|
||||
snprintf(targetSizeStr, sizeof(targetSizeStr), "%" PRIuSIZE, targetSize);
|
||||
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
CTYPESMSG_SIZE_MISMATCH_CAST,
|
||||
@ -1916,7 +1917,7 @@ VariadicArgumentTypeError(JSContext* cx, uint32_t index, HandleValue actual)
|
||||
return false;
|
||||
|
||||
char indexStr[16];
|
||||
JS_snprintf(indexStr, 16, "%u", index + 1);
|
||||
snprintf(indexStr, sizeof(indexStr), "%u", index + 1);
|
||||
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
CTYPESMSG_VARG_TYPE_ERROR, indexStr, valStr);
|
||||
@ -6305,7 +6306,7 @@ StructType::ConstructData(JSContext* cx,
|
||||
size_t count = fields->count();
|
||||
if (count >= 2) {
|
||||
char fieldLengthStr[32];
|
||||
JS_snprintf(fieldLengthStr, 32, "0, 1, or %u", count);
|
||||
snprintf(fieldLengthStr, sizeof(fieldLengthStr), "0, 1, or %" PRIuSIZE, count);
|
||||
return ArgumentLengthError(cx, "StructType constructor", fieldLengthStr,
|
||||
"s");
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ void
|
||||
AppendUInt(mozilla::Vector<T, N, AP>& v, unsigned n)
|
||||
{
|
||||
char array[16];
|
||||
size_t alen = JS_snprintf(array, 16, "%u", n);
|
||||
size_t alen = snprintf(array, sizeof(array), "%u", n);
|
||||
size_t vlen = v.length();
|
||||
if (!v.resize(vlen + alen))
|
||||
return;
|
||||
|
@ -55,7 +55,7 @@ class NameResolver
|
||||
/* Append a number to buf. */
|
||||
bool appendNumber(double n) {
|
||||
char number[30];
|
||||
int digits = JS_snprintf(number, sizeof(number), "%g", n);
|
||||
int digits = snprintf(number, sizeof(number), "%g", n);
|
||||
return buf->append(number, digits);
|
||||
}
|
||||
|
||||
|
@ -341,11 +341,11 @@ Statistics::formatCompactSliceMessage() const
|
||||
"GC Slice %u - Pause: %.3fms of %s budget (@ %.3fms); Reason: %s; Reset: %s%s; Times: ";
|
||||
char buffer[1024];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
JS_snprintf(buffer, sizeof(buffer), format, index,
|
||||
t(slice.duration()), budgetDescription, t(slice.start - slices[0].start),
|
||||
ExplainReason(slice.reason),
|
||||
slice.resetReason ? "yes - " : "no",
|
||||
slice.resetReason ? slice.resetReason : "");
|
||||
snprintf(buffer, sizeof(buffer), format, index,
|
||||
t(slice.duration()), budgetDescription, t(slice.start - slices[0].start),
|
||||
ExplainReason(slice.reason),
|
||||
slice.resetReason ? "yes - " : "no",
|
||||
slice.resetReason ? slice.resetReason : "");
|
||||
|
||||
FragmentVector fragments;
|
||||
if (!fragments.append(DuplicateString(buffer)) ||
|
||||
@ -373,34 +373,34 @@ Statistics::formatCompactSummaryMessage() const
|
||||
|
||||
char buffer[1024];
|
||||
if (!nonincrementalReason_) {
|
||||
JS_snprintf(buffer, sizeof(buffer),
|
||||
"Max Pause: %.3fms; MMU 20ms: %.1f%%; MMU 50ms: %.1f%%; Total: %.3fms; ",
|
||||
t(longest), mmu20 * 100., mmu50 * 100., t(total));
|
||||
snprintf(buffer, sizeof(buffer),
|
||||
"Max Pause: %.3fms; MMU 20ms: %.1f%%; MMU 50ms: %.1f%%; Total: %.3fms; ",
|
||||
t(longest), mmu20 * 100., mmu50 * 100., t(total));
|
||||
} else {
|
||||
JS_snprintf(buffer, sizeof(buffer), "Non-Incremental: %.3fms (%s); ",
|
||||
t(total), nonincrementalReason_);
|
||||
snprintf(buffer, sizeof(buffer), "Non-Incremental: %.3fms (%s); ",
|
||||
t(total), nonincrementalReason_);
|
||||
}
|
||||
if (!fragments.append(DuplicateString(buffer)))
|
||||
return UniqueChars(nullptr);
|
||||
|
||||
JS_snprintf(buffer, sizeof(buffer),
|
||||
"Zones: %d of %d (-%d); Compartments: %d of %d (-%d); HeapSize: %.3f MiB; "\
|
||||
"HeapChange (abs): %+d (%d); ",
|
||||
zoneStats.collectedZoneCount, zoneStats.zoneCount, zoneStats.sweptZoneCount,
|
||||
zoneStats.collectedCompartmentCount, zoneStats.compartmentCount,
|
||||
zoneStats.sweptCompartmentCount,
|
||||
double(preBytes) / bytesPerMiB,
|
||||
counts[STAT_NEW_CHUNK] - counts[STAT_DESTROY_CHUNK],
|
||||
counts[STAT_NEW_CHUNK] + counts[STAT_DESTROY_CHUNK]);
|
||||
snprintf(buffer, sizeof(buffer),
|
||||
"Zones: %d of %d (-%d); Compartments: %d of %d (-%d); HeapSize: %.3f MiB; "\
|
||||
"HeapChange (abs): %+d (%d); ",
|
||||
zoneStats.collectedZoneCount, zoneStats.zoneCount, zoneStats.sweptZoneCount,
|
||||
zoneStats.collectedCompartmentCount, zoneStats.compartmentCount,
|
||||
zoneStats.sweptCompartmentCount,
|
||||
double(preBytes) / bytesPerMiB,
|
||||
counts[STAT_NEW_CHUNK] - counts[STAT_DESTROY_CHUNK],
|
||||
counts[STAT_NEW_CHUNK] + counts[STAT_DESTROY_CHUNK]);
|
||||
if (!fragments.append(DuplicateString(buffer)))
|
||||
return UniqueChars(nullptr);
|
||||
|
||||
MOZ_ASSERT_IF(counts[STAT_ARENA_RELOCATED], gckind == GC_SHRINK);
|
||||
if (gckind == GC_SHRINK) {
|
||||
JS_snprintf(buffer, sizeof(buffer),
|
||||
"Kind: %s; Relocated: %.3f MiB; ",
|
||||
ExplainInvocationKind(gckind),
|
||||
double(ArenaSize * counts[STAT_ARENA_RELOCATED]) / bytesPerMiB);
|
||||
snprintf(buffer, sizeof(buffer),
|
||||
"Kind: %s; Relocated: %.3f MiB; ",
|
||||
ExplainInvocationKind(gckind),
|
||||
double(ArenaSize * counts[STAT_ARENA_RELOCATED]) / bytesPerMiB);
|
||||
if (!fragments.append(DuplicateString(buffer)))
|
||||
return UniqueChars(nullptr);
|
||||
}
|
||||
@ -425,13 +425,13 @@ Statistics::formatCompactSlicePhaseTimes(const PhaseTimeTable phaseTimes) const
|
||||
int64_t ownTime = phaseTimes[dagSlot][phase];
|
||||
int64_t childTime = SumChildTimes(dagSlot, phase, phaseTimes);
|
||||
if (ownTime > MaxUnaccountedTimeUS) {
|
||||
JS_snprintf(buffer, sizeof(buffer), "%s: %.3fms", phases[phase].name, t(ownTime));
|
||||
snprintf(buffer, sizeof(buffer), "%s: %.3fms", phases[phase].name, t(ownTime));
|
||||
if (!fragments.append(DuplicateString(buffer)))
|
||||
return UniqueChars(nullptr);
|
||||
|
||||
if (childTime && (ownTime - childTime) > MaxUnaccountedTimeUS) {
|
||||
MOZ_ASSERT(level < 3);
|
||||
JS_snprintf(buffer, sizeof(buffer), "%s: %.3fms", "Other", t(ownTime - childTime));
|
||||
snprintf(buffer, sizeof(buffer), "%s: %.3fms", "Other", t(ownTime - childTime));
|
||||
if (!fragments.append(DuplicateString(buffer)))
|
||||
return UniqueChars(nullptr);
|
||||
}
|
||||
@ -492,22 +492,22 @@ Statistics::formatDetailedDescription()
|
||||
";
|
||||
char buffer[1024];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
JS_snprintf(buffer, sizeof(buffer), format,
|
||||
ExplainInvocationKind(gckind),
|
||||
ExplainReason(slices[0].reason),
|
||||
nonincrementalReason_ ? "no - " : "yes",
|
||||
nonincrementalReason_ ? nonincrementalReason_ : "",
|
||||
zoneStats.collectedZoneCount, zoneStats.zoneCount, zoneStats.sweptZoneCount,
|
||||
zoneStats.collectedCompartmentCount, zoneStats.compartmentCount,
|
||||
zoneStats.sweptCompartmentCount,
|
||||
counts[STAT_MINOR_GC],
|
||||
counts[STAT_STOREBUFFER_OVERFLOW],
|
||||
mmu20 * 100., mmu50 * 100.,
|
||||
t(sccTotal), t(sccLongest),
|
||||
double(preBytes) / bytesPerMiB,
|
||||
counts[STAT_NEW_CHUNK] - counts[STAT_DESTROY_CHUNK], counts[STAT_NEW_CHUNK] +
|
||||
counts[STAT_DESTROY_CHUNK],
|
||||
double(ArenaSize * counts[STAT_ARENA_RELOCATED]) / bytesPerMiB);
|
||||
snprintf(buffer, sizeof(buffer), format,
|
||||
ExplainInvocationKind(gckind),
|
||||
ExplainReason(slices[0].reason),
|
||||
nonincrementalReason_ ? "no - " : "yes",
|
||||
nonincrementalReason_ ? nonincrementalReason_ : "",
|
||||
zoneStats.collectedZoneCount, zoneStats.zoneCount, zoneStats.sweptZoneCount,
|
||||
zoneStats.collectedCompartmentCount, zoneStats.compartmentCount,
|
||||
zoneStats.sweptCompartmentCount,
|
||||
counts[STAT_MINOR_GC],
|
||||
counts[STAT_STOREBUFFER_OVERFLOW],
|
||||
mmu20 * 100., mmu50 * 100.,
|
||||
t(sccTotal), t(sccLongest),
|
||||
double(preBytes) / bytesPerMiB,
|
||||
counts[STAT_NEW_CHUNK] - counts[STAT_DESTROY_CHUNK], counts[STAT_NEW_CHUNK] +
|
||||
counts[STAT_DESTROY_CHUNK],
|
||||
double(ArenaSize * counts[STAT_ARENA_RELOCATED]) / bytesPerMiB);
|
||||
return DuplicateString(buffer);
|
||||
}
|
||||
|
||||
@ -528,12 +528,12 @@ Statistics::formatDetailedSliceDescription(unsigned i, const SliceData& slice)
|
||||
";
|
||||
char buffer[1024];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
JS_snprintf(buffer, sizeof(buffer), format, i,
|
||||
ExplainReason(slice.reason),
|
||||
slice.resetReason ? "yes - " : "no", slice.resetReason ? slice.resetReason : "",
|
||||
gc::StateName(slice.initialState), gc::StateName(slice.finalState),
|
||||
uint64_t(slice.endFaults - slice.startFaults),
|
||||
t(slice.duration()), budgetDescription, t(slice.start - slices[0].start));
|
||||
snprintf(buffer, sizeof(buffer), format, i,
|
||||
ExplainReason(slice.reason),
|
||||
slice.resetReason ? "yes - " : "no", slice.resetReason ? slice.resetReason : "",
|
||||
gc::StateName(slice.initialState), gc::StateName(slice.finalState),
|
||||
uint64_t(slice.endFaults - slice.startFaults),
|
||||
t(slice.duration()), budgetDescription, t(slice.start - slices[0].start));
|
||||
return DuplicateString(buffer);
|
||||
}
|
||||
|
||||
@ -555,15 +555,15 @@ Statistics::formatDetailedPhaseTimes(const PhaseTimeTable phaseTimes)
|
||||
int64_t ownTime = phaseTimes[dagSlot][phase];
|
||||
int64_t childTime = SumChildTimes(dagSlot, phase, phaseTimes);
|
||||
if (ownTime > 0) {
|
||||
JS_snprintf(buffer, sizeof(buffer), " %s%s: %.3fms\n",
|
||||
LevelToIndent[level], phases[phase].name, t(ownTime));
|
||||
snprintf(buffer, sizeof(buffer), " %s%s: %.3fms\n",
|
||||
LevelToIndent[level], phases[phase].name, t(ownTime));
|
||||
if (!fragments.append(DuplicateString(buffer)))
|
||||
return UniqueChars(nullptr);
|
||||
|
||||
if (childTime && (ownTime - childTime) > MaxUnaccountedChildTimeUS) {
|
||||
MOZ_ASSERT(level < 3);
|
||||
JS_snprintf(buffer, sizeof(buffer), " %s%s: %.3fms\n",
|
||||
LevelToIndent[level + 1], "Other", t(ownTime - childTime));
|
||||
snprintf(buffer, sizeof(buffer), " %s%s: %.3fms\n",
|
||||
LevelToIndent[level + 1], "Other", t(ownTime - childTime));
|
||||
if (!fragments.append(DuplicateString(buffer)))
|
||||
return UniqueChars(nullptr);
|
||||
}
|
||||
@ -586,7 +586,7 @@ Statistics::formatDetailedTotals()
|
||||
";
|
||||
char buffer[1024];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
JS_snprintf(buffer, sizeof(buffer), format, t(total), t(longest));
|
||||
snprintf(buffer, sizeof(buffer), format, t(total), t(longest));
|
||||
return DuplicateString(buffer);
|
||||
}
|
||||
|
||||
@ -657,23 +657,23 @@ Statistics::formatJsonDescription(uint64_t timestamp)
|
||||
"\"removed_chunks\":%d,";
|
||||
char buffer[1024];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
JS_snprintf(buffer, sizeof(buffer), format,
|
||||
(unsigned long long)timestamp,
|
||||
longest / 1000, longest % 1000,
|
||||
total / 1000, total % 1000,
|
||||
zoneStats.collectedZoneCount,
|
||||
zoneStats.zoneCount,
|
||||
zoneStats.compartmentCount,
|
||||
counts[STAT_MINOR_GC],
|
||||
counts[STAT_STOREBUFFER_OVERFLOW],
|
||||
int(mmu20 * 100),
|
||||
int(mmu50 * 100),
|
||||
sccTotal / 1000, sccTotal % 1000,
|
||||
sccLongest / 1000, sccLongest % 1000,
|
||||
nonincrementalReason_ ? nonincrementalReason_ : "none",
|
||||
unsigned(preBytes / 1024 / 1024),
|
||||
counts[STAT_NEW_CHUNK],
|
||||
counts[STAT_DESTROY_CHUNK]);
|
||||
snprintf(buffer, sizeof(buffer), format,
|
||||
(unsigned long long)timestamp,
|
||||
longest / 1000, longest % 1000,
|
||||
total / 1000, total % 1000,
|
||||
zoneStats.collectedZoneCount,
|
||||
zoneStats.zoneCount,
|
||||
zoneStats.compartmentCount,
|
||||
counts[STAT_MINOR_GC],
|
||||
counts[STAT_STOREBUFFER_OVERFLOW],
|
||||
int(mmu20 * 100),
|
||||
int(mmu50 * 100),
|
||||
sccTotal / 1000, sccTotal % 1000,
|
||||
sccLongest / 1000, sccLongest % 1000,
|
||||
nonincrementalReason_ ? nonincrementalReason_ : "none",
|
||||
unsigned(preBytes / 1024 / 1024),
|
||||
counts[STAT_NEW_CHUNK],
|
||||
counts[STAT_DESTROY_CHUNK]);
|
||||
return DuplicateString(buffer);
|
||||
}
|
||||
|
||||
@ -699,17 +699,17 @@ Statistics::formatJsonSliceDescription(unsigned i, const SliceData& slice)
|
||||
"\"end_timestamp\":%llu,";
|
||||
char buffer[1024];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
JS_snprintf(buffer, sizeof(buffer), format,
|
||||
i,
|
||||
duration / 1000, duration % 1000,
|
||||
when / 1000, when % 1000,
|
||||
ExplainReason(slice.reason),
|
||||
gc::StateName(slice.initialState),
|
||||
gc::StateName(slice.finalState),
|
||||
budgetDescription,
|
||||
pageFaults,
|
||||
slice.start,
|
||||
slice.end);
|
||||
snprintf(buffer, sizeof(buffer), format,
|
||||
i,
|
||||
duration / 1000, duration % 1000,
|
||||
when / 1000, when % 1000,
|
||||
ExplainReason(slice.reason),
|
||||
gc::StateName(slice.initialState),
|
||||
gc::StateName(slice.finalState),
|
||||
budgetDescription,
|
||||
pageFaults,
|
||||
slice.start,
|
||||
slice.end);
|
||||
return DuplicateString(buffer);
|
||||
}
|
||||
|
||||
@ -740,8 +740,8 @@ Statistics::formatJsonPhaseTimes(const PhaseTimeTable phaseTimes)
|
||||
|
||||
UniqueChars name = FilterJsonKey(phases[phase].name);
|
||||
int64_t ownTime = phaseTimes[dagSlot][phase];
|
||||
JS_snprintf(buffer, sizeof(buffer), "\"%s\":%llu.%03llu",
|
||||
name.get(), ownTime / 1000, ownTime % 1000);
|
||||
snprintf(buffer, sizeof(buffer), "\"%s\":%" PRId64 ".%03" PRId64,
|
||||
name.get(), ownTime / 1000, ownTime % 1000);
|
||||
|
||||
if (!fragments.append(DuplicateString(buffer)))
|
||||
return UniqueChars(nullptr);
|
||||
|
@ -96,10 +96,10 @@ JS::CallbackTracer::getTracingEdgeName(char* buffer, size_t bufferSize)
|
||||
return;
|
||||
}
|
||||
if (contextIndex_ != InvalidIndex) {
|
||||
JS_snprintf(buffer, bufferSize, "%s[%lu]", contextName_, contextIndex_);
|
||||
snprintf(buffer, bufferSize, "%s[%" PRIuSIZE "]", contextName_, contextIndex_);
|
||||
return;
|
||||
}
|
||||
JS_snprintf(buffer, bufferSize, "%s", contextName_);
|
||||
snprintf(buffer, bufferSize, "%s", contextName_);
|
||||
}
|
||||
|
||||
|
||||
@ -375,9 +375,9 @@ JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc, void* thing,
|
||||
PutEscapedString(buf, bufsize, fun->displayAtom(), 0);
|
||||
}
|
||||
} else if (obj->getClass()->flags & JSCLASS_HAS_PRIVATE) {
|
||||
JS_snprintf(buf, bufsize, " %p", obj->as<NativeObject>().getPrivate());
|
||||
snprintf(buf, bufsize, " %p", obj->as<NativeObject>().getPrivate());
|
||||
} else {
|
||||
JS_snprintf(buf, bufsize, " <no private>");
|
||||
snprintf(buf, bufsize, " <no private>");
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -385,7 +385,7 @@ JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc, void* thing,
|
||||
case JS::TraceKind::Script:
|
||||
{
|
||||
JSScript* script = static_cast<JSScript*>(thing);
|
||||
JS_snprintf(buf, bufsize, " %s:%" PRIuSIZE, script->filename(), script->lineno());
|
||||
snprintf(buf, bufsize, " %s:%" PRIuSIZE, script->filename(), script->lineno());
|
||||
break;
|
||||
}
|
||||
|
||||
@ -399,7 +399,7 @@ JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc, void* thing,
|
||||
bool willFit = str->length() + strlen("<length > ") +
|
||||
CountDecimalDigits(str->length()) < bufsize;
|
||||
|
||||
n = JS_snprintf(buf, bufsize, "<length %" PRIuSIZE "%s> ",
|
||||
n = snprintf(buf, bufsize, "<length %" PRIuSIZE "%s> ",
|
||||
str->length(),
|
||||
willFit ? "" : " (truncated)");
|
||||
buf += n;
|
||||
@ -407,7 +407,7 @@ JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc, void* thing,
|
||||
|
||||
PutEscapedString(buf, bufsize, &str->asLinear(), 0);
|
||||
} else {
|
||||
JS_snprintf(buf, bufsize, "<rope: length %" PRIuSIZE ">", str->length());
|
||||
snprintf(buf, bufsize, "<rope: length %" PRIuSIZE ">", str->length());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -421,10 +421,10 @@ JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc, void* thing,
|
||||
bufsize--;
|
||||
PutEscapedString(buf, bufsize, &desc->asLinear(), 0);
|
||||
} else {
|
||||
JS_snprintf(buf, bufsize, "<nonlinear desc>");
|
||||
snprintf(buf, bufsize, "<nonlinear desc>");
|
||||
}
|
||||
} else {
|
||||
JS_snprintf(buf, bufsize, "<null>");
|
||||
snprintf(buf, bufsize, "<null>");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ AssertMarkedOrAllocated(const EdgeValue& edge)
|
||||
return;
|
||||
|
||||
char msgbuf[1024];
|
||||
JS_snprintf(msgbuf, sizeof(msgbuf), "[barrier verifier] Unmarked edge: %s", edge.label);
|
||||
snprintf(msgbuf, sizeof(msgbuf), "[barrier verifier] Unmarked edge: %s", edge.label);
|
||||
MOZ_ReportAssertionFailure(msgbuf, __FILE__, __LINE__);
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
@ -1152,13 +1152,13 @@ InitFromBailout(JSContext* cx, HandleScript caller, jsbytecode* callerPC,
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
JS_snprintf(buf, len, "%s %s %s on line %u of %s:%" PRIuSIZE,
|
||||
BailoutKindString(bailoutKind),
|
||||
resumeAfter ? "after" : "at",
|
||||
CodeName[op],
|
||||
PCToLineNumber(script, pc),
|
||||
filename,
|
||||
script->lineno());
|
||||
snprintf(buf, len, "%s %s %s on line %u of %s:%" PRIuSIZE,
|
||||
BailoutKindString(bailoutKind),
|
||||
resumeAfter ? "after" : "at",
|
||||
CodeName[op],
|
||||
PCToLineNumber(script, pc),
|
||||
filename,
|
||||
script->lineno());
|
||||
cx->runtime()->spsProfiler.markEvent(buf);
|
||||
js_free(buf);
|
||||
}
|
||||
|
@ -4751,8 +4751,8 @@ CodeGenerator::maybeCreateScriptCounts()
|
||||
JSScript* innerScript = block->info().script();
|
||||
description = (char*) js_calloc(200);
|
||||
if (description) {
|
||||
JS_snprintf(description, 200, "%s:%" PRIuSIZE,
|
||||
innerScript->filename(), innerScript->lineno());
|
||||
snprintf(description, 200, "%s:%" PRIuSIZE,
|
||||
innerScript->filename(), innerScript->lineno());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -178,14 +178,14 @@ IonSpewer::init()
|
||||
#endif
|
||||
|
||||
size_t len;
|
||||
len = JS_snprintf(jsonBuffer, bufferLength, JIT_SPEW_DIR "/ion%" PRIuSIZE ".json", pid);
|
||||
len = snprintf(jsonBuffer, bufferLength, JIT_SPEW_DIR "/ion%" PRIuSIZE ".json", pid);
|
||||
if (bufferLength <= len) {
|
||||
fprintf(stderr, "Warning: IonSpewer::init: Cannot serialize file name.");
|
||||
return false;
|
||||
}
|
||||
jsonFilename = jsonBuffer;
|
||||
|
||||
len = JS_snprintf(c1Buffer, bufferLength, JIT_SPEW_DIR "/ion%" PRIuSIZE ".cfg", pid);
|
||||
len = snprintf(c1Buffer, bufferLength, JIT_SPEW_DIR "/ion%" PRIuSIZE ".cfg", pid);
|
||||
if (bufferLength <= len) {
|
||||
fprintf(stderr, "Warning: IonSpewer::init: Cannot serialize file name.");
|
||||
return false;
|
||||
|
@ -330,7 +330,7 @@ JitcodeGlobalEntry::createScriptString(JSContext* cx, JSScript* script, size_t*
|
||||
size_t linenoLength = 0;
|
||||
char linenoStr[15];
|
||||
if (hasName || (script->functionNonDelazifying() || script->isForEval())) {
|
||||
linenoLength = JS_snprintf(linenoStr, 15, "%" PRIuSIZE, script->lineno());
|
||||
linenoLength = snprintf(linenoStr, sizeof(linenoStr), "%" PRIuSIZE, script->lineno());
|
||||
hasLineno = true;
|
||||
}
|
||||
|
||||
|
@ -863,7 +863,7 @@ SpewConstructor(TypeSet::Type ty, JSFunction* constructor)
|
||||
if (constructor->displayAtom())
|
||||
PutEscapedString(buf, 512, constructor->displayAtom(), 0);
|
||||
else
|
||||
JS_snprintf(buf, mozilla::ArrayLength(buf), "??");
|
||||
snprintf(buf, mozilla::ArrayLength(buf), "??");
|
||||
|
||||
const char* filename;
|
||||
size_t lineno;
|
||||
@ -1231,7 +1231,7 @@ IonTrackedOptimizationsTypeInfo::ForEachOpAdapter::readType(const IonTrackedType
|
||||
char locationBuf[20];
|
||||
if (!name) {
|
||||
uintptr_t addr = JS_FUNC_TO_DATA_PTR(uintptr_t, fun->native());
|
||||
JS_snprintf(locationBuf, mozilla::ArrayLength(locationBuf), "%llx", addr);
|
||||
snprintf(locationBuf, mozilla::ArrayLength(locationBuf), "%" PRIxPTR, addr);
|
||||
}
|
||||
op_.readType("native", name, name ? nullptr : locationBuf, Nothing());
|
||||
return;
|
||||
@ -1246,7 +1246,7 @@ IonTrackedOptimizationsTypeInfo::ForEachOpAdapter::readType(const IonTrackedType
|
||||
}
|
||||
|
||||
const char* className = ty.objectKey()->clasp()->name;
|
||||
JS_snprintf(buf, bufsize, "[object %s]", className);
|
||||
snprintf(buf, bufsize, "[object %s]", className);
|
||||
|
||||
if (tracked.hasAllocationSite()) {
|
||||
JSScript* script = tracked.script;
|
||||
|
@ -1495,7 +1495,7 @@ Assembler::spewBranch(Instruction* i, Label* target /* may be nullptr */)
|
||||
char labelBuf[128];
|
||||
labelBuf[0] = 0;
|
||||
if (!target)
|
||||
JS_snprintf(labelBuf, sizeof(labelBuf), " -> (link-time target)");
|
||||
snprintf(labelBuf, sizeof(labelBuf), " -> (link-time target)");
|
||||
if (InstBranchImm::IsTHIS(*i)) {
|
||||
InstBranchImm* bimm = InstBranchImm::AsTHIS(*i);
|
||||
BOffImm destOff;
|
||||
@ -1514,8 +1514,8 @@ Assembler::spewBranch(Instruction* i, Label* target /* may be nullptr */)
|
||||
;
|
||||
buffer[i] = 0;
|
||||
if (target) {
|
||||
JS_snprintf(labelBuf, sizeof(labelBuf), " -> %d%s", spewResolve(target),
|
||||
!target->bound() ? "f" : "");
|
||||
snprintf(labelBuf, sizeof(labelBuf), " -> %d%s", spewResolve(target),
|
||||
!target->bound() ? "f" : "");
|
||||
target = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ JS::CallArgs::requireAtLeast(JSContext* cx, const char* fnname, unsigned require
|
||||
{
|
||||
if (length() < required) {
|
||||
char numArgsStr[40];
|
||||
JS_snprintf(numArgsStr, sizeof numArgsStr, "%u", required - 1);
|
||||
snprintf(numArgsStr, sizeof(numArgsStr), "%u", required - 1);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
|
||||
fnname, numArgsStr, required == 2 ? "" : "s");
|
||||
return false;
|
||||
|
@ -610,7 +610,7 @@ js::ExpandErrorArgumentsVA(ExclusiveContext* cx, JSErrorCallback callback,
|
||||
*messagep = cx->pod_malloc<char>(nbytes);
|
||||
if (!*messagep)
|
||||
goto error;
|
||||
JS_snprintf(*messagep, nbytes, defaultErrorMessage, errorNumber);
|
||||
snprintf(*messagep, nbytes, defaultErrorMessage, errorNumber);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -786,7 +786,7 @@ js::ReportMissingArg(JSContext* cx, HandleValue v, unsigned arg)
|
||||
char argbuf[11];
|
||||
UniqueChars bytes;
|
||||
|
||||
JS_snprintf(argbuf, sizeof argbuf, "%u", arg);
|
||||
snprintf(argbuf, sizeof argbuf, "%u", arg);
|
||||
if (IsFunctionObject(v)) {
|
||||
RootedAtom name(cx, v.toObject().as<JSFunction>().name());
|
||||
bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, name);
|
||||
@ -1110,7 +1110,7 @@ void
|
||||
AutoEnterOOMUnsafeRegion::crash(const char* reason)
|
||||
{
|
||||
char msgbuf[1024];
|
||||
JS_snprintf(msgbuf, sizeof(msgbuf), "[unhandlable oom] %s", reason);
|
||||
snprintf(msgbuf, sizeof(msgbuf), "[unhandlable oom] %s", reason);
|
||||
MOZ_ReportAssertionFailure(msgbuf, __FILE__, __LINE__);
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
@ -2421,42 +2421,42 @@ static void
|
||||
print_gmt_string(char* buf, size_t size, double utctime)
|
||||
{
|
||||
MOZ_ASSERT(NumbersAreIdentical(TimeClip(utctime).toDouble(), utctime));
|
||||
JS_snprintf(buf, size, "%s, %.2d %s %.4d %.2d:%.2d:%.2d GMT",
|
||||
days[int(WeekDay(utctime))],
|
||||
int(DateFromTime(utctime)),
|
||||
months[int(MonthFromTime(utctime))],
|
||||
int(YearFromTime(utctime)),
|
||||
int(HourFromTime(utctime)),
|
||||
int(MinFromTime(utctime)),
|
||||
int(SecFromTime(utctime)));
|
||||
snprintf(buf, size, "%s, %.2d %s %.4d %.2d:%.2d:%.2d GMT",
|
||||
days[int(WeekDay(utctime))],
|
||||
int(DateFromTime(utctime)),
|
||||
months[int(MonthFromTime(utctime))],
|
||||
int(YearFromTime(utctime)),
|
||||
int(HourFromTime(utctime)),
|
||||
int(MinFromTime(utctime)),
|
||||
int(SecFromTime(utctime)));
|
||||
}
|
||||
|
||||
static void
|
||||
print_iso_string(char* buf, size_t size, double utctime)
|
||||
{
|
||||
MOZ_ASSERT(NumbersAreIdentical(TimeClip(utctime).toDouble(), utctime));
|
||||
JS_snprintf(buf, size, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d.%.3dZ",
|
||||
int(YearFromTime(utctime)),
|
||||
int(MonthFromTime(utctime)) + 1,
|
||||
int(DateFromTime(utctime)),
|
||||
int(HourFromTime(utctime)),
|
||||
int(MinFromTime(utctime)),
|
||||
int(SecFromTime(utctime)),
|
||||
int(msFromTime(utctime)));
|
||||
snprintf(buf, size, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d.%.3dZ",
|
||||
int(YearFromTime(utctime)),
|
||||
int(MonthFromTime(utctime)) + 1,
|
||||
int(DateFromTime(utctime)),
|
||||
int(HourFromTime(utctime)),
|
||||
int(MinFromTime(utctime)),
|
||||
int(SecFromTime(utctime)),
|
||||
int(msFromTime(utctime)));
|
||||
}
|
||||
|
||||
static void
|
||||
print_iso_extended_string(char* buf, size_t size, double utctime)
|
||||
{
|
||||
MOZ_ASSERT(NumbersAreIdentical(TimeClip(utctime).toDouble(), utctime));
|
||||
JS_snprintf(buf, size, "%+.6d-%.2d-%.2dT%.2d:%.2d:%.2d.%.3dZ",
|
||||
int(YearFromTime(utctime)),
|
||||
int(MonthFromTime(utctime)) + 1,
|
||||
int(DateFromTime(utctime)),
|
||||
int(HourFromTime(utctime)),
|
||||
int(MinFromTime(utctime)),
|
||||
int(SecFromTime(utctime)),
|
||||
int(msFromTime(utctime)));
|
||||
snprintf(buf, size, "%+.6d-%.2d-%.2dT%.2d:%.2d:%.2d.%.3dZ",
|
||||
int(YearFromTime(utctime)),
|
||||
int(MonthFromTime(utctime)) + 1,
|
||||
int(DateFromTime(utctime)),
|
||||
int(HourFromTime(utctime)),
|
||||
int(MinFromTime(utctime)),
|
||||
int(SecFromTime(utctime)),
|
||||
int(msFromTime(utctime)));
|
||||
}
|
||||
|
||||
/* ES5 B.2.6. */
|
||||
@ -2467,7 +2467,7 @@ date_toGMTString_impl(JSContext* cx, const CallArgs& args)
|
||||
|
||||
char buf[100];
|
||||
if (!IsFinite(utctime))
|
||||
JS_snprintf(buf, sizeof buf, js_NaN_date_str);
|
||||
snprintf(buf, sizeof buf, js_NaN_date_str);
|
||||
else
|
||||
print_gmt_string(buf, sizeof buf, utctime);
|
||||
|
||||
@ -2592,7 +2592,7 @@ date_format(JSContext* cx, double date, formatspec format, MutableHandleValue rv
|
||||
PRMJTime split;
|
||||
|
||||
if (!IsFinite(date)) {
|
||||
JS_snprintf(buf, sizeof buf, js_NaN_date_str);
|
||||
snprintf(buf, sizeof buf, js_NaN_date_str);
|
||||
} else {
|
||||
MOZ_ASSERT(NumbersAreIdentical(TimeClip(date).toDouble(), date));
|
||||
|
||||
@ -2653,38 +2653,38 @@ date_format(JSContext* cx, double date, formatspec format, MutableHandleValue rv
|
||||
* requires a PRMJTime... which only has 16-bit years. Sub-ECMA.
|
||||
*/
|
||||
/* Tue Oct 31 2000 09:41:40 GMT-0800 (PST) */
|
||||
JS_snprintf(buf, sizeof buf,
|
||||
"%s %s %.2d %.4d %.2d:%.2d:%.2d GMT%+.4d%s%s",
|
||||
days[int(WeekDay(local))],
|
||||
months[int(MonthFromTime(local))],
|
||||
int(DateFromTime(local)),
|
||||
int(YearFromTime(local)),
|
||||
int(HourFromTime(local)),
|
||||
int(MinFromTime(local)),
|
||||
int(SecFromTime(local)),
|
||||
offset,
|
||||
usetz ? " " : "",
|
||||
usetz ? tzbuf : "");
|
||||
snprintf(buf, sizeof buf,
|
||||
"%s %s %.2d %.4d %.2d:%.2d:%.2d GMT%+.4d%s%s",
|
||||
days[int(WeekDay(local))],
|
||||
months[int(MonthFromTime(local))],
|
||||
int(DateFromTime(local)),
|
||||
int(YearFromTime(local)),
|
||||
int(HourFromTime(local)),
|
||||
int(MinFromTime(local)),
|
||||
int(SecFromTime(local)),
|
||||
offset,
|
||||
usetz ? " " : "",
|
||||
usetz ? tzbuf : "");
|
||||
break;
|
||||
case FORMATSPEC_DATE:
|
||||
/* Tue Oct 31 2000 */
|
||||
JS_snprintf(buf, sizeof buf,
|
||||
"%s %s %.2d %.4d",
|
||||
days[int(WeekDay(local))],
|
||||
months[int(MonthFromTime(local))],
|
||||
int(DateFromTime(local)),
|
||||
int(YearFromTime(local)));
|
||||
snprintf(buf, sizeof buf,
|
||||
"%s %s %.2d %.4d",
|
||||
days[int(WeekDay(local))],
|
||||
months[int(MonthFromTime(local))],
|
||||
int(DateFromTime(local)),
|
||||
int(YearFromTime(local)));
|
||||
break;
|
||||
case FORMATSPEC_TIME:
|
||||
/* 09:41:40 GMT-0800 (PST) */
|
||||
JS_snprintf(buf, sizeof buf,
|
||||
"%.2d:%.2d:%.2d GMT%+.4d%s%s",
|
||||
int(HourFromTime(local)),
|
||||
int(MinFromTime(local)),
|
||||
int(SecFromTime(local)),
|
||||
offset,
|
||||
usetz ? " " : "",
|
||||
usetz ? tzbuf : "");
|
||||
snprintf(buf, sizeof buf,
|
||||
"%.2d:%.2d:%.2d GMT%+.4d%s%s",
|
||||
int(HourFromTime(local)),
|
||||
int(MinFromTime(local)),
|
||||
int(SecFromTime(local)),
|
||||
offset,
|
||||
usetz ? " " : "",
|
||||
usetz ? tzbuf : "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2703,7 +2703,7 @@ ToLocaleFormatHelper(JSContext* cx, HandleObject obj, const char* format, Mutabl
|
||||
|
||||
char buf[100];
|
||||
if (!IsFinite(utctime)) {
|
||||
JS_snprintf(buf, sizeof buf, js_NaN_date_str);
|
||||
snprintf(buf, sizeof buf, js_NaN_date_str);
|
||||
} else {
|
||||
int result_len;
|
||||
double local = LocalTime(utctime);
|
||||
@ -2728,8 +2728,8 @@ ToLocaleFormatHelper(JSContext* cx, HandleObject obj, const char* format, Mutabl
|
||||
isdigit(buf[2]) && isdigit(buf[3]))) {
|
||||
double localtime = obj->as<DateObject>().cachedLocalTime();
|
||||
int year = IsNaN(localtime) ? 0 : (int) YearFromTime(localtime);
|
||||
JS_snprintf(buf + (result_len - 2), (sizeof buf) - (result_len - 2),
|
||||
"%d", year);
|
||||
snprintf(buf + (result_len - 2), (sizeof buf) - (result_len - 2),
|
||||
"%d", year);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ js_dtostr(DtoaState* state, char* buffer, size_t bufferSize, JSDToStrMode mode,
|
||||
numBegin[0] = numBegin[1];
|
||||
numBegin[1] = '.';
|
||||
}
|
||||
JS_snprintf(numEnd, bufferSize - (numEnd - buffer), "e%+d", decPt-1);
|
||||
snprintf(numEnd, bufferSize - (numEnd - buffer), "e%+d", decPt-1);
|
||||
} else if (decPt != nDigits) {
|
||||
/* Some kind of a fraction in fixed notation */
|
||||
MOZ_ASSERT(decPt <= nDigits);
|
||||
|
@ -741,12 +741,12 @@ ErrorReport::ReportAddonExceptionToTelementry(JSContext* cx)
|
||||
filename = "FILE_NOT_FOUND";
|
||||
}
|
||||
char histogramKey[64];
|
||||
JS_snprintf(histogramKey, sizeof(histogramKey),
|
||||
"%s %s %s %u",
|
||||
addonIdChars.get(),
|
||||
funname,
|
||||
filename,
|
||||
(reportp ? reportp->lineno : 0) );
|
||||
snprintf(histogramKey, sizeof(histogramKey),
|
||||
"%s %s %s %u",
|
||||
addonIdChars.get(),
|
||||
funname,
|
||||
filename,
|
||||
(reportp ? reportp->lineno : 0) );
|
||||
cx->runtime()->addTelemetry(JS_TELEMETRY_ADDON_EXCEPTIONS, 1, histogramKey);
|
||||
}
|
||||
|
||||
|
@ -2914,11 +2914,11 @@ int
|
||||
SliceBudget::describe(char* buffer, size_t maxlen) const
|
||||
{
|
||||
if (isUnlimited())
|
||||
return JS_snprintf(buffer, maxlen, "unlimited");
|
||||
return snprintf(buffer, maxlen, "unlimited");
|
||||
else if (isWorkBudget())
|
||||
return JS_snprintf(buffer, maxlen, "work(%" PRId64 ")", workBudget.budget);
|
||||
return snprintf(buffer, maxlen, "work(%" PRId64 ")", workBudget.budget);
|
||||
else
|
||||
return JS_snprintf(buffer, maxlen, "%" PRId64 "ms", timeBudget.budget);
|
||||
return snprintf(buffer, maxlen, "%" PRId64 "ms", timeBudget.budget);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -3276,20 +3276,20 @@ GetObjectSlotNameFunctor::operator()(JS::CallbackTracer* trc, char* buf, size_t
|
||||
}
|
||||
|
||||
if (slotname)
|
||||
JS_snprintf(buf, bufsize, pattern, slotname);
|
||||
snprintf(buf, bufsize, pattern, slotname);
|
||||
else
|
||||
JS_snprintf(buf, bufsize, "**UNKNOWN SLOT %" PRIu32 "**", slot);
|
||||
snprintf(buf, bufsize, "**UNKNOWN SLOT %" PRIu32 "**", slot);
|
||||
} while (false);
|
||||
} else {
|
||||
jsid propid = shape->propid();
|
||||
if (JSID_IS_INT(propid)) {
|
||||
JS_snprintf(buf, bufsize, "%" PRId32 "", JSID_TO_INT(propid));
|
||||
snprintf(buf, bufsize, "%" PRId32, JSID_TO_INT(propid));
|
||||
} else if (JSID_IS_ATOM(propid)) {
|
||||
PutEscapedString(buf, bufsize, JSID_TO_ATOM(propid), 0);
|
||||
} else if (JSID_IS_SYMBOL(propid)) {
|
||||
JS_snprintf(buf, bufsize, "**SYMBOL KEY**");
|
||||
snprintf(buf, bufsize, "**SYMBOL KEY**");
|
||||
} else {
|
||||
JS_snprintf(buf, bufsize, "**FINALIZED ATOM KEY**");
|
||||
snprintf(buf, bufsize, "**FINALIZED ATOM KEY**");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -842,8 +842,8 @@ js::Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
||||
JSOp op = (JSOp)*pc;
|
||||
if (op >= JSOP_LIMIT) {
|
||||
char numBuf1[12], numBuf2[12];
|
||||
JS_snprintf(numBuf1, sizeof numBuf1, "%d", op);
|
||||
JS_snprintf(numBuf2, sizeof numBuf2, "%d", JSOP_LIMIT);
|
||||
snprintf(numBuf1, sizeof numBuf1, "%d", op);
|
||||
snprintf(numBuf2, sizeof numBuf2, "%d", JSOP_LIMIT);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_BYTECODE_TOO_BIG, numBuf1, numBuf2);
|
||||
return 0;
|
||||
@ -1016,7 +1016,7 @@ js::Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
||||
|
||||
default: {
|
||||
char numBuf[12];
|
||||
JS_snprintf(numBuf, sizeof numBuf, "%x", cs->format);
|
||||
snprintf(numBuf, sizeof numBuf, "%x", cs->format);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_UNKNOWN_FORMAT, numBuf);
|
||||
return 0;
|
||||
|
@ -969,72 +969,6 @@ JS_vsmprintf(const char* fmt, va_list ap)
|
||||
return ss.base;
|
||||
}
|
||||
|
||||
/*
|
||||
* Stuff routine that discards overflow data
|
||||
*/
|
||||
static bool
|
||||
LimitStuff(SprintfState* ss, const char* sp, size_t len)
|
||||
{
|
||||
size_t limit = ss->maxlen - (ss->cur - ss->base);
|
||||
|
||||
if (len > limit)
|
||||
len = limit;
|
||||
while (len) {
|
||||
--len;
|
||||
*ss->cur++ = *sp++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* sprintf into a fixed size buffer. Make sure there is a NUL at the end
|
||||
* when finished.
|
||||
*/
|
||||
JS_PUBLIC_API(uint32_t)
|
||||
JS_snprintf(char* out, uint32_t outlen, const char* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int rv;
|
||||
|
||||
MOZ_ASSERT(outlen > 0);
|
||||
if (outlen == 0)
|
||||
return 0;
|
||||
|
||||
va_start(ap, fmt);
|
||||
rv = JS_vsnprintf(out, outlen, fmt, ap);
|
||||
va_end(ap);
|
||||
return rv;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(uint32_t)
|
||||
JS_vsnprintf(char* out, uint32_t outlen, const char* fmt, va_list ap)
|
||||
{
|
||||
SprintfState ss;
|
||||
|
||||
if (outlen == 0)
|
||||
return 0;
|
||||
|
||||
ss.stuff = LimitStuff;
|
||||
ss.base = out;
|
||||
ss.cur = out;
|
||||
ss.maxlen = outlen;
|
||||
(void) dosprintf(&ss, fmt, ap);
|
||||
|
||||
uint32_t charsWritten = ss.cur - ss.base;
|
||||
MOZ_RELEASE_ASSERT(charsWritten > 0);
|
||||
|
||||
// If we didn't append a null then we must have hit the buffer limit. Write
|
||||
// a null terminator now and return a value indicating that we failed.
|
||||
if (ss.cur[-1] != '\0') {
|
||||
ss.cur[-1] = '\0';
|
||||
return outlen;
|
||||
}
|
||||
|
||||
// Success: return the number of character written excluding the null
|
||||
// terminator.
|
||||
return charsWritten - 1;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(char*)
|
||||
JS_sprintf_append(char* last, const char* fmt, ...)
|
||||
{
|
||||
|
@ -32,13 +32,6 @@
|
||||
|
||||
#include "jstypes.h"
|
||||
|
||||
/*
|
||||
** sprintf into a fixed size buffer. Guarantees that a NUL is at the end
|
||||
** of the buffer. The return value is the length of the written output,
|
||||
** NOT including the NUL, which is guaranteed less than "outlen" on success.
|
||||
*/
|
||||
extern JS_PUBLIC_API(uint32_t) JS_snprintf(char* out, uint32_t outlen, const char* fmt, ...);
|
||||
|
||||
/*
|
||||
** sprintf into a malloc'd buffer. Return a pointer to the malloc'd
|
||||
** buffer on success, nullptr on failure. Call "JS_smprintf_free" to release
|
||||
@ -63,7 +56,6 @@ extern JS_PUBLIC_API(char*) JS_sprintf_append(char* last, const char* fmt, ...);
|
||||
/*
|
||||
** va_list forms of the above.
|
||||
*/
|
||||
extern JS_PUBLIC_API(uint32_t) JS_vsnprintf(char* out, uint32_t outlen, const char* fmt, va_list ap);
|
||||
extern JS_PUBLIC_API(char*) JS_vsmprintf(const char* fmt, va_list ap);
|
||||
extern JS_PUBLIC_API(char*) JS_vsprintf_append(char* last, const char* fmt, va_list ap);
|
||||
|
||||
|
@ -2312,7 +2312,7 @@ FormatIntroducedFilename(ExclusiveContext* cx, const char* filename, unsigned li
|
||||
// and wants us to use a special free function.)
|
||||
char linenoBuf[15];
|
||||
size_t filenameLen = strlen(filename);
|
||||
size_t linenoLen = JS_snprintf(linenoBuf, 15, "%u", lineno);
|
||||
size_t linenoLen = snprintf(linenoBuf, sizeof(linenoBuf), "%u", lineno);
|
||||
size_t introducerLen = strlen(introducer);
|
||||
size_t len = filenameLen +
|
||||
6 /* == strlen(" line ") */ +
|
||||
@ -2325,8 +2325,8 @@ FormatIntroducedFilename(ExclusiveContext* cx, const char* filename, unsigned li
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
}
|
||||
mozilla::DebugOnly<size_t> checkLen = JS_snprintf(formatted, len, "%s line %s > %s",
|
||||
filename, linenoBuf, introducer);
|
||||
mozilla::DebugOnly<size_t> checkLen = snprintf(formatted, len, "%s line %s > %s",
|
||||
filename, linenoBuf, introducer);
|
||||
MOZ_ASSERT(checkLen == len - 1);
|
||||
|
||||
return formatted;
|
||||
|
@ -1508,9 +1508,9 @@ Evaluate(JSContext* cx, unsigned argc, Value* vp)
|
||||
if (loadBytecode && assertEqBytecode) {
|
||||
if (saveLength != loadLength) {
|
||||
char loadLengthStr[16];
|
||||
JS_snprintf(loadLengthStr, sizeof(loadLengthStr), "%" PRIu32, loadLength);
|
||||
snprintf(loadLengthStr, sizeof(loadLengthStr), "%" PRIu32, loadLength);
|
||||
char saveLengthStr[16];
|
||||
JS_snprintf(saveLengthStr, sizeof(saveLengthStr), "%" PRIu32, saveLength);
|
||||
snprintf(saveLengthStr, sizeof(saveLengthStr), "%" PRIu32, saveLength);
|
||||
|
||||
JS_ReportErrorNumber(cx, my_GetErrorMessage, nullptr, JSSMSG_CACHE_EQ_SIZE_FAILED,
|
||||
loadLengthStr, saveLengthStr);
|
||||
|
@ -226,7 +226,7 @@ static void
|
||||
ReportInvalidCharacter(JSContext* cx, uint32_t offset)
|
||||
{
|
||||
char buffer[10];
|
||||
JS_snprintf(buffer, 10, "%u", offset);
|
||||
snprintf(buffer, 10, "%u", offset);
|
||||
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
|
||||
JSMSG_MALFORMED_UTF8_CHAR, buffer);
|
||||
}
|
||||
@ -241,7 +241,7 @@ static void
|
||||
ReportTooBigCharacter(JSContext* cx, uint32_t v)
|
||||
{
|
||||
char buffer[10];
|
||||
JS_snprintf(buffer, 10, "0x%x", v + 0x10000);
|
||||
snprintf(buffer, 10, "0x%x", v + 0x10000);
|
||||
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
|
||||
JSMSG_UTF8_CHAR_TOO_LARGE, buffer);
|
||||
}
|
||||
|
@ -570,9 +570,9 @@ LCovRuntime::fillWithFilename(char *name, size_t length)
|
||||
static mozilla::Atomic<size_t> globalRuntimeId(0);
|
||||
size_t rid = globalRuntimeId++;
|
||||
|
||||
size_t len = JS_snprintf(name, length, "%s/%" PRId64 "-%" PRIuSIZE "-%" PRIuSIZE ".info",
|
||||
outDir, timestamp, pid_, rid);
|
||||
if (length <= len) {
|
||||
int len = snprintf(name, length, "%s/%" PRId64 "-%" PRIuSIZE "-%" PRIuSIZE ".info",
|
||||
outDir, timestamp, pid_, rid);
|
||||
if (length != size_t(len)) {
|
||||
fprintf(stderr, "Warning: LCovRuntime::init: Cannot serialize file name.");
|
||||
return false;
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ class MOZ_RAII js::EnterDebuggeeNoExecute
|
||||
}
|
||||
const char* filename = script->filename() ? script->filename() : "(none)";
|
||||
char linenoStr[15];
|
||||
JS_snprintf(linenoStr, sizeof(linenoStr), "%" PRIuSIZE, script->lineno());
|
||||
snprintf(linenoStr, sizeof(linenoStr), "%" PRIuSIZE, script->lineno());
|
||||
unsigned flags = warning ? JSREPORT_WARNING : JSREPORT_ERROR;
|
||||
return JS_ReportErrorFlagsAndNumber(cx, flags, GetErrorMessage, nullptr,
|
||||
JSMSG_DEBUGGEE_WOULD_RUN,
|
||||
|
@ -4034,7 +4034,7 @@ END_CASE(JSOP_IS_CONSTRUCTING)
|
||||
DEFAULT()
|
||||
{
|
||||
char numBuf[12];
|
||||
JS_snprintf(numBuf, sizeof numBuf, "%d", *REGS.pc);
|
||||
snprintf(numBuf, sizeof numBuf, "%d", *REGS.pc);
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_BAD_BYTECODE, numBuf);
|
||||
goto error;
|
||||
|
@ -90,9 +90,9 @@ JSONParser<CharT>::error(const char* msg)
|
||||
|
||||
const size_t MaxWidth = sizeof("4294967295");
|
||||
char columnNumber[MaxWidth];
|
||||
JS_snprintf(columnNumber, sizeof columnNumber, "%" PRIu32, column);
|
||||
snprintf(columnNumber, sizeof columnNumber, "%" PRIu32, column);
|
||||
char lineNumber[MaxWidth];
|
||||
JS_snprintf(lineNumber, sizeof lineNumber, "%" PRIu32, line);
|
||||
snprintf(lineNumber, sizeof lineNumber, "%" PRIu32, line);
|
||||
|
||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_JSON_BAD_PARSE,
|
||||
msg, lineNumber, columnNumber);
|
||||
|
@ -208,7 +208,7 @@ Sprinter::vprintf(const char* fmt, va_list ap)
|
||||
do {
|
||||
va_list aq;
|
||||
va_copy(aq, ap);
|
||||
int i = JS_vsnprintf(base + offset, size - offset, fmt, aq);
|
||||
int i = vsnprintf(base + offset, size - offset, fmt, aq);
|
||||
va_end(aq);
|
||||
if (i > -1 && (size_t) i < size - offset) {
|
||||
offset += i;
|
||||
|
@ -347,9 +347,9 @@ SPSProfiler::allocProfileString(JSScript* script, JSFunction* maybeFun)
|
||||
js_free(cstr);
|
||||
return nullptr;
|
||||
}
|
||||
ret = JS_snprintf(cstr, len + 1, "%s (%s:%" PRIu64 ")", atomStr.get(), filename, lineno);
|
||||
ret = snprintf(cstr, len + 1, "%s (%s:%" PRIu64 ")", atomStr.get(), filename, lineno);
|
||||
} else {
|
||||
ret = JS_snprintf(cstr, len + 1, "%s:%" PRIu64, filename, lineno);
|
||||
ret = snprintf(cstr, len + 1, "%s:%" PRIu64, filename, lineno);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(ret == len, "Computed length should match actual length!");
|
||||
|
@ -363,7 +363,7 @@ TraceLoggerThread::getOrCreateEventPayload(const char* text)
|
||||
if (!str)
|
||||
return nullptr;
|
||||
|
||||
DebugOnly<size_t> ret = JS_snprintf(str, len + 1, "%s", text);
|
||||
DebugOnly<size_t> ret = snprintf(str, len + 1, "%s", text);
|
||||
MOZ_ASSERT(ret == len);
|
||||
MOZ_ASSERT(strlen(str) == len);
|
||||
|
||||
@ -431,7 +431,7 @@ TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId type, const char* f
|
||||
return nullptr;
|
||||
|
||||
DebugOnly<size_t> ret =
|
||||
JS_snprintf(str, len + 1, "script %s:%" PRIuSIZE ":%" PRIuSIZE, filename, lineno, colno);
|
||||
snprintf(str, len + 1, "script %s:%" PRIuSIZE ":%" PRIuSIZE, filename, lineno, colno);
|
||||
MOZ_ASSERT(ret == len);
|
||||
MOZ_ASSERT(strlen(str) == len);
|
||||
|
||||
|
@ -205,9 +205,9 @@ TypeSet::TypeString(TypeSet::Type type)
|
||||
which = (which + 1) & 3;
|
||||
|
||||
if (type.isSingleton())
|
||||
JS_snprintf(bufs[which], 40, "<0x%p>", (void*) type.singletonNoBarrier());
|
||||
snprintf(bufs[which], 40, "<0x%p>", (void*) type.singletonNoBarrier());
|
||||
else
|
||||
JS_snprintf(bufs[which], 40, "[0x%p]", (void*) type.groupNoBarrier());
|
||||
snprintf(bufs[which], 40, "[0x%p]", (void*) type.groupNoBarrier());
|
||||
|
||||
return bufs[which];
|
||||
}
|
||||
@ -232,6 +232,26 @@ js::InferSpew(SpewChannel channel, const char* fmt, ...)
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
MOZ_NORETURN MOZ_COLD static void
|
||||
TypeFailure(JSContext* cx, const char* fmt, ...)
|
||||
{
|
||||
char msgbuf[1024]; /* Larger error messages will be truncated */
|
||||
char errbuf[1024];
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(errbuf, sizeof(errbuf), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
snprintf(msgbuf, sizeof(msgbuf), "[infer failure] %s", errbuf);
|
||||
|
||||
/* Dump type state, even if INFERFLAGS is unset. */
|
||||
PrintTypes(cx, cx->compartment(), true);
|
||||
|
||||
MOZ_ReportAssertionFailure(msgbuf, __FILE__, __LINE__);
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
bool
|
||||
js::ObjectGroupHasProperty(JSContext* cx, ObjectGroup* group, jsid id, const Value& value)
|
||||
{
|
||||
@ -286,25 +306,6 @@ js::ObjectGroupHasProperty(JSContext* cx, ObjectGroup* group, jsid id, const Val
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
js::TypeFailure(JSContext* cx, const char* fmt, ...)
|
||||
{
|
||||
char msgbuf[1024]; /* Larger error messages will be truncated */
|
||||
char errbuf[1024];
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
JS_vsnprintf(errbuf, sizeof(errbuf), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
JS_snprintf(msgbuf, sizeof(msgbuf), "[infer failure] %s", errbuf);
|
||||
|
||||
/* Dump type state, even if INFERFLAGS is unset. */
|
||||
PrintTypes(cx, cx->compartment(), true);
|
||||
|
||||
MOZ_ReportAssertionFailure(msgbuf, __FILE__, __LINE__);
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// TypeSet
|
||||
|
@ -1310,9 +1310,6 @@ inline void InferSpew(SpewChannel which, const char* fmt, ...) {}
|
||||
|
||||
#endif
|
||||
|
||||
/* Print a warning, dump state and abort the program. */
|
||||
MOZ_NORETURN MOZ_COLD void TypeFailure(JSContext* cx, const char* fmt, ...);
|
||||
|
||||
// Prints type information for a context if spew is enabled or force is set.
|
||||
void
|
||||
PrintTypes(JSContext* cx, JSCompartment* comp, bool force);
|
||||
|
@ -361,7 +361,7 @@ CheckChar16InCharRange(char16_t c)
|
||||
/* U+0080/U+0100 - U+FFFF data lost. */
|
||||
static const size_t MSG_BUF_SIZE = 64;
|
||||
char msg[MSG_BUF_SIZE];
|
||||
JS_snprintf(msg, MSG_BUF_SIZE, "char16_t out of char range; high bits of data lost: 0x%x", c);
|
||||
snprintf(msg, MSG_BUF_SIZE, "char16_t out of char range; high bits of data lost: 0x%x", int(c));
|
||||
NS_WARNING(msg);
|
||||
return false;
|
||||
}
|
||||
|
@ -3689,8 +3689,7 @@ XPCJSRuntime::DescribeCustomObjects(JSObject* obj, const js::Class* clasp,
|
||||
return false;
|
||||
}
|
||||
|
||||
JS_snprintf(name, sizeof(name), "JS Object (%s - %s)",
|
||||
clasp->name, si->GetJSClass()->name);
|
||||
snprintf(name, sizeof(name), "JS Object (%s - %s)", clasp->name, si->GetJSClass()->name);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -103,10 +103,9 @@ NS_CYCLE_COLLECTION_CLASSNAME(nsXPCWrappedJS)::Traverse
|
||||
if (cb.WantDebugInfo()) {
|
||||
char name[72];
|
||||
if (tmp->GetClass())
|
||||
JS_snprintf(name, sizeof(name), "nsXPCWrappedJS (%s)",
|
||||
tmp->GetClass()->GetInterfaceName());
|
||||
snprintf(name, sizeof(name), "nsXPCWrappedJS (%s)", tmp->GetClass()->GetInterfaceName());
|
||||
else
|
||||
JS_snprintf(name, sizeof(name), "nsXPCWrappedJS");
|
||||
snprintf(name, sizeof(name), "nsXPCWrappedJS");
|
||||
cb.DescribeRefCountedNode(refcnt, name);
|
||||
} else {
|
||||
NS_IMPL_CYCLE_COLLECTION_DESCRIBE(nsXPCWrappedJS, refcnt)
|
||||
|
@ -51,10 +51,9 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(XPCWrappedNative)
|
||||
char name[72];
|
||||
XPCNativeScriptableInfo* si = tmp->GetScriptableInfo();
|
||||
if (si)
|
||||
JS_snprintf(name, sizeof(name), "XPCWrappedNative (%s)",
|
||||
si->GetJSClass()->name);
|
||||
snprintf(name, sizeof(name), "XPCWrappedNative (%s)", si->GetJSClass()->name);
|
||||
else
|
||||
JS_snprintf(name, sizeof(name), "XPCWrappedNative");
|
||||
snprintf(name, sizeof(name), "XPCWrappedNative");
|
||||
|
||||
cb.DescribeRefCountedNode(tmp->mRefCnt.get(), name);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user