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/dwarf_cu_to_module.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/common/dwarf_cu_to_module.h') diff --git a/src/common/dwarf_cu_to_module.h b/src/common/dwarf_cu_to_module.h index fd9c380d..fca92710 100644 --- a/src/common/dwarf_cu_to_module.h +++ b/src/common/dwarf_cu_to_module.h @@ -39,6 +39,8 @@ #ifndef COMMON_LINUX_DWARF_CU_TO_MODULE_H__ #define COMMON_LINUX_DWARF_CU_TO_MODULE_H__ +#include + #include #include "common/language.h" @@ -84,7 +86,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler { // Add CONTENTS of size LENGTH to the section map as NAME. void AddSectionToSectionMap(const string& name, - const char* contents, + const uint8_t *contents, uint64 length); // Clear the section map for testing. @@ -140,7 +142,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler { // mappings, given a pointer to some DWARF line number data // PROGRAM, and an overestimate of its size. Add no zero-length // lines to LINES. - virtual void ReadProgram(const char *program, uint64 length, + virtual void ReadProgram(const uint8_t *program, uint64 length, Module *module, vector *lines) = 0; }; -- cgit v1.2.1