Merge pull request #3264 from TeBoring/php-bug

Enusre public header and generated code have no implicit converion.
pull/2526/merge
Paul Yang 8 years ago committed by GitHub
commit dd7265e1a2
  1. 2
      src/Makefile.am
  2. 6
      src/google/protobuf/any.pb.cc
  3. 117
      src/google/protobuf/api.pb.cc
  4. 33
      src/google/protobuf/compiler/cpp/cpp_enum_field.cc
  5. 36
      src/google/protobuf/compiler/cpp/cpp_map_field.cc
  6. 14
      src/google/protobuf/compiler/cpp/cpp_message.cc
  7. 14
      src/google/protobuf/compiler/cpp/cpp_message_field.cc
  8. 11
      src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
  9. 20
      src/google/protobuf/compiler/cpp/cpp_string_field.cc
  10. 84
      src/google/protobuf/compiler/plugin.pb.cc
  11. 54
      src/google/protobuf/compiler/profile.pb.cc
  12. 757
      src/google/protobuf/descriptor.pb.cc
  13. 14
      src/google/protobuf/duration.pb.cc
  14. 8
      src/google/protobuf/dynamic_message.h
  15. 6
      src/google/protobuf/field_mask.pb.cc
  16. 17
      src/google/protobuf/generated_message_reflection.h
  17. 2
      src/google/protobuf/map.h
  18. 11
      src/google/protobuf/map_entry_lite.h
  19. 2
      src/google/protobuf/map_field_inl.h
  20. 2
      src/google/protobuf/map_field_lite.h
  21. 8
      src/google/protobuf/map_type_handler.h
  22. 6
      src/google/protobuf/repeated_field.h
  23. 6
      src/google/protobuf/source_context.pb.cc
  24. 42
      src/google/protobuf/struct.pb.cc
  25. 3
      src/google/protobuf/stubs/fastmem.h
  26. 2
      src/google/protobuf/stubs/hash.h
  27. 8
      src/google/protobuf/stubs/port.h
  28. 20
      src/google/protobuf/stubs/stringpiece.h
  29. 14
      src/google/protobuf/timestamp.pb.cc
  30. 162
      src/google/protobuf/type.pb.cc
  31. 6
      src/google/protobuf/unknown_field_set.h
  32. 10
      src/google/protobuf/wire_format_lite.h
  33. 16
      src/google/protobuf/wire_format_lite_inl.h
  34. 6
      src/google/protobuf/wrappers.pb.cc

@ -924,7 +924,7 @@ no_warning_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la \
../gmock/gtest/lib/libgtest_main.la ../gmock/gtest/lib/libgtest_main.la
no_warning_test_CPPFLAGS = -I$(srcdir)/../gmock/gtest/include no_warning_test_CPPFLAGS = -I$(srcdir)/../gmock/gtest/include
no_warning_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) \ no_warning_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) \
-Wall -Werror -Wall -Wconversion -Werror
nodist_no_warning_test_SOURCES = no_warning_test.cc $(protoc_outputs) nodist_no_warning_test_SOURCES = no_warning_test.cc $(protoc_outputs)
TESTS = protobuf-test protobuf-lazy-descriptor-test protobuf-lite-test \ TESTS = protobuf-test protobuf-lazy-descriptor-test protobuf-lite-test \

@ -240,7 +240,7 @@ bool Any::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_type_url())); input, this->mutable_type_url()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->type_url().data(), this->type_url().length(), this->type_url().data(), static_cast<int>(this->type_url().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Any.type_url")); "google.protobuf.Any.type_url"));
} else { } else {
@ -291,7 +291,7 @@ void Any::SerializeWithCachedSizes(
// string type_url = 1; // string type_url = 1;
if (this->type_url().size() > 0) { if (this->type_url().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->type_url().data(), this->type_url().length(), this->type_url().data(), static_cast<int>(this->type_url().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Any.type_url"); "google.protobuf.Any.type_url");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -316,7 +316,7 @@ void Any::SerializeWithCachedSizes(
// string type_url = 1; // string type_url = 1;
if (this->type_url().size() > 0) { if (this->type_url().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->type_url().data(), this->type_url().length(), this->type_url().data(), static_cast<int>(this->type_url().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Any.type_url"); "google.protobuf.Any.type_url");
target = target =

@ -240,8 +240,9 @@ Api::Api(const Api& from)
void Api::SharedCtor() { void Api::SharedCtor() {
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
version_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); version_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&source_context_, 0, reinterpret_cast<char*>(&syntax_) - ::memset(&source_context_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&source_context_) + sizeof(syntax_)); reinterpret_cast<char*>(&syntax_) -
reinterpret_cast<char*>(&source_context_)) + sizeof(syntax_));
_cached_size_ = 0; _cached_size_ = 0;
} }
@ -312,7 +313,7 @@ bool Api::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name())); input, this->mutable_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Api.name")); "google.protobuf.Api.name"));
} else { } else {
@ -352,7 +353,7 @@ bool Api::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_version())); input, this->mutable_version()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->version().data(), this->version().length(), this->version().data(), static_cast<int>(this->version().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Api.version")); "google.protobuf.Api.version"));
} else { } else {
@ -430,7 +431,7 @@ void Api::SerializeWithCachedSizes(
// string name = 1; // string name = 1;
if (this->name().size() > 0) { if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Api.name"); "google.protobuf.Api.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -438,21 +439,23 @@ void Api::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.Method methods = 2; // repeated .google.protobuf.Method methods = 2;
for (unsigned int i = 0, n = this->methods_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->methods_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->methods(i), output); 2, this->methods(static_cast<int>(i)), output);
} }
// repeated .google.protobuf.Option options = 3; // repeated .google.protobuf.Option options = 3;
for (unsigned int i = 0, n = this->options_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->options(i), output); 3, this->options(static_cast<int>(i)), output);
} }
// string version = 4; // string version = 4;
if (this->version().size() > 0) { if (this->version().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->version().data(), this->version().length(), this->version().data(), static_cast<int>(this->version().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Api.version"); "google.protobuf.Api.version");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -466,9 +469,10 @@ void Api::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.Mixin mixins = 6; // repeated .google.protobuf.Mixin mixins = 6;
for (unsigned int i = 0, n = this->mixins_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->mixins_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
6, this->mixins(i), output); 6, this->mixins(static_cast<int>(i)), output);
} }
// .google.protobuf.Syntax syntax = 7; // .google.protobuf.Syntax syntax = 7;
@ -489,7 +493,7 @@ void Api::SerializeWithCachedSizes(
// string name = 1; // string name = 1;
if (this->name().size() > 0) { if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Api.name"); "google.protobuf.Api.name");
target = target =
@ -498,23 +502,25 @@ void Api::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.Method methods = 2; // repeated .google.protobuf.Method methods = 2;
for (unsigned int i = 0, n = this->methods_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->methods_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray( InternalWriteMessageNoVirtualToArray(
2, this->methods(i), deterministic, target); 2, this->methods(static_cast<int>(i)), deterministic, target);
} }
// repeated .google.protobuf.Option options = 3; // repeated .google.protobuf.Option options = 3;
for (unsigned int i = 0, n = this->options_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray( InternalWriteMessageNoVirtualToArray(
3, this->options(i), deterministic, target); 3, this->options(static_cast<int>(i)), deterministic, target);
} }
// string version = 4; // string version = 4;
if (this->version().size() > 0) { if (this->version().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->version().data(), this->version().length(), this->version().data(), static_cast<int>(this->version().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Api.version"); "google.protobuf.Api.version");
target = target =
@ -530,10 +536,11 @@ void Api::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.Mixin mixins = 6; // repeated .google.protobuf.Mixin mixins = 6;
for (unsigned int i = 0, n = this->mixins_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->mixins_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray( InternalWriteMessageNoVirtualToArray(
6, this->mixins(i), deterministic, target); 6, this->mixins(static_cast<int>(i)), deterministic, target);
} }
// .google.protobuf.Syntax syntax = 7; // .google.protobuf.Syntax syntax = 7;
@ -552,34 +559,34 @@ size_t Api::ByteSizeLong() const {
// repeated .google.protobuf.Method methods = 2; // repeated .google.protobuf.Method methods = 2;
{ {
unsigned int count = this->methods_size(); unsigned int count = static_cast<unsigned int>(this->methods_size());
total_size += 1UL * count; total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
total_size += total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->methods(i)); this->methods(static_cast<int>(i)));
} }
} }
// repeated .google.protobuf.Option options = 3; // repeated .google.protobuf.Option options = 3;
{ {
unsigned int count = this->options_size(); unsigned int count = static_cast<unsigned int>(this->options_size());
total_size += 1UL * count; total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
total_size += total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->options(i)); this->options(static_cast<int>(i)));
} }
} }
// repeated .google.protobuf.Mixin mixins = 6; // repeated .google.protobuf.Mixin mixins = 6;
{ {
unsigned int count = this->mixins_size(); unsigned int count = static_cast<unsigned int>(this->mixins_size());
total_size += 1UL * count; total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
total_size += total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->mixins(i)); this->mixins(static_cast<int>(i)));
} }
} }
@ -989,8 +996,8 @@ Method::Method(const Method& from)
response_type_url_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.response_type_url_); response_type_url_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.response_type_url_);
} }
::memcpy(&request_streaming_, &from.request_streaming_, ::memcpy(&request_streaming_, &from.request_streaming_,
reinterpret_cast<char*>(&syntax_) - static_cast<size_t>(reinterpret_cast<char*>(&syntax_) -
reinterpret_cast<char*>(&request_streaming_) + sizeof(syntax_)); reinterpret_cast<char*>(&request_streaming_)) + sizeof(syntax_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.Method) // @@protoc_insertion_point(copy_constructor:google.protobuf.Method)
} }
@ -998,8 +1005,9 @@ void Method::SharedCtor() {
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
request_type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); request_type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
response_type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); response_type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&request_streaming_, 0, reinterpret_cast<char*>(&syntax_) - ::memset(&request_streaming_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&request_streaming_) + sizeof(syntax_)); reinterpret_cast<char*>(&syntax_) -
reinterpret_cast<char*>(&request_streaming_)) + sizeof(syntax_));
_cached_size_ = 0; _cached_size_ = 0;
} }
@ -1043,8 +1051,9 @@ void Method::Clear() {
name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
request_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); request_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
response_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); response_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&request_streaming_, 0, reinterpret_cast<char*>(&syntax_) - ::memset(&request_streaming_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&request_streaming_) + sizeof(syntax_)); reinterpret_cast<char*>(&syntax_) -
reinterpret_cast<char*>(&request_streaming_)) + sizeof(syntax_));
} }
bool Method::MergePartialFromCodedStream( bool Method::MergePartialFromCodedStream(
@ -1064,7 +1073,7 @@ bool Method::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name())); input, this->mutable_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Method.name")); "google.protobuf.Method.name"));
} else { } else {
@ -1080,7 +1089,7 @@ bool Method::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_request_type_url())); input, this->mutable_request_type_url()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->request_type_url().data(), this->request_type_url().length(), this->request_type_url().data(), static_cast<int>(this->request_type_url().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Method.request_type_url")); "google.protobuf.Method.request_type_url"));
} else { } else {
@ -1110,7 +1119,7 @@ bool Method::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_response_type_url())); input, this->mutable_response_type_url()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->response_type_url().data(), this->response_type_url().length(), this->response_type_url().data(), static_cast<int>(this->response_type_url().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Method.response_type_url")); "google.protobuf.Method.response_type_url"));
} else { } else {
@ -1190,7 +1199,7 @@ void Method::SerializeWithCachedSizes(
// string name = 1; // string name = 1;
if (this->name().size() > 0) { if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Method.name"); "google.protobuf.Method.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -1200,7 +1209,7 @@ void Method::SerializeWithCachedSizes(
// string request_type_url = 2; // string request_type_url = 2;
if (this->request_type_url().size() > 0) { if (this->request_type_url().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->request_type_url().data(), this->request_type_url().length(), this->request_type_url().data(), static_cast<int>(this->request_type_url().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Method.request_type_url"); "google.protobuf.Method.request_type_url");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -1215,7 +1224,7 @@ void Method::SerializeWithCachedSizes(
// string response_type_url = 4; // string response_type_url = 4;
if (this->response_type_url().size() > 0) { if (this->response_type_url().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->response_type_url().data(), this->response_type_url().length(), this->response_type_url().data(), static_cast<int>(this->response_type_url().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Method.response_type_url"); "google.protobuf.Method.response_type_url");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -1228,9 +1237,10 @@ void Method::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.Option options = 6; // repeated .google.protobuf.Option options = 6;
for (unsigned int i = 0, n = this->options_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
6, this->options(i), output); 6, this->options(static_cast<int>(i)), output);
} }
// .google.protobuf.Syntax syntax = 7; // .google.protobuf.Syntax syntax = 7;
@ -1251,7 +1261,7 @@ void Method::SerializeWithCachedSizes(
// string name = 1; // string name = 1;
if (this->name().size() > 0) { if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Method.name"); "google.protobuf.Method.name");
target = target =
@ -1262,7 +1272,7 @@ void Method::SerializeWithCachedSizes(
// string request_type_url = 2; // string request_type_url = 2;
if (this->request_type_url().size() > 0) { if (this->request_type_url().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->request_type_url().data(), this->request_type_url().length(), this->request_type_url().data(), static_cast<int>(this->request_type_url().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Method.request_type_url"); "google.protobuf.Method.request_type_url");
target = target =
@ -1278,7 +1288,7 @@ void Method::SerializeWithCachedSizes(
// string response_type_url = 4; // string response_type_url = 4;
if (this->response_type_url().size() > 0) { if (this->response_type_url().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->response_type_url().data(), this->response_type_url().length(), this->response_type_url().data(), static_cast<int>(this->response_type_url().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Method.response_type_url"); "google.protobuf.Method.response_type_url");
target = target =
@ -1292,10 +1302,11 @@ void Method::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.Option options = 6; // repeated .google.protobuf.Option options = 6;
for (unsigned int i = 0, n = this->options_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray( InternalWriteMessageNoVirtualToArray(
6, this->options(i), deterministic, target); 6, this->options(static_cast<int>(i)), deterministic, target);
} }
// .google.protobuf.Syntax syntax = 7; // .google.protobuf.Syntax syntax = 7;
@ -1314,12 +1325,12 @@ size_t Method::ByteSizeLong() const {
// repeated .google.protobuf.Option options = 6; // repeated .google.protobuf.Option options = 6;
{ {
unsigned int count = this->options_size(); unsigned int count = static_cast<unsigned int>(this->options_size());
total_size += 1UL * count; total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
total_size += total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->options(i)); this->options(static_cast<int>(i)));
} }
} }
@ -1780,7 +1791,7 @@ bool Mixin::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name())); input, this->mutable_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Mixin.name")); "google.protobuf.Mixin.name"));
} else { } else {
@ -1796,7 +1807,7 @@ bool Mixin::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_root())); input, this->mutable_root()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->root().data(), this->root().length(), this->root().data(), static_cast<int>(this->root().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Mixin.root")); "google.protobuf.Mixin.root"));
} else { } else {
@ -1835,7 +1846,7 @@ void Mixin::SerializeWithCachedSizes(
// string name = 1; // string name = 1;
if (this->name().size() > 0) { if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Mixin.name"); "google.protobuf.Mixin.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -1845,7 +1856,7 @@ void Mixin::SerializeWithCachedSizes(
// string root = 2; // string root = 2;
if (this->root().size() > 0) { if (this->root().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->root().data(), this->root().length(), this->root().data(), static_cast<int>(this->root().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Mixin.root"); "google.protobuf.Mixin.root");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -1864,7 +1875,7 @@ void Mixin::SerializeWithCachedSizes(
// string name = 1; // string name = 1;
if (this->name().size() > 0) { if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Mixin.name"); "google.protobuf.Mixin.name");
target = target =
@ -1875,7 +1886,7 @@ void Mixin::SerializeWithCachedSizes(
// string root = 2; // string root = 2;
if (this->root().size() > 0) { if (this->root().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->root().data(), this->root().length(), this->root().data(), static_cast<int>(this->root().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Mixin.root"); "google.protobuf.Mixin.root");
target = target =

@ -143,12 +143,14 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
if (UseUnknownFieldSet(descriptor_->file(), options_)) { if (UseUnknownFieldSet(descriptor_->file(), options_)) {
printer->Print(variables_, printer->Print(variables_,
"} else {\n" "} else {\n"
" mutable_unknown_fields()->AddVarint($number$, value);\n"); " mutable_unknown_fields()->AddVarint(\n"
" $number$, static_cast<::google::protobuf::uint64>(value));\n");
} else { } else {
printer->Print( printer->Print(
"} else {\n" "} else {\n"
" unknown_fields_stream.WriteVarint32($tag$u);\n" " unknown_fields_stream.WriteVarint32($tag$u);\n"
" unknown_fields_stream.WriteVarint32(value);\n", " unknown_fields_stream.WriteVarint32(\n"
" static_cast<::google::protobuf::uint32>(value));\n",
"tag", SimpleItoa(internal::WireFormat::MakeTag(descriptor_))); "tag", SimpleItoa(internal::WireFormat::MakeTag(descriptor_)));
} }
printer->Print(variables_, printer->Print(variables_,
@ -344,12 +346,14 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
if (UseUnknownFieldSet(descriptor_->file(), options_)) { if (UseUnknownFieldSet(descriptor_->file(), options_)) {
printer->Print(variables_, printer->Print(variables_,
"} else {\n" "} else {\n"
" mutable_unknown_fields()->AddVarint($number$, value);\n"); " mutable_unknown_fields()->AddVarint(\n"
" $number$, static_cast<::google::protobuf::uint64>(value));\n");
} else { } else {
printer->Print( printer->Print(
"} else {\n" "} else {\n"
" unknown_fields_stream.WriteVarint32(tag);\n" " unknown_fields_stream.WriteVarint32(tag);\n"
" unknown_fields_stream.WriteVarint32(value);\n"); " unknown_fields_stream.WriteVarint32(\n"
" static_cast<::google::protobuf::uint32>(value));\n");
} }
printer->Print("}\n"); printer->Print("}\n");
} }
@ -391,7 +395,7 @@ GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const {
"::google::protobuf::uint32 length;\n" "::google::protobuf::uint32 length;\n"
"DO_(input->ReadVarint32(&length));\n" "DO_(input->ReadVarint32(&length));\n"
"::google::protobuf::io::CodedInputStream::Limit limit = " "::google::protobuf::io::CodedInputStream::Limit limit = "
"input->PushLimit(length);\n" "input->PushLimit(static_cast<int>(length));\n"
"while (input->BytesUntilLimit() > 0) {\n" "while (input->BytesUntilLimit() > 0) {\n"
" int value;\n" " int value;\n"
" DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n" " DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n"
@ -407,11 +411,13 @@ GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const {
" } else {\n"); " } else {\n");
if (UseUnknownFieldSet(descriptor_->file(), options_)) { if (UseUnknownFieldSet(descriptor_->file(), options_)) {
printer->Print(variables_, printer->Print(variables_,
" mutable_unknown_fields()->AddVarint($number$, value);\n"); " mutable_unknown_fields()->AddVarint(\n"
" $number$, static_cast<::google::protobuf::uint64>(value));\n");
} else { } else {
printer->Print(variables_, printer->Print(variables_,
" unknown_fields_stream.WriteVarint32(tag);\n" " unknown_fields_stream.WriteVarint32(tag);\n"
" unknown_fields_stream.WriteVarint32(value);\n"); " unknown_fields_stream.WriteVarint32(\n"
" static_cast<::google::protobuf::uint32>(value));\n");
} }
printer->Print( printer->Print(
" }\n"); " }\n");
@ -432,7 +438,8 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const {
" $number$,\n" " $number$,\n"
" ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n"
" output);\n" " output);\n"
" output->WriteVarint32(_$name$_cached_byte_size_);\n" " output->WriteVarint32(\n"
" static_cast<::google::protobuf::uint32>(_$name$_cached_byte_size_));\n"
"}\n"); "}\n");
} }
printer->Print(variables_, printer->Print(variables_,
@ -460,7 +467,8 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
" ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n"
" target);\n" " target);\n"
" target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(" " target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray("
" _$name$_cached_byte_size_, target);\n" " static_cast<::google::protobuf::uint32>(\n"
" _$name$_cached_byte_size_), target);\n"
" target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(\n" " target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(\n"
" this->$name$_, target);\n" " this->$name$_, target);\n"
"}\n"); "}\n");
@ -476,19 +484,20 @@ GenerateByteSize(io::Printer* printer) const {
printer->Print(variables_, printer->Print(variables_,
"{\n" "{\n"
" size_t data_size = 0;\n" " size_t data_size = 0;\n"
" unsigned int count = this->$name$_size();"); " unsigned int count = static_cast<unsigned int>(this->$name$_size());");
printer->Indent(); printer->Indent();
printer->Print(variables_, printer->Print(variables_,
"for (unsigned int i = 0; i < count; i++) {\n" "for (unsigned int i = 0; i < count; i++) {\n"
" data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(\n" " data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(\n"
" this->$name$(i));\n" " this->$name$(static_cast<int>(i)));\n"
"}\n"); "}\n");
if (descriptor_->is_packed()) { if (descriptor_->is_packed()) {
printer->Print(variables_, printer->Print(variables_,
"if (data_size > 0) {\n" "if (data_size > 0) {\n"
" total_size += $tag_size$ +\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" "}\n"
"int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);\n" "int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);\n"
"GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n" "GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n"

@ -256,7 +256,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
} else { } else {
printer->Print(variables_, printer->Print(variables_,
" unknown_fields_stream.WriteVarint32($tag$u);\n" " unknown_fields_stream.WriteVarint32($tag$u);\n"
" unknown_fields_stream.WriteVarint32(data.size());\n" " unknown_fields_stream.WriteVarint32(\n"
" static_cast<google::protobuf::uint32>(data.size()));\n"
" unknown_fields_stream.WriteString(data);\n"); " unknown_fields_stream.WriteString(data);\n");
} }
@ -267,12 +268,16 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
if (key_field->type() == FieldDescriptor::TYPE_STRING) { if (key_field->type() == FieldDescriptor::TYPE_STRING) {
GenerateUtf8CheckCodeForString( GenerateUtf8CheckCodeForString(
key_field, options_, true, variables_, key_field, options_, true, variables_,
StrCat(key, ".data(), ", key, ".length(),\n").data(), printer); StrCat(key, ".data(), static_cast<int>(", key, ".length()),\n").data(),
printer);
} }
if (value_field->type() == FieldDescriptor::TYPE_STRING) { if (value_field->type() == FieldDescriptor::TYPE_STRING) {
GenerateUtf8CheckCodeForString(value_field, options_, true, variables_, GenerateUtf8CheckCodeForString(
StrCat(value, ".data(), ", value, ".length(),\n").data(), printer); value_field, options_, true, variables_,
StrCat(value, ".data(), static_cast<int>(", value, ".length()),\n")
.data(),
printer);
} }
// If entry is allocated by arena, its desctructor should be avoided. // If entry is allocated by arena, its desctructor should be avoided.
@ -376,14 +381,14 @@ void MapFieldGenerator::GenerateSerializeWithCachedSizes(
printer->Indent(); printer->Indent();
printer->Indent(); printer->Indent();
if (string_key) { if (string_key) {
GenerateUtf8CheckCodeForString(key_field, options_, false, variables, GenerateUtf8CheckCodeForString(
"p->first.data(), p->first.length(),\n", key_field, options_, false, variables,
printer); "p->first.data(), static_cast<int>(p->first.length()),\n", printer);
} }
if (string_value) { if (string_value) {
GenerateUtf8CheckCodeForString(value_field, options_, false, variables, GenerateUtf8CheckCodeForString(
"p->second.data(), p->second.length(),\n", value_field, options_, false, variables,
printer); "p->second.data(), static_cast<int>(p->second.length()),\n", printer);
} }
printer->Outdent(); printer->Outdent();
printer->Outdent(); printer->Outdent();
@ -404,13 +409,14 @@ void MapFieldGenerator::GenerateSerializeWithCachedSizes(
" for (::google::protobuf::Map< $key_cpp$, $val_cpp$ >::const_iterator\n" " for (::google::protobuf::Map< $key_cpp$, $val_cpp$ >::const_iterator\n"
" it = this->$name$().begin();\n" " it = this->$name$().begin();\n"
" it != this->$name$().end(); ++it, ++n) {\n" " it != this->$name$().end(); ++it, ++n) {\n"
" items[n] = SortItem(&*it);\n" " items[static_cast<ptrdiff_t>(n)] = SortItem(&*it);\n"
" }\n" " }\n"
" ::std::sort(&items[0], &items[n], Less());\n"); " ::std::sort(&items[0], &items[static_cast<ptrdiff_t>(n)], Less());\n");
printer->Indent(); printer->Indent();
GenerateSerializationLoop(printer, variables, SupportsArenas(descriptor_), GenerateSerializationLoop(printer, variables, SupportsArenas(descriptor_),
utf8_check, "for (size_type i = 0; i < n; i++)", utf8_check, "for (size_type i = 0; i < n; i++)",
string_key ? "items[i]" : "items[i].second", false); string_key ? "items[static_cast<ptrdiff_t>(i)]" :
"items[static_cast<ptrdiff_t>(i)].second", false);
printer->Outdent(); printer->Outdent();
printer->Print( printer->Print(
"} else {\n"); "} else {\n");

@ -2308,12 +2308,13 @@ void MessageGenerator::GenerateConstructorBody(io::Printer* printer,
if (copy_constructor) { if (copy_constructor) {
pod_template = pod_template =
"::memcpy(&$first$_, &from.$first$_,\n" "::memcpy(&$first$_, &from.$first$_,\n"
" reinterpret_cast<char*>(&$last$_) -\n" " static_cast<size_t>(reinterpret_cast<char*>(&$last$_) -\n"
" reinterpret_cast<char*>(&$first$_) + sizeof($last$_));\n"; " reinterpret_cast<char*>(&$first$_)) + sizeof($last$_));\n";
} else { } else {
pod_template = pod_template =
"::memset(&$first$_, 0, reinterpret_cast<char*>(&$last$_) -\n" "::memset(&$first$_, 0, static_cast<size_t>(\n"
" reinterpret_cast<char*>(&$first$_) + sizeof($last$_));\n"; " reinterpret_cast<char*>(&$last$_) -\n"
" reinterpret_cast<char*>(&$first$_)) + sizeof($last$_));\n";
} }
for (int i = 0; i < optimized_order_.size(); ++i) { for (int i = 0; i < optimized_order_.size(); ++i) {
@ -2750,8 +2751,9 @@ GenerateClear(io::Printer* printer) {
FieldName(optimized_order_[memset_run_end]); FieldName(optimized_order_[memset_run_end]);
printer->Print( printer->Print(
"::memset(&$first$_, 0, reinterpret_cast<char*>(&$last$_) -\n" "::memset(&$first$_, 0, static_cast<size_t>(\n"
" reinterpret_cast<char*>(&$first$_) + sizeof($last$_));\n", " reinterpret_cast<char*>(&$last$_) -\n"
" reinterpret_cast<char*>(&$first$_)) + sizeof($last$_));\n",
"first", first_field_name, "first", first_field_name,
"last", last_field_name); "last", last_field_name);
} }

@ -1084,19 +1084,21 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
void RepeatedMessageFieldGenerator:: void RepeatedMessageFieldGenerator::
GenerateSerializeWithCachedSizes(io::Printer* printer) const { GenerateSerializeWithCachedSizes(io::Printer* printer) const {
printer->Print(variables_, printer->Print(variables_,
"for (unsigned int i = 0, n = this->$name$_size(); i < n; i++) {\n" "for (unsigned int i = 0,\n"
" n = static_cast<unsigned int>(this->$name$_size()); i < n; i++) {\n"
" ::google::protobuf::internal::WireFormatLite::Write$stream_writer$(\n" " ::google::protobuf::internal::WireFormatLite::Write$stream_writer$(\n"
" $number$, this->$name$(i), output);\n" " $number$, this->$name$(static_cast<int>(i)), output);\n"
"}\n"); "}\n");
} }
void RepeatedMessageFieldGenerator:: void RepeatedMessageFieldGenerator::
GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
printer->Print(variables_, printer->Print(variables_,
"for (unsigned int i = 0, n = this->$name$_size(); i < n; i++) {\n" "for (unsigned int i = 0,\n"
" n = static_cast<unsigned int>(this->$name$_size()); i < n; i++) {\n"
" target = ::google::protobuf::internal::WireFormatLite::\n" " target = ::google::protobuf::internal::WireFormatLite::\n"
" InternalWrite$declared_type$NoVirtualToArray(\n" " InternalWrite$declared_type$NoVirtualToArray(\n"
" $number$, this->$name$(i), deterministic, target);\n" " $number$, this->$name$(static_cast<int>(i)), deterministic, target);\n"
"}\n"); "}\n");
} }
@ -1104,14 +1106,14 @@ void RepeatedMessageFieldGenerator::
GenerateByteSize(io::Printer* printer) const { GenerateByteSize(io::Printer* printer) const {
printer->Print(variables_, printer->Print(variables_,
"{\n" "{\n"
" unsigned int count = this->$name$_size();\n"); " unsigned int count = static_cast<unsigned int>(this->$name$_size());\n");
printer->Indent(); printer->Indent();
printer->Print(variables_, printer->Print(variables_,
"total_size += $tag_size$UL * count;\n" "total_size += $tag_size$UL * count;\n"
"for (unsigned int i = 0; i < count; i++) {\n" "for (unsigned int i = 0; i < count; i++) {\n"
" total_size +=\n" " total_size +=\n"
" ::google::protobuf::internal::WireFormatLite::$declared_type$SizeNoVirtual(\n" " ::google::protobuf::internal::WireFormatLite::$declared_type$SizeNoVirtual(\n"
" this->$name$(i));\n" " this->$name$(static_cast<int>(i)));\n"
"}\n"); "}\n");
printer->Outdent(); printer->Outdent();
printer->Print("}\n"); printer->Print("}\n");

@ -382,7 +382,8 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const {
"$number$, " "$number$, "
"::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, " "::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, "
"output);\n" "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) { if (FixedSize(descriptor_->type()) > 0) {
// TODO(ckennelly): Use RepeatedField<T>::unsafe_data() via // TODO(ckennelly): Use RepeatedField<T>::unsafe_data() via
@ -422,7 +423,8 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
" ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n"
" target);\n" " target);\n"
" target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(\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" " target = ::google::protobuf::internal::WireFormatLite::\n"
" Write$declared_type$NoTagToArray(this->$name$_, target);\n" " Write$declared_type$NoTagToArray(this->$name$_, target);\n"
"}\n"); "}\n");
@ -444,7 +446,7 @@ GenerateByteSize(io::Printer* printer) const {
" $declared_type$Size(this->$name$_);\n"); " $declared_type$Size(this->$name$_);\n");
} else { } else {
printer->Print(variables_, 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"); "size_t data_size = $fixed_size$UL * count;\n");
} }
@ -452,7 +454,8 @@ GenerateByteSize(io::Printer* printer) const {
printer->Print(variables_, printer->Print(variables_,
"if (data_size > 0) {\n" "if (data_size > 0) {\n"
" total_size += $tag_size$ +\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" "}\n"
"int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);\n" "int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);\n"
"GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n" "GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n"

@ -477,7 +477,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
GenerateUtf8CheckCodeForString( GenerateUtf8CheckCodeForString(
descriptor_, options_, true, variables_, descriptor_, options_, true, variables_,
"this->$name$().data(), this->$name$().length(),\n", printer); "this->$name$().data(), static_cast<int>(this->$name$().length()),\n",
printer);
} }
} }
@ -486,7 +487,8 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const {
if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
GenerateUtf8CheckCodeForString( GenerateUtf8CheckCodeForString(
descriptor_, options_, false, variables_, descriptor_, options_, false, variables_,
"this->$name$().data(), this->$name$().length(),\n", printer); "this->$name$().data(), static_cast<int>(this->$name$().length()),\n",
printer);
} }
printer->Print(variables_, printer->Print(variables_,
"::google::protobuf::internal::WireFormatLite::Write$declared_type$MaybeAliased(\n" "::google::protobuf::internal::WireFormatLite::Write$declared_type$MaybeAliased(\n"
@ -498,7 +500,8 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
GenerateUtf8CheckCodeForString( GenerateUtf8CheckCodeForString(
descriptor_, options_, false, variables_, descriptor_, options_, false, variables_,
"this->$name$().data(), this->$name$().length(),\n", printer); "this->$name$().data(), static_cast<int>(this->$name$().length()),\n",
printer);
} }
printer->Print(variables_, printer->Print(variables_,
"target =\n" "target =\n"
@ -797,7 +800,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
GenerateUtf8CheckCodeForString( GenerateUtf8CheckCodeForString(
descriptor_, options_, true, variables_, descriptor_, options_, true, variables_,
"this->$name$().data(), this->$name$().length(),\n", printer); "this->$name$().data(), static_cast<int>(this->$name$().length()),\n",
printer);
} }
} }
@ -969,7 +973,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
GenerateUtf8CheckCodeForString( GenerateUtf8CheckCodeForString(
descriptor_, options_, true, variables_, descriptor_, options_, true, variables_,
"this->$name$(this->$name$_size() - 1).data(),\n" "this->$name$(this->$name$_size() - 1).data(),\n"
"this->$name$(this->$name$_size() - 1).length(),\n", "static_cast<int>(this->$name$(this->$name$_size() - 1).length()),\n",
printer); printer);
} }
} }
@ -982,7 +986,8 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const {
if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
GenerateUtf8CheckCodeForString( GenerateUtf8CheckCodeForString(
descriptor_, options_, false, variables_, descriptor_, options_, false, variables_,
"this->$name$(i).data(), this->$name$(i).length(),\n", printer); "this->$name$(i).data(), static_cast<int>(this->$name$(i).length()),\n",
printer);
} }
printer->Outdent(); printer->Outdent();
printer->Print(variables_, printer->Print(variables_,
@ -999,7 +1004,8 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
GenerateUtf8CheckCodeForString( GenerateUtf8CheckCodeForString(
descriptor_, options_, false, variables_, descriptor_, options_, false, variables_,
"this->$name$(i).data(), this->$name$(i).length(),\n", printer); "this->$name$(i).data(), static_cast<int>(this->$name$(i).length()),\n",
printer);
} }
printer->Outdent(); printer->Outdent();
printer->Print(variables_, printer->Print(variables_,

@ -239,16 +239,17 @@ Version::Version(const Version& from)
suffix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.suffix_); suffix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.suffix_);
} }
::memcpy(&major_, &from.major_, ::memcpy(&major_, &from.major_,
reinterpret_cast<char*>(&patch_) - static_cast<size_t>(reinterpret_cast<char*>(&patch_) -
reinterpret_cast<char*>(&major_) + sizeof(patch_)); reinterpret_cast<char*>(&major_)) + sizeof(patch_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.Version) // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.Version)
} }
void Version::SharedCtor() { void Version::SharedCtor() {
_cached_size_ = 0; _cached_size_ = 0;
suffix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); suffix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&major_, 0, reinterpret_cast<char*>(&patch_) - ::memset(&major_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&major_) + sizeof(patch_)); reinterpret_cast<char*>(&patch_) -
reinterpret_cast<char*>(&major_)) + sizeof(patch_));
} }
Version::~Version() { Version::~Version() {
@ -290,8 +291,9 @@ void Version::Clear() {
(*suffix_.UnsafeRawStringPointer())->clear(); (*suffix_.UnsafeRawStringPointer())->clear();
} }
if (_has_bits_[0 / 32] & 14u) { if (_has_bits_[0 / 32] & 14u) {
::memset(&major_, 0, reinterpret_cast<char*>(&patch_) - ::memset(&major_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&major_) + sizeof(patch_)); reinterpret_cast<char*>(&patch_) -
reinterpret_cast<char*>(&major_)) + sizeof(patch_));
} }
_has_bits_.Clear(); _has_bits_.Clear();
_internal_metadata_.Clear(); _internal_metadata_.Clear();
@ -356,7 +358,7 @@ bool Version::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_suffix())); input, this->mutable_suffix()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->suffix().data(), this->suffix().length(), this->suffix().data(), static_cast<int>(this->suffix().length()),
::google::protobuf::internal::WireFormat::PARSE, ::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.compiler.Version.suffix"); "google.protobuf.compiler.Version.suffix");
} else { } else {
@ -412,7 +414,7 @@ void Version::SerializeWithCachedSizes(
// optional string suffix = 4; // optional string suffix = 4;
if (cached_has_bits & 0x00000001u) { if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->suffix().data(), this->suffix().length(), this->suffix().data(), static_cast<int>(this->suffix().length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.Version.suffix"); "google.protobuf.compiler.Version.suffix");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -451,7 +453,7 @@ void Version::SerializeWithCachedSizes(
// optional string suffix = 4; // optional string suffix = 4;
if (cached_has_bits & 0x00000001u) { if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->suffix().data(), this->suffix().length(), this->suffix().data(), static_cast<int>(this->suffix().length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.Version.suffix"); "google.protobuf.compiler.Version.suffix");
target = target =
@ -845,7 +847,7 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream(
input, this->add_file_to_generate())); input, this->add_file_to_generate()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->file_to_generate(this->file_to_generate_size() - 1).data(), this->file_to_generate(this->file_to_generate_size() - 1).data(),
this->file_to_generate(this->file_to_generate_size() - 1).length(), static_cast<int>(this->file_to_generate(this->file_to_generate_size() - 1).length()),
::google::protobuf::internal::WireFormat::PARSE, ::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate");
} else { } else {
@ -861,7 +863,7 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_parameter())); input, this->mutable_parameter()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->parameter().data(), this->parameter().length(), this->parameter().data(), static_cast<int>(this->parameter().length()),
::google::protobuf::internal::WireFormat::PARSE, ::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.compiler.CodeGeneratorRequest.parameter"); "google.protobuf.compiler.CodeGeneratorRequest.parameter");
} else { } else {
@ -925,7 +927,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
// repeated string file_to_generate = 1; // repeated string file_to_generate = 1;
for (int i = 0, n = this->file_to_generate_size(); i < n; i++) { for (int i = 0, n = this->file_to_generate_size(); i < n; i++) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->file_to_generate(i).data(), this->file_to_generate(i).length(), this->file_to_generate(i).data(), static_cast<int>(this->file_to_generate(i).length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate");
::google::protobuf::internal::WireFormatLite::WriteString( ::google::protobuf::internal::WireFormatLite::WriteString(
@ -936,7 +938,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
// optional string parameter = 2; // optional string parameter = 2;
if (cached_has_bits & 0x00000001u) { if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->parameter().data(), this->parameter().length(), this->parameter().data(), static_cast<int>(this->parameter().length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorRequest.parameter"); "google.protobuf.compiler.CodeGeneratorRequest.parameter");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -950,9 +952,10 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.FileDescriptorProto proto_file = 15; // repeated .google.protobuf.FileDescriptorProto proto_file = 15;
for (unsigned int i = 0, n = this->proto_file_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->proto_file_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
15, this->proto_file(i), output); 15, this->proto_file(static_cast<int>(i)), output);
} }
if (_internal_metadata_.have_unknown_fields()) { if (_internal_metadata_.have_unknown_fields()) {
@ -971,7 +974,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
// repeated string file_to_generate = 1; // repeated string file_to_generate = 1;
for (int i = 0, n = this->file_to_generate_size(); i < n; i++) { for (int i = 0, n = this->file_to_generate_size(); i < n; i++) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->file_to_generate(i).data(), this->file_to_generate(i).length(), this->file_to_generate(i).data(), static_cast<int>(this->file_to_generate(i).length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate");
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
@ -982,7 +985,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
// optional string parameter = 2; // optional string parameter = 2;
if (cached_has_bits & 0x00000001u) { if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->parameter().data(), this->parameter().length(), this->parameter().data(), static_cast<int>(this->parameter().length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorRequest.parameter"); "google.protobuf.compiler.CodeGeneratorRequest.parameter");
target = target =
@ -998,10 +1001,11 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.FileDescriptorProto proto_file = 15; // repeated .google.protobuf.FileDescriptorProto proto_file = 15;
for (unsigned int i = 0, n = this->proto_file_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->proto_file_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray( InternalWriteMessageNoVirtualToArray(
15, this->proto_file(i), deterministic, target); 15, this->proto_file(static_cast<int>(i)), deterministic, target);
} }
if (_internal_metadata_.have_unknown_fields()) { if (_internal_metadata_.have_unknown_fields()) {
@ -1031,12 +1035,12 @@ size_t CodeGeneratorRequest::ByteSizeLong() const {
// repeated .google.protobuf.FileDescriptorProto proto_file = 15; // repeated .google.protobuf.FileDescriptorProto proto_file = 15;
{ {
unsigned int count = this->proto_file_size(); unsigned int count = static_cast<unsigned int>(this->proto_file_size());
total_size += 1UL * count; total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
total_size += total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->proto_file(i)); this->proto_file(static_cast<int>(i)));
} }
} }
@ -1464,7 +1468,7 @@ bool CodeGeneratorResponse_File::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name())); input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormat::PARSE, ::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.compiler.CodeGeneratorResponse.File.name"); "google.protobuf.compiler.CodeGeneratorResponse.File.name");
} else { } else {
@ -1480,7 +1484,7 @@ bool CodeGeneratorResponse_File::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_insertion_point())); input, this->mutable_insertion_point()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->insertion_point().data(), this->insertion_point().length(), this->insertion_point().data(), static_cast<int>(this->insertion_point().length()),
::google::protobuf::internal::WireFormat::PARSE, ::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point");
} else { } else {
@ -1496,7 +1500,7 @@ bool CodeGeneratorResponse_File::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_content())); input, this->mutable_content()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->content().data(), this->content().length(), this->content().data(), static_cast<int>(this->content().length()),
::google::protobuf::internal::WireFormat::PARSE, ::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.compiler.CodeGeneratorResponse.File.content"); "google.protobuf.compiler.CodeGeneratorResponse.File.content");
} else { } else {
@ -1537,7 +1541,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes(
// optional string name = 1; // optional string name = 1;
if (cached_has_bits & 0x00000001u) { if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorResponse.File.name"); "google.protobuf.compiler.CodeGeneratorResponse.File.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -1547,7 +1551,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes(
// optional string insertion_point = 2; // optional string insertion_point = 2;
if (cached_has_bits & 0x00000002u) { if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->insertion_point().data(), this->insertion_point().length(), this->insertion_point().data(), static_cast<int>(this->insertion_point().length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -1557,7 +1561,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes(
// optional string content = 15; // optional string content = 15;
if (cached_has_bits & 0x00000004u) { if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->content().data(), this->content().length(), this->content().data(), static_cast<int>(this->content().length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorResponse.File.content"); "google.protobuf.compiler.CodeGeneratorResponse.File.content");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -1581,7 +1585,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes(
// optional string name = 1; // optional string name = 1;
if (cached_has_bits & 0x00000001u) { if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorResponse.File.name"); "google.protobuf.compiler.CodeGeneratorResponse.File.name");
target = target =
@ -1592,7 +1596,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes(
// optional string insertion_point = 2; // optional string insertion_point = 2;
if (cached_has_bits & 0x00000002u) { if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->insertion_point().data(), this->insertion_point().length(), this->insertion_point().data(), static_cast<int>(this->insertion_point().length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point");
target = target =
@ -1603,7 +1607,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes(
// optional string content = 15; // optional string content = 15;
if (cached_has_bits & 0x00000004u) { if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->content().data(), this->content().length(), this->content().data(), static_cast<int>(this->content().length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorResponse.File.content"); "google.protobuf.compiler.CodeGeneratorResponse.File.content");
target = target =
@ -2021,7 +2025,7 @@ bool CodeGeneratorResponse::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_error())); input, this->mutable_error()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->error().data(), this->error().length(), this->error().data(), static_cast<int>(this->error().length()),
::google::protobuf::internal::WireFormat::PARSE, ::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.compiler.CodeGeneratorResponse.error"); "google.protobuf.compiler.CodeGeneratorResponse.error");
} else { } else {
@ -2074,7 +2078,7 @@ void CodeGeneratorResponse::SerializeWithCachedSizes(
// optional string error = 1; // optional string error = 1;
if (cached_has_bits & 0x00000001u) { if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->error().data(), this->error().length(), this->error().data(), static_cast<int>(this->error().length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorResponse.error"); "google.protobuf.compiler.CodeGeneratorResponse.error");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -2082,9 +2086,10 @@ void CodeGeneratorResponse::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
for (unsigned int i = 0, n = this->file_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->file_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
15, this->file(i), output); 15, this->file(static_cast<int>(i)), output);
} }
if (_internal_metadata_.have_unknown_fields()) { if (_internal_metadata_.have_unknown_fields()) {
@ -2104,7 +2109,7 @@ void CodeGeneratorResponse::SerializeWithCachedSizes(
// optional string error = 1; // optional string error = 1;
if (cached_has_bits & 0x00000001u) { if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->error().data(), this->error().length(), this->error().data(), static_cast<int>(this->error().length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorResponse.error"); "google.protobuf.compiler.CodeGeneratorResponse.error");
target = target =
@ -2113,10 +2118,11 @@ void CodeGeneratorResponse::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
for (unsigned int i = 0, n = this->file_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->file_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray( InternalWriteMessageNoVirtualToArray(
15, this->file(i), deterministic, target); 15, this->file(static_cast<int>(i)), deterministic, target);
} }
if (_internal_metadata_.have_unknown_fields()) { if (_internal_metadata_.have_unknown_fields()) {
@ -2138,12 +2144,12 @@ size_t CodeGeneratorResponse::ByteSizeLong() const {
} }
// repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
{ {
unsigned int count = this->file_size(); unsigned int count = static_cast<unsigned int>(this->file_size());
total_size += 1UL * count; total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
total_size += total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->file(i)); this->file(static_cast<int>(i)));
} }
} }

@ -205,16 +205,17 @@ FieldAccessInfo::FieldAccessInfo(const FieldAccessInfo& from)
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
} }
::memcpy(&getters_count_, &from.getters_count_, ::memcpy(&getters_count_, &from.getters_count_,
reinterpret_cast<char*>(&configs_count_) - static_cast<size_t>(reinterpret_cast<char*>(&configs_count_) -
reinterpret_cast<char*>(&getters_count_) + sizeof(configs_count_)); reinterpret_cast<char*>(&getters_count_)) + sizeof(configs_count_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.FieldAccessInfo) // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.FieldAccessInfo)
} }
void FieldAccessInfo::SharedCtor() { void FieldAccessInfo::SharedCtor() {
_cached_size_ = 0; _cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&getters_count_, 0, reinterpret_cast<char*>(&configs_count_) - ::memset(&getters_count_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&getters_count_) + sizeof(configs_count_)); reinterpret_cast<char*>(&configs_count_) -
reinterpret_cast<char*>(&getters_count_)) + sizeof(configs_count_));
} }
FieldAccessInfo::~FieldAccessInfo() { FieldAccessInfo::~FieldAccessInfo() {
@ -256,8 +257,9 @@ void FieldAccessInfo::Clear() {
(*name_.UnsafeRawStringPointer())->clear(); (*name_.UnsafeRawStringPointer())->clear();
} }
if (_has_bits_[0 / 32] & 14u) { if (_has_bits_[0 / 32] & 14u) {
::memset(&getters_count_, 0, reinterpret_cast<char*>(&configs_count_) - ::memset(&getters_count_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&getters_count_) + sizeof(configs_count_)); reinterpret_cast<char*>(&configs_count_) -
reinterpret_cast<char*>(&getters_count_)) + sizeof(configs_count_));
} }
_has_bits_.Clear(); _has_bits_.Clear();
_internal_metadata_.Clear(); _internal_metadata_.Clear();
@ -280,7 +282,7 @@ bool FieldAccessInfo::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name())); input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormat::PARSE, ::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.compiler.FieldAccessInfo.name"); "google.protobuf.compiler.FieldAccessInfo.name");
} else { } else {
@ -363,7 +365,7 @@ void FieldAccessInfo::SerializeWithCachedSizes(
// optional string name = 1; // optional string name = 1;
if (cached_has_bits & 0x00000001u) { if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.FieldAccessInfo.name"); "google.protobuf.compiler.FieldAccessInfo.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -402,7 +404,7 @@ void FieldAccessInfo::SerializeWithCachedSizes(
// optional string name = 1; // optional string name = 1;
if (cached_has_bits & 0x00000001u) { if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.FieldAccessInfo.name"); "google.protobuf.compiler.FieldAccessInfo.name");
target = target =
@ -795,7 +797,7 @@ bool MessageAccessInfo::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name())); input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormat::PARSE, ::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.compiler.MessageAccessInfo.name"); "google.protobuf.compiler.MessageAccessInfo.name");
} else { } else {
@ -862,7 +864,7 @@ void MessageAccessInfo::SerializeWithCachedSizes(
// optional string name = 1; // optional string name = 1;
if (cached_has_bits & 0x00000001u) { if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.MessageAccessInfo.name"); "google.protobuf.compiler.MessageAccessInfo.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -875,9 +877,10 @@ void MessageAccessInfo::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.compiler.FieldAccessInfo field = 3; // repeated .google.protobuf.compiler.FieldAccessInfo field = 3;
for (unsigned int i = 0, n = this->field_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->field_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->field(i), output); 3, this->field(static_cast<int>(i)), output);
} }
if (_internal_metadata_.have_unknown_fields()) { if (_internal_metadata_.have_unknown_fields()) {
@ -897,7 +900,7 @@ void MessageAccessInfo::SerializeWithCachedSizes(
// optional string name = 1; // optional string name = 1;
if (cached_has_bits & 0x00000001u) { if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.MessageAccessInfo.name"); "google.protobuf.compiler.MessageAccessInfo.name");
target = target =
@ -911,10 +914,11 @@ void MessageAccessInfo::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.compiler.FieldAccessInfo field = 3; // repeated .google.protobuf.compiler.FieldAccessInfo field = 3;
for (unsigned int i = 0, n = this->field_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->field_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray( InternalWriteMessageNoVirtualToArray(
3, this->field(i), deterministic, target); 3, this->field(static_cast<int>(i)), deterministic, target);
} }
if (_internal_metadata_.have_unknown_fields()) { if (_internal_metadata_.have_unknown_fields()) {
@ -936,12 +940,12 @@ size_t MessageAccessInfo::ByteSizeLong() const {
} }
// repeated .google.protobuf.compiler.FieldAccessInfo field = 3; // repeated .google.protobuf.compiler.FieldAccessInfo field = 3;
{ {
unsigned int count = this->field_size(); unsigned int count = static_cast<unsigned int>(this->field_size());
total_size += 1UL * count; total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
total_size += total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->field(i)); this->field(static_cast<int>(i)));
} }
} }
@ -1279,9 +1283,10 @@ void AccessInfo::SerializeWithCachedSizes(
(void) cached_has_bits; (void) cached_has_bits;
// repeated .google.protobuf.compiler.MessageAccessInfo message = 1; // repeated .google.protobuf.compiler.MessageAccessInfo message = 1;
for (unsigned int i = 0, n = this->message_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->message_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->message(i), output); 1, this->message(static_cast<int>(i)), output);
} }
if (_internal_metadata_.have_unknown_fields()) { if (_internal_metadata_.have_unknown_fields()) {
@ -1298,10 +1303,11 @@ void AccessInfo::SerializeWithCachedSizes(
(void) cached_has_bits; (void) cached_has_bits;
// repeated .google.protobuf.compiler.MessageAccessInfo message = 1; // repeated .google.protobuf.compiler.MessageAccessInfo message = 1;
for (unsigned int i = 0, n = this->message_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->message_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray( InternalWriteMessageNoVirtualToArray(
1, this->message(i), deterministic, target); 1, this->message(static_cast<int>(i)), deterministic, target);
} }
if (_internal_metadata_.have_unknown_fields()) { if (_internal_metadata_.have_unknown_fields()) {
@ -1323,12 +1329,12 @@ size_t AccessInfo::ByteSizeLong() const {
} }
// repeated .google.protobuf.compiler.MessageAccessInfo message = 1; // repeated .google.protobuf.compiler.MessageAccessInfo message = 1;
{ {
unsigned int count = this->message_size(); unsigned int count = static_cast<unsigned int>(this->message_size());
total_size += 1UL * count; total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
total_size += total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->message(i)); this->message(static_cast<int>(i)));
} }
} }

File diff suppressed because it is too large Load Diff

@ -164,14 +164,15 @@ Duration::Duration(const Duration& from)
_cached_size_(0) { _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_); _internal_metadata_.MergeFrom(from._internal_metadata_);
::memcpy(&seconds_, &from.seconds_, ::memcpy(&seconds_, &from.seconds_,
reinterpret_cast<char*>(&nanos_) - static_cast<size_t>(reinterpret_cast<char*>(&nanos_) -
reinterpret_cast<char*>(&seconds_) + sizeof(nanos_)); reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.Duration) // @@protoc_insertion_point(copy_constructor:google.protobuf.Duration)
} }
void Duration::SharedCtor() { void Duration::SharedCtor() {
::memset(&seconds_, 0, reinterpret_cast<char*>(&nanos_) - ::memset(&seconds_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&seconds_) + sizeof(nanos_)); reinterpret_cast<char*>(&nanos_) -
reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_));
_cached_size_ = 0; _cached_size_ = 0;
} }
@ -215,8 +216,9 @@ Duration* Duration::New(::google::protobuf::Arena* arena) const {
void Duration::Clear() { void Duration::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Duration) // @@protoc_insertion_point(message_clear_start:google.protobuf.Duration)
::memset(&seconds_, 0, reinterpret_cast<char*>(&nanos_) - ::memset(&seconds_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&seconds_) + sizeof(nanos_)); reinterpret_cast<char*>(&nanos_) -
reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_));
} }
bool Duration::MergePartialFromCodedStream( bool Duration::MergePartialFromCodedStream(

@ -156,20 +156,20 @@ class LIBPROTOBUF_EXPORT DynamicMapSorter {
int map_size, int map_size,
const Reflection* reflection, const Reflection* reflection,
const FieldDescriptor* field) { const FieldDescriptor* field) {
std::vector<const Message*> result(map_size); std::vector<const Message*> result(static_cast<size_t>(map_size));
const RepeatedPtrField<Message>& map_field = const RepeatedPtrField<Message>& map_field =
reflection->GetRepeatedPtrField<Message>(message, field); reflection->GetRepeatedPtrField<Message>(message, field);
int i = 0; size_t i = 0;
for (RepeatedPtrField<Message>::const_pointer_iterator it = for (RepeatedPtrField<Message>::const_pointer_iterator it =
map_field.pointer_begin(); it != map_field.pointer_end(); ) { map_field.pointer_begin(); it != map_field.pointer_end(); ) {
result[i++] = *it++; result[i++] = *it++;
} }
GOOGLE_DCHECK_EQ(result.size(), static_cast<size_t>(i)); GOOGLE_DCHECK_EQ(result.size(), i);
MapEntryMessageComparator comparator(field->message_type()); MapEntryMessageComparator comparator(field->message_type());
std::sort(result.begin(), result.end(), comparator); std::sort(result.begin(), result.end(), comparator);
// Complain if the keys aren't in ascending order. // Complain if the keys aren't in ascending order.
#ifndef NDEBUG #ifndef NDEBUG
for (int j = 1; j < map_size; j++) { for (size_t j = 1; j < static_cast<size_t>(map_size); j++) {
if (!comparator(result[j - 1], result[j])) { if (!comparator(result[j - 1], result[j])) {
GOOGLE_LOG(ERROR) << (comparator(result[j], result[j - 1]) ? GOOGLE_LOG(ERROR) << (comparator(result[j], result[j - 1]) ?
"internal error in map key sorting" : "internal error in map key sorting" :

@ -213,7 +213,7 @@ bool FieldMask::MergePartialFromCodedStream(
input, this->add_paths())); input, this->add_paths()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->paths(this->paths_size() - 1).data(), this->paths(this->paths_size() - 1).data(),
this->paths(this->paths_size() - 1).length(), static_cast<int>(this->paths(this->paths_size() - 1).length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.FieldMask.paths")); "google.protobuf.FieldMask.paths"));
} else { } else {
@ -252,7 +252,7 @@ void FieldMask::SerializeWithCachedSizes(
// repeated string paths = 1; // repeated string paths = 1;
for (int i = 0, n = this->paths_size(); i < n; i++) { for (int i = 0, n = this->paths_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->paths(i).data(), this->paths(i).length(), this->paths(i).data(), static_cast<int>(this->paths(i).length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.FieldMask.paths"); "google.protobuf.FieldMask.paths");
::google::protobuf::internal::WireFormatLite::WriteString( ::google::protobuf::internal::WireFormatLite::WriteString(
@ -271,7 +271,7 @@ void FieldMask::SerializeWithCachedSizes(
// repeated string paths = 1; // repeated string paths = 1;
for (int i = 0, n = this->paths_size(); i < n; i++) { for (int i = 0, n = this->paths_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->paths(i).data(), this->paths(i).length(), this->paths(i).data(), static_cast<int>(this->paths(i).length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.FieldMask.paths"); "google.protobuf.FieldMask.paths");
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::

@ -129,7 +129,7 @@ class WeakFieldMap; // weak_field_map.h
struct ReflectionSchema { struct ReflectionSchema {
public: public:
// Size of a google::protobuf::Message object of this type. // Size of a google::protobuf::Message object of this type.
uint32 GetObjectSize() const { return object_size_; } uint32 GetObjectSize() const { return static_cast<uint32>(object_size_); }
// Offset of a non-oneof field. Getting a field offset is slightly more // Offset of a non-oneof field. Getting a field offset is slightly more
// efficient when we know statically that it is not a oneof field. // efficient when we know statically that it is not a oneof field.
@ -141,8 +141,9 @@ struct ReflectionSchema {
// Offset of any field. // Offset of any field.
uint32 GetFieldOffset(const FieldDescriptor* field) const { uint32 GetFieldOffset(const FieldDescriptor* field) const {
if (field->containing_oneof()) { if (field->containing_oneof()) {
size_t offset = field->containing_type()->field_count() + size_t offset =
field->containing_oneof()->index(); static_cast<size_t>(field->containing_type()->field_count() +
field->containing_oneof()->index());
return offsets_[offset]; return offsets_[offset];
} else { } else {
return GetFieldOffsetNonOneof(field); return GetFieldOffsetNonOneof(field);
@ -150,7 +151,9 @@ struct ReflectionSchema {
} }
uint32 GetOneofCaseOffset(const OneofDescriptor* oneof_descriptor) const { uint32 GetOneofCaseOffset(const OneofDescriptor* oneof_descriptor) const {
return oneof_case_offset_ + (oneof_descriptor->index() * sizeof(uint32)); return static_cast<uint32>(oneof_case_offset_) +
static_cast<uint32>(
static_cast<size_t>(oneof_descriptor->index()) * sizeof(uint32));
} }
bool HasHasbits() const { return has_bits_offset_ != -1; } bool HasHasbits() const { return has_bits_offset_ != -1; }
@ -164,7 +167,7 @@ struct ReflectionSchema {
// Byte offset of the hasbits array. // Byte offset of the hasbits array.
uint32 HasBitsOffset() const { uint32 HasBitsOffset() const {
GOOGLE_DCHECK(HasHasbits()); GOOGLE_DCHECK(HasHasbits());
return has_bits_offset_; return static_cast<uint32>(has_bits_offset_);
} }
// The offset of the InternalMetadataWithArena member. // The offset of the InternalMetadataWithArena member.
@ -172,7 +175,7 @@ struct ReflectionSchema {
// The schema doesn't contain enough information to distinguish between // The schema doesn't contain enough information to distinguish between
// these two cases. // these two cases.
uint32 GetMetadataOffset() const { uint32 GetMetadataOffset() const {
return metadata_offset_; return static_cast<uint32>(metadata_offset_);
} }
// Whether this message has an ExtensionSet. // Whether this message has an ExtensionSet.
@ -181,7 +184,7 @@ struct ReflectionSchema {
// The offset of the ExtensionSet in this message. // The offset of the ExtensionSet in this message.
uint32 GetExtensionSetOffset() const { uint32 GetExtensionSetOffset() const {
GOOGLE_DCHECK(HasExtensionSet()); GOOGLE_DCHECK(HasExtensionSet());
return extensions_offset_; return static_cast<uint32>(extensions_offset_);
} }
// The off set of WeakFieldMap when the message contains weak fields. // The off set of WeakFieldMap when the message contains weak fields.

@ -158,7 +158,7 @@ class Map {
private: private:
void Init() { void Init() {
elements_ = Arena::Create<InnerMap>(arena_, 0, hasher(), Allocator(arena_)); elements_ = Arena::Create<InnerMap>(arena_, 0u, hasher(), Allocator(arena_));
} }
// re-implement std::allocator to use arena allocator for memory allocation. // re-implement std::allocator to use arena allocator for memory allocation.

@ -226,8 +226,10 @@ class MapEntryImpl : public Base {
size_t ByteSizeLong() const { size_t ByteSizeLong() const {
size_t size = 0; size_t size = 0;
size += has_key() ? kTagSize + KeyTypeHandler::ByteSize(key()) : 0; size += has_key() ?
size += has_value() ? kTagSize + ValueTypeHandler::ByteSize(value()) : 0; kTagSize + static_cast<size_t>(KeyTypeHandler::ByteSize(key())) : 0;
size += has_value() ?
kTagSize + static_cast<size_t>(ValueTypeHandler::ByteSize(value())) : 0;
return size; return size;
} }
@ -250,11 +252,10 @@ class MapEntryImpl : public Base {
int GetCachedSize() const { int GetCachedSize() const {
int size = 0; int size = 0;
size += has_key() size += has_key()
? kTagSize + KeyTypeHandler::GetCachedSize(key()) ? static_cast<int>(kTagSize) + KeyTypeHandler::GetCachedSize(key())
: 0; : 0;
size += has_value() size += has_value()
? kTagSize + ValueTypeHandler::GetCachedSize( ? static_cast<int>(kTagSize) + ValueTypeHandler::GetCachedSize(value())
value())
: 0; : 0;
return size; return size;
} }

@ -168,7 +168,7 @@ template <typename Derived, typename Key, typename T,
int MapField<Derived, Key, T, kKeyFieldType, kValueFieldType, int MapField<Derived, Key, T, kKeyFieldType, kValueFieldType,
default_enum_value>::size() const { default_enum_value>::size() const {
MapFieldBase::SyncMapWithRepeatedField(); MapFieldBase::SyncMapWithRepeatedField();
return impl_.GetMap().size(); return static_cast<int>(impl_.GetMap().size());
} }
template <typename Derived, typename Key, typename T, template <typename Derived, typename Key, typename T,

@ -60,7 +60,7 @@ class MapFieldLite {
Map<Key, T>* MutableMap() { return &map_; } Map<Key, T>* MutableMap() { return &map_; }
// Convenient methods for generated message implementation. // Convenient methods for generated message implementation.
int size() const { return map_.size(); } int size() const { return static_cast<int>(map_.size()); }
void Clear() { return map_.clear(); } void Clear() { return map_.clear(); }
void MergeFrom(const MapFieldLite& other) { void MergeFrom(const MapFieldLite& other) {
for (typename Map<Key, T>::const_iterator it = other.map_.begin(); for (typename Map<Key, T>::const_iterator it = other.map_.begin();

@ -284,7 +284,7 @@ MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::ByteSize(
template <typename Type> \ template <typename Type> \
inline int MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::ByteSize( \ inline int MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::ByteSize( \
const MapEntryAccessorType& value) { \ const MapEntryAccessorType& value) { \
return WireFormatLite::DeclaredType##Size(value); \ return static_cast<int>(WireFormatLite::DeclaredType##Size(value)); \
} }
GOOGLE_PROTOBUF_BYTE_SIZE(STRING, String) GOOGLE_PROTOBUF_BYTE_SIZE(STRING, String)
@ -320,7 +320,9 @@ template <typename Type>
inline int inline int
MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::GetCachedSize( MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::GetCachedSize(
const MapEntryAccessorType& value) { const MapEntryAccessorType& value) {
return WireFormatLite::LengthDelimitedSize(value.GetCachedSize()); return static_cast<int>(
WireFormatLite::LengthDelimitedSize(
static_cast<size_t>(value.GetCachedSize())));
} }
#define GET_CACHED_SIZE(FieldType, DeclaredType) \ #define GET_CACHED_SIZE(FieldType, DeclaredType) \
@ -328,7 +330,7 @@ MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::GetCachedSize(
inline int \ inline int \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::GetCachedSize( \ MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::GetCachedSize( \
const MapEntryAccessorType& value) { \ const MapEntryAccessorType& value) { \
return WireFormatLite::DeclaredType##Size(value); \ return static_cast<int>(WireFormatLite::DeclaredType##Size(value)); \
} }
GET_CACHED_SIZE(STRING, String) GET_CACHED_SIZE(STRING, String)

@ -1335,7 +1335,7 @@ void RepeatedField<Element>::Reserve(int new_size) {
static_cast<size_t>(new_size), static_cast<size_t>(new_size),
(std::numeric_limits<size_t>::max() - kRepHeaderSize) / sizeof(Element)) (std::numeric_limits<size_t>::max() - kRepHeaderSize) / sizeof(Element))
<< "Requested size is too large to fit into size_t."; << "Requested size is too large to fit into size_t.";
size_t bytes = kRepHeaderSize + sizeof(Element) * new_size; size_t bytes = kRepHeaderSize + sizeof(Element) * static_cast<size_t>(new_size);
if (arena == NULL) { if (arena == NULL) {
rep_ = static_cast<Rep*>(::operator new(bytes)); rep_ = static_cast<Rep*>(::operator new(bytes));
} else { } else {
@ -1399,7 +1399,7 @@ void ElementCopier<Element, HasTrivialCopy>::operator()(
template <typename Element> template <typename Element>
struct ElementCopier<Element, true> { struct ElementCopier<Element, true> {
void operator()(Element* to, const Element* from, int array_size) { void operator()(Element* to, const Element* from, int array_size) {
memcpy(to, from, array_size * sizeof(Element)); memcpy(to, from, static_cast<size_t>(array_size) * sizeof(Element));
} }
}; };
@ -1651,7 +1651,7 @@ inline void RepeatedPtrFieldBase::SwapElements(int index1, int index2) {
template <typename TypeHandler> template <typename TypeHandler>
inline size_t RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong() const { inline size_t RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong() const {
size_t allocated_bytes = total_size_ * sizeof(void*); size_t allocated_bytes = static_cast<size_t>(total_size_) * sizeof(void*);
if (rep_ != NULL) { if (rep_ != NULL) {
for (int i = 0; i < rep_->allocated_size; ++i) { for (int i = 0; i < rep_->allocated_size; ++i) {
allocated_bytes += TypeHandler::SpaceUsedLong( allocated_bytes += TypeHandler::SpaceUsedLong(

@ -218,7 +218,7 @@ bool SourceContext::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_file_name())); input, this->mutable_file_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->file_name().data(), this->file_name().length(), this->file_name().data(), static_cast<int>(this->file_name().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.SourceContext.file_name")); "google.protobuf.SourceContext.file_name"));
} else { } else {
@ -257,7 +257,7 @@ void SourceContext::SerializeWithCachedSizes(
// string file_name = 1; // string file_name = 1;
if (this->file_name().size() > 0) { if (this->file_name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->file_name().data(), this->file_name().length(), this->file_name().data(), static_cast<int>(this->file_name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.SourceContext.file_name"); "google.protobuf.SourceContext.file_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -276,7 +276,7 @@ void SourceContext::SerializeWithCachedSizes(
// string file_name = 1; // string file_name = 1;
if (this->file_name().size() > 0) { if (this->file_name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->file_name().data(), this->file_name().length(), this->file_name().data(), static_cast<int>(this->file_name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.SourceContext.file_name"); "google.protobuf.SourceContext.file_name");
target = target =

@ -340,7 +340,7 @@ bool Struct::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, &parser)); input, &parser));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
parser.key().data(), parser.key().length(), parser.key().data(), static_cast<int>(parser.key().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Struct.FieldsEntry.key")); "google.protobuf.Struct.FieldsEntry.key"));
} else { } else {
@ -385,7 +385,7 @@ void Struct::SerializeWithCachedSizes(
struct Utf8Check { struct Utf8Check {
static void Check(ConstPtr p) { static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(), p->first.data(), static_cast<int>(p->first.length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Struct.FieldsEntry.key"); "google.protobuf.Struct.FieldsEntry.key");
} }
@ -400,19 +400,19 @@ void Struct::SerializeWithCachedSizes(
for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator
it = this->fields().begin(); it = this->fields().begin();
it != this->fields().end(); ++it, ++n) { it != this->fields().end(); ++it, ++n) {
items[n] = SortItem(&*it); items[static_cast<ptrdiff_t>(n)] = SortItem(&*it);
} }
::std::sort(&items[0], &items[n], Less()); ::std::sort(&items[0], &items[static_cast<ptrdiff_t>(n)], Less());
::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry; ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry;
for (size_type i = 0; i < n; i++) { for (size_type i = 0; i < n; i++) {
entry.reset(fields_.NewEntryWrapper( entry.reset(fields_.NewEntryWrapper(
items[i]->first, items[i]->second)); items[static_cast<ptrdiff_t>(i)]->first, items[static_cast<ptrdiff_t>(i)]->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *entry, output); 1, *entry, output);
if (entry->GetArena() != NULL) { if (entry->GetArena() != NULL) {
entry.release(); entry.release();
} }
Utf8Check::Check(items[i]); Utf8Check::Check(items[static_cast<ptrdiff_t>(i)]);
} }
} else { } else {
::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry; ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry;
@ -449,7 +449,7 @@ void Struct::SerializeWithCachedSizes(
struct Utf8Check { struct Utf8Check {
static void Check(ConstPtr p) { static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(), p->first.data(), static_cast<int>(p->first.length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Struct.FieldsEntry.key"); "google.protobuf.Struct.FieldsEntry.key");
} }
@ -464,13 +464,13 @@ void Struct::SerializeWithCachedSizes(
for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator
it = this->fields().begin(); it = this->fields().begin();
it != this->fields().end(); ++it, ++n) { it != this->fields().end(); ++it, ++n) {
items[n] = SortItem(&*it); items[static_cast<ptrdiff_t>(n)] = SortItem(&*it);
} }
::std::sort(&items[0], &items[n], Less()); ::std::sort(&items[0], &items[static_cast<ptrdiff_t>(n)], Less());
::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry; ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry;
for (size_type i = 0; i < n; i++) { for (size_type i = 0; i < n; i++) {
entry.reset(fields_.NewEntryWrapper( entry.reset(fields_.NewEntryWrapper(
items[i]->first, items[i]->second)); items[static_cast<ptrdiff_t>(i)]->first, items[static_cast<ptrdiff_t>(i)]->second));
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray( InternalWriteMessageNoVirtualToArray(
1, *entry, deterministic, target); 1, *entry, deterministic, target);
@ -478,7 +478,7 @@ void Struct::SerializeWithCachedSizes(
if (entry->GetArena() != NULL) { if (entry->GetArena() != NULL) {
entry.release(); entry.release();
} }
Utf8Check::Check(items[i]); Utf8Check::Check(items[static_cast<ptrdiff_t>(i)]);
} }
} else { } else {
::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry; ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry;
@ -834,7 +834,7 @@ bool Value::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_string_value())); input, this->mutable_string_value()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->string_value().data(), this->string_value().length(), this->string_value().data(), static_cast<int>(this->string_value().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Value.string_value")); "google.protobuf.Value.string_value"));
} else { } else {
@ -923,7 +923,7 @@ void Value::SerializeWithCachedSizes(
// string string_value = 3; // string string_value = 3;
if (has_string_value()) { if (has_string_value()) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->string_value().data(), this->string_value().length(), this->string_value().data(), static_cast<int>(this->string_value().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Value.string_value"); "google.protobuf.Value.string_value");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -970,7 +970,7 @@ void Value::SerializeWithCachedSizes(
// string string_value = 3; // string string_value = 3;
if (has_string_value()) { if (has_string_value()) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->string_value().data(), this->string_value().length(), this->string_value().data(), static_cast<int>(this->string_value().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Value.string_value"); "google.protobuf.Value.string_value");
target = target =
@ -1673,9 +1673,10 @@ void ListValue::SerializeWithCachedSizes(
(void) cached_has_bits; (void) cached_has_bits;
// repeated .google.protobuf.Value values = 1; // repeated .google.protobuf.Value values = 1;
for (unsigned int i = 0, n = this->values_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->values_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->values(i), output); 1, this->values(static_cast<int>(i)), output);
} }
// @@protoc_insertion_point(serialize_end:google.protobuf.ListValue) // @@protoc_insertion_point(serialize_end:google.protobuf.ListValue)
@ -1688,10 +1689,11 @@ void ListValue::SerializeWithCachedSizes(
(void) cached_has_bits; (void) cached_has_bits;
// repeated .google.protobuf.Value values = 1; // repeated .google.protobuf.Value values = 1;
for (unsigned int i = 0, n = this->values_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->values_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray( InternalWriteMessageNoVirtualToArray(
1, this->values(i), deterministic, target); 1, this->values(static_cast<int>(i)), deterministic, target);
} }
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ListValue) // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ListValue)
@ -1704,12 +1706,12 @@ size_t ListValue::ByteSizeLong() const {
// repeated .google.protobuf.Value values = 1; // repeated .google.protobuf.Value values = 1;
{ {
unsigned int count = this->values_size(); unsigned int count = static_cast<unsigned int>(this->values_size());
total_size += 1UL * count; total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
total_size += total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->values(i)); this->values(static_cast<int>(i)));
} }
} }

@ -111,7 +111,8 @@ inline int fastmemcmp_inlined(const char *a, const char *b, size_t n) {
b += sizeof(uint32); b += sizeof(uint32);
} }
while (a < a_limit) { while (a < a_limit) {
int d = static_cast<uint32>(*a++) - static_cast<uint32>(*b++); int d =
static_cast<int>(static_cast<uint32>(*a++) - static_cast<uint32>(*b++));
if (d) return d; if (d) return d;
} }
return 0; return 0;

@ -348,7 +348,7 @@ struct hash<const char*> {
inline size_t operator()(const char* str) const { inline size_t operator()(const char* str) const {
size_t result = 0; size_t result = 0;
for (; *str != '\0'; str++) { for (; *str != '\0'; str++) {
result = 5 * result + *str; result = 5 * result + static_cast<size_t>(*str);
} }
return result; return result;
} }

@ -354,7 +354,7 @@ class Bits {
public: public:
static uint32 Log2FloorNonZero(uint32 n) { static uint32 Log2FloorNonZero(uint32 n) {
#if defined(__GNUC__) #if defined(__GNUC__)
return 31 ^ __builtin_clz(n); return 31 ^ static_cast<uint32>(__builtin_clz(n));
#elif defined(COMPILER_MSVC) && defined(_M_IX86) #elif defined(COMPILER_MSVC) && defined(_M_IX86)
_asm { _asm {
bsr ebx, n bsr ebx, n
@ -373,7 +373,7 @@ class Bits {
// To work around this, when we build for NaCl we use the portable // To work around this, when we build for NaCl we use the portable
// implementation instead. // implementation instead.
#if defined(__GNUC__) && !defined(GOOGLE_PROTOBUF_OS_NACL) #if defined(__GNUC__) && !defined(GOOGLE_PROTOBUF_OS_NACL)
return 63 ^ __builtin_clzll(n); return 63 ^ static_cast<uint32>(__builtin_clzll(n));
#else #else
return Log2FloorNonZero64_Portable(n); return Log2FloorNonZero64_Portable(n);
#endif #endif
@ -400,9 +400,9 @@ class Bits {
const uint32 topbits = static_cast<uint32>(n >> 32); const uint32 topbits = static_cast<uint32>(n >> 32);
if (topbits == 0) { if (topbits == 0) {
// Top bits are zero, so scan in bottom bits // Top bits are zero, so scan in bottom bits
return Log2FloorNonZero(static_cast<uint32>(n)); return static_cast<int>(Log2FloorNonZero(static_cast<uint32>(n)));
} else { } else {
return 32 + Log2FloorNonZero(topbits); return 32 + static_cast<int>(Log2FloorNonZero(topbits));
} }
} }
}; };

@ -292,7 +292,7 @@ class LIBPROTOBUF_EXPORT StringPiece {
int compare(StringPiece x) const { int compare(StringPiece x) const {
const stringpiece_ssize_type min_size = const stringpiece_ssize_type min_size =
length_ < x.length_ ? length_ : x.length_; length_ < x.length_ ? length_ : x.length_;
int r = memcmp(ptr_, x.ptr_, min_size); int r = memcmp(ptr_, x.ptr_, static_cast<size_t>(min_size));
if (r < 0) return -1; if (r < 0) return -1;
if (r > 0) return 1; if (r > 0) return 1;
if (length_ < x.length_) return -1; if (length_ < x.length_) return -1;
@ -310,7 +310,7 @@ class LIBPROTOBUF_EXPORT StringPiece {
// "as_string()" method defined here for existing code. // "as_string()" method defined here for existing code.
string ToString() const { string ToString() const {
if (ptr_ == NULL) return string(); if (ptr_ == NULL) return string();
return string(data(), size()); return string(data(), static_cast<size_type>(size()));
} }
operator string() const { operator string() const {
@ -321,12 +321,14 @@ class LIBPROTOBUF_EXPORT StringPiece {
void AppendToString(string* target) const; void AppendToString(string* target) const;
bool starts_with(StringPiece x) const { bool starts_with(StringPiece x) const {
return (length_ >= x.length_) && (memcmp(ptr_, x.ptr_, x.length_) == 0); return (length_ >= x.length_) &&
(memcmp(ptr_, x.ptr_, static_cast<size_t>(x.length_)) == 0);
} }
bool ends_with(StringPiece x) const { bool ends_with(StringPiece x) const {
return ((length_ >= x.length_) && return ((length_ >= x.length_) &&
(memcmp(ptr_ + (length_-x.length_), x.ptr_, x.length_) == 0)); (memcmp(ptr_ + (length_-x.length_), x.ptr_,
static_cast<size_t>(x.length_)) == 0));
} }
// Checks whether StringPiece starts with x and if so advances the beginning // Checks whether StringPiece starts with x and if so advances the beginning
@ -398,7 +400,7 @@ inline bool operator==(StringPiece x, StringPiece y) {
} }
return x.data() == y.data() || len <= 0 || return x.data() == y.data() || len <= 0 ||
memcmp(x.data(), y.data(), len) == 0; memcmp(x.data(), y.data(), static_cast<size_t>(len)) == 0;
} }
inline bool operator!=(StringPiece x, StringPiece y) { inline bool operator!=(StringPiece x, StringPiece y) {
@ -408,7 +410,7 @@ inline bool operator!=(StringPiece x, StringPiece y) {
inline bool operator<(StringPiece x, StringPiece y) { inline bool operator<(StringPiece x, StringPiece y) {
const stringpiece_ssize_type min_size = const stringpiece_ssize_type min_size =
x.size() < y.size() ? x.size() : y.size(); x.size() < y.size() ? x.size() : y.size();
const int r = memcmp(x.data(), y.data(), min_size); const int r = memcmp(x.data(), y.data(), static_cast<size_t>(min_size));
return (r < 0) || (r == 0 && x.size() < y.size()); return (r < 0) || (r == 0 && x.size() < y.size());
} }
@ -458,7 +460,9 @@ struct StringPiecePod {
return size_; return size_;
} }
std::string ToString() const { return std::string(data_, size_); } std::string ToString() const {
return std::string(data_, static_cast<size_t>(size_));
}
private: private:
const char* data_; const char* data_;
stringpiece_ssize_type size_; stringpiece_ssize_type size_;
@ -473,7 +477,7 @@ template<> struct hash<StringPiece> {
size_t operator()(const StringPiece& s) const { size_t operator()(const StringPiece& s) const {
size_t result = 0; size_t result = 0;
for (const char *str = s.data(), *end = str + s.size(); str < end; str++) { for (const char *str = s.data(), *end = str + s.size(); str < end; str++) {
result = 5 * result + *str; result = 5 * result + static_cast<size_t>(*str);
} }
return result; return result;
} }

@ -164,14 +164,15 @@ Timestamp::Timestamp(const Timestamp& from)
_cached_size_(0) { _cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_); _internal_metadata_.MergeFrom(from._internal_metadata_);
::memcpy(&seconds_, &from.seconds_, ::memcpy(&seconds_, &from.seconds_,
reinterpret_cast<char*>(&nanos_) - static_cast<size_t>(reinterpret_cast<char*>(&nanos_) -
reinterpret_cast<char*>(&seconds_) + sizeof(nanos_)); reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.Timestamp) // @@protoc_insertion_point(copy_constructor:google.protobuf.Timestamp)
} }
void Timestamp::SharedCtor() { void Timestamp::SharedCtor() {
::memset(&seconds_, 0, reinterpret_cast<char*>(&nanos_) - ::memset(&seconds_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&seconds_) + sizeof(nanos_)); reinterpret_cast<char*>(&nanos_) -
reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_));
_cached_size_ = 0; _cached_size_ = 0;
} }
@ -215,8 +216,9 @@ Timestamp* Timestamp::New(::google::protobuf::Arena* arena) const {
void Timestamp::Clear() { void Timestamp::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Timestamp) // @@protoc_insertion_point(message_clear_start:google.protobuf.Timestamp)
::memset(&seconds_, 0, reinterpret_cast<char*>(&nanos_) - ::memset(&seconds_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&seconds_) + sizeof(nanos_)); reinterpret_cast<char*>(&nanos_) -
reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_));
} }
bool Timestamp::MergePartialFromCodedStream( bool Timestamp::MergePartialFromCodedStream(

@ -437,8 +437,9 @@ Type::Type(const Type& from)
void Type::SharedCtor() { void Type::SharedCtor() {
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&source_context_, 0, reinterpret_cast<char*>(&syntax_) - ::memset(&source_context_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&source_context_) + sizeof(syntax_)); reinterpret_cast<char*>(&syntax_) -
reinterpret_cast<char*>(&source_context_)) + sizeof(syntax_));
_cached_size_ = 0; _cached_size_ = 0;
} }
@ -514,7 +515,7 @@ bool Type::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name())); input, this->mutable_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Type.name")); "google.protobuf.Type.name"));
} else { } else {
@ -543,7 +544,7 @@ bool Type::MergePartialFromCodedStream(
input, this->add_oneofs())); input, this->add_oneofs()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->oneofs(this->oneofs_size() - 1).data(), this->oneofs(this->oneofs_size() - 1).data(),
this->oneofs(this->oneofs_size() - 1).length(), static_cast<int>(this->oneofs(this->oneofs_size() - 1).length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Type.oneofs")); "google.protobuf.Type.oneofs"));
} else { } else {
@ -621,7 +622,7 @@ void Type::SerializeWithCachedSizes(
// string name = 1; // string name = 1;
if (this->name().size() > 0) { if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Type.name"); "google.protobuf.Type.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -629,15 +630,16 @@ void Type::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.Field fields = 2; // repeated .google.protobuf.Field fields = 2;
for (unsigned int i = 0, n = this->fields_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->fields_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->fields(i), output); 2, this->fields(static_cast<int>(i)), output);
} }
// repeated string oneofs = 3; // repeated string oneofs = 3;
for (int i = 0, n = this->oneofs_size(); i < n; i++) { for (int i = 0, n = this->oneofs_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->oneofs(i).data(), this->oneofs(i).length(), this->oneofs(i).data(), static_cast<int>(this->oneofs(i).length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Type.oneofs"); "google.protobuf.Type.oneofs");
::google::protobuf::internal::WireFormatLite::WriteString( ::google::protobuf::internal::WireFormatLite::WriteString(
@ -645,9 +647,10 @@ void Type::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.Option options = 4; // repeated .google.protobuf.Option options = 4;
for (unsigned int i = 0, n = this->options_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->options(i), output); 4, this->options(static_cast<int>(i)), output);
} }
// .google.protobuf.SourceContext source_context = 5; // .google.protobuf.SourceContext source_context = 5;
@ -674,7 +677,7 @@ void Type::SerializeWithCachedSizes(
// string name = 1; // string name = 1;
if (this->name().size() > 0) { if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Type.name"); "google.protobuf.Type.name");
target = target =
@ -683,16 +686,17 @@ void Type::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.Field fields = 2; // repeated .google.protobuf.Field fields = 2;
for (unsigned int i = 0, n = this->fields_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->fields_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray( InternalWriteMessageNoVirtualToArray(
2, this->fields(i), deterministic, target); 2, this->fields(static_cast<int>(i)), deterministic, target);
} }
// repeated string oneofs = 3; // repeated string oneofs = 3;
for (int i = 0, n = this->oneofs_size(); i < n; i++) { for (int i = 0, n = this->oneofs_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->oneofs(i).data(), this->oneofs(i).length(), this->oneofs(i).data(), static_cast<int>(this->oneofs(i).length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Type.oneofs"); "google.protobuf.Type.oneofs");
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
@ -700,10 +704,11 @@ void Type::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.Option options = 4; // repeated .google.protobuf.Option options = 4;
for (unsigned int i = 0, n = this->options_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray( InternalWriteMessageNoVirtualToArray(
4, this->options(i), deterministic, target); 4, this->options(static_cast<int>(i)), deterministic, target);
} }
// .google.protobuf.SourceContext source_context = 5; // .google.protobuf.SourceContext source_context = 5;
@ -729,12 +734,12 @@ size_t Type::ByteSizeLong() const {
// repeated .google.protobuf.Field fields = 2; // repeated .google.protobuf.Field fields = 2;
{ {
unsigned int count = this->fields_size(); unsigned int count = static_cast<unsigned int>(this->fields_size());
total_size += 1UL * count; total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
total_size += total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->fields(i)); this->fields(static_cast<int>(i)));
} }
} }
@ -748,12 +753,12 @@ size_t Type::ByteSizeLong() const {
// repeated .google.protobuf.Option options = 4; // repeated .google.protobuf.Option options = 4;
{ {
unsigned int count = this->options_size(); unsigned int count = static_cast<unsigned int>(this->options_size());
total_size += 1UL * count; total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
total_size += total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->options(i)); this->options(static_cast<int>(i)));
} }
} }
@ -1199,8 +1204,8 @@ Field::Field(const Field& from)
GetArenaNoVirtual()); GetArenaNoVirtual());
} }
::memcpy(&kind_, &from.kind_, ::memcpy(&kind_, &from.kind_,
reinterpret_cast<char*>(&packed_) - static_cast<size_t>(reinterpret_cast<char*>(&packed_) -
reinterpret_cast<char*>(&kind_) + sizeof(packed_)); reinterpret_cast<char*>(&kind_)) + sizeof(packed_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.Field) // @@protoc_insertion_point(copy_constructor:google.protobuf.Field)
} }
@ -1209,8 +1214,9 @@ void Field::SharedCtor() {
type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
json_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); json_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
default_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); default_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&kind_, 0, reinterpret_cast<char*>(&packed_) - ::memset(&kind_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&kind_) + sizeof(packed_)); reinterpret_cast<char*>(&packed_) -
reinterpret_cast<char*>(&kind_)) + sizeof(packed_));
_cached_size_ = 0; _cached_size_ = 0;
} }
@ -1263,8 +1269,9 @@ void Field::Clear() {
type_url_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); type_url_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
json_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); json_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
default_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); default_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
::memset(&kind_, 0, reinterpret_cast<char*>(&packed_) - ::memset(&kind_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&kind_) + sizeof(packed_)); reinterpret_cast<char*>(&packed_) -
reinterpret_cast<char*>(&kind_)) + sizeof(packed_));
} }
bool Field::MergePartialFromCodedStream( bool Field::MergePartialFromCodedStream(
@ -1328,7 +1335,7 @@ bool Field::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name())); input, this->mutable_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Field.name")); "google.protobuf.Field.name"));
} else { } else {
@ -1344,7 +1351,7 @@ bool Field::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_type_url())); input, this->mutable_type_url()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->type_url().data(), this->type_url().length(), this->type_url().data(), static_cast<int>(this->type_url().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Field.type_url")); "google.protobuf.Field.type_url"));
} else { } else {
@ -1400,7 +1407,7 @@ bool Field::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_json_name())); input, this->mutable_json_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->json_name().data(), this->json_name().length(), this->json_name().data(), static_cast<int>(this->json_name().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Field.json_name")); "google.protobuf.Field.json_name"));
} else { } else {
@ -1416,7 +1423,7 @@ bool Field::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_default_value())); input, this->mutable_default_value()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->default_value().data(), this->default_value().length(), this->default_value().data(), static_cast<int>(this->default_value().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Field.default_value")); "google.protobuf.Field.default_value"));
} else { } else {
@ -1472,7 +1479,7 @@ void Field::SerializeWithCachedSizes(
// string name = 4; // string name = 4;
if (this->name().size() > 0) { if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Field.name"); "google.protobuf.Field.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -1482,7 +1489,7 @@ void Field::SerializeWithCachedSizes(
// string type_url = 6; // string type_url = 6;
if (this->type_url().size() > 0) { if (this->type_url().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->type_url().data(), this->type_url().length(), this->type_url().data(), static_cast<int>(this->type_url().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Field.type_url"); "google.protobuf.Field.type_url");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -1500,15 +1507,16 @@ void Field::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.Option options = 9; // repeated .google.protobuf.Option options = 9;
for (unsigned int i = 0, n = this->options_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
9, this->options(i), output); 9, this->options(static_cast<int>(i)), output);
} }
// string json_name = 10; // string json_name = 10;
if (this->json_name().size() > 0) { if (this->json_name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->json_name().data(), this->json_name().length(), this->json_name().data(), static_cast<int>(this->json_name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Field.json_name"); "google.protobuf.Field.json_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -1518,7 +1526,7 @@ void Field::SerializeWithCachedSizes(
// string default_value = 11; // string default_value = 11;
if (this->default_value().size() > 0) { if (this->default_value().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->default_value().data(), this->default_value().length(), this->default_value().data(), static_cast<int>(this->default_value().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Field.default_value"); "google.protobuf.Field.default_value");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -1554,7 +1562,7 @@ void Field::SerializeWithCachedSizes(
// string name = 4; // string name = 4;
if (this->name().size() > 0) { if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Field.name"); "google.protobuf.Field.name");
target = target =
@ -1565,7 +1573,7 @@ void Field::SerializeWithCachedSizes(
// string type_url = 6; // string type_url = 6;
if (this->type_url().size() > 0) { if (this->type_url().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->type_url().data(), this->type_url().length(), this->type_url().data(), static_cast<int>(this->type_url().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Field.type_url"); "google.protobuf.Field.type_url");
target = target =
@ -1584,16 +1592,17 @@ void Field::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.Option options = 9; // repeated .google.protobuf.Option options = 9;
for (unsigned int i = 0, n = this->options_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray( InternalWriteMessageNoVirtualToArray(
9, this->options(i), deterministic, target); 9, this->options(static_cast<int>(i)), deterministic, target);
} }
// string json_name = 10; // string json_name = 10;
if (this->json_name().size() > 0) { if (this->json_name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->json_name().data(), this->json_name().length(), this->json_name().data(), static_cast<int>(this->json_name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Field.json_name"); "google.protobuf.Field.json_name");
target = target =
@ -1604,7 +1613,7 @@ void Field::SerializeWithCachedSizes(
// string default_value = 11; // string default_value = 11;
if (this->default_value().size() > 0) { if (this->default_value().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->default_value().data(), this->default_value().length(), this->default_value().data(), static_cast<int>(this->default_value().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Field.default_value"); "google.protobuf.Field.default_value");
target = target =
@ -1622,12 +1631,12 @@ size_t Field::ByteSizeLong() const {
// repeated .google.protobuf.Option options = 9; // repeated .google.protobuf.Option options = 9;
{ {
unsigned int count = this->options_size(); unsigned int count = static_cast<unsigned int>(this->options_size());
total_size += 1UL * count; total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
total_size += total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->options(i)); this->options(static_cast<int>(i)));
} }
} }
@ -2264,8 +2273,9 @@ Enum::Enum(const Enum& from)
void Enum::SharedCtor() { void Enum::SharedCtor() {
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&source_context_, 0, reinterpret_cast<char*>(&syntax_) - ::memset(&source_context_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&source_context_) + sizeof(syntax_)); reinterpret_cast<char*>(&syntax_) -
reinterpret_cast<char*>(&source_context_)) + sizeof(syntax_));
_cached_size_ = 0; _cached_size_ = 0;
} }
@ -2340,7 +2350,7 @@ bool Enum::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name())); input, this->mutable_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Enum.name")); "google.protobuf.Enum.name"));
} else { } else {
@ -2430,7 +2440,7 @@ void Enum::SerializeWithCachedSizes(
// string name = 1; // string name = 1;
if (this->name().size() > 0) { if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Enum.name"); "google.protobuf.Enum.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -2438,15 +2448,17 @@ void Enum::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.EnumValue enumvalue = 2; // repeated .google.protobuf.EnumValue enumvalue = 2;
for (unsigned int i = 0, n = this->enumvalue_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->enumvalue_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->enumvalue(i), output); 2, this->enumvalue(static_cast<int>(i)), output);
} }
// repeated .google.protobuf.Option options = 3; // repeated .google.protobuf.Option options = 3;
for (unsigned int i = 0, n = this->options_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->options(i), output); 3, this->options(static_cast<int>(i)), output);
} }
// .google.protobuf.SourceContext source_context = 4; // .google.protobuf.SourceContext source_context = 4;
@ -2473,7 +2485,7 @@ void Enum::SerializeWithCachedSizes(
// string name = 1; // string name = 1;
if (this->name().size() > 0) { if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Enum.name"); "google.protobuf.Enum.name");
target = target =
@ -2482,17 +2494,19 @@ void Enum::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.EnumValue enumvalue = 2; // repeated .google.protobuf.EnumValue enumvalue = 2;
for (unsigned int i = 0, n = this->enumvalue_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->enumvalue_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray( InternalWriteMessageNoVirtualToArray(
2, this->enumvalue(i), deterministic, target); 2, this->enumvalue(static_cast<int>(i)), deterministic, target);
} }
// repeated .google.protobuf.Option options = 3; // repeated .google.protobuf.Option options = 3;
for (unsigned int i = 0, n = this->options_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray( InternalWriteMessageNoVirtualToArray(
3, this->options(i), deterministic, target); 3, this->options(static_cast<int>(i)), deterministic, target);
} }
// .google.protobuf.SourceContext source_context = 4; // .google.protobuf.SourceContext source_context = 4;
@ -2518,23 +2532,23 @@ size_t Enum::ByteSizeLong() const {
// repeated .google.protobuf.EnumValue enumvalue = 2; // repeated .google.protobuf.EnumValue enumvalue = 2;
{ {
unsigned int count = this->enumvalue_size(); unsigned int count = static_cast<unsigned int>(this->enumvalue_size());
total_size += 1UL * count; total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
total_size += total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->enumvalue(i)); this->enumvalue(static_cast<int>(i)));
} }
} }
// repeated .google.protobuf.Option options = 3; // repeated .google.protobuf.Option options = 3;
{ {
unsigned int count = this->options_size(); unsigned int count = static_cast<unsigned int>(this->options_size());
total_size += 1UL * count; total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
total_size += total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->options(i)); this->options(static_cast<int>(i)));
} }
} }
@ -2959,7 +2973,7 @@ bool EnumValue::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name())); input, this->mutable_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.EnumValue.name")); "google.protobuf.EnumValue.name"));
} else { } else {
@ -3024,7 +3038,7 @@ void EnumValue::SerializeWithCachedSizes(
// string name = 1; // string name = 1;
if (this->name().size() > 0) { if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.EnumValue.name"); "google.protobuf.EnumValue.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -3037,9 +3051,10 @@ void EnumValue::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.Option options = 3; // repeated .google.protobuf.Option options = 3;
for (unsigned int i = 0, n = this->options_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->options(i), output); 3, this->options(static_cast<int>(i)), output);
} }
// @@protoc_insertion_point(serialize_end:google.protobuf.EnumValue) // @@protoc_insertion_point(serialize_end:google.protobuf.EnumValue)
@ -3054,7 +3069,7 @@ void EnumValue::SerializeWithCachedSizes(
// string name = 1; // string name = 1;
if (this->name().size() > 0) { if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.EnumValue.name"); "google.protobuf.EnumValue.name");
target = target =
@ -3068,10 +3083,11 @@ void EnumValue::SerializeWithCachedSizes(
} }
// repeated .google.protobuf.Option options = 3; // repeated .google.protobuf.Option options = 3;
for (unsigned int i = 0, n = this->options_size(); i < n; i++) { for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite:: target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray( InternalWriteMessageNoVirtualToArray(
3, this->options(i), deterministic, target); 3, this->options(static_cast<int>(i)), deterministic, target);
} }
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumValue) // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumValue)
@ -3084,12 +3100,12 @@ size_t EnumValue::ByteSizeLong() const {
// repeated .google.protobuf.Option options = 3; // repeated .google.protobuf.Option options = 3;
{ {
unsigned int count = this->options_size(); unsigned int count = static_cast<unsigned int>(this->options_size());
total_size += 1UL * count; total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
total_size += total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->options(i)); this->options(static_cast<int>(i)));
} }
} }
@ -3460,7 +3476,7 @@ bool Option::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name())); input, this->mutable_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.Option.name")); "google.protobuf.Option.name"));
} else { } else {
@ -3511,7 +3527,7 @@ void Option::SerializeWithCachedSizes(
// string name = 1; // string name = 1;
if (this->name().size() > 0) { if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Option.name"); "google.protobuf.Option.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -3536,7 +3552,7 @@ void Option::SerializeWithCachedSizes(
// string name = 1; // string name = 1;
if (this->name().size() > 0) { if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(), this->name().data(), static_cast<int>(this->name().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Option.name"); "google.protobuf.Option.name");
target = target =

@ -282,10 +282,10 @@ inline int UnknownFieldSet::field_count() const {
} }
inline const UnknownField& UnknownFieldSet::field(int index) const { inline const UnknownField& UnknownFieldSet::field(int index) const {
GOOGLE_DCHECK(fields_ != NULL); GOOGLE_DCHECK(fields_ != NULL);
return (*fields_)[index]; return (*fields_)[static_cast<size_t>(index)];
} }
inline UnknownField* UnknownFieldSet::mutable_field(int index) { inline UnknownField* UnknownFieldSet::mutable_field(int index) {
return &(*fields_)[index]; return &(*fields_)[static_cast<size_t>(index)];
} }
inline void UnknownFieldSet::AddLengthDelimited( inline void UnknownFieldSet::AddLengthDelimited(
@ -296,7 +296,7 @@ inline void UnknownFieldSet::AddLengthDelimited(
inline int UnknownField::number() const { return number_; } inline int UnknownField::number() const { return static_cast<int>(number_); }
inline UnknownField::Type UnknownField::type() const { inline UnknownField::Type UnknownField::type() const {
return static_cast<Type>(type_); return static_cast<Type>(type_);
} }

@ -787,7 +787,7 @@ inline int WireFormatLite::GetTagFieldNumber(uint32 tag) {
inline size_t WireFormatLite::TagSize(int field_number, inline size_t WireFormatLite::TagSize(int field_number,
WireFormatLite::FieldType type) { WireFormatLite::FieldType type) {
size_t result = io::CodedOutputStream::VarintSize32( size_t result = io::CodedOutputStream::VarintSize32(
field_number << kTagTypeBits); static_cast<uint32>(field_number << kTagTypeBits));
if (type == TYPE_GROUP) { if (type == TYPE_GROUP) {
// Groups have both a start and an end tag. // Groups have both a start and an end tag.
return result * 2; return result * 2;
@ -846,20 +846,20 @@ inline double WireFormatLite::DecodeDouble(uint64 value) {
inline uint32 WireFormatLite::ZigZagEncode32(int32 n) { inline uint32 WireFormatLite::ZigZagEncode32(int32 n) {
// Note: the right-shift must be arithmetic // Note: the right-shift must be arithmetic
return (static_cast<uint32>(n) << 1) ^ (n >> 31); return static_cast<uint32>((n << 1) ^ (n >> 31));
} }
inline int32 WireFormatLite::ZigZagDecode32(uint32 n) { inline int32 WireFormatLite::ZigZagDecode32(uint32 n) {
return (n >> 1) ^ -static_cast<int32>(n & 1); return static_cast<int32>(n >> 1) ^ -static_cast<int32>(n & 1);
} }
inline uint64 WireFormatLite::ZigZagEncode64(int64 n) { inline uint64 WireFormatLite::ZigZagEncode64(int64 n) {
// Note: the right-shift must be arithmetic // Note: the right-shift must be arithmetic
return (static_cast<uint64>(n) << 1) ^ (n >> 63); return static_cast<uint64>((n << 1) ^ (n >> 63));
} }
inline int64 WireFormatLite::ZigZagDecode64(uint64 n) { inline int64 WireFormatLite::ZigZagDecode64(uint64 n) {
return (n >> 1) ^ -static_cast<int64>(n & 1); return static_cast<int64>(n >> 1) ^ -static_cast<int64>(n & 1);
} }
// String is for UTF-8 text only, but, even so, ReadString() can simply // String is for UTF-8 text only, but, even so, ReadString() can simply

@ -268,7 +268,7 @@ inline bool WireFormatLite::ReadRepeatedFixedSizePrimitive(
if (size > 0) { if (size > 0) {
const uint8* buffer = reinterpret_cast<const uint8*>(void_pointer); const uint8* buffer = reinterpret_cast<const uint8*>(void_pointer);
// The number of bytes each type occupies on the wire. // The number of bytes each type occupies on the wire.
const int per_value_size = tag_size + sizeof(value); const int per_value_size = tag_size + static_cast<int>(sizeof(value));
// parentheses around (std::min) prevents macro expansion of min(...) // parentheses around (std::min) prevents macro expansion of min(...)
int elements_available = int elements_available =
@ -344,8 +344,8 @@ inline bool WireFormatLite::ReadPackedFixedSizePrimitive(
int length; int length;
if (!input->ReadVarintSizeAsInt(&length)) return false; if (!input->ReadVarintSizeAsInt(&length)) return false;
const int old_entries = values->size(); const int old_entries = values->size();
const int new_entries = length / sizeof(CType); const int new_entries = length / static_cast<int>(sizeof(CType));
const int new_bytes = new_entries * sizeof(CType); const int new_bytes = new_entries * static_cast<int>(sizeof(CType));
if (new_bytes != length) return false; if (new_bytes != length) return false;
// We would *like* to pre-allocate the buffer to write into (for // We would *like* to pre-allocate the buffer to write into (for
// speed), but *must* avoid performing a very large allocation due // speed), but *must* avoid performing a very large allocation due
@ -695,8 +695,8 @@ inline uint8* WireFormatLite::WriteFixedNoTagToArray(
GOOGLE_DCHECK_GT(n, 0); GOOGLE_DCHECK_GT(n, 0);
const T* ii = value.unsafe_data(); const T* ii = value.unsafe_data();
const int bytes = n * sizeof(ii[0]); const int bytes = n * static_cast<int>(sizeof(ii[0]));
memcpy(target, ii, bytes); memcpy(target, ii, static_cast<size_t>(bytes));
return target + bytes; return target + bytes;
#else #else
return WritePrimitiveNoTagToArray(value, Writer, target); return WritePrimitiveNoTagToArray(value, Writer, target);
@ -954,7 +954,7 @@ inline uint8* WireFormatLite::InternalWriteMessageToArray(
uint8* target) { uint8* target) {
target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target); target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target);
target = io::CodedOutputStream::WriteVarint32ToArray( target = io::CodedOutputStream::WriteVarint32ToArray(
value.GetCachedSize(), target); static_cast<uint32>(value.GetCachedSize()), target);
return value.InternalSerializeWithCachedSizesToArray(deterministic, target); return value.InternalSerializeWithCachedSizesToArray(deterministic, target);
} }
@ -975,7 +975,9 @@ inline uint8* WireFormatLite::InternalWriteMessageNoVirtualToArray(
bool deterministic, uint8* target) { bool deterministic, uint8* target) {
target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target); target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target);
target = io::CodedOutputStream::WriteVarint32ToArray( target = io::CodedOutputStream::WriteVarint32ToArray(
value.MessageType_WorkAroundCppLookupDefect::GetCachedSize(), target); static_cast<uint32>(
value.MessageType_WorkAroundCppLookupDefect::GetCachedSize()),
target);
return value.MessageType_WorkAroundCppLookupDefect:: return value.MessageType_WorkAroundCppLookupDefect::
InternalSerializeWithCachedSizesToArray(deterministic, target); InternalSerializeWithCachedSizesToArray(deterministic, target);
} }

@ -2209,7 +2209,7 @@ bool StringValue::MergePartialFromCodedStream(
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_value())); input, this->mutable_value()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->value().data(), this->value().length(), this->value().data(), static_cast<int>(this->value().length()),
::google::protobuf::internal::WireFormatLite::PARSE, ::google::protobuf::internal::WireFormatLite::PARSE,
"google.protobuf.StringValue.value")); "google.protobuf.StringValue.value"));
} else { } else {
@ -2248,7 +2248,7 @@ void StringValue::SerializeWithCachedSizes(
// string value = 1; // string value = 1;
if (this->value().size() > 0) { if (this->value().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->value().data(), this->value().length(), this->value().data(), static_cast<int>(this->value().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.StringValue.value"); "google.protobuf.StringValue.value");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@ -2267,7 +2267,7 @@ void StringValue::SerializeWithCachedSizes(
// string value = 1; // string value = 1;
if (this->value().size() > 0) { if (this->value().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->value().data(), this->value().length(), this->value().data(), static_cast<int>(this->value().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE, ::google::protobuf::internal::WireFormatLite::SERIALIZE,
"google.protobuf.StringValue.value"); "google.protobuf.StringValue.value");
target = target =

Loading…
Cancel
Save