Bug 1060419 - make AppendPrintf and nsPrintfCString use Printf.h, r=froydnj

MozReview-Commit-ID: 2E8FoiNxU8L

--HG--
extra : rebase_source : 810ac727bef0751f24edea18c52e0ec170bf367d
This commit is contained in:
Tom Tromey 2016-12-14 09:32:21 -07:00
Родитель 38a0f29d29
Коммит d2667a2b27
55 изменённых файлов: 189 добавлений и 151 удалений

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

@ -360,7 +360,7 @@ Exception::ToString(JSContext* aCx, nsACString& _retval)
static const char defaultMsg[] = "<no message>"; static const char defaultMsg[] = "<no message>";
static const char defaultLocation[] = "<unknown>"; static const char defaultLocation[] = "<unknown>";
static const char format[] = static const char format[] =
"[Exception... \"%s\" nsresult: \"0x%x (%s)\" location: \"%s\" data: %s]"; "[Exception... \"%s\" nsresult: \"0x%" PRIx32 " (%s)\" location: \"%s\" data: %s]";
nsCString location; nsCString location;
@ -388,7 +388,7 @@ Exception::ToString(JSContext* aCx, nsACString& _retval)
const char* data = mData ? "yes" : "no"; const char* data = mData ? "yes" : "no";
_retval.Truncate(); _retval.Truncate();
_retval.AppendPrintf(format, msg, mResult, resultName, _retval.AppendPrintf(format, msg, static_cast<uint32_t>(mResult), resultName,
location.get(), data); location.get(), data);
return NS_OK; return NS_OK;
} }
@ -552,7 +552,7 @@ DOMException::ToString(JSContext* aCx, nsACString& aReturn)
static const char defaultLocation[] = "<unknown>"; static const char defaultLocation[] = "<unknown>";
static const char defaultName[] = "<unknown>"; static const char defaultName[] = "<unknown>";
static const char format[] = static const char format[] =
"[Exception... \"%s\" code: \"%d\" nsresult: \"0x%x (%s)\" location: \"%s\"]"; "[Exception... \"%s\" code: \"%d\" nsresult: \"0x%" PRIx32 " (%s)\" location: \"%s\"]";
nsAutoCString location; nsAutoCString location;
@ -563,7 +563,7 @@ DOMException::ToString(JSContext* aCx, nsACString& aReturn)
const char* msg = !mMessage.IsEmpty() ? mMessage.get() : defaultMsg; const char* msg = !mMessage.IsEmpty() ? mMessage.get() : defaultMsg;
const char* resultName = !mName.IsEmpty() ? mName.get() : defaultName; const char* resultName = !mName.IsEmpty() ? mName.get() : defaultName;
aReturn.AppendPrintf(format, msg, mCode, mResult, resultName, aReturn.AppendPrintf(format, msg, mCode, static_cast<uint32_t>(mResult), resultName,
location.get()); location.get());
return NS_OK; return NS_OK;

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

@ -168,7 +168,7 @@ AppendWindowURI(nsGlobalWindow *aWindow, nsACString& aStr, bool aAnonymize)
if (uri) { if (uri) {
if (aAnonymize && !aWindow->IsChromeWindow()) { if (aAnonymize && !aWindow->IsChromeWindow()) {
aStr.AppendPrintf("<anonymized-%llu>", aWindow->WindowID()); aStr.AppendPrintf("<anonymized-%" PRIu64 ">", aWindow->WindowID());
} else { } else {
nsCString spec = uri->GetSpecOrDefault(); nsCString spec = uri->GetSpecOrDefault();
@ -276,7 +276,7 @@ CollectWindowReports(nsGlobalWindow *aWindow,
if (top) { if (top) {
windowPath += NS_LITERAL_CSTRING("top("); windowPath += NS_LITERAL_CSTRING("top(");
AppendWindowURI(top, windowPath, aAnonymize); AppendWindowURI(top, windowPath, aAnonymize);
windowPath.AppendPrintf(", id=%llu)", top->WindowID()); windowPath.AppendPrintf(", id=%" PRIu64 ")", top->WindowID());
aTopWindowPaths->Put(aWindow->WindowID(), windowPath); aTopWindowPaths->Put(aWindow->WindowID(), windowPath);

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

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MemoryBlobImpl.h" #include "MemoryBlobImpl.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/SHA1.h" #include "mozilla/SHA1.h"
#include "nsIIPCSerializableInputStream.h" #include "nsIIPCSerializableInputStream.h"
#include "nsPrintfCString.h" #include "nsPrintfCString.h"
@ -166,11 +167,11 @@ public:
aHandleReport->Callback( aHandleReport->Callback(
/* process */ NS_LITERAL_CSTRING(""), /* process */ NS_LITERAL_CSTRING(""),
nsPrintfCString( nsPrintfCString(
"explicit/dom/memory-file-data/large/file(length=%llu, sha1=%s)", "explicit/dom/memory-file-data/large/file(length=%" PRIu64 ", sha1=%s)",
owner->mLength, aAnonymize ? "<anonymized>" : digestString.get()), owner->mLength, aAnonymize ? "<anonymized>" : digestString.get()),
KIND_HEAP, UNITS_BYTES, size, KIND_HEAP, UNITS_BYTES, size,
nsPrintfCString( nsPrintfCString(
"Memory used to back a memory file of length %llu bytes. The file " "Memory used to back a memory file of length %" PRIu64 " bytes. The file "
"has a sha1 of %s.\n\n" "has a sha1 of %s.\n\n"
"Note that the allocator may round up a memory file's length -- " "Note that the allocator may round up a memory file's length -- "
"that is, an N-byte memory file may take up more than N bytes of " "that is, an N-byte memory file may take up more than N bytes of "

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

@ -26,6 +26,7 @@
#include "mozilla/Maybe.h" #include "mozilla/Maybe.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
#include "mozilla/SizePrintfMacros.h"
#include "mozilla/SnappyCompressOutputStream.h" #include "mozilla/SnappyCompressOutputStream.h"
#include "mozilla/SnappyUncompressInputStream.h" #include "mozilla/SnappyUncompressInputStream.h"
#include "mozilla/StaticPtr.h" #include "mozilla/StaticPtr.h"
@ -583,9 +584,9 @@ ClampResultCode(nsresult aResultCode)
return NS_ERROR_DOM_INDEXEDDB_CONSTRAINT_ERR; return NS_ERROR_DOM_INDEXEDDB_CONSTRAINT_ERR;
default: default:
#ifdef DEBUG #ifdef DEBUG
nsPrintfCString message("Converting non-IndexedDB error code (0x%X) to " nsPrintfCString message("Converting non-IndexedDB error code (0x%" PRIX32 ") to "
"NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR", "NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR",
aResultCode); static_cast<uint32_t>(aResultCode));
NS_WARNING(message.get()); NS_WARNING(message.get());
#else #else
; ;
@ -4557,7 +4558,7 @@ CreateStorageConnection(nsIFile* aDBFile,
// Set the page size first. // Set the page size first.
if (kSQLitePageSizeOverride) { if (kSQLitePageSizeOverride) {
rv = connection->ExecuteSimpleSQL( rv = connection->ExecuteSimpleSQL(
nsPrintfCString("PRAGMA page_size = %lu;", kSQLitePageSizeOverride) nsPrintfCString("PRAGMA page_size = %" PRIu32 ";", kSQLitePageSizeOverride)
); );
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
return rv; return rv;
@ -4793,7 +4794,7 @@ CreateStorageConnection(nsIFile* aDBFile,
// Successfully set to rollback journal mode so changing the page size // Successfully set to rollback journal mode so changing the page size
// is possible with a VACUUM. // is possible with a VACUUM.
rv = connection->ExecuteSimpleSQL( rv = connection->ExecuteSimpleSQL(
nsPrintfCString("PRAGMA page_size = %lu;", kSQLitePageSizeOverride) nsPrintfCString("PRAGMA page_size = %" PRIu32 ";", kSQLitePageSizeOverride)
); );
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
return rv; return rv;
@ -5724,7 +5725,7 @@ public:
nsCString GetThreadName() const nsCString GetThreadName() const
{ {
return nsPrintfCString("IndexedDB #%lu", mSerialNumber); return nsPrintfCString("IndexedDB #%" PRIu32, mSerialNumber);
} }
private: private:

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

@ -277,7 +277,7 @@ public:
} }
}; };
inline void inline void MOZ_FORMAT_PRINTF(2, 3)
LoggingHelper(bool aUseProfiler, const char* aFmt, ...) LoggingHelper(bool aUseProfiler, const char* aFmt, ...)
{ {
MOZ_ASSERT(IndexedDatabaseManager::GetLoggingMode() != MOZ_ASSERT(IndexedDatabaseManager::GetLoggingMode() !=

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

@ -27,7 +27,7 @@ ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr)
nsContentUtils::LogSimpleConsoleError( nsContentUtils::LogSimpleConsoleError(
NS_ConvertUTF8toUTF16(nsPrintfCString( NS_ConvertUTF8toUTF16(nsPrintfCString(
"IndexedDB %s: %s:%lu", aStr, aFile, aLine)), "IndexedDB %s: %s:%" PRIu32, aStr, aFile, aLine)),
"indexedDB"); "indexedDB");
} }

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

@ -419,7 +419,7 @@ ContentParentsMemoryReporter::CollectReports(
} }
nsPrintfCString path("queued-ipc-messages/content-parent" nsPrintfCString path("queued-ipc-messages/content-parent"
"(%s, pid=%d, %s, 0x%p, refcnt=%d)", "(%s, pid=%d, %s, 0x%p, refcnt=%" PRIuPTR ")",
NS_ConvertUTF16toUTF8(friendlyName).get(), NS_ConvertUTF16toUTF8(friendlyName).get(),
cp->Pid(), channelStr, cp->Pid(), channelStr,
static_cast<nsIContentParent*>(cp), refcnt); static_cast<nsIContentParent*>(cp), refcnt);

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

@ -534,7 +534,7 @@ ProcessPriorityManagerImpl::GetParticularProcessPriorityManager(
mParticularManagers.Put(cpId, pppm); mParticularManagers.Put(cpId, pppm);
FireTestOnlyObserverNotification("process-created", FireTestOnlyObserverNotification("process-created",
nsPrintfCString("%lld", cpId)); nsPrintfCString("%" PRIu64, cpId));
} }
return pppm.forget(); return pppm.forget();
@ -1195,7 +1195,7 @@ ParticularProcessPriorityManager::FireTestOnlyObserverNotification(
return; return;
} }
nsAutoCString data(nsPrintfCString("%lld", ChildID())); nsAutoCString data(nsPrintfCString("%" PRIu64, ChildID()));
if (!aData.IsEmpty()) { if (!aData.IsEmpty()) {
data.Append(':'); data.Append(':');
data.Append(aData); data.Append(aData);

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

@ -834,8 +834,8 @@ DecoderDoctorDiagnostics::GetDescription() const
} }
break; break;
case eEvent: case eEvent:
s = nsPrintfCString("event domain %s result=%u", s = nsPrintfCString("event domain %s result=%" PRIu32,
EventDomainString(mEvent.mDomain), mEvent.mResult); EventDomainString(mEvent.mDomain), static_cast<uint32_t>(mEvent.mResult));
break; break;
default: default:
MOZ_ASSERT_UNREACHABLE("Unexpected DiagnosticsType"); MOZ_ASSERT_UNREACHABLE("Unexpected DiagnosticsType");

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

@ -225,7 +225,8 @@ MediaDecoderReader::AsyncReadMetadata()
// We're not waiting for anything. If we didn't get the metadata, that's an // We're not waiting for anything. If we didn't get the metadata, that's an
// error. // error.
if (NS_FAILED(rv) || !metadata->mInfo.HasValidMedia()) { if (NS_FAILED(rv) || !metadata->mInfo.HasValidMedia()) {
DECODER_WARN("ReadMetadata failed, rv=%x HasValidMedia=%d", rv, metadata->mInfo.HasValidMedia()); DECODER_WARN("ReadMetadata failed, rv=%" PRIx32 " HasValidMedia=%d",
static_cast<uint32_t>(rv), metadata->mInfo.HasValidMedia());
return MetadataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_METADATA_ERR, __func__); return MetadataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_METADATA_ERR, __func__);
} }

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

@ -3756,11 +3756,11 @@ MediaDecoderStateMachine::GetDebugInfo()
{ {
MOZ_ASSERT(OnTaskQueue()); MOZ_ASSERT(OnTaskQueue());
return nsPrintfCString( return nsPrintfCString(
"GetMediaTime=%lld GetClock=%lld mMediaSink=%p " "GetMediaTime=%" PRId64 " GetClock=%" PRId64 " mMediaSink=%p "
"state=%s mPlayState=%d mSentFirstFrameLoadedEvent=%d IsPlaying=%d " "state=%s mPlayState=%d mSentFirstFrameLoadedEvent=%d IsPlaying=%d "
"mAudioStatus=%s mVideoStatus=%s mDecodedAudioEndTime=%lld " "mAudioStatus=%s mVideoStatus=%s mDecodedAudioEndTime=%" PRId64
"mDecodedVideoEndTime=%lld " " mDecodedVideoEndTime=%" PRId64
"mAudioCompleted=%d mVideoCompleted=%d ", " mAudioCompleted=%d mVideoCompleted=%d ",
GetMediaTime(), mMediaSink->IsStarted() ? GetClock() : -1, GetMediaTime(), mMediaSink->IsStarted() ? GetClock() : -1,
mMediaSink.get(), ToStateStr(), mPlayState.Ref(), mMediaSink.get(), ToStateStr(), mPlayState.Ref(),
mSentFirstFrameLoadedEvent, IsPlaying(), AudioRequestStatus(), mSentFirstFrameLoadedEvent, IsPlaying(), AudioRequestStatus(),

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

@ -2786,12 +2786,12 @@ MediaFormatReader::GetMozDebugReaderData(nsACString& aString)
} }
result += nsPrintfCString("audio decoder: %s\n", audioName); result += nsPrintfCString("audio decoder: %s\n", audioName);
result += nsPrintfCString("audio frames decoded: %lld\n", result += nsPrintfCString("audio frames decoded: %" PRIu64 "\n",
mAudio.mNumSamplesOutputTotal); mAudio.mNumSamplesOutputTotal);
if (HasAudio()) { if (HasAudio()) {
result += nsPrintfCString( result += nsPrintfCString(
"audio state: ni=%d no=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%llu " "audio state: ni=%d no=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%" PRIu64
"out:%llu qs=%u pending:%u waiting:%d sid:%u\n", " out:%" PRIu64 " qs=%u pending:%u waiting:%d sid:%u\n",
NeedInput(mAudio), mAudio.HasPromise(), mAudio.mDemuxRequest.Exists(), NeedInput(mAudio), mAudio.HasPromise(), mAudio.mDemuxRequest.Exists(),
int(mAudio.mQueuedSamples.Length()), int(mAudio.mQueuedSamples.Length()),
mAudio.mTimeThreshold ? mAudio.mTimeThreshold.ref().Time().ToSeconds() mAudio.mTimeThreshold ? mAudio.mTimeThreshold.ref().Time().ToSeconds()
@ -2805,13 +2805,13 @@ MediaFormatReader::GetMozDebugReaderData(nsACString& aString)
result += result +=
nsPrintfCString("hardware video decoding: %s\n", nsPrintfCString("hardware video decoding: %s\n",
VideoIsHardwareAccelerated() ? "enabled" : "disabled"); VideoIsHardwareAccelerated() ? "enabled" : "disabled");
result += nsPrintfCString("video frames decoded: %lld (skipped:%lld)\n", result += nsPrintfCString("video frames decoded: %" PRIu64 " (skipped:%" PRIu64 ")\n",
mVideo.mNumSamplesOutputTotal, mVideo.mNumSamplesOutputTotal,
mVideo.mNumSamplesSkippedTotal); mVideo.mNumSamplesSkippedTotal);
if (HasVideo()) { if (HasVideo()) {
result += nsPrintfCString( result += nsPrintfCString(
"video state: ni=%d no=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%llu " "video state: ni=%d no=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%" PRIu64
"out:%llu qs=%u pending:%u waiting:%d sid:%u\n", " out:%" PRIu64 " qs=%u pending:%u waiting:%d sid:%u\n",
NeedInput(mVideo), mVideo.HasPromise(), mVideo.mDemuxRequest.Exists(), NeedInput(mVideo), mVideo.HasPromise(), mVideo.mDemuxRequest.Exists(),
int(mVideo.mQueuedSamples.Length()), int(mVideo.mQueuedSamples.Length()),
mVideo.mTimeThreshold ? mVideo.mTimeThreshold.ref().Time().ToSeconds() mVideo.mTimeThreshold ? mVideo.mTimeThreshold.ref().Time().ToSeconds()

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

@ -51,7 +51,7 @@ public:
if (NS_SUCCEEDED(mCode)) { if (NS_SUCCEEDED(mCode)) {
return nsCString(); return nsCString();
} }
return nsPrintfCString("0x%08x: %s", mCode, mMessage.get()); return nsPrintfCString("0x%08" PRIx32 ": %s", static_cast<uint32_t>(mCode), mMessage.get());
} }
private: private:
@ -62,4 +62,4 @@ private:
#define RESULT_DETAIL(arg, ...) nsPrintfCString("%s: " arg, __func__, ##__VA_ARGS__) #define RESULT_DETAIL(arg, ...) nsPrintfCString("%s: " arg, __func__, ##__VA_ARGS__)
} // namespace mozilla } // namespace mozilla
#endif // MediaResult_h_ #endif // MediaResult_h_

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

@ -42,8 +42,8 @@ DetailedPromise::~DetailedPromise()
void void
DetailedPromise::MaybeReject(nsresult aArg, const nsACString& aReason) DetailedPromise::MaybeReject(nsresult aArg, const nsACString& aReason)
{ {
nsPrintfCString msg("%s promise rejected 0x%x '%s'", mName.get(), aArg, nsPrintfCString msg("%s promise rejected 0x%" PRIx32 " '%s'", mName.get(),
PromiseFlatCString(aReason).get()); static_cast<uint32_t>(aArg), PromiseFlatCString(aReason).get());
EME_LOG("%s", msg.get()); EME_LOG("%s", msg.get());
MaybeReportTelemetry(Failed); MaybeReportTelemetry(Failed);

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

@ -341,7 +341,8 @@ MP4TrackDemuxer::GetNextSample()
bool keyframe = type == mp4_demuxer::H264::FrameType::I_FRAME; bool keyframe = type == mp4_demuxer::H264::FrameType::I_FRAME;
if (sample->mKeyframe != keyframe) { if (sample->mKeyframe != keyframe) {
NS_WARNING(nsPrintfCString("Frame incorrectly marked as %skeyframe " NS_WARNING(nsPrintfCString("Frame incorrectly marked as %skeyframe "
"@ pts:%lld dur:%u dts:%lld", "@ pts:%" PRId64 " dur:%" PRId64
" dts:%" PRId64,
keyframe ? "" : "non-", sample->mTime, keyframe ? "" : "non-", sample->mTime,
sample->mDuration, sample->mTimecode) sample->mDuration, sample->mTimecode)
.get()); .get());
@ -351,7 +352,8 @@ MP4TrackDemuxer::GetNextSample()
} }
case mp4_demuxer::H264::FrameType::INVALID: case mp4_demuxer::H264::FrameType::INVALID:
NS_WARNING( NS_WARNING(
nsPrintfCString("Invalid H264 frame @ pts:%lld dur:%u dts:%lld", nsPrintfCString("Invalid H264 frame @ pts:%" PRId64 " dur:%" PRId64
" dts:%" PRId64,
sample->mTime, sample->mDuration, sample->mTimecode) sample->mTime, sample->mDuration, sample->mTimecode)
.get()); .get());
// We could reject the sample now, however demuxer errors are fatal. // We could reject the sample now, however demuxer errors are fatal.

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

@ -230,8 +230,8 @@ nsCString
DecodedStreamData::GetDebugInfo() DecodedStreamData::GetDebugInfo()
{ {
return nsPrintfCString( return nsPrintfCString(
"DecodedStreamData=%p mPlaying=%d mAudioFramesWritten=%lld " "DecodedStreamData=%p mPlaying=%d mAudioFramesWritten=%" PRId64
"mNextAudioTime=%lld mNextVideoTime=%lld mHaveSentFinish=%d " " mNextAudioTime=%" PRId64 " mNextVideoTime=%" PRId64 " mHaveSentFinish=%d "
"mHaveSentFinishAudio=%d mHaveSentFinishVideo=%d", "mHaveSentFinishAudio=%d mHaveSentFinishVideo=%d",
this, mPlaying, mAudioFramesWritten, mNextAudioTime, mNextVideoTime, this, mPlaying, mAudioFramesWritten, mNextAudioTime, mNextVideoTime,
mHaveSentFinish, mHaveSentFinishAudio, mHaveSentFinishVideo); mHaveSentFinish, mHaveSentFinishAudio, mHaveSentFinishVideo);
@ -781,7 +781,7 @@ DecodedStream::GetDebugInfo()
{ {
AssertOwnerThread(); AssertOwnerThread();
return nsPrintfCString( return nsPrintfCString(
"DecodedStream=%p mStartTime=%lld mLastOutputTime=%lld mPlaying=%d mData=%p", "DecodedStream=%p mStartTime=%" PRId64 " mLastOutputTime=%" PRId64 " mPlaying=%d mData=%p",
this, mStartTime.valueOr(-1), mLastOutputTime, mPlaying, mData.get()) this, mStartTime.valueOr(-1), mLastOutputTime, mPlaying, mData.get())
+ (mData ? nsCString("\n") + mData->GetDebugInfo() : nsCString()); + (mData ? nsCString("\n") + mData->GetDebugInfo() : nsCString());
} }

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

@ -479,8 +479,8 @@ VideoSink::GetDebugInfo()
{ {
AssertOwnerThread(); AssertOwnerThread();
return nsPrintfCString( return nsPrintfCString(
"IsStarted=%d IsPlaying=%d, VideoQueue: finished=%d size=%d, " "IsStarted=%d IsPlaying=%d, VideoQueue: finished=%d size=%" PRIuSIZE ", "
"mVideoFrameEndTime=%lld mHasVideo=%d mVideoSinkEndRequest.Exists()=%d " "mVideoFrameEndTime=%" PRId64 " mHasVideo=%d mVideoSinkEndRequest.Exists()=%d "
"mEndPromiseHolder.IsEmpty()=%d\n", "mEndPromiseHolder.IsEmpty()=%d\n",
IsStarted(), IsPlaying(), VideoQueue().IsFinished(), VideoQueue().GetSize(), IsStarted(), IsPlaying(), VideoQueue().IsFinished(), VideoQueue().GetSize(),
mVideoFrameEndTime, mHasVideo, mVideoSinkEndRequest.Exists(), mEndPromiseHolder.IsEmpty()) mVideoFrameEndTime, mHasVideo, mVideoSinkEndRequest.Exists(), mEndPromiseHolder.IsEmpty())

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

@ -254,7 +254,7 @@ MediaSourceDemuxer::GetMozDebugReaderData(nsACString& aString)
result += nsPrintfCString("Dumping data for demuxer %p:\n", this); result += nsPrintfCString("Dumping data for demuxer %p:\n", this);
if (mAudioTrack) { if (mAudioTrack) {
result += nsPrintfCString("\tDumping Audio Track Buffer(%s): - mLastAudioTime: %f\n" result += nsPrintfCString("\tDumping Audio Track Buffer(%s): - mLastAudioTime: %f\n"
"\t\tNumSamples:%u Size:%u Evictable:%u NextGetSampleIndex:%u NextInsertionIndex:%d\n", "\t\tNumSamples:%" PRIuSIZE " Size:%u Evictable:%u NextGetSampleIndex:%u NextInsertionIndex:%d\n",
mAudioTrack->mAudioTracks.mInfo->mMimeType.get(), mAudioTrack->mAudioTracks.mInfo->mMimeType.get(),
mAudioTrack->mAudioTracks.mNextSampleTime.ToSeconds(), mAudioTrack->mAudioTracks.mNextSampleTime.ToSeconds(),
mAudioTrack->mAudioTracks.mBuffers[0].Length(), mAudioTrack->mAudioTracks.mBuffers[0].Length(),
@ -268,7 +268,7 @@ MediaSourceDemuxer::GetMozDebugReaderData(nsACString& aString)
} }
if (mVideoTrack) { if (mVideoTrack) {
result += nsPrintfCString("\tDumping Video Track Buffer(%s) - mLastVideoTime: %f\n" result += nsPrintfCString("\tDumping Video Track Buffer(%s) - mLastVideoTime: %f\n"
"\t\tNumSamples:%u Size:%u Evictable:%u NextGetSampleIndex:%u NextInsertionIndex:%d\n", "\t\tNumSamples:%" PRIuSIZE " Size:%u Evictable:%u NextGetSampleIndex:%u NextInsertionIndex:%d\n",
mVideoTrack->mVideoTracks.mInfo->mMimeType.get(), mVideoTrack->mVideoTracks.mInfo->mMimeType.get(),
mVideoTrack->mVideoTracks.mNextSampleTime.ToSeconds(), mVideoTrack->mVideoTracks.mNextSampleTime.ToSeconds(),
mVideoTrack->mVideoTracks.mBuffers[0].Length(), mVideoTrack->mVideoTracks.mBuffers[0].Length(),

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

@ -269,7 +269,7 @@ AppleATDecoder::DecodeSample(MediaRawData* aSample)
LOG("Error decoding audio sample: %d\n", static_cast<int>(rv)); LOG("Error decoding audio sample: %d\n", static_cast<int>(rv));
return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR,
RESULT_DETAIL("Error decoding audio sample: %d @ %lld", RESULT_DETAIL("Error decoding audio sample: %d @ %lld",
rv, aSample->mTime)); static_cast<int>(rv), aSample->mTime));
} }
if (numFrames) { if (numFrames) {

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

@ -1157,7 +1157,7 @@ nsresult nsPluginStreamListenerPeer::SetUpStreamListener(nsIRequest *request,
uint32_t major, minor; uint32_t major, minor;
if (NS_SUCCEEDED(httpChannelInternal->GetResponseVersion(&major, if (NS_SUCCEEDED(httpChannelInternal->GetResponseVersion(&major,
&minor))) { &minor))) {
ver = nsPrintfCString("/%lu.%lu", major, minor); ver = nsPrintfCString("/%" PRIu32 ".%" PRIu32, major, minor);
} }
} }
@ -1168,7 +1168,7 @@ nsresult nsPluginStreamListenerPeer::SetUpStreamListener(nsIRequest *request,
} }
// Assemble everything and pass to listener. // Assemble everything and pass to listener.
nsPrintfCString status("HTTP%s %lu %s", ver.get(), statusNum, nsPrintfCString status("HTTP%s %" PRIu32 " %s", ver.get(), statusNum,
statusText.get()); statusText.get());
static_cast<nsIHTTPHeaderListener*>(mPStreamListener)->StatusLine(status.get()); static_cast<nsIHTTPHeaderListener*>(mPStreamListener)->StatusLine(status.get());
} }

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

@ -1285,7 +1285,7 @@ ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr)
nsContentUtils::LogSimpleConsoleError( nsContentUtils::LogSimpleConsoleError(
NS_ConvertUTF8toUTF16(nsPrintfCString( NS_ConvertUTF8toUTF16(nsPrintfCString(
"Quota %s: %s:%lu", aStr, aFile, aLine)), "Quota %s: %s:%" PRIu32, aStr, aFile, aLine)),
"quota"); "quota");
} }
@ -4334,7 +4334,7 @@ QuotaManager::EnsureStorageIsInitialized()
// Set the page size first. // Set the page size first.
if (kSQLitePageSizeOverride) { if (kSQLitePageSizeOverride) {
rv = connection->ExecuteSimpleSQL( rv = connection->ExecuteSimpleSQL(
nsPrintfCString("PRAGMA page_size = %lu;", kSQLitePageSizeOverride) nsPrintfCString("PRAGMA page_size = %" PRIu32 ";", kSQLitePageSizeOverride)
); );
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
return rv; return rv;

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

@ -2182,9 +2182,9 @@ void ReportLoadError(ErrorResult& aRv, nsresult aLoadResult,
// We don't want to throw a JS exception, because for toplevel script // We don't want to throw a JS exception, because for toplevel script
// loads that would get squelched. // loads that would get squelched.
aRv.ThrowDOMException(NS_ERROR_DOM_NETWORK_ERR, aRv.ThrowDOMException(NS_ERROR_DOM_NETWORK_ERR,
nsPrintfCString("Failed to load worker script at %s (nsresult = 0x%x)", nsPrintfCString("Failed to load worker script at %s (nsresult = 0x%" PRIx32 ")",
NS_ConvertUTF16toUTF8(aScriptURL).get(), NS_ConvertUTF16toUTF8(aScriptURL).get(),
aLoadResult)); static_cast<uint32_t>(aLoadResult)));
return; return;
} }

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

@ -539,8 +539,8 @@ txXPathNodeUtils::getOwnerDocument(const txXPathNode& aNode)
return new txXPathNode(aNode.mNode->OwnerDoc()); return new txXPathNode(aNode.mNode->OwnerDoc());
} }
const char gPrintfFmt[] = "id0x%p"; const char gPrintfFmt[] = "id0x%" PRIxPTR;
const char gPrintfFmtAttr[] = "id0x%p-%010i"; const char gPrintfFmtAttr[] = "id0x%" PRIxPTR "-%010i";
/* static */ /* static */
nsresult nsresult

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

@ -639,8 +639,6 @@ txEXSLTFunctionCall::evaluate(txIEvalContext *aContext,
case DATE_TIME: case DATE_TIME:
{ {
// http://exslt.org/date/functions/date-time/ // http://exslt.org/date/functions/date-time/
// format: YYYY-MM-DDTTHH:MM:SS.sss+00:00
char formatstr[] = "%04hd-%02ld-%02ldT%02ld:%02ld:%02ld.%03ld%c%02ld:%02ld";
PRExplodedTime prtime; PRExplodedTime prtime;
PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &prtime); PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &prtime);
@ -655,7 +653,10 @@ txEXSLTFunctionCall::evaluate(txIEvalContext *aContext,
rv = aContext->recycler()->getStringResult(&strRes); rv = aContext->recycler()->getStringResult(&strRes);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
CopyASCIItoUTF16(nsPrintfCString(formatstr, // format: YYYY-MM-DDTTHH:MM:SS.sss+00:00
CopyASCIItoUTF16(nsPrintfCString("%04hd-%02" PRId32 "-%02" PRId32
"T%02" PRId32 ":%02" PRId32 ":%02" PRId32
".%03" PRId32 "%c%02" PRId32 ":%02" PRId32,
prtime.tm_year, prtime.tm_month + 1, prtime.tm_mday, prtime.tm_year, prtime.tm_month + 1, prtime.tm_mday,
prtime.tm_hour, prtime.tm_min, prtime.tm_sec, prtime.tm_hour, prtime.tm_min, prtime.tm_sec,
prtime.tm_usec / 10000, prtime.tm_usec / 10000,

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

@ -223,7 +223,7 @@ public:
tokenizer.CheckWhite() && tokenizer.CheckWhite() &&
tokenizer.Check(Tokenizer::TOKEN_INTEGER, intToken)) { tokenizer.Check(Tokenizer::TOKEN_INTEGER, intToken)) {
*mFailureId = "FAILURE_ID_ANGLE_ID_"; *mFailureId = "FAILURE_ID_ANGLE_ID_";
mFailureId->AppendPrintf("%i", intToken.AsInteger()); mFailureId->AppendPrintf("%" PRIu64, intToken.AsInteger());
} else { } else {
*mFailureId = "FAILURE_ID_ANGLE_UNKNOWN"; *mFailureId = "FAILURE_ID_ANGLE_UNKNOWN";
} }

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

@ -22,6 +22,7 @@
#include "gfxUtils.h" // for gfxUtils, etc #include "gfxUtils.h" // for gfxUtils, etc
#include "gfx2DGlue.h" #include "gfx2DGlue.h"
#include "mozilla/DebugOnly.h" // for DebugOnly #include "mozilla/DebugOnly.h" // for DebugOnly
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Telemetry.h" // for Accumulate #include "mozilla/Telemetry.h" // for Accumulate
#include "mozilla/ToString.h" #include "mozilla/ToString.h"
#include "mozilla/gfx/2D.h" // for DrawTarget #include "mozilla/gfx/2D.h" // for DrawTarget
@ -1872,20 +1873,20 @@ Layer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
aStream << " [scrollbar]"; aStream << " [scrollbar]";
} }
if (GetScrollbarDirection() == ScrollDirection::VERTICAL) { if (GetScrollbarDirection() == ScrollDirection::VERTICAL) {
aStream << nsPrintfCString(" [vscrollbar=%lld]", GetScrollbarTargetContainerId()).get(); aStream << nsPrintfCString(" [vscrollbar=%" PRIu64 "]", GetScrollbarTargetContainerId()).get();
} }
if (GetScrollbarDirection() == ScrollDirection::HORIZONTAL) { if (GetScrollbarDirection() == ScrollDirection::HORIZONTAL) {
aStream << nsPrintfCString(" [hscrollbar=%lld]", GetScrollbarTargetContainerId()).get(); aStream << nsPrintfCString(" [hscrollbar=%" PRIu64 "]", GetScrollbarTargetContainerId()).get();
} }
if (GetIsFixedPosition()) { if (GetIsFixedPosition()) {
LayerPoint anchor = GetFixedPositionAnchor(); LayerPoint anchor = GetFixedPositionAnchor();
aStream << nsPrintfCString(" [isFixedPosition scrollId=%lld sides=0x%x anchor=%s]", aStream << nsPrintfCString(" [isFixedPosition scrollId=%" PRIu64 " sides=0x%x anchor=%s]",
GetFixedPositionScrollContainerId(), GetFixedPositionScrollContainerId(),
GetFixedPositionSides(), GetFixedPositionSides(),
ToString(anchor).c_str()).get(); ToString(anchor).c_str()).get();
} }
if (GetIsStickyPosition()) { if (GetIsStickyPosition()) {
aStream << nsPrintfCString(" [isStickyPosition scrollId=%d outer=(%.3f,%.3f)-(%.3f,%.3f) " aStream << nsPrintfCString(" [isStickyPosition scrollId=%" PRIu64 " outer=(%.3f,%.3f)-(%.3f,%.3f) "
"inner=(%.3f,%.3f)-(%.3f,%.3f)]", "inner=(%.3f,%.3f)-(%.3f,%.3f)]",
GetStickyScrollContainerId(), GetStickyScrollContainerId(),
GetStickyScrollRangeOuter().x, GetStickyScrollRangeOuter().x,

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

@ -190,10 +190,10 @@ AppendToString(std::stringstream& aStream, const FrameMetrics& m,
AppendToString(aStream, m.GetCumulativeResolution(), " cr="); AppendToString(aStream, m.GetCumulativeResolution(), " cr=");
AppendToString(aStream, m.GetZoom(), " z="); AppendToString(aStream, m.GetZoom(), " z=");
AppendToString(aStream, m.GetExtraResolution(), " er="); AppendToString(aStream, m.GetExtraResolution(), " er=");
aStream << nsPrintfCString(")] [u=(%d %d %lu)", aStream << nsPrintfCString(")] [u=(%d %d %" PRIu32 ")",
m.GetScrollUpdateType(), m.GetDoSmoothScroll(), m.GetScrollUpdateType(), m.GetDoSmoothScroll(),
m.GetScrollGeneration()).get(); m.GetScrollGeneration()).get();
aStream << nsPrintfCString("] [i=(%ld %lld %d)] }", aStream << nsPrintfCString("] [i=(%" PRIu32 " %" PRIu64 " %d)] }",
m.GetPresShellId(), m.GetScrollId(), m.IsRootContent()).get(); m.GetPresShellId(), m.GetScrollId(), m.IsRootContent()).get();
} }
aStream << sfx; aStream << sfx;

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

@ -11,6 +11,8 @@
#include <errno.h> #include <errno.h>
#endif #endif
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/ipc/ProtocolUtils.h" #include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/dom/ContentParent.h" #include "mozilla/dom/ContentParent.h"
@ -232,7 +234,7 @@ AnnotateSystemError()
if (error) { if (error) {
CrashReporter::AnnotateCrashReport( CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("IPCSystemError"), NS_LITERAL_CSTRING("IPCSystemError"),
nsPrintfCString("%lld", error)); nsPrintfCString("%" PRId64, error));
} }
} }
#endif #endif

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

@ -120,7 +120,7 @@ class Logging
ptr = nullptr; ptr = nullptr;
} }
out = nsPrintfCString("<%s %s:%d:%p>", side, objDesc, id.serialNumber(), ptr); out = nsPrintfCString("<%s %s:%" PRIu64 ":%p>", side, objDesc, id.serialNumber(), ptr);
} }
void format(const ReceiverObj& obj, nsCString& out) { void format(const ReceiverObj& obj, nsCString& out) {

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

@ -1954,7 +1954,7 @@ ReportZoneStats(const JS::ZoneStats& zStats,
bool truncated = notableString.Length() < info.length; bool truncated = notableString.Length() < info.length;
nsCString path = pathPrefix + nsCString path = pathPrefix +
nsPrintfCString("strings/" STRING_LENGTH "%d, copies=%d, \"%s\"%s)/", nsPrintfCString("strings/" STRING_LENGTH "%" PRIuSIZE ", copies=%d, \"%s\"%s)/",
info.length, info.numCopies, escapedString.get(), info.length, info.numCopies, escapedString.get(),
truncated ? " (truncated)" : ""); truncated ? " (truncated)" : "");

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

@ -127,17 +127,13 @@ GetPrefsFor(EventClassID aEventClassID)
nsPrintfCString repositionPref("ui.%s.radius.reposition", prefBranch); nsPrintfCString repositionPref("ui.%s.radius.reposition", prefBranch);
Preferences::AddBoolVarCache(&prefs->mRepositionEventCoords, repositionPref.get(), false); Preferences::AddBoolVarCache(&prefs->mRepositionEventCoords, repositionPref.get(), false);
nsPrintfCString touchClusterPref("ui.zoomedview.enabled", prefBranch); Preferences::AddBoolVarCache(&prefs->mTouchClusterDetectionEnabled, "ui.zoomedview.enabled", false);
Preferences::AddBoolVarCache(&prefs->mTouchClusterDetectionEnabled, touchClusterPref.get(), false);
nsPrintfCString simplifiedClusterDetectionPref("ui.zoomedview.simplified", prefBranch); Preferences::AddBoolVarCache(&prefs->mSimplifiedClusterDetection, "ui.zoomedview.simplified", false);
Preferences::AddBoolVarCache(&prefs->mSimplifiedClusterDetection, simplifiedClusterDetectionPref.get(), false);
nsPrintfCString limitReadableSizePref("ui.zoomedview.limitReadableSize", prefBranch); Preferences::AddUintVarCache(&prefs->mLimitReadableSize, "ui.zoomedview.limitReadableSize", 8);
Preferences::AddUintVarCache(&prefs->mLimitReadableSize, limitReadableSizePref.get(), 8);
nsPrintfCString keepLimitSize("ui.zoomedview.keepLimitSize", prefBranch); Preferences::AddUintVarCache(&prefs->mKeepLimitSizeForCluster, "ui.zoomedview.keepLimitSize", 16);
Preferences::AddUintVarCache(&prefs->mKeepLimitSizeForCluster, keepLimitSize.get(), 16);
} }
return prefs; return prefs;

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

@ -62,7 +62,7 @@ GetFrameState(nsIFrame* aFrame)
#undef FRAME_STATE_BIT #undef FRAME_STATE_BIT
if (state) { if (state) {
result.AppendPrintf(" | 0x%0llx", state); result.AppendPrintf(" | 0x%0" PRIx64, static_cast<uint64_t>(state));
} }
return result; return result;

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

@ -498,7 +498,7 @@ ListInterestingFiles(nsString& aAnnotation, nsIFile* aFile,
aAnnotation.AppendLiteral(" ("); aAnnotation.AppendLiteral(" (");
int64_t size; int64_t size;
if (NS_SUCCEEDED(aFile->GetFileSize(&size))) { if (NS_SUCCEEDED(aFile->GetFileSize(&size))) {
aAnnotation.AppendPrintf("%ld", size); aAnnotation.AppendPrintf("%" PRId64, size);
} else { } else {
aAnnotation.AppendLiteral("???"); aAnnotation.AppendLiteral("???");
} }
@ -601,7 +601,8 @@ AnnotateCrashReport(nsIURI* aURI)
nsAutoCString resolvedSpec; nsAutoCString resolvedSpec;
nsresult rv = handler->ResolveURI(aURI, resolvedSpec); nsresult rv = handler->ResolveURI(aURI, resolvedSpec);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
annotation.AppendPrintf("(ResolveURI failed with 0x%08x)\n", rv); annotation.AppendPrintf("(ResolveURI failed with 0x%08" PRIx32 ")\n",
static_cast<uint32_t>(rv));
} }
annotation.Append(NS_ConvertUTF8toUTF16(resolvedSpec)); annotation.Append(NS_ConvertUTF8toUTF16(resolvedSpec));
annotation.Append('\n'); annotation.Append('\n');
@ -694,7 +695,8 @@ AnnotateCrashReport(nsIURI* aURI)
nsZipFind* find; nsZipFind* find;
rv = zip->FindInit(nullptr, &find); rv = zip->FindInit(nullptr, &find);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
annotation.AppendPrintf(" (FindInit failed with 0x%08x)\n", rv); annotation.AppendPrintf(" (FindInit failed with 0x%08" PRIx32 ")\n",
static_cast<uint32_t>(rv));
} else if (!find) { } else if (!find) {
annotation.AppendLiteral(" (FindInit returned null)\n"); annotation.AppendLiteral(" (FindInit returned null)\n");
} else { } else {
@ -784,7 +786,7 @@ nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI,
nsresult rv = loader->LoadSheetSync(aURI, aParsingMode, true, aSheet); nsresult rv = loader->LoadSheetSync(aURI, aParsingMode, true, aSheet);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
ErrorLoadingSheet(aURI, ErrorLoadingSheet(aURI,
nsPrintfCString("LoadSheetSync failed with error %x", rv).get(), nsPrintfCString("LoadSheetSync failed with error %" PRIx32, static_cast<uint32_t>(rv)).get(),
aFailureAction); aFailureAction);
} }
} }

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

@ -95,7 +95,7 @@ void nsStyleUtil::AppendEscapedCSSString(const nsAString& aString,
for (; in != end; in++) { for (; in != end; in++) {
if (*in < 0x20 || (*in >= 0x7F && *in < 0xA0)) { if (*in < 0x20 || (*in >= 0x7F && *in < 0xA0)) {
// Escape U+0000 through U+001F and U+007F through U+009F numerically. // Escape U+0000 through U+001F and U+007F through U+009F numerically.
aReturn.AppendPrintf("\\%hx ", *in); aReturn.AppendPrintf("\\%x ", *in);
} else { } else {
if (*in == '"' || *in == '\'' || *in == '\\') { if (*in == '"' || *in == '\'' || *in == '\\') {
// Escape backslash and quote characters symbolically. // Escape backslash and quote characters symbolically.
@ -149,7 +149,7 @@ nsStyleUtil::AppendEscapedCSSIdent(const nsAString& aIdent, nsAString& aReturn)
// numerically. If we didn't escape it numerically, it would get // numerically. If we didn't escape it numerically, it would get
// interpreted as a numeric escape for the wrong character. // interpreted as a numeric escape for the wrong character.
if (in != end && ('0' <= *in && *in <= '9')) { if (in != end && ('0' <= *in && *in <= '9')) {
aReturn.AppendPrintf("\\%hx ", *in); aReturn.AppendPrintf("\\%x ", *in);
++in; ++in;
} }
@ -159,7 +159,7 @@ nsStyleUtil::AppendEscapedCSSIdent(const nsAString& aIdent, nsAString& aReturn)
aReturn.Append(char16_t(0xFFFD)); aReturn.Append(char16_t(0xFFFD));
} else if (ch < 0x20 || (0x7F <= ch && ch < 0xA0)) { } else if (ch < 0x20 || (0x7F <= ch && ch < 0xA0)) {
// Escape U+0000 through U+001F and U+007F through U+009F numerically. // Escape U+0000 through U+001F and U+007F through U+009F numerically.
aReturn.AppendPrintf("\\%hx ", *in); aReturn.AppendPrintf("\\%x ", *in);
} else { } else {
// Escape ASCII non-identifier printables as a backslash plus // Escape ASCII non-identifier printables as a backslash plus
// the character. // the character.

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

@ -2327,7 +2327,7 @@ nsOfflineCacheDevice::CreateApplicationCache(const nsACString &group,
// Include the timestamp to guarantee uniqueness across runs, and // Include the timestamp to guarantee uniqueness across runs, and
// the gNextTemporaryClientID for uniqueness within a second. // the gNextTemporaryClientID for uniqueness within a second.
clientID.Append(nsPrintfCString("|%016lld|%d", clientID.Append(nsPrintfCString("|%016" PRId64 "|%d",
now / PR_USEC_PER_SEC, now / PR_USEC_PER_SEC,
gNextTemporaryClientID++)); gNextTemporaryClientID++));

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

@ -16,6 +16,9 @@
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsSocketTransportService2.h" #include "nsSocketTransportService2.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/SizePrintfMacros.h"
namespace mozilla { namespace mozilla {
namespace net { namespace net {
@ -50,15 +53,15 @@ nsHttpConnectionMgr::OnMsgPrintDiagnostics(int32_t, ARefBase *)
AtActiveConnectionLimit(ent, NS_HTTP_ALLOW_KEEPALIVE)); AtActiveConnectionLimit(ent, NS_HTTP_ALLOW_KEEPALIVE));
mLogData.AppendPrintf(" RestrictConnections = %d\n", mLogData.AppendPrintf(" RestrictConnections = %d\n",
RestrictConnections(ent)); RestrictConnections(ent));
mLogData.AppendPrintf(" Pending Q Length = %u\n", mLogData.AppendPrintf(" Pending Q Length = %" PRIuSIZE "\n",
ent->mPendingQ.Length()); ent->mPendingQ.Length());
mLogData.AppendPrintf(" Active Conns Length = %u\n", mLogData.AppendPrintf(" Active Conns Length = %" PRIuSIZE "\n",
ent->mActiveConns.Length()); ent->mActiveConns.Length());
mLogData.AppendPrintf(" Idle Conns Length = %u\n", mLogData.AppendPrintf(" Idle Conns Length = %" PRIuSIZE "\n",
ent->mIdleConns.Length()); ent->mIdleConns.Length());
mLogData.AppendPrintf(" Half Opens Length = %u\n", mLogData.AppendPrintf(" Half Opens Length = %" PRIuSIZE "\n",
ent->mHalfOpens.Length()); ent->mHalfOpens.Length());
mLogData.AppendPrintf(" Coalescing Keys Length = %u\n", mLogData.AppendPrintf(" Coalescing Keys Length = %" PRIuSIZE "\n",
ent->mCoalescingKeys.Length()); ent->mCoalescingKeys.Length());
mLogData.AppendPrintf(" Spdy using = %d, preferred = %d\n", mLogData.AppendPrintf(" Spdy using = %d, preferred = %d\n",
ent->mUsingSpdy, ent->mInPreferredHash); ent->mUsingSpdy, ent->mInPreferredHash);
@ -141,7 +144,7 @@ nsHttpConnection::PrintDiagnostics(nsCString &log)
log.AppendPrintf(" time since last read = %ums\n", log.AppendPrintf(" time since last read = %ums\n",
PR_IntervalToMilliseconds(now - mLastReadTime)); 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); mMaxBytesRead, mTotalBytesRead, mTotalBytesWritten);
log.AppendPrintf(" rtt = %ums\n", PR_IntervalToMilliseconds(mRtt)); log.AppendPrintf(" rtt = %ums\n", PR_IntervalToMilliseconds(mRtt));
@ -173,7 +176,7 @@ Http2Session::PrintDiagnostics(nsCString &log)
mStreamTransactionHash.Count(), mStreamTransactionHash.Count(),
mStreamIDHash.Count()); mStreamIDHash.Count());
log.AppendPrintf(" Queued Stream Size = %d\n", mQueuedStreams.GetSize()); log.AppendPrintf(" Queued Stream Size = %" PRIuSIZE "\n", mQueuedStreams.GetSize());
PRIntervalTime now = PR_IntervalNow(); PRIntervalTime now = PR_IntervalNow();
log.AppendPrintf(" Ping Threshold = %ums\n", log.AppendPrintf(" Ping Threshold = %ums\n",

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

@ -3649,7 +3649,7 @@ nsHttpChannel::OpenCacheEntry(bool isHttps)
cacheEntryOpenFlags |= nsICacheStorage::OPEN_BYPASS_IF_BUSY; cacheEntryOpenFlags |= nsICacheStorage::OPEN_BYPASS_IF_BUSY;
if (PossiblyIntercepted()) { if (PossiblyIntercepted()) {
extension.Append(nsPrintfCString("u%lld", mInterceptionID)); extension.Append(nsPrintfCString("u%" PRIu64, mInterceptionID));
} else if (mPostID) { } else if (mPostID) {
extension.Append(nsPrintfCString("%d", mPostID)); extension.Append(nsPrintfCString("%d", mPostID));
} }

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

@ -895,7 +895,8 @@ nsHttpHandler::InitUserAgentComponents()
#endif #endif
SInt32 majorVersion = nsCocoaFeatures::OSXVersionMajor(); SInt32 majorVersion = nsCocoaFeatures::OSXVersionMajor();
SInt32 minorVersion = nsCocoaFeatures::OSXVersionMinor(); SInt32 minorVersion = nsCocoaFeatures::OSXVersionMinor();
mOscpu += nsPrintfCString(" %d.%d", majorVersion, minorVersion); mOscpu += nsPrintfCString(" %d.%d", static_cast<int>(majorVersion),
static_cast<int>(minorVersion));
#elif defined (XP_UNIX) #elif defined (XP_UNIX)
struct utsname name; struct utsname name;

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

@ -229,7 +229,7 @@ nsHttpResponseHead::SetContentLength(int64_t len)
mHeaders.ClearHeader(nsHttp::Content_Length); mHeaders.ClearHeader(nsHttp::Content_Length);
else else
mHeaders.SetHeader(nsHttp::Content_Length, mHeaders.SetHeader(nsHttp::Content_Length,
nsPrintfCString("%lld", len), nsPrintfCString("%" PRId64, len),
false, false,
nsHttpHeaderArray::eVarietyResponse); nsHttpHeaderArray::eVarietyResponse);
} }

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

@ -735,7 +735,7 @@ nsFileView::GetCellText(int32_t aRow, nsITreeColumn* aCol,
else { else {
int64_t fileSize; int64_t fileSize;
curFile->GetFileSize(&fileSize); curFile->GetFileSize(&fileSize);
CopyUTF8toUTF16(nsPrintfCString("%lld", fileSize), aCellText); CopyUTF8toUTF16(nsPrintfCString("%" PRId64, fileSize), aCellText);
} }
} }

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

@ -1666,7 +1666,7 @@ nsNavBookmarks::SetItemDateAdded(int64_t aItemId, PRTime aDateAdded,
OnItemChanged(bookmark.id, OnItemChanged(bookmark.id,
NS_LITERAL_CSTRING("dateAdded"), NS_LITERAL_CSTRING("dateAdded"),
false, false,
nsPrintfCString("%lld", bookmark.dateAdded), nsPrintfCString("%" PRId64, bookmark.dateAdded),
bookmark.dateAdded, bookmark.dateAdded,
bookmark.type, bookmark.type,
bookmark.parentId, bookmark.parentId,
@ -1736,7 +1736,7 @@ nsNavBookmarks::SetItemLastModified(int64_t aItemId, PRTime aLastModified,
OnItemChanged(bookmark.id, OnItemChanged(bookmark.id,
NS_LITERAL_CSTRING("lastModified"), NS_LITERAL_CSTRING("lastModified"),
false, false,
nsPrintfCString("%lld", bookmark.lastModified), nsPrintfCString("%" PRId64, bookmark.lastModified),
bookmark.lastModified, bookmark.lastModified,
bookmark.type, bookmark.type,
bookmark.parentId, bookmark.parentId,

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

@ -7,6 +7,8 @@
#include <stdio.h> #include <stdio.h>
#include "mozilla/DebugOnly.h" #include "mozilla/DebugOnly.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/SizePrintfMacros.h"
#include "nsNavHistory.h" #include "nsNavHistory.h"
@ -210,7 +212,7 @@ void GetTagsSqlFragment(int64_t aTagsFolder,
"JOIN moz_bookmarks t_t ON t_t.id = +b_t.parent " "JOIN moz_bookmarks t_t ON t_t.id = +b_t.parent "
"WHERE b_t.fk = ") + aRelation + NS_LITERAL_CSTRING(" " "WHERE b_t.fk = ") + aRelation + NS_LITERAL_CSTRING(" "
"AND t_t.parent = ") + "AND t_t.parent = ") +
nsPrintfCString("%lld", aTagsFolder) + NS_LITERAL_CSTRING(" " nsPrintfCString("%" PRId64, aTagsFolder) + NS_LITERAL_CSTRING(" "
")")); ")"));
} }
@ -1553,7 +1555,7 @@ PlacesSQLQueryBuilder::SelectAsURI()
"LEFT OUTER JOIN moz_favicons f ON h.favicon_id = f.id " "LEFT OUTER JOIN moz_favicons f ON h.favicon_id = f.id "
"WHERE NOT EXISTS ( " "WHERE NOT EXISTS ( "
"SELECT id FROM moz_bookmarks WHERE id = b2.parent AND parent = ") + "SELECT id FROM moz_bookmarks WHERE id = b2.parent AND parent = ") +
nsPrintfCString("%lld", history->GetTagsFolder()) + nsPrintfCString("%" PRId64, history->GetTagsFolder()) +
NS_LITERAL_CSTRING(") " NS_LITERAL_CSTRING(") "
"ORDER BY b2.fk DESC, b2.lastModified DESC"); "ORDER BY b2.fk DESC, b2.lastModified DESC");
} }
@ -1574,7 +1576,7 @@ PlacesSQLQueryBuilder::SelectAsURI()
"WHERE NOT EXISTS " "WHERE NOT EXISTS "
"(SELECT id FROM moz_bookmarks " "(SELECT id FROM moz_bookmarks "
"WHERE id = b.parent AND parent = ") + "WHERE id = b.parent AND parent = ") +
nsPrintfCString("%lld", history->GetTagsFolder()) + nsPrintfCString("%" PRId64, history->GetTagsFolder()) +
NS_LITERAL_CSTRING(") " NS_LITERAL_CSTRING(") "
"{ADDITIONAL_CONDITIONS}"); "{ADDITIONAL_CONDITIONS}");
} }
@ -1634,7 +1636,7 @@ PlacesSQLQueryBuilder::SelectAsDay()
// insert position in a result. // insert position in a result.
mQueryString = nsPrintfCString( mQueryString = nsPrintfCString(
"SELECT null, " "SELECT null, "
"'place:type=%ld&sort=%ld&beginTime='||beginTime||'&endTime='||endTime, " "'place:type=%d&sort=%d&beginTime='||beginTime||'&endTime='||endTime, "
"dayTitle, null, null, beginTime, null, null, null, null, null, null, " "dayTitle, null, null, beginTime, null, null, null, null, null, null, "
"null, null, null " "null, null, null "
"FROM (", // TOUTER BEGIN "FROM (", // TOUTER BEGIN
@ -1838,7 +1840,7 @@ PlacesSQLQueryBuilder::SelectAsSite()
} }
mQueryString = nsPrintfCString( mQueryString = nsPrintfCString(
"SELECT null, 'place:type=%ld&sort=%ld&domain=&domainIsHost=true'%s, " "SELECT null, 'place:type=%d&sort=%d&domain=&domainIsHost=true'%s, "
":localhost, :localhost, null, null, null, null, null, null, null, " ":localhost, :localhost, null, null, null, null, null, null, null, "
"null, null, null " "null, null, null "
"WHERE EXISTS ( " "WHERE EXISTS ( "
@ -1853,7 +1855,7 @@ PlacesSQLQueryBuilder::SelectAsSite()
") " ") "
"UNION ALL " "UNION ALL "
"SELECT null, " "SELECT null, "
"'place:type=%ld&sort=%ld&domain='||host||'&domainIsHost=true'%s, " "'place:type=%d&sort=%d&domain='||host||'&domainIsHost=true'%s, "
"host, host, null, null, null, null, null, null, null, " "host, host, null, null, null, null, null, null, null, "
"null, null, null " "null, null, null "
"FROM ( " "FROM ( "
@ -1893,11 +1895,11 @@ PlacesSQLQueryBuilder::SelectAsTag()
mHasDateColumns = true; mHasDateColumns = true;
mQueryString = nsPrintfCString( mQueryString = nsPrintfCString(
"SELECT null, 'place:folder=' || id || '&queryType=%d&type=%ld', " "SELECT null, 'place:folder=' || id || '&queryType=%d&type=%d', "
"title, null, null, null, null, null, dateAdded, " "title, null, null, null, null, null, dateAdded, "
"lastModified, null, null, null, null, null, null " "lastModified, null, null, null, null, null, null "
"FROM moz_bookmarks " "FROM moz_bookmarks "
"WHERE parent = %lld", "WHERE parent = %" PRId64,
nsINavHistoryQueryOptions::QUERY_TYPE_BOOKMARKS, nsINavHistoryQueryOptions::QUERY_TYPE_BOOKMARKS,
nsINavHistoryQueryOptions::RESULTS_AS_TAG_CONTENTS, nsINavHistoryQueryOptions::RESULTS_AS_TAG_CONTENTS,
history->GetTagsFolder() history->GetTagsFolder()
@ -3356,7 +3358,7 @@ nsNavHistory::QueryToSelectClause(nsNavHistoryQuery* aQuery, // const
clause.Condition("b.parent IN("); clause.Condition("b.parent IN(");
for (nsTArray<int64_t>::size_type i = 0; i < includeFolders.Length(); ++i) { for (nsTArray<int64_t>::size_type i = 0; i < includeFolders.Length(); ++i) {
clause.Str(nsPrintfCString("%lld", includeFolders[i]).get()); clause.Str(nsPrintfCString("%" PRId64, includeFolders[i]).get());
if (i < includeFolders.Length() - 1) { if (i < includeFolders.Length() - 1) {
clause.Str(","); clause.Str(",");
} }

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

@ -46,7 +46,7 @@ ReflectIceEntry(const WebrtcTelemetry::WebrtcIceCandidateType *entry,
if (!statsObj) if (!statsObj)
return false; return false;
if (!JS_DefineProperty(cx, obj, if (!JS_DefineProperty(cx, obj,
nsPrintfCString("%lu", bitmask).BeginReading(), nsPrintfCString("%" PRIu32, bitmask).BeginReading(),
statsObj, JSPROP_ENUMERATE)) { statsObj, JSPROP_ENUMERATE)) {
return false; return false;
} }

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

@ -39,7 +39,7 @@ static mozilla::LazyLogModule gUrlClassifierStreamUpdaterLog("UrlClassifierStrea
// Calls nsIURLFormatter::TrimSensitiveURLs to remove sensitive // Calls nsIURLFormatter::TrimSensitiveURLs to remove sensitive
// info from the logging message. // info from the logging message.
static void TrimAndLog(const char* aFmt, ...) static MOZ_FORMAT_PRINTF(1, 2) void TrimAndLog(const char* aFmt, ...)
{ {
nsString raw; nsString raw;
@ -404,7 +404,8 @@ nsUrlClassifierStreamUpdater::StreamFinished(nsresult status,
// We are a service and may not be reset with Init between calls, so reset // We are a service and may not be reset with Init between calls, so reset
// mBeganStream manually. // mBeganStream manually.
mBeganStream = false; mBeganStream = false;
LOG(("nsUrlClassifierStreamUpdater::StreamFinished [%x, %d]", status, requestedDelay)); LOG(("nsUrlClassifierStreamUpdater::StreamFinished [%" PRIx32 ", %d]",
static_cast<uint32_t>(status), requestedDelay));
if (NS_FAILED(status) || mPendingUpdates.Length() == 0) { if (NS_FAILED(status) || mPendingUpdates.Length() == 0) {
// We're done. // We're done.
LOG(("nsUrlClassifierStreamUpdater::Done [this=%p]", this)); LOG(("nsUrlClassifierStreamUpdater::Done [this=%p]", this));
@ -710,7 +711,7 @@ nsUrlClassifierStreamUpdater::OnDataAvailable(nsIRequest *request,
LOG(("OnDataAvailable (%d bytes)", aLength)); LOG(("OnDataAvailable (%d bytes)", aLength));
if (aSourceOffset > MAX_FILE_SIZE) { if (aSourceOffset > MAX_FILE_SIZE) {
LOG(("OnDataAvailable::Abort because exceeded the maximum file size(%lld)", aSourceOffset)); LOG(("OnDataAvailable::Abort because exceeded the maximum file size(%" PRIu64 ")", aSourceOffset));
return NS_ERROR_FILE_TOO_BIG; return NS_ERROR_FILE_TOO_BIG;
} }
@ -735,8 +736,8 @@ nsUrlClassifierStreamUpdater::OnStopRequest(nsIRequest *request, nsISupports* co
if (!mDBService) if (!mDBService)
return NS_ERROR_NOT_INITIALIZED; return NS_ERROR_NOT_INITIALIZED;
LOG(("OnStopRequest (status %x, beganStream %s, this=%p)", aStatus, LOG(("OnStopRequest (status %" PRIx32 ", beganStream %s, this=%p)",
mBeganStream ? "true" : "false", this)); static_cast<uint32_t>(aStatus), mBeganStream ? "true" : "false", this));
nsresult rv; nsresult rv;

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

@ -47,7 +47,7 @@ CreateResetProfile(nsIToolkitProfileService* aProfileSvc, const nsACString& aOld
} else { } else {
newProfileName.Assign("default-"); newProfileName.Assign("default-");
} }
newProfileName.Append(nsPrintfCString("%lld", PR_Now() / 1000)); newProfileName.Append(nsPrintfCString("%" PRId64, PR_Now() / 1000));
nsresult rv = aProfileSvc->CreateProfile(nullptr, // choose a default dir for us nsresult rv = aProfileSvc->CreateProfile(nullptr, // choose a default dir for us
newProfileName, newProfileName,
getter_AddRefs(newProfile)); getter_AddRefs(newProfile));

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

@ -4175,9 +4175,9 @@ XREMain::XRE_mainRun()
} }
// Needs to be set after xpcom initialization. // Needs to be set after xpcom initialization.
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonBase"), CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonBase"),
nsPrintfCString("%.16llx", uint64_t(gMozillaPoisonBase))); nsPrintfCString("%.16" PRIu64, uint64_t(gMozillaPoisonBase)));
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonSize"), CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonSize"),
nsPrintfCString("%lu", uint32_t(gMozillaPoisonSize))); nsPrintfCString("%" PRIu32, uint32_t(gMozillaPoisonSize)));
#ifdef XP_WIN #ifdef XP_WIN
PR_CreateThread(PR_USER_THREAD, AnnotateSystemManufacturer_ThreadStart, 0, PR_CreateThread(PR_USER_THREAD, AnnotateSystemManufacturer_ThreadStart, 0,

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

@ -67,7 +67,7 @@ void ShutdownTaskTracer();
// Add a label to the currently running task, aFormat is the message to log, // Add a label to the currently running task, aFormat is the message to log,
// followed by corresponding parameters. // followed by corresponding parameters.
void AddLabel(const char* aFormat, ...); void AddLabel(const char* aFormat, ...) MOZ_FORMAT_PRINTF(1, 2);
void StartLogging(); void StartLogging();
void StopLogging(); void StopLogging();

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

@ -461,7 +461,7 @@ private:
aDesc.AppendPrintf("The stack size of a non-main thread named '%s' with " aDesc.AppendPrintf("The stack size of a non-main thread named '%s' with "
"thread ID %d. This corresponds to '[stack:%d]' " "thread ID %d. This corresponds to '[stack:%d]' "
"in /proc/%d/smaps.", threadName.get(), tid, tid); "in /proc/%d/smaps.", threadName.get(), tid, tid, tid);
} else if (absPath.EqualsLiteral("[vdso]")) { } else if (absPath.EqualsLiteral("[vdso]")) {
aName.AppendLiteral("vdso"); aName.AppendLiteral("vdso");
aDesc.AppendLiteral( aDesc.AppendLiteral(

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

@ -50,7 +50,7 @@ public:
MozillaRegisterDebugFILE(mFile); MozillaRegisterDebugFILE(mFile);
} }
void Printf(const char* aFormat, ...) void Printf(const char* aFormat, ...) MOZ_FORMAT_PRINTF(2, 3)
{ {
MOZ_ASSERT(mFile); MOZ_ASSERT(mFile);
va_list list; va_list list;

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

@ -25,7 +25,7 @@ class nsPrintfCString : public nsFixedCString
typedef nsCString string_type; typedef nsCString string_type;
public: public:
explicit nsPrintfCString(const char_type* aFormat, ...) explicit nsPrintfCString(const char_type* aFormat, ...) MOZ_FORMAT_PRINTF(2, 3)
: nsFixedCString(mLocalBuffer, kLocalBufferSize, 0) : nsFixedCString(mLocalBuffer, kLocalBufferSize, 0)
{ {
va_list ap; va_list ap;

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

@ -7,6 +7,7 @@
#include "mozilla/CheckedInt.h" #include "mozilla/CheckedInt.h"
#include "mozilla/double-conversion.h" #include "mozilla/double-conversion.h"
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
#include "mozilla/Printf.h"
using double_conversion::DoubleToStringConverter; using double_conversion::DoubleToStringConverter;
@ -904,29 +905,41 @@ nsTSubstring_CharT::StripChars(const char_type* aChars, uint32_t aOffset)
mLength = to - mData; mLength = to - mData;
} }
int struct MOZ_STACK_CLASS PrintfAppend_CharT : public mozilla::PrintfTarget
nsTSubstring_CharT::AppendFunc(void* aArg, const char* aStr, uint32_t aLen)
{ {
self_type* self = static_cast<self_type*>(aArg); explicit PrintfAppend_CharT(nsTSubstring_CharT* aString)
: mString(aString)
// NSPR sends us the final null terminator even though we don't want it {
if (aLen && aStr[aLen - 1] == '\0') {
--aLen;
} }
self->AppendASCII(aStr, aLen); bool append(const char* aStr, size_t aLen) override {
if (aLen == 0) {
return true;
}
return aLen; // Printf sends us the final null terminator even though we don't want it
} if (aStr[aLen - 1] == '\0') {
--aLen;
}
mString->AppendASCII(aStr, aLen);
return true;
}
private:
nsTSubstring_CharT* mString;
};
void void
nsTSubstring_CharT::AppendPrintf(const char* aFormat, ...) nsTSubstring_CharT::AppendPrintf(const char* aFormat, ...)
{ {
PrintfAppend_CharT appender(this);
va_list ap; va_list ap;
va_start(ap, aFormat); va_start(ap, aFormat);
uint32_t r = PR_vsxprintf(AppendFunc, this, aFormat, ap); bool r = appender.vprint(aFormat, ap);
if (r == (uint32_t)-1) { if (!r) {
MOZ_CRASH("Allocation or other failure in PR_vsxprintf"); MOZ_CRASH("Allocation or other failure in PrintfTarget::print");
} }
va_end(ap); va_end(ap);
} }
@ -934,9 +947,10 @@ nsTSubstring_CharT::AppendPrintf(const char* aFormat, ...)
void void
nsTSubstring_CharT::AppendPrintf(const char* aFormat, va_list aAp) nsTSubstring_CharT::AppendPrintf(const char* aFormat, va_list aAp)
{ {
uint32_t r = PR_vsxprintf(AppendFunc, this, aFormat, aAp); PrintfAppend_CharT appender(this);
if (r == (uint32_t)-1) { bool r = appender.vprint(aFormat, aAp);
MOZ_CRASH("Allocation or other failure in PR_vsxprintf"); if (!r) {
MOZ_CRASH("Allocation or other failure in PrintfTarget::print");
} }
} }

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

@ -6,6 +6,7 @@
// IWYU pragma: private, include "nsString.h" // IWYU pragma: private, include "nsString.h"
#include "mozilla/Casting.h" #include "mozilla/Casting.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/UniquePtr.h" #include "mozilla/UniquePtr.h"
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
@ -574,46 +575,54 @@ public:
} }
/** /**
* Append a formatted string to the current string. Uses the format * Append a formatted string to the current string. Uses the
* codes documented in prprf.h * standard printf format codes.
*/ */
void AppendPrintf(const char* aFormat, ...); void AppendPrintf(const char* aFormat, ...) MOZ_FORMAT_PRINTF(2, 3);
void AppendPrintf(const char* aFormat, va_list aAp); void AppendPrintf(const char* aFormat, va_list aAp);
void AppendInt(int32_t aInteger) void AppendInt(int32_t aInteger)
{ {
AppendPrintf("%d", aInteger); AppendPrintf("%" PRId32, aInteger);
} }
void AppendInt(int32_t aInteger, int aRadix) void AppendInt(int32_t aInteger, int aRadix)
{ {
const char* fmt = aRadix == 10 ? "%d" : aRadix == 8 ? "%o" : "%x"; if (aRadix == 10) {
AppendPrintf(fmt, aInteger); AppendPrintf("%" PRId32, aInteger);
} else {
AppendPrintf(aRadix == 8 ? "%" PRIo32 : "%" PRIx32,
static_cast<uint32_t>(aInteger));
}
} }
void AppendInt(uint32_t aInteger) void AppendInt(uint32_t aInteger)
{ {
AppendPrintf("%u", aInteger); AppendPrintf("%" PRIu32, aInteger);
} }
void AppendInt(uint32_t aInteger, int aRadix) void AppendInt(uint32_t aInteger, int aRadix)
{ {
const char* fmt = aRadix == 10 ? "%u" : aRadix == 8 ? "%o" : "%x"; AppendPrintf(aRadix == 10 ? "%" PRIu32 : aRadix == 8 ? "%" PRIo32 : "%" PRIx32,
AppendPrintf(fmt, aInteger); aInteger);
} }
void AppendInt(int64_t aInteger) void AppendInt(int64_t aInteger)
{ {
AppendPrintf("%lld", aInteger); AppendPrintf("%" PRId64, aInteger);
} }
void AppendInt(int64_t aInteger, int aRadix) void AppendInt(int64_t aInteger, int aRadix)
{ {
const char* fmt = aRadix == 10 ? "%lld" : aRadix == 8 ? "%llo" : "%llx"; if (aRadix == 10) {
AppendPrintf(fmt, aInteger); AppendPrintf("%" PRId64, aInteger);
} else {
AppendPrintf(aRadix == 8 ? "%" PRIo64 : "%" PRIx64,
static_cast<uint64_t>(aInteger));
}
} }
void AppendInt(uint64_t aInteger) void AppendInt(uint64_t aInteger)
{ {
AppendPrintf("%llu", aInteger); AppendPrintf("%" PRIu64, aInteger);
} }
void AppendInt(uint64_t aInteger, int aRadix) void AppendInt(uint64_t aInteger, int aRadix)
{ {
const char* fmt = aRadix == 10 ? "%llu" : aRadix == 8 ? "%llo" : "%llx"; AppendPrintf(aRadix == 10 ? "%" PRIu64 : aRadix == 8 ? "%" PRIo64 : "%" PRIx64,
AppendPrintf(fmt, aInteger); aInteger);
} }
/** /**
@ -1044,8 +1053,6 @@ protected:
void NS_FASTCALL ReplaceLiteral(index_type aCutStart, size_type aCutLength, void NS_FASTCALL ReplaceLiteral(index_type aCutStart, size_type aCutLength,
const char_type* aData, size_type aLength); const char_type* aData, size_type aLength);
static int AppendFunc(void* aArg, const char* aStr, uint32_t aLen);
public: public:
// NOTE: this method is declared public _only_ for convenience for // NOTE: this method is declared public _only_ for convenience for

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

@ -12,6 +12,7 @@
#define nsTFixedString_CharT nsFixedCString #define nsTFixedString_CharT nsFixedCString
#define nsTAutoString_CharT nsAutoCString #define nsTAutoString_CharT nsAutoCString
#define nsTSubstring_CharT nsACString #define nsTSubstring_CharT nsACString
#define PrintfAppend_CharT PrintfAppend_nsACString
#define nsTSubstringTuple_CharT nsCSubstringTuple #define nsTSubstringTuple_CharT nsCSubstringTuple
#define nsTStringComparator_CharT nsCStringComparator #define nsTStringComparator_CharT nsCStringComparator
#define nsTDefaultStringComparator_CharT nsDefaultCStringComparator #define nsTDefaultStringComparator_CharT nsDefaultCStringComparator

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

@ -12,6 +12,7 @@
#define nsTFixedString_CharT nsFixedString #define nsTFixedString_CharT nsFixedString
#define nsTAutoString_CharT nsAutoString #define nsTAutoString_CharT nsAutoString
#define nsTSubstring_CharT nsAString #define nsTSubstring_CharT nsAString
#define PrintfAppend_CharT PrintfAppend_nsAString
#define nsTSubstringTuple_CharT nsSubstringTuple #define nsTSubstringTuple_CharT nsSubstringTuple
#define nsTStringComparator_CharT nsStringComparator #define nsTStringComparator_CharT nsStringComparator
#define nsTDefaultStringComparator_CharT nsDefaultStringComparator #define nsTDefaultStringComparator_CharT nsDefaultStringComparator

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

@ -13,6 +13,7 @@
#undef nsTFixedString_CharT #undef nsTFixedString_CharT
#undef nsTAutoString_CharT #undef nsTAutoString_CharT
#undef nsTSubstring_CharT #undef nsTSubstring_CharT
#undef PrintfAppend_CharT
#undef nsTSubstringTuple_CharT #undef nsTSubstringTuple_CharT
#undef nsTStringComparator_CharT #undef nsTStringComparator_CharT
#undef nsTDefaultStringComparator_CharT #undef nsTDefaultStringComparator_CharT