summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2014-09-04 18:33:12 -0700
committerNico Weber <thakis@chromium.org>2014-09-05 01:35:50 +0000
commitea993a8549fda789ca41cceb919266931fd353f5 (patch)
treed67c4b909bb44b6b42d024d3f915aa6f53a900e8
parent9f8fe767920001f734dddc678bad491be8cc363b (diff)
downloadchromium_src-ea993a8549fda789ca41cceb919266931fd353f5.zip
chromium_src-ea993a8549fda789ca41cceb919266931fd353f5.tar.gz
chromium_src-ea993a8549fda789ca41cceb919266931fd353f5.tar.bz2
win/clang: Fix all remaining -Wformat warnings.
We recently switched from building chromium_builder_tests to building everything, this fixes almost all warnings in the ~1000 translation units we weren't compiling before. No behavior change. BUG=82385 R=scottmg@chromium.org TBR=cpu Review URL: https://codereview.chromium.org/543923002 Cr-Commit-Position: refs/heads/master@{#293393}
-rw-r--r--chrome/installer/gcapi/gcapi_test.cc2
-rw-r--r--cloud_print/service/service.gyp10
-rw-r--r--cloud_print/virtual_driver/win/install/setup.cc2
-rw-r--r--net/tools/dump_cache/upgrade_win.cc2
-rw-r--r--remoting/remoting_host_win.gypi4
-rw-r--r--sandbox/win/sandbox_poc/pocdll/fs.cc4
-rw-r--r--sandbox/win/sandbox_poc/pocdll/handles.cc12
-rw-r--r--sandbox/win/sandbox_poc/pocdll/invasive.cc10
-rw-r--r--sandbox/win/sandbox_poc/pocdll/processes_and_threads.cc16
-rw-r--r--sandbox/win/sandbox_poc/pocdll/spyware.cc4
-rw-r--r--tools/win/static_initializers/static_initializers.cc6
11 files changed, 41 insertions, 31 deletions
diff --git a/chrome/installer/gcapi/gcapi_test.cc b/chrome/installer/gcapi/gcapi_test.cc
index 477b15a..4e90d41 100644
--- a/chrome/installer/gcapi/gcapi_test.cc
+++ b/chrome/installer/gcapi/gcapi_test.cc
@@ -25,7 +25,7 @@ void call_statically() {
if (result_flag_off != result_flag_on)
printf("Registry key flag is not being set properly.");
- printf("Static call returned result as %d and reason as %d.\n",
+ printf("Static call returned result as %ld and reason as %ld.\n",
result_flag_on, reason);
}
diff --git a/cloud_print/service/service.gyp b/cloud_print/service/service.gyp
index 04d612d..482bc19 100644
--- a/cloud_print/service/service.gyp
+++ b/cloud_print/service/service.gyp
@@ -121,6 +121,16 @@
'secur32.lib',
],
},
+ 'conditions': [
+ ['clang==1', {
+ # atlapp.h contains a global "using namespace WTL;".
+ # TODO: Remove once cloud_print_service.cc no longer depends on
+ # atlapp.h, http://crbug.com/5027
+ 'VCCLCompilerTool': {
+ 'AdditionalOptions': ['-Wno-header-hygiene'],
+ },
+ }],
+ ],
},
},
{
diff --git a/cloud_print/virtual_driver/win/install/setup.cc b/cloud_print/virtual_driver/win/install/setup.cc
index 0a0cfe4..588eb6d 100644
--- a/cloud_print/virtual_driver/win/install/setup.cc
+++ b/cloud_print/virtual_driver/win/install/setup.cc
@@ -345,7 +345,7 @@ HRESULT InstallPrinter(void) {
base::string16 port_name;
printer_info.pPortName = const_cast<LPWSTR>(kPortName);
printer_info.Attributes = PRINTER_ATTRIBUTE_DIRECT|PRINTER_ATTRIBUTE_LOCAL;
- printer_info.pPrintProcessor = L"winprint";
+ printer_info.pPrintProcessor = const_cast<LPWSTR>(L"winprint");
HANDLE handle = AddPrinter(NULL, 2, reinterpret_cast<BYTE*>(&printer_info));
if (handle == NULL) {
HRESULT result = GetLastHResult();
diff --git a/net/tools/dump_cache/upgrade_win.cc b/net/tools/dump_cache/upgrade_win.cc
index dfb9e5c..41eafb7 100644
--- a/net/tools/dump_cache/upgrade_win.cc
+++ b/net/tools/dump_cache/upgrade_win.cc
@@ -401,7 +401,7 @@ void MasterSM::DoGetKey(int bytes_read) {
void MasterSM::DoCreateEntryComplete(int result) {
std::string key(input_->buffer);
if (result != net::OK) {
- printf("Skipping entry \"%s\": %d\n", key.c_str(), GetLastError());
+ printf("Skipping entry \"%s\": %ld\n", key.c_str(), GetLastError());
return SendGetPrevEntry();
}
diff --git a/remoting/remoting_host_win.gypi b/remoting/remoting_host_win.gypi
index a3f0777..d91505a 100644
--- a/remoting/remoting_host_win.gypi
+++ b/remoting/remoting_host_win.gypi
@@ -252,9 +252,9 @@
},
'conditions': [
['clang==1', {
- # atlbase.h contains a global "using namespace WTL;".
+ # atlapp.h contains a global "using namespace WTL;".
# TODO: Remove once remoting/host/verify_config_window_win.h no
- # longer depends on atlbase.h, http://crbug.com/5027
+ # longer depends on atlapp.h, http://crbug.com/5027
'VCCLCompilerTool': {
'AdditionalOptions': ['-Wno-header-hygiene'],
},
diff --git a/sandbox/win/sandbox_poc/pocdll/fs.cc b/sandbox/win/sandbox_poc/pocdll/fs.cc
index aafb9a5..40596af 100644
--- a/sandbox/win/sandbox_poc/pocdll/fs.cc
+++ b/sandbox/win/sandbox_poc/pocdll/fs.cc
@@ -14,7 +14,7 @@ void TryOpenFile(const wchar_t *path, FILE *output) {
wchar_t path_expanded[MAX_PATH] = {0};
DWORD size = ::ExpandEnvironmentStrings(path, path_expanded, MAX_PATH - 1);
if (!size) {
- fprintf(output, "[ERROR] Cannot expand \"%S\". Error %d.\r\n", path,
+ fprintf(output, "[ERROR] Cannot expand \"%S\". Error %ld.\r\n", path,
::GetLastError());
}
@@ -32,7 +32,7 @@ void TryOpenFile(const wchar_t *path, FILE *output) {
file);
::CloseHandle(file);
} else {
- fprintf(output, "[BLOCKED] Opening file \"%S\". Error %d.\r\n", path,
+ fprintf(output, "[BLOCKED] Opening file \"%S\". Error %ld.\r\n", path,
::GetLastError());
}
}
diff --git a/sandbox/win/sandbox_poc/pocdll/handles.cc b/sandbox/win/sandbox_poc/pocdll/handles.cc
index 0568484f..483e24a 100644
--- a/sandbox/win/sandbox_poc/pocdll/handles.cc
+++ b/sandbox/win/sandbox_poc/pocdll/handles.cc
@@ -20,7 +20,7 @@ void POCDLL_API TestGetHandle(HANDLE log) {
// Initialize the NTAPI functions we need
HMODULE ntdll_handle = ::GetModuleHandle(L"ntdll.dll");
if (!ntdll_handle) {
- fprintf(output, "[ERROR] Cannot load ntdll.dll. Error %d\r\n",
+ fprintf(output, "[ERROR] Cannot load ntdll.dll. Error %ld\r\n",
::GetLastError());
return;
}
@@ -33,7 +33,7 @@ void POCDLL_API TestGetHandle(HANDLE log) {
GetProcAddress(ntdll_handle, "NtQuerySystemInformation"));
if (!NtQueryObject || !NtQueryInformationFile || !NtQuerySystemInformation) {
- fprintf(output, "[ERROR] Cannot load all NT functions. Error %d\r\n",
+ fprintf(output, "[ERROR] Cannot load all NT functions. Error %ld\r\n",
::GetLastError());
return;
}
@@ -45,7 +45,7 @@ void POCDLL_API TestGetHandle(HANDLE log) {
SystemHandleInformation, &temp_info, sizeof(temp_info),
&buffer_size);
if (!buffer_size) {
- fprintf(output, "[ERROR] Get the number of handles. Error 0x%X\r\n",
+ fprintf(output, "[ERROR] Get the number of handles. Error 0x%lX\r\n",
status);
return;
}
@@ -56,7 +56,7 @@ void POCDLL_API TestGetHandle(HANDLE log) {
status = NtQuerySystemInformation(SystemHandleInformation, system_handles,
buffer_size, &buffer_size);
if (STATUS_SUCCESS != status) {
- fprintf(output, "[ERROR] Failed to get the handle list. Error 0x%X\r\n",
+ fprintf(output, "[ERROR] Failed to get the handle list. Error 0x%lX\r\n",
status);
delete [] system_handles;
return;
@@ -152,14 +152,14 @@ void POCDLL_API TestGetHandle(HANDLE log) {
file_name_string.Buffer = file_name->FileName;
file_name_string.Length = (USHORT)file_name->FileNameLength;
file_name_string.MaximumLength = (USHORT)file_name->FileNameLength;
- fprintf(output, "[GRANTED] Handle 0x%4.4X Access: 0x%8.8X "
+ fprintf(output, "[GRANTED] Handle 0x%4.4X Access: 0x%8.8lX "
"Type: %-13.13wZ Path: %wZ\r\n",
h,
system_handles->Information[i].GrantedAccess,
type ? &type->TypeName : NULL,
&file_name_string);
} else {
- fprintf(output, "[GRANTED] Handle 0x%4.4X Access: 0x%8.8X "
+ fprintf(output, "[GRANTED] Handle 0x%4.4X Access: 0x%8.8lX "
"Type: %-13.13wZ Path: %wZ\r\n",
h,
system_handles->Information[i].GrantedAccess,
diff --git a/sandbox/win/sandbox_poc/pocdll/invasive.cc b/sandbox/win/sandbox_poc/pocdll/invasive.cc
index df36612..9ee13b0 100644
--- a/sandbox/win/sandbox_poc/pocdll/invasive.cc
+++ b/sandbox/win/sandbox_poc/pocdll/invasive.cc
@@ -35,11 +35,11 @@ void POCDLL_API TestThreadBombing(HANDLE log) {
0, // No creation flags
&tid);
if (thread) {
- fprintf(output, "[GRANTED] Creating thread with tid 0x%X\r\n", tid);
+ fprintf(output, "[GRANTED] Creating thread with tid 0x%lX\r\n", tid);
::CloseHandle(thread);
number_errors = 0;
} else {
- fprintf(output, "[BLOCKED] Creating thread. Error %d\r\n",
+ fprintf(output, "[BLOCKED] Creating thread. Error %ld\r\n",
::GetLastError());
number_errors++;
}
@@ -90,10 +90,10 @@ void POCDLL_API TestTakeAllCpu(HANDLE log) {
::SetThreadAffinityMask(thread, affinity_mask);
if (::SetThreadPriority(thread, REALTIME_PRIORITY_CLASS)) {
- fprintf(output, "[GRANTED] Set thread(%d) priority to Realtime\r\n",
+ fprintf(output, "[GRANTED] Set thread(%ld) priority to Realtime\r\n",
tid);
} else {
- fprintf(output, "[BLOCKED] Set thread(%d) priority to Realtime\r\n",
+ fprintf(output, "[BLOCKED] Set thread(%ld) priority to Realtime\r\n",
tid);
}
@@ -103,7 +103,7 @@ void POCDLL_API TestTakeAllCpu(HANDLE log) {
system_mask = system_mask >> 1;
}
} else {
- fprintf(output, "[ERROR] Cannot get affinity mask. Error %d\r\n",
+ fprintf(output, "[ERROR] Cannot get affinity mask. Error %ld\r\n",
::GetLastError());
}
}
diff --git a/sandbox/win/sandbox_poc/pocdll/processes_and_threads.cc b/sandbox/win/sandbox_poc/pocdll/processes_and_threads.cc
index 0a7503c..03e12ba 100644
--- a/sandbox/win/sandbox_poc/pocdll/processes_and_threads.cc
+++ b/sandbox/win/sandbox_poc/pocdll/processes_and_threads.cc
@@ -17,7 +17,7 @@ void POCDLL_API TestProcesses(HANDLE log) {
HANDLE snapshot = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
if (INVALID_HANDLE_VALUE == snapshot) {
fprintf(output, "[BLOCKED] Cannot list all processes on the system. "
- "Error %d\r\n", ::GetLastError());
+ "Error %ld\r\n", ::GetLastError());
return;
}
@@ -31,13 +31,13 @@ void POCDLL_API TestProcesses(HANDLE log) {
FALSE, // Do not inherit handle.
process_entry.th32ProcessID);
if (NULL == process) {
- fprintf(output, "[BLOCKED] Found process %S:%d but cannot open it. "
- "Error %d\r\n",
+ fprintf(output, "[BLOCKED] Found process %S:%ld but cannot open it. "
+ "Error %ld\r\n",
process_entry.szExeFile,
process_entry.th32ProcessID,
::GetLastError());
} else {
- fprintf(output, "[GRANTED] Found process %S:%d and open succeeded.\r\n",
+ fprintf(output, "[GRANTED] Found process %S:%ld and open succeeded.\r\n",
process_entry.szExeFile, process_entry.th32ProcessID);
::CloseHandle(process);
}
@@ -47,7 +47,7 @@ void POCDLL_API TestProcesses(HANDLE log) {
DWORD err_code = ::GetLastError();
if (ERROR_NO_MORE_FILES != err_code) {
- fprintf(output, "[ERROR] Error %d while looking at the processes on "
+ fprintf(output, "[ERROR] Error %ld while looking at the processes on "
"the system\r\n", err_code);
}
@@ -61,7 +61,7 @@ void POCDLL_API TestThreads(HANDLE log) {
HANDLE snapshot = ::CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, NULL);
if (INVALID_HANDLE_VALUE == snapshot) {
fprintf(output, "[BLOCKED] Cannot list all threads on the system. "
- "Error %d\r\n", ::GetLastError());
+ "Error %ld\r\n", ::GetLastError());
return;
}
@@ -80,7 +80,7 @@ void POCDLL_API TestThreads(HANDLE log) {
nb_failure++;
} else {
nb_success++;
- fprintf(output, "[GRANTED] Found thread %d:%d and able to open it.\r\n",
+ fprintf(output, "[GRANTED] Found thread %ld:%ld and able to open it.\r\n",
thread_entry.th32OwnerProcessID,
thread_entry.th32ThreadID);
::CloseHandle(thread);
@@ -91,7 +91,7 @@ void POCDLL_API TestThreads(HANDLE log) {
DWORD err_code = ::GetLastError();
if (ERROR_NO_MORE_FILES != err_code) {
- fprintf(output, "[ERROR] Error %d while looking at the processes on "
+ fprintf(output, "[ERROR] Error %ld while looking at the processes on "
"the system\r\n", err_code);
}
diff --git a/sandbox/win/sandbox_poc/pocdll/spyware.cc b/sandbox/win/sandbox_poc/pocdll/spyware.cc
index cd75d4f..cf0bd41 100644
--- a/sandbox/win/sandbox_poc/pocdll/spyware.cc
+++ b/sandbox/win/sandbox_poc/pocdll/spyware.cc
@@ -19,7 +19,7 @@ void POCDLL_API TestSpyKeys(HANDLE log) {
fprintf(output, "[GRANTED] successfully registered hotkey\r\n");
UnregisterHotKey(NULL, 1);
} else {
- fprintf(output, "[BLOCKED] Failed to register hotkey. Error = %d\r\n",
+ fprintf(output, "[BLOCKED] Failed to register hotkey. Error = %ld\r\n",
::GetLastError());
}
@@ -63,6 +63,6 @@ void POCDLL_API TestSpyScreen(HANDLE log) {
}
}
- fprintf(output, "[BLOCKED] Read pixel on screen. Error = %d\r\n",
+ fprintf(output, "[BLOCKED] Read pixel on screen. Error = %ld\r\n",
::GetLastError());
}
diff --git a/tools/win/static_initializers/static_initializers.cc b/tools/win/static_initializers/static_initializers.cc
index a09715e..440bb9de 100644
--- a/tools/win/static_initializers/static_initializers.cc
+++ b/tools/win/static_initializers/static_initializers.cc
@@ -26,7 +26,7 @@ static bool LoadDataFromPdb(const wchar_t* filename,
(void**)source);
if (FAILED(hr)) {
- printf("CoCreateInstance failed - HRESULT = %08X\n", hr);
+ printf("CoCreateInstance failed - HRESULT = %08lX\n", hr);
return false;
}
@@ -36,7 +36,7 @@ static bool LoadDataFromPdb(const wchar_t* filename,
// Open and prepare the debug data associated with the executable.
hr = (*source)->loadDataForExe(filename, search_path, NULL);
if (FAILED(hr)) {
- printf("loadDataForExe failed - HRESULT = %08X\n", hr);
+ printf("loadDataForExe failed - HRESULT = %08lX\n", hr);
return false;
}
@@ -44,7 +44,7 @@ static bool LoadDataFromPdb(const wchar_t* filename,
hr = (*source)->openSession(session);
if (FAILED(hr)) {
- printf("openSession failed - HRESULT = %08X\n", hr);
+ printf("openSession failed - HRESULT = %08lX\n", hr);
return false;
}