mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-03-10 18:12:56 +00:00
convert to uint8_t* for binary data to fix -Wnarrowing build errors
Newer gcc versions default to -Werror=narrowing when using newer C++
standards (which we do). This causes issues when we try to stuff a
value like 0xea into a char -- the value is out of range for signed
char bytes. That's when gcc throws an error:
.../bytereader_unittest.cc: In member function 'virtual void Reader_DW_EH_PE_absptr4_Test::TestBody()':
.../bytereader_unittest.cc:400:55: error: narrowing conversion of '234' from 'int' to 'char' inside { } [-Wnarrowing]
BUG=chromium:579384
TEST=`make check` passes
R=mark@chromium.org
Review URL: https://codereview.chromium.org/1605153004 .
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
#include <cxxabi.h>
|
||||
#endif
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -140,7 +141,7 @@ DwarfCUToModule::FileContext::~FileContext() {
|
||||
}
|
||||
|
||||
void DwarfCUToModule::FileContext::AddSectionToSectionMap(
|
||||
const string& name, const char* contents, uint64 length) {
|
||||
const string& name, const uint8_t *contents, uint64 length) {
|
||||
section_map_[name] = std::make_pair(contents, length);
|
||||
}
|
||||
|
||||
@@ -814,7 +815,7 @@ void DwarfCUToModule::ReadSourceLines(uint64 offset) {
|
||||
cu_context_->reporter->MissingSection(".debug_line");
|
||||
return;
|
||||
}
|
||||
const char *section_start = map_entry->second.first;
|
||||
const uint8_t *section_start = map_entry->second.first;
|
||||
uint64 section_length = map_entry->second.second;
|
||||
if (offset >= section_length) {
|
||||
cu_context_->reporter->BadLineInfoOffset(offset);
|
||||
|
||||
Reference in New Issue
Block a user