aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/compiler/cpp/cpp_primitive_field.cc')
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_primitive_field.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
index 07ac0bb4..b05fcc4e 100644
--- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
@@ -392,7 +392,8 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const {
"$number$, "
"::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, "
"output);\n"
- " output->WriteVarint32(_$name$_cached_byte_size_);\n");
+ " output->WriteVarint32(static_cast< ::google::protobuf::uint32>(\n"
+ " _$name$_cached_byte_size_));\n");
if (FixedSize(descriptor_->type()) > 0) {
// TODO(ckennelly): Use RepeatedField<T>::unsafe_data() via
@@ -432,7 +433,8 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
" ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n"
" target);\n"
" target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(\n"
- " _$name$_cached_byte_size_, target);\n"
+ " static_cast< ::google::protobuf::uint32>(\n"
+ " _$name$_cached_byte_size_), target);\n"
" target = ::google::protobuf::internal::WireFormatLite::\n"
" Write$declared_type$NoTagToArray(this->$name$_, target);\n"
"}\n");
@@ -454,7 +456,7 @@ GenerateByteSize(io::Printer* printer) const {
" $declared_type$Size(this->$name$_);\n");
} else {
printer->Print(variables_,
- "unsigned int count = this->$name$_size();\n"
+ "unsigned int count = static_cast<unsigned int>(this->$name$_size());\n"
"size_t data_size = $fixed_size$UL * count;\n");
}
@@ -462,7 +464,8 @@ GenerateByteSize(io::Printer* printer) const {
printer->Print(variables_,
"if (data_size > 0) {\n"
" total_size += $tag_size$ +\n"
- " ::google::protobuf::internal::WireFormatLite::Int32Size(data_size);\n"
+ " ::google::protobuf::internal::WireFormatLite::Int32Size(\n"
+ " static_cast< ::google::protobuf::int32>(data_size));\n"
"}\n"
"int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);\n"
"GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n"