Bug 1766561 - Fix various formatting errors. r=media-playback-reviewers,gfx-reviewers,nika,necko-reviewers,rkraesig,alwu,padenot,kershaw

- Missing/Extra formatting directives
- Typos in formatting directives
- Non-literal strings used as formatting strings
- Wrong types passed as argument
- Swapped/Wrong arguments
- Commas between parts of unique formatting strings

Differential Revision: https://phabricator.services.mozilla.com/D144921
This commit is contained in:
Mike Hommey 2022-05-03 20:49:10 +00:00
parent af52d87089
commit ec71e64fa5
11 changed files with 42 additions and 34 deletions

View File

@ -62,7 +62,7 @@ RefPtr<MediaDataDecoder::DecodePromise> WMFMediaDataDecoder::ProcessError(
"WMFMediaDataDecoder::ProcessError for decoder with description %s with "
"reason: %s",
GetDescriptionName().get(), aReason);
LOG(markerString.get());
LOG("%s", markerString.get());
PROFILER_MARKER_TEXT("WMFDecoder Error", MEDIA_PLAYBACK, {}, markerString);
// TODO: For the error DXGI_ERROR_DEVICE_RESET, we could return

View File

@ -375,7 +375,7 @@ MediaResult WMFVideoMFTManager::InitInternal() {
if (!mDXVAFailureReason.IsEmpty()) {
// DXVA failure reason being set can mean that D3D11 failed, or that DXVA is
// entirely disabled.
LOG(nsPrintfCString("DXVA failure: %s", mDXVAFailureReason.get()).get());
LOG("DXVA failure: %s", mDXVAFailureReason.get());
}
if (!mUseHwAccel) {

View File

@ -227,7 +227,8 @@ void gfxDWriteFontFamily::FindStyleVariationsLocked(
fe->Name().get(), Name().get(),
(fe->IsItalic()) ? "italic"
: (fe->IsOblique() ? "oblique" : "normal"),
weightString.get(), fe->Stretch(), psname.get(), fullname.get()));
weightString.get(), fe->Stretch().AsScalar(), psname.get(),
fullname.get()));
}
}
@ -1717,7 +1718,7 @@ nsresult gfxDWriteFontList::InitFontListForPlatform() {
fe->Name().get(), gillSansMTFamily->Name().get(),
(fe->IsItalic()) ? "italic"
: (fe->IsOblique() ? "oblique" : "normal"),
weightString.get(), fe->Stretch()));
weightString.get(), fe->Stretch().AsScalar()));
}
}

View File

@ -395,7 +395,7 @@ void EventTokenBucket::WantNormalTimers() {
}
void EventTokenBucket::FineGrainResetTimerNotify() {
SOCKET_LOG(("EventTokenBucket::FineGrainResetTimerNotify() events = %zd\n",
SOCKET_LOG(("EventTokenBucket::FineGrainResetTimerNotify(%p) events = %zd\n",
this, mEvents.GetSize()));
mFineGrainResetTimerArmed = false;

View File

@ -3118,22 +3118,25 @@ static void LogOSError(const char* aPrefix, const void* aObjPtr) {
# ifdef XP_WIN
DWORD errCode = WSAGetLastError();
LPVOID errMessage;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&errMessage, 0, NULL);
char* errMessage;
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)&errMessage, 0, NULL);
NS_WARNING(nsPrintfCString("%s [%p] OS error[0x%lx] %s",
aPrefix ? aPrefix : "nsSocketTransport", aObjPtr,
errCode,
errMessage ? errMessage : "<no error text>")
.get());
LocalFree(errMessage);
# else
int errCode = errno;
char* errMessage = strerror(errno);
# endif
NS_WARNING(nsPrintfCString("%s [%p] OS error[0x%x] %s",
aPrefix ? aPrefix : "nsSocketTransport", aObjPtr,
errCode,
errMessage ? errMessage : "<no error text>")
.get());
# ifdef XP_WIN
LocalFree(errMessage);
# endif
#endif
}

View File

@ -160,7 +160,7 @@ void nsNotifyAddrListener::HashSortedNetworkIds(std::vector<GUID> nwGUIDS,
sha1.update(&nwGUID, sizeof(GUID));
if (LOG_ENABLED()) {
nsPrintfCString guid("%08lX%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X%lX",
nsPrintfCString guid("%08lX%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X",
nwGUID.Data1, nwGUID.Data2, nwGUID.Data3,
nwGUID.Data4[0], nwGUID.Data4[1], nwGUID.Data4[2],
nwGUID.Data4[3], nwGUID.Data4[4], nwGUID.Data4[5],

View File

@ -858,7 +858,8 @@ bool IMMHandler::OnIMESetContext(nsWindow* aWindow, WPARAM wParam,
// the WM_IME_SETCONTEXT on the top level window.
if (IsTopLevelWindowOfComposition(aWindow)) {
MOZ_LOG(gIMELog, LogLevel::Info,
(" IMMHandler::OnIMESetContext, hWnd=%p is top level window"));
(" IMMHandler::OnIMESetContext, hWnd=%p is top level window",
aWindow->GetWindowHandle()));
return true;
}

View File

@ -2375,7 +2375,7 @@ bool NativeKey::HandleAppCommandMessage() const {
this));
if (mWidget->Destroyed()) {
MOZ_LOG(gKeyLog, LogLevel::Info,
("%p NativeKey::HandleAppCommandMessage(), %s event caused "
("%p NativeKey::HandleAppCommandMessage(), keyup event caused "
"destroying the widget",
this));
return true;
@ -3103,10 +3103,10 @@ bool NativeKey::GetFollowingCharMessage(MSG& aCharMsg) {
gKeyLog, LogLevel::Warning,
("%p NativeKey::GetFollowingCharMessage(), WARNING, failed to "
"remove a char message due to message change, let's retry to "
"remove the message with newly found char message, ",
"nextKeyMsgInAllWindows=%s, nextKeyMsg=%s, kFoundCharMsg=%s", this,
ToString(nextKeyMsgInAllWindows).get(), ToString(nextKeyMsg).get(),
ToString(kFoundCharMsg).get()));
"remove the message with newly found char message, "
"nextKeyMsgInAllWindows=%s, nextKeyMsg=%s, kFoundCharMsg=%s",
this, ToString(nextKeyMsgInAllWindows).get(),
ToString(nextKeyMsg).get(), ToString(kFoundCharMsg).get()));
nextKeyMsg = nextKeyMsgInAllWindows;
continue;
}
@ -3187,8 +3187,9 @@ bool NativeKey::GetFollowingCharMessage(MSG& aCharMsg) {
if (removedMsg.message == WM_NULL) {
MOZ_LOG(gKeyLog, LogLevel::Warning,
("%p NativeKey::GetFollowingCharMessage(), WARNING, failed to "
"remove a char message, instead, removed WM_NULL message, ",
"removedMsg=%s", this, ToString(removedMsg).get()));
"remove a char message, instead, removed WM_NULL message, "
"removedMsg=%s",
this, ToString(removedMsg).get()));
// Check if there is the message which we're trying to remove.
MSG newNextKeyMsg;
if (!WinUtils::PeekMessage(&newNextKeyMsg, mMsg.hwnd, WM_KEYFIRST,

View File

@ -2296,11 +2296,12 @@ void TSFTextStore::FlushPendingActions() {
switch (action.mType) {
case PendingAction::Type::eKeyboardEvent:
if (mDestroyed) {
MOZ_LOG(gIMELog, LogLevel::Warning,
("0x%p TSFTextStore::FlushPendingActions() "
"IGNORED pending KeyboardEvent(%s) due to already destroyed",
action.mKeyMsg.message == WM_KEYDOWN ? "eKeyDown" : "eKeyUp",
this));
MOZ_LOG(
gIMELog, LogLevel::Warning,
("0x%p TSFTextStore::FlushPendingActions() "
"IGNORED pending KeyboardEvent(%s) due to already destroyed",
this,
action.mKeyMsg.message == WM_KEYDOWN ? "eKeyDown" : "eKeyUp"));
}
MOZ_DIAGNOSTIC_ASSERT(action.mKeyMsg.message == WM_KEYDOWN ||
action.mKeyMsg.message == WM_KEYUP);
@ -2695,10 +2696,11 @@ TSFTextStore::GetStatus(TS_STATUS* pdcs) {
STDMETHODIMP
TSFTextStore::QueryInsert(LONG acpTestStart, LONG acpTestEnd, ULONG cch,
LONG* pacpResultStart, LONG* pacpResultEnd) {
MOZ_LOG(gIMELog, LogLevel::Info,
("0x%p TSFTextStore::QueryInsert(acpTestStart=%ld, "
"acpTestEnd=%ld, cch=%lu, pacpResultStart=0x%p, pacpResultEnd=0x%p)",
this, acpTestStart, acpTestEnd, cch, acpTestStart, acpTestEnd));
MOZ_LOG(
gIMELog, LogLevel::Info,
("0x%p TSFTextStore::QueryInsert(acpTestStart=%ld, "
"acpTestEnd=%ld, cch=%lu, pacpResultStart=0x%p, pacpResultEnd=0x%p)",
this, acpTestStart, acpTestEnd, cch, pacpResultStart, pacpResultEnd));
if (!pacpResultStart || !pacpResultEnd) {
MOZ_LOG(gIMELog, LogLevel::Error,

View File

@ -524,7 +524,7 @@ void WinUtils::LogW(const wchar_t* fmt, ...) {
NS_ASSERTION(gWindowsLog,
"Called WinUtils Log() but Widget "
"log module doesn't exist!");
MOZ_LOG(gWindowsLog, LogLevel::Error, (utf8));
MOZ_LOG(gWindowsLog, LogLevel::Error, ("%s", utf8));
}
delete[] utf8;
}
@ -557,7 +557,7 @@ void WinUtils::Log(const char* fmt, ...) {
NS_ASSERTION(gWindowsLog,
"Called WinUtils Log() but Widget "
"log module doesn't exist!");
MOZ_LOG(gWindowsLog, LogLevel::Error, (buffer));
MOZ_LOG(gWindowsLog, LogLevel::Error, ("%s", buffer));
delete[] buffer;
}

View File

@ -126,7 +126,7 @@ ULONG WINAPI ControlCallback(WMIDPREQUESTCODE aRequestCode, PVOID aContext,
// Note: We only accept one handle
if ((HANDLE)sessionHandle == INVALID_HANDLE_VALUE) {
ULONG result = GetLastError();
LOG(("Probes: ControlCallback failed, %ul", result));
LOG(("Probes: ControlCallback failed, %lu", result));
return result;
} else if (context->mIsActive && context->mSessionHandle &&
context->mSessionHandle != sessionHandle) {