Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Unified Diff: src/common/dwarf/bytereader-inl.h

Issue 1605153004: unittests: fix -Wnarrowing build errors (Closed) Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
Patch Set: back to stdint.h Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/common/dwarf/bytereader.cc ('k') | src/common/dwarf/bytereader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/common/dwarf/bytereader-inl.h
diff --git a/src/common/dwarf/bytereader-inl.h b/src/common/dwarf/bytereader-inl.h
index 3c167089f7218fac04b7894c6f8c9db79230c916..42c92f943f40e8a6978f359b369b0b3c0e2c6fe6 100644
--- a/src/common/dwarf/bytereader-inl.h
+++ b/src/common/dwarf/bytereader-inl.h
@@ -32,16 +32,15 @@
#include "common/dwarf/bytereader.h"
#include <assert.h>
+#include <stdint.h>
namespace dwarf2reader {
-inline uint8 ByteReader::ReadOneByte(const char* buffer) const {
+inline uint8 ByteReader::ReadOneByte(const uint8_t *buffer) const {
return buffer[0];
}
-inline uint16 ByteReader::ReadTwoBytes(const char* signed_buffer) const {
- const unsigned char *buffer
- = reinterpret_cast<const unsigned char *>(signed_buffer);
+inline uint16 ByteReader::ReadTwoBytes(const uint8_t *buffer) const {
const uint16 buffer0 = buffer[0];
const uint16 buffer1 = buffer[1];
if (endian_ == ENDIANNESS_LITTLE) {
@@ -51,9 +50,7 @@ inline uint16 ByteReader::ReadTwoBytes(const char* signed_buffer) const {
}
}
-inline uint64 ByteReader::ReadFourBytes(const char* signed_buffer) const {
- const unsigned char *buffer
- = reinterpret_cast<const unsigned char *>(signed_buffer);
+inline uint64 ByteReader::ReadFourBytes(const uint8_t *buffer) const {
const uint32 buffer0 = buffer[0];
const uint32 buffer1 = buffer[1];
const uint32 buffer2 = buffer[2];
@@ -65,9 +62,7 @@ inline uint64 ByteReader::ReadFourBytes(const char* signed_buffer) const {
}
}
-inline uint64 ByteReader::ReadEightBytes(const char* signed_buffer) const {
- const unsigned char *buffer
- = reinterpret_cast<const unsigned char *>(signed_buffer);
+inline uint64 ByteReader::ReadEightBytes(const uint8_t *buffer) const {
const uint64 buffer0 = buffer[0];
const uint64 buffer1 = buffer[1];
const uint64 buffer2 = buffer[2];
@@ -89,12 +84,12 @@ inline uint64 ByteReader::ReadEightBytes(const char* signed_buffer) const {
// information, plus one bit saying whether the number continues or
// not.
-inline uint64 ByteReader::ReadUnsignedLEB128(const char* buffer,
+inline uint64 ByteReader::ReadUnsignedLEB128(const uint8_t *buffer,
size_t* len) const {
uint64 result = 0;
size_t num_read = 0;
unsigned int shift = 0;
- unsigned char byte;
+ uint8_t byte;
do {
byte = *buffer++;
@@ -114,12 +109,12 @@ inline uint64 ByteReader::ReadUnsignedLEB128(const char* buffer,
// Read a signed LEB128 number. These are like regular LEB128
// numbers, except the last byte may have a sign bit set.
-inline int64 ByteReader::ReadSignedLEB128(const char* buffer,
+inline int64 ByteReader::ReadSignedLEB128(const uint8_t *buffer,
size_t* len) const {
int64 result = 0;
unsigned int shift = 0;
size_t num_read = 0;
- unsigned char byte;
+ uint8_t byte;
do {
byte = *buffer++;
@@ -134,18 +129,18 @@ inline int64 ByteReader::ReadSignedLEB128(const char* buffer,
return result;
}
-inline uint64 ByteReader::ReadOffset(const char* buffer) const {
+inline uint64 ByteReader::ReadOffset(const uint8_t *buffer) const {
assert(this->offset_reader_);
return (this->*offset_reader_)(buffer);
}
-inline uint64 ByteReader::ReadAddress(const char* buffer) const {
+inline uint64 ByteReader::ReadAddress(const uint8_t *buffer) const {
assert(this->address_reader_);
return (this->*address_reader_)(buffer);
}
inline void ByteReader::SetCFIDataBase(uint64 section_base,
- const char *buffer_base) {
+ const uint8_t *buffer_base) {
section_base_ = section_base;
buffer_base_ = buffer_base;
have_section_base_ = true;
« no previous file with comments | « src/common/dwarf/bytereader.cc ('k') | src/common/dwarf/bytereader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698