aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/map_entry_lite.h
diff options
context:
space:
mode:
authorGravatar Bo Yang <teboring@google.com>2017-06-23 12:56:44 -0700
committerGravatar Bo Yang <paulyang1211@gmail.com>2017-06-24 11:28:13 -0700
commite3c807d4e752b477b707f5d021264faf9b127304 (patch)
tree505092dff769b14d6a07be62314bc948b9398090 /src/google/protobuf/map_entry_lite.h
parent9c0b35cf620c4904a18e25733f50c9c0474fefa6 (diff)
Fix more implicit type conversions in public headers and generated code.
Diffstat (limited to 'src/google/protobuf/map_entry_lite.h')
-rw-r--r--src/google/protobuf/map_entry_lite.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/google/protobuf/map_entry_lite.h b/src/google/protobuf/map_entry_lite.h
index 7aad9a1c..15104490 100644
--- a/src/google/protobuf/map_entry_lite.h
+++ b/src/google/protobuf/map_entry_lite.h
@@ -226,8 +226,10 @@ class MapEntryImpl : public Base {
size_t ByteSizeLong() const {
size_t size = 0;
- size += has_key() ? kTagSize + KeyTypeHandler::ByteSize(key()) : 0;
- size += has_value() ? kTagSize + ValueTypeHandler::ByteSize(value()) : 0;
+ size += has_key() ?
+ kTagSize + static_cast<size_t>(KeyTypeHandler::ByteSize(key())) : 0;
+ size += has_value() ?
+ kTagSize + static_cast<size_t>(ValueTypeHandler::ByteSize(value())) : 0;
return size;
}
@@ -250,11 +252,10 @@ class MapEntryImpl : public Base {
int GetCachedSize() const {
int size = 0;
size += has_key()
- ? static_cast<int>(kTagSize + KeyTypeHandler::GetCachedSize(key()))
+ ? static_cast<int>(kTagSize) + KeyTypeHandler::GetCachedSize(key())
: 0;
size += has_value()
- ? static_cast<int>(kTagSize + ValueTypeHandler::GetCachedSize(
- value()))
+ ? static_cast<int>(kTagSize) + ValueTypeHandler::GetCachedSize(value())
: 0;
return size;
}