mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
win: Fix %u, %d, %x/DWORD printf mismatches
To enable clang-cl's printf format string mismatch checking, a few mismatch errors need to be fixed where DWORD (unsigned long) is printed with %u, %d or %x (an 'l' is needed). Change-Id: I2cbfafe823a186bfe3a555aec3a7ca03e85466f8 Reviewed-on: https://chromium-review.googlesource.com/598651 Commit-Queue: Xi Cheng <chengx@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
edf4dde8ae
commit
01110c0a3b
@ -277,7 +277,7 @@ void AddUint64(std::vector<unsigned char>* data_vector, uint64_t data) {
|
||||
void CreatePipe(std::wstring* pipe_name, ScopedFileHANDLE* pipe_instance) {
|
||||
int tries = 5;
|
||||
std::string pipe_name_base =
|
||||
base::StringPrintf("\\\\.\\pipe\\crashpad_%d_", GetCurrentProcessId());
|
||||
base::StringPrintf("\\\\.\\pipe\\crashpad_%lu_", GetCurrentProcessId());
|
||||
do {
|
||||
*pipe_name = base::UTF8ToUTF16(pipe_name_base + RandomString());
|
||||
|
||||
|
@ -106,7 +106,7 @@ void SystemSnapshotWin::Initialize(ProcessReaderWin* process_reader) {
|
||||
os_version_major_ = ffi.dwFileVersionMS >> 16;
|
||||
os_version_minor_ = ffi.dwFileVersionMS & 0xffff;
|
||||
os_version_bugfix_ = ffi.dwFileVersionLS >> 16;
|
||||
os_version_build_ = base::StringPrintf("%u", ffi.dwFileVersionLS & 0xffff);
|
||||
os_version_build_ = base::StringPrintf("%lu", ffi.dwFileVersionLS & 0xffff);
|
||||
os_version_full_ = base::StringPrintf(
|
||||
"%s %u.%u.%u.%s%s",
|
||||
os_name.c_str(),
|
||||
|
@ -47,7 +47,7 @@ std::string UserAgent() {
|
||||
|
||||
VS_FIXEDFILEINFO version;
|
||||
if (GetModuleVersionAndType(base::FilePath(kWinHttpDll), &version)) {
|
||||
user_agent.append(base::StringPrintf("/%u.%u.%u.%u",
|
||||
user_agent.append(base::StringPrintf("/%lu.%lu.%lu.%lu",
|
||||
version.dwFileVersionMS >> 16,
|
||||
version.dwFileVersionMS & 0xffff,
|
||||
version.dwFileVersionLS >> 16,
|
||||
@ -56,7 +56,7 @@ std::string UserAgent() {
|
||||
|
||||
if (GetModuleVersionAndType(base::FilePath(L"kernel32.dll"), &version) &&
|
||||
(version.dwFileOS & VOS_NT_WINDOWS32) == VOS_NT_WINDOWS32) {
|
||||
user_agent.append(base::StringPrintf(" Windows_NT/%u.%u.%u.%u (",
|
||||
user_agent.append(base::StringPrintf(" Windows_NT/%lu.%lu.%lu.%lu (",
|
||||
version.dwFileVersionMS >> 16,
|
||||
version.dwFileVersionMS & 0xffff,
|
||||
version.dwFileVersionLS >> 16,
|
||||
@ -96,12 +96,12 @@ std::string WinHttpMessage(const char* extra) {
|
||||
arraysize(msgbuf),
|
||||
NULL);
|
||||
if (!len) {
|
||||
return base::StringPrintf("%s: error 0x%x while retrieving error 0x%x",
|
||||
return base::StringPrintf("%s: error 0x%lx while retrieving error 0x%lx",
|
||||
extra,
|
||||
GetLastError(),
|
||||
error_code);
|
||||
}
|
||||
return base::StringPrintf("%s: %s (0x%x)", extra, msgbuf, error_code);
|
||||
return base::StringPrintf("%s: %s (0x%lx)", extra, msgbuf, error_code);
|
||||
}
|
||||
|
||||
struct ScopedHINTERNETTraits {
|
||||
@ -371,7 +371,7 @@ bool HTTPTransportWin::ExecuteSynchronously(std::string* response_body) {
|
||||
}
|
||||
|
||||
if (status_code != 200) {
|
||||
LOG(ERROR) << base::StringPrintf("HTTP status %d", status_code);
|
||||
LOG(ERROR) << base::StringPrintf("HTTP status %lu", status_code);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ std::string FormatNtstatus(DWORD ntstatus) {
|
||||
if (len) {
|
||||
return msgbuf;
|
||||
} else {
|
||||
return base::StringPrintf("<failed to retrieve error message (0x%x)>",
|
||||
return base::StringPrintf("<failed to retrieve error message (0x%lx)>",
|
||||
GetLastError());
|
||||
}
|
||||
}
|
||||
@ -63,7 +63,7 @@ NtstatusLogMessage::NtstatusLogMessage(
|
||||
|
||||
NtstatusLogMessage::~NtstatusLogMessage() {
|
||||
stream() << ": " << FormatNtstatus(ntstatus_)
|
||||
<< base::StringPrintf(" (0x%08x)", ntstatus_);
|
||||
<< base::StringPrintf(" (0x%08lx)", ntstatus_);
|
||||
}
|
||||
|
||||
} // namespace logging
|
||||
|
Loading…
x
Reference in New Issue
Block a user