diff --git a/src/google/protobuf/map_type_handler.h b/src/google/protobuf/map_type_handler.h index 7244065b2d..f59348eee3 100644 --- a/src/google/protobuf/map_type_handler.h +++ b/src/google/protobuf/map_type_handler.h @@ -467,11 +467,11 @@ inline const char* ReadSINT32(const char* ptr, int32* value) { } template inline const char* ReadENUM(const char* ptr, E* value) { - *value = static_cast(ReadVarint64(&ptr)); + *value = static_cast(ReadVarint32(&ptr)); return ptr; } inline const char* ReadBOOL(const char* ptr, bool* value) { - *value = static_cast(ReadVarint64(&ptr)); + *value = static_cast(ReadVarint32(&ptr)); return ptr; } diff --git a/src/google/protobuf/parse_context.h b/src/google/protobuf/parse_context.h index 753892fe06..ffde46134e 100644 --- a/src/google/protobuf/parse_context.h +++ b/src/google/protobuf/parse_context.h @@ -586,9 +586,9 @@ inline uint64 ReadVarint64(const char** p) { } inline uint32 ReadVarint32(const char** p) { - uint64 tmp; + uint32 tmp; *p = VarintParse(*p, &tmp); - return static_cast(tmp); + return tmp; } inline int64 ReadVarintZigZag64(const char** p) {