mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 965022 - Use MOZ_FORMAT_PRINTF for nsTString::AppendPrintf, and fix incorrect usages. r=jrmuizel
This commit is contained in:
parent
3d7ea0d29f
commit
be8b04e34d
@ -19,6 +19,7 @@
|
||||
#include "XPCJSMemoryReporter.h"
|
||||
#include "js/MemoryMetrics.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "mozilla/IntegerPrintfMacros.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -169,7 +170,7 @@ AppendWindowURI(nsGlobalWindow *aWindow, nsACString& aStr, bool aAnonymize)
|
||||
|
||||
if (uri) {
|
||||
if (aAnonymize && !aWindow->IsChromeWindow()) {
|
||||
aStr.AppendPrintf("<anonymized-%d>", aWindow->WindowID());
|
||||
aStr.AppendPrintf("<anonymized-%" PRIu64 ">", aWindow->WindowID());
|
||||
} else {
|
||||
nsCString spec;
|
||||
uri->GetSpec(spec);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "WebGLProgram.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
#include "GLContext.h"
|
||||
#include "mozilla/IntegerPrintfMacros.h"
|
||||
|
||||
#include "MurmurHash3.h"
|
||||
|
||||
@ -234,7 +235,7 @@ WebGLProgram::HashMapIdentifier(const nsACString& name, nsCString *hashedName)
|
||||
uint64_t hash = IdentifierHashFunction(name.BeginReading(), name.Length());
|
||||
hashedName->Truncate();
|
||||
// This MUST MATCH angle/src/compiler/translator/HashNames.h HASHED_NAME_PREFIX
|
||||
hashedName->AppendPrintf("webgl_%llx", hash);
|
||||
hashedName->AppendPrintf("webgl_%" PRIx64, hash);
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(WebGLProgram, mAttachedShaders)
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "nsTableRowFrame.h"
|
||||
#include "nsTableRowGroupFrame.h"
|
||||
#include "nsTextFrame.h"
|
||||
#include "mozilla/IntegerPrintfMacros.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -59,7 +60,7 @@ GetFrameState(nsIFrame* aFrame)
|
||||
#undef FRAME_STATE_BIT
|
||||
|
||||
if (state) {
|
||||
result.AppendPrintf(" | 0x%0llx", state);
|
||||
result.AppendPrintf(" | 0x%0" PRIx64, state);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -62,7 +62,7 @@ void nsStyleUtil::AppendEscapedCSSString(const nsAString& aString,
|
||||
for (; in != end; in++) {
|
||||
if (*in < 0x20 || (*in >= 0x7F && *in < 0xA0)) {
|
||||
// Escape U+0000 through U+001F and U+007F through U+009F numerically.
|
||||
aReturn.AppendPrintf("\\%hX ", *in);
|
||||
aReturn.AppendPrintf("\\%hX ", static_cast<int16_t>(*in));
|
||||
} else {
|
||||
if (*in == '"' || *in == '\'' || *in == '\\') {
|
||||
// Escape backslash and quote characters symbolically.
|
||||
@ -116,7 +116,7 @@ nsStyleUtil::AppendEscapedCSSIdent(const nsAString& aIdent, nsAString& aReturn)
|
||||
// numerically. If we didn't escape it numerically, it would get
|
||||
// interpreted as a numeric escape for the wrong character.
|
||||
if (in != end && ('0' <= *in && *in <= '9')) {
|
||||
aReturn.AppendPrintf("\\%hX ", *in);
|
||||
aReturn.AppendPrintf("\\%hX ", static_cast<int16_t>(*in));
|
||||
++in;
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ nsStyleUtil::AppendEscapedCSSIdent(const nsAString& aIdent, nsAString& aReturn)
|
||||
}
|
||||
if (ch < 0x20 || (0x7F <= ch && ch < 0xA0)) {
|
||||
// Escape U+0000 through U+001F and U+007F through U+009F numerically.
|
||||
aReturn.AppendPrintf("\\%hX ", *in);
|
||||
aReturn.AppendPrintf("\\%hX ", static_cast<int16_t>(*in));
|
||||
} else {
|
||||
// Escape ASCII non-identifier printables as a backslash plus
|
||||
// the character.
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "nsHttpHandler.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsHttpRequestHead.h"
|
||||
#include "mozilla/IntegerPrintfMacros.h"
|
||||
|
||||
extern PRThread *gSocketThread;
|
||||
|
||||
@ -63,13 +64,13 @@ nsHttpConnectionMgr::PrintDiagnosticsCB(const nsACString &key,
|
||||
self->AtActiveConnectionLimit(ent, NS_HTTP_ALLOW_KEEPALIVE));
|
||||
self->mLogData.AppendPrintf(" RestrictConnections = %d\n",
|
||||
self->RestrictConnections(ent));
|
||||
self->mLogData.AppendPrintf(" Pending Q Length = %u\n",
|
||||
self->mLogData.AppendPrintf(" Pending Q Length = %" PRIuSIZE "\n",
|
||||
ent->mPendingQ.Length());
|
||||
self->mLogData.AppendPrintf(" Active Conns Length = %u\n",
|
||||
self->mLogData.AppendPrintf(" Active Conns Length = %" PRIuSIZE "\n",
|
||||
ent->mActiveConns.Length());
|
||||
self->mLogData.AppendPrintf(" Idle Conns Length = %u\n",
|
||||
self->mLogData.AppendPrintf(" Idle Conns Length = %" PRIuSIZE "\n",
|
||||
ent->mIdleConns.Length());
|
||||
self->mLogData.AppendPrintf(" Half Opens Length = %u\n",
|
||||
self->mLogData.AppendPrintf(" Half Opens Length = %" PRIuSIZE "\n",
|
||||
ent->mHalfOpens.Length());
|
||||
self->mLogData.AppendPrintf(" Coalescing Key = %s\n",
|
||||
ent->mCoalescingKey.get());
|
||||
@ -146,7 +147,7 @@ nsHttpConnection::PrintDiagnostics(nsCString &log)
|
||||
log.AppendPrintf(" time since last read = %ums\n",
|
||||
PR_IntervalToMilliseconds(now - mLastReadTime));
|
||||
|
||||
log.AppendPrintf(" max-read/read/written %lld/%lld/%lld\n",
|
||||
log.AppendPrintf(" max-read/read/written %" PRId64 "/%" PRId64 "/%" PRId64 "\n",
|
||||
mMaxBytesRead, mTotalBytesRead, mTotalBytesWritten);
|
||||
|
||||
log.AppendPrintf(" rtt = %ums\n", PR_IntervalToMilliseconds(mRtt));
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "mozilla/Casting.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/IntegerPrintfMacros.h"
|
||||
|
||||
#ifndef MOZILLA_INTERNAL_API
|
||||
#error Cannot use internal string classes without MOZILLA_INTERNAL_API defined. Use the frozen header nsStringAPI.h instead.
|
||||
@ -556,7 +557,8 @@ public:
|
||||
* Append a formatted string to the current string. Uses the format
|
||||
* codes documented in prprf.h
|
||||
*/
|
||||
void AppendPrintf(const char* aFormat, ...);
|
||||
// Note: MOZ_FORMAT_PRINTF(2, 3) because 'this counts as a parameter.
|
||||
void AppendPrintf(const char* aFormat, ...) MOZ_FORMAT_PRINTF(2, 3);
|
||||
void AppendPrintf(const char* aFormat, va_list aAp);
|
||||
void AppendInt(int32_t aInteger)
|
||||
{
|
||||
@ -578,20 +580,20 @@ public:
|
||||
}
|
||||
void AppendInt(int64_t aInteger)
|
||||
{
|
||||
AppendPrintf("%lld", aInteger);
|
||||
AppendPrintf("%" PRId64, aInteger);
|
||||
}
|
||||
void AppendInt(int64_t aInteger, int aRadix)
|
||||
{
|
||||
const char* fmt = aRadix == 10 ? "%lld" : aRadix == 8 ? "%llo" : "%llx";
|
||||
const char* fmt = aRadix == 10 ? "%" PRId64 : aRadix == 8 ? "%" PRIo64 : "%" PRIx64;
|
||||
AppendPrintf(fmt, aInteger);
|
||||
}
|
||||
void AppendInt(uint64_t aInteger)
|
||||
{
|
||||
AppendPrintf("%llu", aInteger);
|
||||
AppendPrintf("%" PRIu64, aInteger);
|
||||
}
|
||||
void AppendInt(uint64_t aInteger, int aRadix)
|
||||
{
|
||||
const char* fmt = aRadix == 10 ? "%llu" : aRadix == 8 ? "%llo" : "%llx";
|
||||
const char* fmt = aRadix == 10 ? "%" PRIu64 : aRadix == 8 ? "%" PRIo64 : "%" PRIx64;
|
||||
AppendPrintf(fmt, aInteger);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user