mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2025-08-04 16:02:18 +00:00
Fix MSVC build on 64-bit
Mostly int<->size_t implicit conversions. Warning 4366 (The result of the unary '&' operator may be unaligned) appears in minidump.cc:907, but I don't know why. It looks aligned to me. Change-Id: I641942adc324f8f9832b20662083dc83498688a8 Reviewed-on: https://chromium-review.googlesource.com/637390 Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
parent
005f41eb8c
commit
09df67311f
|
@ -894,7 +894,7 @@
|
||||||
],
|
],
|
||||||
'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'],
|
'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'],
|
||||||
'msvs_disabled_warnings': [
|
'msvs_disabled_warnings': [
|
||||||
4100, 4127, 4396, 4503, 4512, 4819, 4995, 4702
|
4091, 4100, 4127, 4366, 4396, 4503, 4512, 4819, 4995, 4702
|
||||||
],
|
],
|
||||||
'msvs_settings': {
|
'msvs_settings': {
|
||||||
'VCCLCompilerTool': {
|
'VCCLCompilerTool': {
|
||||||
|
|
|
@ -82,7 +82,7 @@ void ExceptionHandlerDeathTest::SetUp() {
|
||||||
// The test case name is exposed as a c-style string,
|
// The test case name is exposed as a c-style string,
|
||||||
// convert it to a wchar_t string.
|
// convert it to a wchar_t string.
|
||||||
int dwRet = MultiByteToWideChar(CP_ACP, 0, test_info->name(),
|
int dwRet = MultiByteToWideChar(CP_ACP, 0, test_info->name(),
|
||||||
strlen(test_info->name()),
|
static_cast<int>(strlen(test_info->name())),
|
||||||
test_name_wide,
|
test_name_wide,
|
||||||
MAX_PATH);
|
MAX_PATH);
|
||||||
if (!dwRet) {
|
if (!dwRet) {
|
||||||
|
@ -293,8 +293,8 @@ wstring find_minidump_in_directory(const wstring &directory) {
|
||||||
wstring filename;
|
wstring filename;
|
||||||
do {
|
do {
|
||||||
const wchar_t extension[] = L".dmp";
|
const wchar_t extension[] = L".dmp";
|
||||||
const int extension_length = sizeof(extension) / sizeof(extension[0]) - 1;
|
const size_t extension_length = sizeof(extension) / sizeof(extension[0]) - 1;
|
||||||
const int filename_length = wcslen(find_data.cFileName);
|
const size_t filename_length = wcslen(find_data.cFileName);
|
||||||
if (filename_length > extension_length &&
|
if (filename_length > extension_length &&
|
||||||
wcsncmp(extension,
|
wcsncmp(extension,
|
||||||
find_data.cFileName + filename_length - extension_length,
|
find_data.cFileName + filename_length - extension_length,
|
||||||
|
|
|
@ -120,7 +120,7 @@ void ExceptionHandlerTest::SetUp() {
|
||||||
// THe test case name is exposed to use as a c-style string,
|
// THe test case name is exposed to use as a c-style string,
|
||||||
// But we might be working in UNICODE here on Windows.
|
// But we might be working in UNICODE here on Windows.
|
||||||
int dwRet = MultiByteToWideChar(CP_ACP, 0, test_info->name(),
|
int dwRet = MultiByteToWideChar(CP_ACP, 0, test_info->name(),
|
||||||
strlen(test_info->name()),
|
static_cast<int>(strlen(test_info->name())),
|
||||||
test_name_wide,
|
test_name_wide,
|
||||||
MAX_PATH);
|
MAX_PATH);
|
||||||
if (!dwRet) {
|
if (!dwRet) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ class MinidumpTest: public testing::Test {
|
||||||
STATUS_ACCESS_VIOLATION, // ExceptionCode
|
STATUS_ACCESS_VIOLATION, // ExceptionCode
|
||||||
0, // ExceptionFlags
|
0, // ExceptionFlags
|
||||||
NULL, // ExceptionRecord;
|
NULL, // ExceptionRecord;
|
||||||
reinterpret_cast<void*>(0xCAFEBABE), // ExceptionAddress;
|
reinterpret_cast<void*>(static_cast<uintptr_t>(0xCAFEBABE)), // ExceptionAddress;
|
||||||
2, // NumberParameters;
|
2, // NumberParameters;
|
||||||
{ EXCEPTION_WRITE_FAULT, reinterpret_cast<ULONG_PTR>(this) }
|
{ EXCEPTION_WRITE_FAULT, reinterpret_cast<ULONG_PTR>(this) }
|
||||||
};
|
};
|
||||||
|
|
|
@ -380,7 +380,7 @@ string TimeTToUTCString(time_t tt) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char timestr[20];
|
char timestr[20];
|
||||||
int rv = strftime(timestr, 20, "%Y-%m-%d %H:%M:%S", ×truct);
|
size_t rv = strftime(timestr, 20, "%Y-%m-%d %H:%M:%S", ×truct);
|
||||||
if (rv == 0) {
|
if (rv == 0) {
|
||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
|
@ -2034,10 +2034,10 @@ string MinidumpModule::debug_file() const {
|
||||||
// that this method (and all other methods in the Minidump family)
|
// that this method (and all other methods in the Minidump family)
|
||||||
// return.
|
// return.
|
||||||
|
|
||||||
unsigned int bytes =
|
size_t bytes =
|
||||||
module_.misc_record.data_size - MDImageDebugMisc_minsize;
|
module_.misc_record.data_size - MDImageDebugMisc_minsize;
|
||||||
if (bytes % 2 == 0) {
|
if (bytes % 2 == 0) {
|
||||||
unsigned int utf16_words = bytes / 2;
|
size_t utf16_words = bytes / 2;
|
||||||
|
|
||||||
// UTF16ToUTF8 expects a vector<uint16_t>, so create a temporary one
|
// UTF16ToUTF8 expects a vector<uint16_t>, so create a temporary one
|
||||||
// and copy the UTF-16 data into it.
|
// and copy the UTF-16 data into it.
|
||||||
|
@ -2392,7 +2392,7 @@ const MDImageDebugMisc* MinidumpModule::GetMiscRecord(uint32_t* size) {
|
||||||
// There is a potential alignment problem, but shouldn't be a problem
|
// There is a potential alignment problem, but shouldn't be a problem
|
||||||
// in practice due to the layout of MDImageDebugMisc.
|
// in practice due to the layout of MDImageDebugMisc.
|
||||||
uint16_t* data16 = reinterpret_cast<uint16_t*>(&(misc_record->data));
|
uint16_t* data16 = reinterpret_cast<uint16_t*>(&(misc_record->data));
|
||||||
unsigned int dataBytes = module_.misc_record.data_size -
|
size_t dataBytes = module_.misc_record.data_size -
|
||||||
MDImageDebugMisc_minsize;
|
MDImageDebugMisc_minsize;
|
||||||
Swap(data16, dataBytes);
|
Swap(data16, dataBytes);
|
||||||
}
|
}
|
||||||
|
@ -4004,7 +4004,7 @@ bool MinidumpMiscInfo::Read(uint32_t expected_size) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!minidump_->SeekSet(saved_position + padding)) {
|
if (!minidump_->SeekSet(saved_position + static_cast<off_t>(padding))) {
|
||||||
BPLOG(ERROR) << "MinidumpMiscInfo could not seek past the miscellaneous "
|
BPLOG(ERROR) << "MinidumpMiscInfo could not seek past the miscellaneous "
|
||||||
<< "info structure";
|
<< "info structure";
|
||||||
return false;
|
return false;
|
||||||
|
@ -4538,7 +4538,7 @@ bool MinidumpMemoryInfoList::Read(uint32_t expected_size) {
|
||||||
infos_ = infos.release();
|
infos_ = infos.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
info_count_ = header_number_of_entries;
|
info_count_ = static_cast<uint32_t>(header_number_of_entries);
|
||||||
|
|
||||||
valid_ = true;
|
valid_ = true;
|
||||||
return true;
|
return true;
|
||||||
|
@ -4730,7 +4730,7 @@ bool MinidumpLinuxMapsList::Read(uint32_t expected_size) {
|
||||||
|
|
||||||
// Set instance variables.
|
// Set instance variables.
|
||||||
maps_ = maps.release();
|
maps_ = maps.release();
|
||||||
maps_count_ = maps_->size();
|
maps_count_ = static_cast<uint32_t>(maps_->size());
|
||||||
valid_ = true;
|
valid_ = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,7 +256,7 @@ bool RangeMap<AddressType, EntryType>::RetrieveRangeAtIndex(
|
||||||
|
|
||||||
template<typename AddressType, typename EntryType>
|
template<typename AddressType, typename EntryType>
|
||||||
int RangeMap<AddressType, EntryType>::GetCount() const {
|
int RangeMap<AddressType, EntryType>::GetCount() const {
|
||||||
return map_.size();
|
return static_cast<int>(map_.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ bool GUIDOrSignatureIdentifier::InitializeFromString(
|
||||||
if (length > 32 && length <= 40) {
|
if (length > 32 && length <= 40) {
|
||||||
// GUID
|
// GUID
|
||||||
if (SSCANF(identifier.c_str(),
|
if (SSCANF(identifier.c_str(),
|
||||||
"%08X%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X%X",
|
"%08X%04hX%04hX%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX%X",
|
||||||
&guid_.Data1, &guid_.Data2, &guid_.Data3,
|
&guid_.Data1, &guid_.Data2, &guid_.Data3,
|
||||||
&guid_.Data4[0], &guid_.Data4[1],
|
&guid_.Data4[0], &guid_.Data4[1],
|
||||||
&guid_.Data4[2], &guid_.Data4[3],
|
&guid_.Data4[2], &guid_.Data4[3],
|
||||||
|
@ -500,7 +500,7 @@ MSSymbolServerConverter::LocateAndConvertSymbolFile(
|
||||||
if (!WindowsStringUtils::safe_mbstowcs(pdb_file, &pdb_file_w)) {
|
if (!WindowsStringUtils::safe_mbstowcs(pdb_file, &pdb_file_w)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"LocateAndConvertSymbolFile: "
|
"LocateAndConvertSymbolFile: "
|
||||||
"WindowsStringUtils::safe_mbstowcs failed for %s\n",
|
"WindowsStringUtils::safe_mbstowcs failed for %ws\n",
|
||||||
pdb_file_w.c_str());
|
pdb_file_w.c_str());
|
||||||
return LOCATE_FAILURE;
|
return LOCATE_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue