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:
Orgad Shaneh 2017-08-28 10:26:23 +03:00 committed by Mike Frysinger
parent 005f41eb8c
commit 09df67311f
7 changed files with 17 additions and 17 deletions

View file

@ -380,7 +380,7 @@ string TimeTToUTCString(time_t tt) {
#endif
char timestr[20];
int rv = strftime(timestr, 20, "%Y-%m-%d %H:%M:%S", &timestruct);
size_t rv = strftime(timestr, 20, "%Y-%m-%d %H:%M:%S", &timestruct);
if (rv == 0) {
return string();
}
@ -2034,10 +2034,10 @@ string MinidumpModule::debug_file() const {
// that this method (and all other methods in the Minidump family)
// return.
unsigned int bytes =
size_t bytes =
module_.misc_record.data_size - MDImageDebugMisc_minsize;
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
// and copy the UTF-16 data into it.
@ -2392,8 +2392,8 @@ const MDImageDebugMisc* MinidumpModule::GetMiscRecord(uint32_t* size) {
// There is a potential alignment problem, but shouldn't be a problem
// in practice due to the layout of MDImageDebugMisc.
uint16_t* data16 = reinterpret_cast<uint16_t*>(&(misc_record->data));
unsigned int dataBytes = module_.misc_record.data_size -
MDImageDebugMisc_minsize;
size_t dataBytes = module_.misc_record.data_size -
MDImageDebugMisc_minsize;
Swap(data16, dataBytes);
}
}
@ -4004,7 +4004,7 @@ bool MinidumpMiscInfo::Read(uint32_t expected_size) {
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 "
<< "info structure";
return false;
@ -4538,7 +4538,7 @@ bool MinidumpMemoryInfoList::Read(uint32_t expected_size) {
infos_ = infos.release();
}
info_count_ = header_number_of_entries;
info_count_ = static_cast<uint32_t>(header_number_of_entries);
valid_ = true;
return true;
@ -4730,7 +4730,7 @@ bool MinidumpLinuxMapsList::Read(uint32_t expected_size) {
// Set instance variables.
maps_ = maps.release();
maps_count_ = maps_->size();
maps_count_ = static_cast<uint32_t>(maps_->size());
valid_ = true;
return true;
}

View file

@ -256,7 +256,7 @@ bool RangeMap<AddressType, EntryType>::RetrieveRangeAtIndex(
template<typename AddressType, typename EntryType>
int RangeMap<AddressType, EntryType>::GetCount() const {
return map_.size();
return static_cast<int>(map_.size());
}