From bc44efdc274aaf5b3b575d66f7e245754c0fa1e1 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 26 Jan 2016 15:38:19 -0500 Subject: 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 . --- src/common/mac/dump_syms.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/common/mac') diff --git a/src/common/mac/dump_syms.cc b/src/common/mac/dump_syms.cc index 4dcdb73e..b86a7c26 100644 --- a/src/common/mac/dump_syms.cc +++ b/src/common/mac/dump_syms.cc @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -316,7 +317,7 @@ class DumpSymbols::DumperLineToModule: compilation_dir_ = compilation_dir; } - void ReadProgram(const char *program, uint64 length, + void ReadProgram(const uint8_t *program, uint64 length, Module *module, vector *lines) { DwarfLineToModule handler(module, compilation_dir_, lines); dwarf2reader::LineInfo parser(program, length, byte_reader_, &handler); @@ -346,7 +347,7 @@ bool DumpSymbols::ReadDwarf(google_breakpad::Module *module, it != dwarf_sections.end(); ++it) { file_context.AddSectionToSectionMap( it->first, - reinterpret_cast(it->second.contents.start), + it->second.contents.start, it->second.contents.Size()); } @@ -354,7 +355,7 @@ bool DumpSymbols::ReadDwarf(google_breakpad::Module *module, dwarf2reader::SectionMap::const_iterator debug_info_entry = file_context.section_map().find("__debug_info"); assert(debug_info_entry != file_context.section_map().end()); - const std::pair& debug_info_section = + const std::pair& debug_info_section = debug_info_entry->second; // There had better be a __debug_info section! if (!debug_info_section.first) { @@ -424,7 +425,7 @@ bool DumpSymbols::ReadCFI(google_breakpad::Module *module, } // Find the call frame information and its size. - const char *cfi = reinterpret_cast(section.contents.start); + const uint8_t *cfi = section.contents.start; size_t cfi_size = section.contents.Size(); // Plug together the parser, handler, and their entourages. -- cgit v1.2.1