Index: src/wasm/decoder.h |
diff --git a/src/wasm/decoder.h b/src/wasm/decoder.h |
index 685f5d0bbf5ec5d7bfa53df55f21bb35a7a457b7..14c0143d28a55a19209cea5a9ffd8bd20bfd4bf7 100644 |
--- a/src/wasm/decoder.h |
+++ b/src/wasm/decoder.h |
@@ -46,7 +46,8 @@ class Decoder { |
virtual ~Decoder() {} |
- inline bool check(const byte* base, int offset, int length, const char* msg) { |
+ inline bool check(const byte* base, unsigned int offset, unsigned int length, |
+ const char* msg) { |
DCHECK_GE(base, start_); |
if ((base + offset + length) > limit_) { |
error(base, base + offset, "%s", msg); |
@@ -56,37 +57,39 @@ class Decoder { |
} |
// Reads a single 8-bit byte, reporting an error if out of bounds. |
- inline uint8_t checked_read_u8(const byte* base, int offset, |
+ inline uint8_t checked_read_u8(const byte* base, unsigned int offset, |
const char* msg = "expected 1 byte") { |
return check(base, offset, 1, msg) ? base[offset] : 0; |
} |
// Reads 16-bit word, reporting an error if out of bounds. |
- inline uint16_t checked_read_u16(const byte* base, int offset, |
+ inline uint16_t checked_read_u16(const byte* base, unsigned int offset, |
const char* msg = "expected 2 bytes") { |
return check(base, offset, 2, msg) ? read_u16(base + offset) : 0; |
} |
// Reads 32-bit word, reporting an error if out of bounds. |
- inline uint32_t checked_read_u32(const byte* base, int offset, |
+ inline uint32_t checked_read_u32(const byte* base, unsigned int offset, |
const char* msg = "expected 4 bytes") { |
return check(base, offset, 4, msg) ? read_u32(base + offset) : 0; |
} |
// Reads 64-bit word, reporting an error if out of bounds. |
- inline uint64_t checked_read_u64(const byte* base, int offset, |
+ inline uint64_t checked_read_u64(const byte* base, unsigned int offset, |
const char* msg = "expected 8 bytes") { |
return check(base, offset, 8, msg) ? read_u64(base + offset) : 0; |
} |
// Reads a variable-length unsigned integer (little endian). |
- uint32_t checked_read_u32v(const byte* base, int offset, int* length, |
+ uint32_t checked_read_u32v(const byte* base, unsigned int offset, |
+ unsigned int* length, |
const char* msg = "expected LEB32") { |
return checked_read_leb<uint32_t, false>(base, offset, length, msg); |
} |
// Reads a variable-length signed integer (little endian). |
- int32_t checked_read_i32v(const byte* base, int offset, int* length, |
+ int32_t checked_read_i32v(const byte* base, unsigned int offset, |
+ unsigned int* length, |
const char* msg = "expected SLEB32") { |
uint32_t result = |
checked_read_leb<uint32_t, true>(base, offset, length, msg); |
@@ -100,13 +103,15 @@ class Decoder { |
} |
// Reads a variable-length unsigned integer (little endian). |
- uint64_t checked_read_u64v(const byte* base, int offset, int* length, |
+ uint64_t checked_read_u64v(const byte* base, unsigned int offset, |
+ unsigned int* length, |
const char* msg = "expected LEB64") { |
return checked_read_leb<uint64_t, false>(base, offset, length, msg); |
} |
// Reads a variable-length signed integer (little endian). |
- int64_t checked_read_i64v(const byte* base, int offset, int* length, |
+ int64_t checked_read_i64v(const byte* base, unsigned int offset, |
+ unsigned int* length, |
const char* msg = "expected SLEB64") { |
uint64_t result = |
checked_read_leb<uint64_t, true>(base, offset, length, msg); |
@@ -204,7 +209,7 @@ class Decoder { |
} |
// Reads a LEB128 variable-length 32-bit integer and advances {pc_}. |
- uint32_t consume_u32v(int* length, const char* name = nullptr) { |
+ uint32_t consume_u32v(unsigned int* length, const char* name = nullptr) { |
TRACE(" +%d %-20s: ", static_cast<int>(pc_ - start_), |
name ? name : "varint"); |
@@ -350,8 +355,8 @@ class Decoder { |
private: |
template <typename IntType, bool is_signed> |
- IntType checked_read_leb(const byte* base, int offset, int* length, |
- const char* msg) { |
+ IntType checked_read_leb(const byte* base, unsigned int offset, |
+ unsigned int* length, const char* msg) { |
if (!check(base, offset, 1, msg)) { |
*length = 0; |
return 0; |