Fix compile error with Windows clang.

This change fixes the following errors shown during compile with
Windows clang:

error: cannot pass non-trivial object of type 'ATL::CComBSTR' to variadic function; expected type from format string was 'wchar_t *' [-Wnon-pod-varargs]

Original CL: https://codereview.chromium.org/1252913009/

BUG=https://code.google.com/p/google-breakpad/issues/detail?id=662

Review URL: https://codereview.chromium.org/1307463003

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1494 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
wfh@chromium.org 2015-08-19 22:28:17 +00:00
parent 3bc3dad8f8
commit 9178d8fa03

View File

@ -277,9 +277,10 @@ bool PDBSourceLineWriter::PrintFunction(IDiaSymbol *function,
AddressRangeVector ranges; AddressRangeVector ranges;
MapAddressRange(image_map_, AddressRange(rva, static_cast<DWORD>(length)), MapAddressRange(image_map_, AddressRange(rva, static_cast<DWORD>(length)),
&ranges); &ranges);
wstring wname(name);
for (size_t i = 0; i < ranges.size(); ++i) { for (size_t i = 0; i < ranges.size(); ++i) {
fprintf(output_, "FUNC %x %x %x %ws\n", fprintf(output_, "FUNC %x %x %x %ws\n",
ranges[i].rva, ranges[i].length, stack_param_size, name); ranges[i].rva, ranges[i].length, stack_param_size, wname.c_str());
} }
CComPtr<IDiaEnumLineNumbers> lines; CComPtr<IDiaEnumLineNumbers> lines;
@ -330,7 +331,7 @@ bool PDBSourceLineWriter::PrintSourceFiles() {
if (!FileIDIsCached(file_name_string)) { if (!FileIDIsCached(file_name_string)) {
// this is a new file name, cache it and output a FILE line. // this is a new file name, cache it and output a FILE line.
CacheFileID(file_name_string, file_id); CacheFileID(file_name_string, file_id);
fwprintf(output_, L"FILE %d %s\n", file_id, file_name); fwprintf(output_, L"FILE %d %ws\n", file_id, file_name_string.c_str());
} else { } else {
// this file name has already been seen, just save this // this file name has already been seen, just save this
// ID for later lookup. // ID for later lookup.
@ -628,6 +629,7 @@ bool PDBSourceLineWriter::PrintFrameDataUsingPDB() {
} }
} }
wstring wprogram_string(program_string);
for (size_t i = 0; i < frame_infos.size(); ++i) { for (size_t i = 0; i < frame_infos.size(); ++i) {
const FrameInfo& fi(frame_infos[i]); const FrameInfo& fi(frame_infos[i]);
fprintf(output_, "STACK WIN %x %x %x %x %x %x %x %x %x %d ", fprintf(output_, "STACK WIN %x %x %x %x %x %x %x %x %x %d ",
@ -635,7 +637,7 @@ bool PDBSourceLineWriter::PrintFrameDataUsingPDB() {
0 /* epilog_size */, parameter_size, saved_register_size, 0 /* epilog_size */, parameter_size, saved_register_size,
local_size, max_stack_size, program_string_result == S_OK); local_size, max_stack_size, program_string_result == S_OK);
if (program_string_result == S_OK) { if (program_string_result == S_OK) {
fprintf(output_, "%ws\n", program_string); fprintf(output_, "%ws\n", wprogram_string.c_str());
} else { } else {
fprintf(output_, "%d\n", allocates_base_pointer); fprintf(output_, "%d\n", allocates_base_pointer);
} }
@ -819,8 +821,9 @@ bool PDBSourceLineWriter::PrintCodePublicSymbol(IDiaSymbol *symbol) {
AddressRangeVector ranges; AddressRangeVector ranges;
MapAddressRange(image_map_, AddressRange(rva, 1), &ranges); MapAddressRange(image_map_, AddressRange(rva, 1), &ranges);
for (size_t i = 0; i < ranges.size(); ++i) { for (size_t i = 0; i < ranges.size(); ++i) {
wstring wname(name);
fprintf(output_, "PUBLIC %x %x %ws\n", ranges[i].rva, fprintf(output_, "PUBLIC %x %x %ws\n", ranges[i].rva,
stack_param_size > 0 ? stack_param_size : 0, name); stack_param_size > 0 ? stack_param_size : 0, wname.c_str());
} }
return true; return true;
} }