From 9ba7d1c03810b47e535018d0362a8affef6f7f56 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 12 Apr 2017 13:55:29 +0200 Subject: C++: Do not forward-declare dependencies in generated .h files --- src/google/protobuf/compiler/cpp/cpp_file.cc | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/google/protobuf/compiler/cpp') diff --git a/src/google/protobuf/compiler/cpp/cpp_file.cc b/src/google/protobuf/compiler/cpp/cpp_file.cc index e0542ae8..1f7a66c5 100644 --- a/src/google/protobuf/compiler/cpp/cpp_file.cc +++ b/src/google/protobuf/compiler/cpp/cpp_file.cc @@ -925,19 +925,11 @@ void FileGenerator::GenerateNamespaceClosers(io::Printer* printer) { void FileGenerator::GenerateForwardDeclarations(io::Printer* printer) { ForwardDeclarations decls; - for (int i = 0; i < file_->dependency_count(); i++) { - FileGenerator dependency(file_->dependency(i), options_); - dependency.FillForwardDeclarations(&decls); - } FillForwardDeclarations(&decls); decls.Print(printer, options_); } void FileGenerator::FillForwardDeclarations(ForwardDeclarations* decls) { - for (int i = 0; i < file_->public_dependency_count(); i++) { - FileGenerator dependency(file_->public_dependency(i), options_); - dependency.FillForwardDeclarations(decls); - } for (int i = 0; i < package_parts_.size(); i++) { decls = decls->AddOrGetNamespace(package_parts_[i]); } -- cgit v1.2.3 From 9c0b35cf620c4904a18e25733f50c9c0474fefa6 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Thu, 22 Jun 2017 15:39:19 -0700 Subject: Enusre public header and generated code have no implicit converion. --- src/Makefile.am | 2 +- src/google/protobuf/any.pb.cc | 6 +- src/google/protobuf/api.pb.cc | 42 ++--- src/google/protobuf/compiler/cpp/cpp_enum_field.cc | 3 +- src/google/protobuf/compiler/cpp/cpp_map_field.cc | 27 +-- .../protobuf/compiler/cpp/cpp_primitive_field.cc | 3 +- .../protobuf/compiler/cpp/cpp_string_field.cc | 20 +- src/google/protobuf/compiler/plugin.pb.cc | 42 ++--- src/google/protobuf/compiler/profile.pb.cc | 12 +- src/google/protobuf/descriptor.pb.cc | 207 +++++++++++---------- src/google/protobuf/field_mask.pb.cc | 6 +- src/google/protobuf/generated_message_reflection.h | 3 +- src/google/protobuf/map_entry_lite.h | 6 +- src/google/protobuf/map_field_inl.h | 2 +- src/google/protobuf/map_field_lite.h | 2 +- src/google/protobuf/map_type_handler.h | 7 +- src/google/protobuf/source_context.pb.cc | 6 +- src/google/protobuf/struct.pb.cc | 12 +- src/google/protobuf/type.pb.cc | 54 +++--- src/google/protobuf/wire_format_lite_inl.h | 8 +- src/google/protobuf/wrappers.pb.cc | 6 +- 21 files changed, 247 insertions(+), 229 deletions(-) (limited to 'src/google/protobuf/compiler/cpp') diff --git a/src/Makefile.am b/src/Makefile.am index bfb875ac..45a8a79b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -924,7 +924,7 @@ no_warning_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la \ ../gmock/gtest/lib/libgtest_main.la no_warning_test_CPPFLAGS = -I$(srcdir)/../gmock/gtest/include 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) TESTS = protobuf-test protobuf-lazy-descriptor-test protobuf-lite-test \ diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc index 6c80aaa2..f1cf6d46 100644 --- a/src/google/protobuf/any.pb.cc +++ b/src/google/protobuf/any.pb.cc @@ -240,7 +240,7 @@ bool Any::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_type_url())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->type_url().data(), this->type_url().length(), + this->type_url().data(), static_cast(this->type_url().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Any.type_url")); } else { @@ -291,7 +291,7 @@ void Any::SerializeWithCachedSizes( // string type_url = 1; if (this->type_url().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->type_url().data(), this->type_url().length(), + this->type_url().data(), static_cast(this->type_url().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Any.type_url"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -316,7 +316,7 @@ void Any::SerializeWithCachedSizes( // string type_url = 1; if (this->type_url().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->type_url().data(), this->type_url().length(), + this->type_url().data(), static_cast(this->type_url().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Any.type_url"); target = diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc index 94c6685f..ce937cd1 100644 --- a/src/google/protobuf/api.pb.cc +++ b/src/google/protobuf/api.pb.cc @@ -312,7 +312,7 @@ bool Api::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Api.name")); } else { @@ -352,7 +352,7 @@ bool Api::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_version())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->version().data(), this->version().length(), + this->version().data(), static_cast(this->version().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Api.version")); } else { @@ -430,7 +430,7 @@ void Api::SerializeWithCachedSizes( // string name = 1; if (this->name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Api.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -452,7 +452,7 @@ void Api::SerializeWithCachedSizes( // string version = 4; if (this->version().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->version().data(), this->version().length(), + this->version().data(), static_cast(this->version().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Api.version"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -489,7 +489,7 @@ void Api::SerializeWithCachedSizes( // string name = 1; if (this->name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Api.name"); target = @@ -514,7 +514,7 @@ void Api::SerializeWithCachedSizes( // string version = 4; if (this->version().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->version().data(), this->version().length(), + this->version().data(), static_cast(this->version().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Api.version"); target = @@ -1064,7 +1064,7 @@ bool Method::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Method.name")); } else { @@ -1080,7 +1080,7 @@ bool Method::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_request_type_url())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->request_type_url().data(), this->request_type_url().length(), + this->request_type_url().data(), static_cast(this->request_type_url().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Method.request_type_url")); } else { @@ -1110,7 +1110,7 @@ bool Method::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_response_type_url())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->response_type_url().data(), this->response_type_url().length(), + this->response_type_url().data(), static_cast(this->response_type_url().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Method.response_type_url")); } else { @@ -1190,7 +1190,7 @@ void Method::SerializeWithCachedSizes( // string name = 1; if (this->name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1200,7 +1200,7 @@ void Method::SerializeWithCachedSizes( // string request_type_url = 2; if (this->request_type_url().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->request_type_url().data(), this->request_type_url().length(), + this->request_type_url().data(), static_cast(this->request_type_url().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.request_type_url"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1215,7 +1215,7 @@ void Method::SerializeWithCachedSizes( // string response_type_url = 4; if (this->response_type_url().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->response_type_url().data(), this->response_type_url().length(), + this->response_type_url().data(), static_cast(this->response_type_url().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.response_type_url"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1251,7 +1251,7 @@ void Method::SerializeWithCachedSizes( // string name = 1; if (this->name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.name"); target = @@ -1262,7 +1262,7 @@ void Method::SerializeWithCachedSizes( // string request_type_url = 2; if (this->request_type_url().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->request_type_url().data(), this->request_type_url().length(), + this->request_type_url().data(), static_cast(this->request_type_url().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.request_type_url"); target = @@ -1278,7 +1278,7 @@ void Method::SerializeWithCachedSizes( // string response_type_url = 4; if (this->response_type_url().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->response_type_url().data(), this->response_type_url().length(), + this->response_type_url().data(), static_cast(this->response_type_url().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.response_type_url"); target = @@ -1780,7 +1780,7 @@ bool Mixin::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Mixin.name")); } else { @@ -1796,7 +1796,7 @@ bool Mixin::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_root())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->root().data(), this->root().length(), + this->root().data(), static_cast(this->root().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Mixin.root")); } else { @@ -1835,7 +1835,7 @@ void Mixin::SerializeWithCachedSizes( // string name = 1; if (this->name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Mixin.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1845,7 +1845,7 @@ void Mixin::SerializeWithCachedSizes( // string root = 2; if (this->root().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->root().data(), this->root().length(), + this->root().data(), static_cast(this->root().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Mixin.root"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1864,7 +1864,7 @@ void Mixin::SerializeWithCachedSizes( // string name = 1; if (this->name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Mixin.name"); target = @@ -1875,7 +1875,7 @@ void Mixin::SerializeWithCachedSizes( // string root = 2; if (this->root().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->root().data(), this->root().length(), + this->root().data(), static_cast(this->root().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Mixin.root"); target = diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc index c15be942..023213a9 100644 --- a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc @@ -488,7 +488,8 @@ GenerateByteSize(io::Printer* printer) const { printer->Print(variables_, "if (data_size > 0) {\n" " total_size += $tag_size$ +\n" - " ::google::protobuf::internal::WireFormatLite::Int32Size(data_size);\n" + " ::google::protobuf::internal::WireFormatLite::Int32Size(\n" + " static_cast(data_size));\n" "}\n" "int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);\n" "GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n" diff --git a/src/google/protobuf/compiler/cpp/cpp_map_field.cc b/src/google/protobuf/compiler/cpp/cpp_map_field.cc index 52a3b8b0..ee0ed164 100644 --- a/src/google/protobuf/compiler/cpp/cpp_map_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_map_field.cc @@ -256,7 +256,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) const { } else { printer->Print(variables_, " unknown_fields_stream.WriteVarint32($tag$u);\n" - " unknown_fields_stream.WriteVarint32(data.size());\n" + " unknown_fields_stream.WriteVarint32(\n" + " static_cast(data.size()));\n" " unknown_fields_stream.WriteString(data);\n"); } @@ -267,12 +268,16 @@ GenerateMergeFromCodedStream(io::Printer* printer) const { if (key_field->type() == FieldDescriptor::TYPE_STRING) { GenerateUtf8CheckCodeForString( - key_field, options_, true, variables_, - StrCat(key, ".data(), ", key, ".length(),\n").data(), printer); + key_field, options_, true, variables_, + StrCat(key, ".data(), static_cast(", key, ".length()),\n").data(), + printer); } if (value_field->type() == FieldDescriptor::TYPE_STRING) { - GenerateUtf8CheckCodeForString(value_field, options_, true, variables_, - StrCat(value, ".data(), ", value, ".length(),\n").data(), printer); + GenerateUtf8CheckCodeForString( + value_field, options_, true, variables_, + StrCat(value, ".data(), static_cast(", value, ".length()),\n") + .data(), + printer); } // If entry is allocated by arena, its desctructor should be avoided. @@ -376,14 +381,14 @@ void MapFieldGenerator::GenerateSerializeWithCachedSizes( printer->Indent(); printer->Indent(); if (string_key) { - GenerateUtf8CheckCodeForString(key_field, options_, false, variables, - "p->first.data(), p->first.length(),\n", - printer); + GenerateUtf8CheckCodeForString( + key_field, options_, false, variables, + "p->first.data(), static_cast(p->first.length()),\n", printer); } if (string_value) { - GenerateUtf8CheckCodeForString(value_field, options_, false, variables, - "p->second.data(), p->second.length(),\n", - printer); + GenerateUtf8CheckCodeForString( + value_field, options_, false, variables, + "p->second.data(), static_cast(p->second.length()),\n", printer); } printer->Outdent(); printer->Outdent(); diff --git a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc index 020c1941..df7c1730 100644 --- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc @@ -452,7 +452,8 @@ GenerateByteSize(io::Printer* printer) const { printer->Print(variables_, "if (data_size > 0) {\n" " total_size += $tag_size$ +\n" - " ::google::protobuf::internal::WireFormatLite::Int32Size(data_size);\n" + " ::google::protobuf::internal::WireFormatLite::Int32Size(\n" + " static_cast(data_size));\n" "}\n" "int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);\n" "GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n" diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc index 7a849e2e..6a710888 100644 --- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc @@ -477,7 +477,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) const { if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { GenerateUtf8CheckCodeForString( descriptor_, options_, true, variables_, - "this->$name$().data(), this->$name$().length(),\n", printer); + "this->$name$().data(), static_cast(this->$name$().length()),\n", + printer); } } @@ -486,7 +487,8 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const { if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { GenerateUtf8CheckCodeForString( descriptor_, options_, false, variables_, - "this->$name$().data(), this->$name$().length(),\n", printer); + "this->$name$().data(), static_cast(this->$name$().length()),\n", + printer); } printer->Print(variables_, "::google::protobuf::internal::WireFormatLite::Write$declared_type$MaybeAliased(\n" @@ -498,7 +500,8 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { GenerateUtf8CheckCodeForString( descriptor_, options_, false, variables_, - "this->$name$().data(), this->$name$().length(),\n", printer); + "this->$name$().data(), static_cast(this->$name$().length()),\n", + printer); } printer->Print(variables_, "target =\n" @@ -797,7 +800,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) const { if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { GenerateUtf8CheckCodeForString( descriptor_, options_, true, variables_, - "this->$name$().data(), this->$name$().length(),\n", printer); + "this->$name$().data(), static_cast(this->$name$().length()),\n", + printer); } } @@ -969,7 +973,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) const { GenerateUtf8CheckCodeForString( descriptor_, options_, true, variables_, "this->$name$(this->$name$_size() - 1).data(),\n" - "this->$name$(this->$name$_size() - 1).length(),\n", + "static_cast(this->$name$(this->$name$_size() - 1).length()),\n", printer); } } @@ -982,7 +986,8 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const { if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { GenerateUtf8CheckCodeForString( descriptor_, options_, false, variables_, - "this->$name$(i).data(), this->$name$(i).length(),\n", printer); + "this->$name$(i).data(), static_cast(this->$name$(i).length()),\n", + printer); } printer->Outdent(); printer->Print(variables_, @@ -999,7 +1004,8 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { GenerateUtf8CheckCodeForString( descriptor_, options_, false, variables_, - "this->$name$(i).data(), this->$name$(i).length(),\n", printer); + "this->$name$(i).data(), static_cast(this->$name$(i).length()),\n", + printer); } printer->Outdent(); printer->Print(variables_, diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index f7dc1b70..1f6755ff 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -356,7 +356,7 @@ bool Version::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_suffix())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->suffix().data(), this->suffix().length(), + this->suffix().data(), static_cast(this->suffix().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.compiler.Version.suffix"); } else { @@ -412,7 +412,7 @@ void Version::SerializeWithCachedSizes( // optional string suffix = 4; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->suffix().data(), this->suffix().length(), + this->suffix().data(), static_cast(this->suffix().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.Version.suffix"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -451,7 +451,7 @@ void Version::SerializeWithCachedSizes( // optional string suffix = 4; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->suffix().data(), this->suffix().length(), + this->suffix().data(), static_cast(this->suffix().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.Version.suffix"); target = @@ -845,7 +845,7 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream( input, this->add_file_to_generate())); ::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).length(), + static_cast(this->file_to_generate(this->file_to_generate_size() - 1).length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); } else { @@ -861,7 +861,7 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_parameter())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->parameter().data(), this->parameter().length(), + this->parameter().data(), static_cast(this->parameter().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.compiler.CodeGeneratorRequest.parameter"); } else { @@ -925,7 +925,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes( // repeated string file_to_generate = 1; for (int i = 0, n = this->file_to_generate_size(); i < n; i++) { ::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(this->file_to_generate(i).length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); ::google::protobuf::internal::WireFormatLite::WriteString( @@ -936,7 +936,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes( // optional string parameter = 2; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->parameter().data(), this->parameter().length(), + this->parameter().data(), static_cast(this->parameter().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorRequest.parameter"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -971,7 +971,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes( // repeated string file_to_generate = 1; for (int i = 0, n = this->file_to_generate_size(); i < n; i++) { ::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(this->file_to_generate(i).length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); target = ::google::protobuf::internal::WireFormatLite:: @@ -982,7 +982,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes( // optional string parameter = 2; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->parameter().data(), this->parameter().length(), + this->parameter().data(), static_cast(this->parameter().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorRequest.parameter"); target = @@ -1464,7 +1464,7 @@ bool CodeGeneratorResponse_File::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.compiler.CodeGeneratorResponse.File.name"); } else { @@ -1480,7 +1480,7 @@ bool CodeGeneratorResponse_File::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_insertion_point())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->insertion_point().data(), this->insertion_point().length(), + this->insertion_point().data(), static_cast(this->insertion_point().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); } else { @@ -1496,7 +1496,7 @@ bool CodeGeneratorResponse_File::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_content())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->content().data(), this->content().length(), + this->content().data(), static_cast(this->content().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.compiler.CodeGeneratorResponse.File.content"); } else { @@ -1537,7 +1537,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorResponse.File.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1547,7 +1547,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes( // optional string insertion_point = 2; if (cached_has_bits & 0x00000002u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->insertion_point().data(), this->insertion_point().length(), + this->insertion_point().data(), static_cast(this->insertion_point().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1557,7 +1557,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes( // optional string content = 15; if (cached_has_bits & 0x00000004u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->content().data(), this->content().length(), + this->content().data(), static_cast(this->content().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorResponse.File.content"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1581,7 +1581,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorResponse.File.name"); target = @@ -1592,7 +1592,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes( // optional string insertion_point = 2; if (cached_has_bits & 0x00000002u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->insertion_point().data(), this->insertion_point().length(), + this->insertion_point().data(), static_cast(this->insertion_point().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); target = @@ -1603,7 +1603,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes( // optional string content = 15; if (cached_has_bits & 0x00000004u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->content().data(), this->content().length(), + this->content().data(), static_cast(this->content().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorResponse.File.content"); target = @@ -2021,7 +2021,7 @@ bool CodeGeneratorResponse::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_error())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->error().data(), this->error().length(), + this->error().data(), static_cast(this->error().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.compiler.CodeGeneratorResponse.error"); } else { @@ -2074,7 +2074,7 @@ void CodeGeneratorResponse::SerializeWithCachedSizes( // optional string error = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->error().data(), this->error().length(), + this->error().data(), static_cast(this->error().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorResponse.error"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -2104,7 +2104,7 @@ void CodeGeneratorResponse::SerializeWithCachedSizes( // optional string error = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->error().data(), this->error().length(), + this->error().data(), static_cast(this->error().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorResponse.error"); target = diff --git a/src/google/protobuf/compiler/profile.pb.cc b/src/google/protobuf/compiler/profile.pb.cc index c185e4f9..1f1d72fb 100644 --- a/src/google/protobuf/compiler/profile.pb.cc +++ b/src/google/protobuf/compiler/profile.pb.cc @@ -280,7 +280,7 @@ bool FieldAccessInfo::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.compiler.FieldAccessInfo.name"); } else { @@ -363,7 +363,7 @@ void FieldAccessInfo::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.FieldAccessInfo.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -402,7 +402,7 @@ void FieldAccessInfo::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.FieldAccessInfo.name"); target = @@ -795,7 +795,7 @@ bool MessageAccessInfo::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.compiler.MessageAccessInfo.name"); } else { @@ -862,7 +862,7 @@ void MessageAccessInfo::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.MessageAccessInfo.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -897,7 +897,7 @@ void MessageAccessInfo::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.MessageAccessInfo.name"); target = diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index ff0819ec..dbe56986 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -1431,7 +1431,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileDescriptorProto.name"); } else { @@ -1447,7 +1447,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_package())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->package().data(), this->package().length(), + this->package().data(), static_cast(this->package().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileDescriptorProto.package"); } else { @@ -1464,7 +1464,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream( input, this->add_dependency())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( this->dependency(this->dependency_size() - 1).data(), - this->dependency(this->dependency_size() - 1).length(), + static_cast(this->dependency(this->dependency_size() - 1).length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileDescriptorProto.dependency"); } else { @@ -1588,7 +1588,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_syntax())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->syntax().data(), this->syntax().length(), + this->syntax().data(), static_cast(this->syntax().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileDescriptorProto.syntax"); } else { @@ -1629,7 +1629,7 @@ void FileDescriptorProto::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileDescriptorProto.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1639,7 +1639,7 @@ void FileDescriptorProto::SerializeWithCachedSizes( // optional string package = 2; if (cached_has_bits & 0x00000002u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->package().data(), this->package().length(), + this->package().data(), static_cast(this->package().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileDescriptorProto.package"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1649,7 +1649,7 @@ void FileDescriptorProto::SerializeWithCachedSizes( // repeated string dependency = 3; for (int i = 0, n = this->dependency_size(); i < n; i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->dependency(i).data(), this->dependency(i).length(), + this->dependency(i).data(), static_cast(this->dependency(i).length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileDescriptorProto.dependency"); ::google::protobuf::internal::WireFormatLite::WriteString( @@ -1707,7 +1707,7 @@ void FileDescriptorProto::SerializeWithCachedSizes( // optional string syntax = 12; if (cached_has_bits & 0x00000004u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->syntax().data(), this->syntax().length(), + this->syntax().data(), static_cast(this->syntax().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileDescriptorProto.syntax"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1731,7 +1731,7 @@ void FileDescriptorProto::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileDescriptorProto.name"); target = @@ -1742,7 +1742,7 @@ void FileDescriptorProto::SerializeWithCachedSizes( // optional string package = 2; if (cached_has_bits & 0x00000002u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->package().data(), this->package().length(), + this->package().data(), static_cast(this->package().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileDescriptorProto.package"); target = @@ -1753,7 +1753,7 @@ void FileDescriptorProto::SerializeWithCachedSizes( // repeated string dependency = 3; for (int i = 0, n = this->dependency_size(); i < n; i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->dependency(i).data(), this->dependency(i).length(), + this->dependency(i).data(), static_cast(this->dependency(i).length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileDescriptorProto.dependency"); target = ::google::protobuf::internal::WireFormatLite:: @@ -1813,7 +1813,7 @@ void FileDescriptorProto::SerializeWithCachedSizes( // optional string syntax = 12; if (cached_has_bits & 0x00000004u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->syntax().data(), this->syntax().length(), + this->syntax().data(), static_cast(this->syntax().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileDescriptorProto.syntax"); target = @@ -3394,7 +3394,7 @@ bool DescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.DescriptorProto.name"); } else { @@ -3507,7 +3507,7 @@ bool DescriptorProto::MergePartialFromCodedStream( input, this->add_reserved_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( this->reserved_name(this->reserved_name_size() - 1).data(), - this->reserved_name(this->reserved_name_size() - 1).length(), + static_cast(this->reserved_name(this->reserved_name_size() - 1).length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.DescriptorProto.reserved_name"); } else { @@ -3548,7 +3548,7 @@ void DescriptorProto::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.DescriptorProto.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -3606,7 +3606,7 @@ void DescriptorProto::SerializeWithCachedSizes( // repeated string reserved_name = 10; for (int i = 0, n = this->reserved_name_size(); i < n; i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->reserved_name(i).data(), this->reserved_name(i).length(), + this->reserved_name(i).data(), static_cast(this->reserved_name(i).length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.DescriptorProto.reserved_name"); ::google::protobuf::internal::WireFormatLite::WriteString( @@ -3630,7 +3630,7 @@ void DescriptorProto::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.DescriptorProto.name"); target = @@ -3697,7 +3697,7 @@ void DescriptorProto::SerializeWithCachedSizes( // repeated string reserved_name = 10; for (int i = 0, n = this->reserved_name_size(); i < n; i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->reserved_name(i).data(), this->reserved_name(i).length(), + this->reserved_name(i).data(), static_cast(this->reserved_name(i).length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.DescriptorProto.reserved_name"); target = ::google::protobuf::internal::WireFormatLite:: @@ -4483,7 +4483,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FieldDescriptorProto.name"); } else { @@ -4499,7 +4499,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_extendee())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->extendee().data(), this->extendee().length(), + this->extendee().data(), static_cast(this->extendee().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FieldDescriptorProto.extendee"); } else { @@ -4567,7 +4567,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_type_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->type_name().data(), this->type_name().length(), + this->type_name().data(), static_cast(this->type_name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FieldDescriptorProto.type_name"); } else { @@ -4583,7 +4583,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_default_value())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->default_value().data(), this->default_value().length(), + this->default_value().data(), static_cast(this->default_value().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FieldDescriptorProto.default_value"); } else { @@ -4625,7 +4625,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_json_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->json_name().data(), this->json_name().length(), + this->json_name().data(), static_cast(this->json_name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FieldDescriptorProto.json_name"); } else { @@ -4666,7 +4666,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -4676,7 +4676,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes( // optional string extendee = 2; if (cached_has_bits & 0x00000002u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->extendee().data(), this->extendee().length(), + this->extendee().data(), static_cast(this->extendee().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.extendee"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -4703,7 +4703,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes( // optional string type_name = 6; if (cached_has_bits & 0x00000004u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->type_name().data(), this->type_name().length(), + this->type_name().data(), static_cast(this->type_name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.type_name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -4713,7 +4713,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes( // optional string default_value = 7; if (cached_has_bits & 0x00000008u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->default_value().data(), this->default_value().length(), + this->default_value().data(), static_cast(this->default_value().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.default_value"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -4734,7 +4734,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes( // optional string json_name = 10; if (cached_has_bits & 0x00000010u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->json_name().data(), this->json_name().length(), + this->json_name().data(), static_cast(this->json_name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.json_name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -4758,7 +4758,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.name"); target = @@ -4769,7 +4769,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes( // optional string extendee = 2; if (cached_has_bits & 0x00000002u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->extendee().data(), this->extendee().length(), + this->extendee().data(), static_cast(this->extendee().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.extendee"); target = @@ -4797,7 +4797,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes( // optional string type_name = 6; if (cached_has_bits & 0x00000004u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->type_name().data(), this->type_name().length(), + this->type_name().data(), static_cast(this->type_name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.type_name"); target = @@ -4808,7 +4808,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes( // optional string default_value = 7; if (cached_has_bits & 0x00000008u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->default_value().data(), this->default_value().length(), + this->default_value().data(), static_cast(this->default_value().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.default_value"); target = @@ -4831,7 +4831,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes( // optional string json_name = 10; if (cached_has_bits & 0x00000010u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->json_name().data(), this->json_name().length(), + this->json_name().data(), static_cast(this->json_name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.json_name"); target = @@ -5617,7 +5617,7 @@ bool OneofDescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.OneofDescriptorProto.name"); } else { @@ -5670,7 +5670,7 @@ void OneofDescriptorProto::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.OneofDescriptorProto.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -5700,7 +5700,7 @@ void OneofDescriptorProto::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.OneofDescriptorProto.name"); target = @@ -6050,7 +6050,7 @@ bool EnumDescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.EnumDescriptorProto.name"); } else { @@ -6115,7 +6115,7 @@ void EnumDescriptorProto::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.EnumDescriptorProto.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -6151,7 +6151,7 @@ void EnumDescriptorProto::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.EnumDescriptorProto.name"); target = @@ -6553,7 +6553,7 @@ bool EnumValueDescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.EnumValueDescriptorProto.name"); } else { @@ -6620,7 +6620,7 @@ void EnumValueDescriptorProto::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.EnumValueDescriptorProto.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -6655,7 +6655,7 @@ void EnumValueDescriptorProto::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.EnumValueDescriptorProto.name"); target = @@ -7046,7 +7046,7 @@ bool ServiceDescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.ServiceDescriptorProto.name"); } else { @@ -7111,7 +7111,7 @@ void ServiceDescriptorProto::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.ServiceDescriptorProto.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -7147,7 +7147,7 @@ void ServiceDescriptorProto::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.ServiceDescriptorProto.name"); target = @@ -7577,7 +7577,7 @@ bool MethodDescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.MethodDescriptorProto.name"); } else { @@ -7593,7 +7593,7 @@ bool MethodDescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_input_type())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->input_type().data(), this->input_type().length(), + this->input_type().data(), static_cast(this->input_type().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.MethodDescriptorProto.input_type"); } else { @@ -7609,7 +7609,7 @@ bool MethodDescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_output_type())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->output_type().data(), this->output_type().length(), + this->output_type().data(), static_cast(this->output_type().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.MethodDescriptorProto.output_type"); } else { @@ -7690,7 +7690,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.MethodDescriptorProto.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -7700,7 +7700,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes( // optional string input_type = 2; if (cached_has_bits & 0x00000002u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->input_type().data(), this->input_type().length(), + this->input_type().data(), static_cast(this->input_type().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.MethodDescriptorProto.input_type"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -7710,7 +7710,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes( // optional string output_type = 3; if (cached_has_bits & 0x00000004u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->output_type().data(), this->output_type().length(), + this->output_type().data(), static_cast(this->output_type().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.MethodDescriptorProto.output_type"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -7750,7 +7750,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes( // optional string name = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.MethodDescriptorProto.name"); target = @@ -7761,7 +7761,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes( // optional string input_type = 2; if (cached_has_bits & 0x00000002u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->input_type().data(), this->input_type().length(), + this->input_type().data(), static_cast(this->input_type().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.MethodDescriptorProto.input_type"); target = @@ -7772,7 +7772,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes( // optional string output_type = 3; if (cached_has_bits & 0x00000004u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->output_type().data(), this->output_type().length(), + this->output_type().data(), static_cast(this->output_type().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.MethodDescriptorProto.output_type"); target = @@ -8434,7 +8434,7 @@ bool FileOptions::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_java_package())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->java_package().data(), this->java_package().length(), + this->java_package().data(), static_cast(this->java_package().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileOptions.java_package"); } else { @@ -8450,7 +8450,7 @@ bool FileOptions::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_java_outer_classname())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->java_outer_classname().data(), this->java_outer_classname().length(), + this->java_outer_classname().data(), static_cast(this->java_outer_classname().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileOptions.java_outer_classname"); } else { @@ -8499,7 +8499,7 @@ bool FileOptions::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_go_package())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->go_package().data(), this->go_package().length(), + this->go_package().data(), static_cast(this->go_package().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileOptions.go_package"); } else { @@ -8613,7 +8613,7 @@ bool FileOptions::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_objc_class_prefix())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->objc_class_prefix().data(), this->objc_class_prefix().length(), + this->objc_class_prefix().data(), static_cast(this->objc_class_prefix().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileOptions.objc_class_prefix"); } else { @@ -8629,7 +8629,7 @@ bool FileOptions::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_csharp_namespace())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->csharp_namespace().data(), this->csharp_namespace().length(), + this->csharp_namespace().data(), static_cast(this->csharp_namespace().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileOptions.csharp_namespace"); } else { @@ -8645,7 +8645,7 @@ bool FileOptions::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_swift_prefix())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->swift_prefix().data(), this->swift_prefix().length(), + this->swift_prefix().data(), static_cast(this->swift_prefix().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileOptions.swift_prefix"); } else { @@ -8661,7 +8661,7 @@ bool FileOptions::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_php_class_prefix())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->php_class_prefix().data(), this->php_class_prefix().length(), + this->php_class_prefix().data(), static_cast(this->php_class_prefix().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileOptions.php_class_prefix"); } else { @@ -8677,7 +8677,7 @@ bool FileOptions::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_php_namespace())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->php_namespace().data(), this->php_namespace().length(), + this->php_namespace().data(), static_cast(this->php_namespace().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileOptions.php_namespace"); } else { @@ -8735,7 +8735,7 @@ void FileOptions::SerializeWithCachedSizes( // optional string java_package = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->java_package().data(), this->java_package().length(), + this->java_package().data(), static_cast(this->java_package().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.java_package"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -8745,7 +8745,7 @@ void FileOptions::SerializeWithCachedSizes( // optional string java_outer_classname = 8; if (cached_has_bits & 0x00000002u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->java_outer_classname().data(), this->java_outer_classname().length(), + this->java_outer_classname().data(), static_cast(this->java_outer_classname().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.java_outer_classname"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -8766,7 +8766,7 @@ void FileOptions::SerializeWithCachedSizes( // optional string go_package = 11; if (cached_has_bits & 0x00000004u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->go_package().data(), this->go_package().length(), + this->go_package().data(), static_cast(this->go_package().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.go_package"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -8811,7 +8811,7 @@ void FileOptions::SerializeWithCachedSizes( // optional string objc_class_prefix = 36; if (cached_has_bits & 0x00000008u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->objc_class_prefix().data(), this->objc_class_prefix().length(), + this->objc_class_prefix().data(), static_cast(this->objc_class_prefix().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.objc_class_prefix"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -8821,7 +8821,7 @@ void FileOptions::SerializeWithCachedSizes( // optional string csharp_namespace = 37; if (cached_has_bits & 0x00000010u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->csharp_namespace().data(), this->csharp_namespace().length(), + this->csharp_namespace().data(), static_cast(this->csharp_namespace().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.csharp_namespace"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -8831,7 +8831,7 @@ void FileOptions::SerializeWithCachedSizes( // optional string swift_prefix = 39; if (cached_has_bits & 0x00000020u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->swift_prefix().data(), this->swift_prefix().length(), + this->swift_prefix().data(), static_cast(this->swift_prefix().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.swift_prefix"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -8841,7 +8841,7 @@ void FileOptions::SerializeWithCachedSizes( // optional string php_class_prefix = 40; if (cached_has_bits & 0x00000040u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->php_class_prefix().data(), this->php_class_prefix().length(), + this->php_class_prefix().data(), static_cast(this->php_class_prefix().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.php_class_prefix"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -8851,7 +8851,7 @@ void FileOptions::SerializeWithCachedSizes( // optional string php_namespace = 41; if (cached_has_bits & 0x00000080u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->php_namespace().data(), this->php_namespace().length(), + this->php_namespace().data(), static_cast(this->php_namespace().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.php_namespace"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -8885,7 +8885,7 @@ void FileOptions::SerializeWithCachedSizes( // optional string java_package = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->java_package().data(), this->java_package().length(), + this->java_package().data(), static_cast(this->java_package().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.java_package"); target = @@ -8896,7 +8896,7 @@ void FileOptions::SerializeWithCachedSizes( // optional string java_outer_classname = 8; if (cached_has_bits & 0x00000002u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->java_outer_classname().data(), this->java_outer_classname().length(), + this->java_outer_classname().data(), static_cast(this->java_outer_classname().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.java_outer_classname"); target = @@ -8918,7 +8918,7 @@ void FileOptions::SerializeWithCachedSizes( // optional string go_package = 11; if (cached_has_bits & 0x00000004u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->go_package().data(), this->go_package().length(), + this->go_package().data(), static_cast(this->go_package().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.go_package"); target = @@ -8964,7 +8964,7 @@ void FileOptions::SerializeWithCachedSizes( // optional string objc_class_prefix = 36; if (cached_has_bits & 0x00000008u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->objc_class_prefix().data(), this->objc_class_prefix().length(), + this->objc_class_prefix().data(), static_cast(this->objc_class_prefix().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.objc_class_prefix"); target = @@ -8975,7 +8975,7 @@ void FileOptions::SerializeWithCachedSizes( // optional string csharp_namespace = 37; if (cached_has_bits & 0x00000010u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->csharp_namespace().data(), this->csharp_namespace().length(), + this->csharp_namespace().data(), static_cast(this->csharp_namespace().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.csharp_namespace"); target = @@ -8986,7 +8986,7 @@ void FileOptions::SerializeWithCachedSizes( // optional string swift_prefix = 39; if (cached_has_bits & 0x00000020u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->swift_prefix().data(), this->swift_prefix().length(), + this->swift_prefix().data(), static_cast(this->swift_prefix().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.swift_prefix"); target = @@ -8997,7 +8997,7 @@ void FileOptions::SerializeWithCachedSizes( // optional string php_class_prefix = 40; if (cached_has_bits & 0x00000040u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->php_class_prefix().data(), this->php_class_prefix().length(), + this->php_class_prefix().data(), static_cast(this->php_class_prefix().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.php_class_prefix"); target = @@ -9008,7 +9008,7 @@ void FileOptions::SerializeWithCachedSizes( // optional string php_namespace = 41; if (cached_has_bits & 0x00000080u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->php_namespace().data(), this->php_namespace().length(), + this->php_namespace().data(), static_cast(this->php_namespace().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.php_namespace"); target = @@ -13267,7 +13267,7 @@ bool UninterpretedOption_NamePart::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name_part())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name_part().data(), this->name_part().length(), + this->name_part().data(), static_cast(this->name_part().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.UninterpretedOption.NamePart.name_part"); } else { @@ -13322,7 +13322,7 @@ void UninterpretedOption_NamePart::SerializeWithCachedSizes( // required string name_part = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name_part().data(), this->name_part().length(), + this->name_part().data(), static_cast(this->name_part().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.UninterpretedOption.NamePart.name_part"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -13351,7 +13351,7 @@ void UninterpretedOption_NamePart::SerializeWithCachedSizes( // required string name_part = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name_part().data(), this->name_part().length(), + this->name_part().data(), static_cast(this->name_part().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.UninterpretedOption.NamePart.name_part"); target = @@ -13723,7 +13723,7 @@ bool UninterpretedOption::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_identifier_value())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->identifier_value().data(), this->identifier_value().length(), + this->identifier_value().data(), static_cast(this->identifier_value().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.UninterpretedOption.identifier_value"); } else { @@ -13793,7 +13793,7 @@ bool UninterpretedOption::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_aggregate_value())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->aggregate_value().data(), this->aggregate_value().length(), + this->aggregate_value().data(), static_cast(this->aggregate_value().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.UninterpretedOption.aggregate_value"); } else { @@ -13840,7 +13840,7 @@ void UninterpretedOption::SerializeWithCachedSizes( // optional string identifier_value = 3; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->identifier_value().data(), this->identifier_value().length(), + this->identifier_value().data(), static_cast(this->identifier_value().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.UninterpretedOption.identifier_value"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -13871,7 +13871,7 @@ void UninterpretedOption::SerializeWithCachedSizes( // optional string aggregate_value = 8; if (cached_has_bits & 0x00000004u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->aggregate_value().data(), this->aggregate_value().length(), + this->aggregate_value().data(), static_cast(this->aggregate_value().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.UninterpretedOption.aggregate_value"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -13902,7 +13902,7 @@ void UninterpretedOption::SerializeWithCachedSizes( // optional string identifier_value = 3; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->identifier_value().data(), this->identifier_value().length(), + this->identifier_value().data(), static_cast(this->identifier_value().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.UninterpretedOption.identifier_value"); target = @@ -13935,7 +13935,7 @@ void UninterpretedOption::SerializeWithCachedSizes( // optional string aggregate_value = 8; if (cached_has_bits & 0x00000004u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->aggregate_value().data(), this->aggregate_value().length(), + this->aggregate_value().data(), static_cast(this->aggregate_value().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.UninterpretedOption.aggregate_value"); target = @@ -14556,7 +14556,7 @@ bool SourceCodeInfo_Location::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_leading_comments())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->leading_comments().data(), this->leading_comments().length(), + this->leading_comments().data(), static_cast(this->leading_comments().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.SourceCodeInfo.Location.leading_comments"); } else { @@ -14572,7 +14572,7 @@ bool SourceCodeInfo_Location::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_trailing_comments())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->trailing_comments().data(), this->trailing_comments().length(), + this->trailing_comments().data(), static_cast(this->trailing_comments().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.SourceCodeInfo.Location.trailing_comments"); } else { @@ -14589,7 +14589,7 @@ bool SourceCodeInfo_Location::MergePartialFromCodedStream( input, this->add_leading_detached_comments())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( this->leading_detached_comments(this->leading_detached_comments_size() - 1).data(), - this->leading_detached_comments(this->leading_detached_comments_size() - 1).length(), + static_cast(this->leading_detached_comments(this->leading_detached_comments_size() - 1).length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.SourceCodeInfo.Location.leading_detached_comments"); } else { @@ -14650,7 +14650,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( // optional string leading_comments = 3; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->leading_comments().data(), this->leading_comments().length(), + this->leading_comments().data(), static_cast(this->leading_comments().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.SourceCodeInfo.Location.leading_comments"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -14660,7 +14660,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( // optional string trailing_comments = 4; if (cached_has_bits & 0x00000002u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->trailing_comments().data(), this->trailing_comments().length(), + this->trailing_comments().data(), static_cast(this->trailing_comments().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.SourceCodeInfo.Location.trailing_comments"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -14670,7 +14670,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( // repeated string leading_detached_comments = 6; for (int i = 0, n = this->leading_detached_comments_size(); i < n; i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->leading_detached_comments(i).data(), this->leading_detached_comments(i).length(), + this->leading_detached_comments(i).data(), static_cast(this->leading_detached_comments(i).length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.SourceCodeInfo.Location.leading_detached_comments"); ::google::protobuf::internal::WireFormatLite::WriteString( @@ -14718,7 +14718,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( // optional string leading_comments = 3; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->leading_comments().data(), this->leading_comments().length(), + this->leading_comments().data(), static_cast(this->leading_comments().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.SourceCodeInfo.Location.leading_comments"); target = @@ -14729,7 +14729,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( // optional string trailing_comments = 4; if (cached_has_bits & 0x00000002u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->trailing_comments().data(), this->trailing_comments().length(), + this->trailing_comments().data(), static_cast(this->trailing_comments().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.SourceCodeInfo.Location.trailing_comments"); target = @@ -14740,7 +14740,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( // repeated string leading_detached_comments = 6; for (int i = 0, n = this->leading_detached_comments_size(); i < n; i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->leading_detached_comments(i).data(), this->leading_detached_comments(i).length(), + this->leading_detached_comments(i).data(), static_cast(this->leading_detached_comments(i).length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.SourceCodeInfo.Location.leading_detached_comments"); target = ::google::protobuf::internal::WireFormatLite:: @@ -14770,7 +14770,8 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const { Int32Size(this->path_); if (data_size > 0) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); + ::google::protobuf::internal::WireFormatLite::Int32Size( + static_cast(data_size)); } int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); @@ -14785,7 +14786,8 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const { Int32Size(this->span_); if (data_size > 0) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); + ::google::protobuf::internal::WireFormatLite::Int32Size( + static_cast(data_size)); } int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); @@ -15555,7 +15557,7 @@ bool GeneratedCodeInfo_Annotation::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_source_file())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->source_file().data(), this->source_file().length(), + this->source_file().data(), static_cast(this->source_file().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.GeneratedCodeInfo.Annotation.source_file"); } else { @@ -15634,7 +15636,7 @@ void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes( // optional string source_file = 2; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->source_file().data(), this->source_file().length(), + this->source_file().data(), static_cast(this->source_file().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.GeneratedCodeInfo.Annotation.source_file"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -15680,7 +15682,7 @@ void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes( // optional string source_file = 2; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->source_file().data(), this->source_file().length(), + this->source_file().data(), static_cast(this->source_file().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.GeneratedCodeInfo.Annotation.source_file"); target = @@ -15721,7 +15723,8 @@ size_t GeneratedCodeInfo_Annotation::ByteSizeLong() const { Int32Size(this->path_); if (data_size > 0) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); + ::google::protobuf::internal::WireFormatLite::Int32Size( + static_cast(data_size)); } int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); diff --git a/src/google/protobuf/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc index 094c4cc9..d7efd083 100644 --- a/src/google/protobuf/field_mask.pb.cc +++ b/src/google/protobuf/field_mask.pb.cc @@ -213,7 +213,7 @@ bool FieldMask::MergePartialFromCodedStream( input, this->add_paths())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->paths(this->paths_size() - 1).data(), - this->paths(this->paths_size() - 1).length(), + static_cast(this->paths(this->paths_size() - 1).length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.FieldMask.paths")); } else { @@ -252,7 +252,7 @@ void FieldMask::SerializeWithCachedSizes( // repeated string paths = 1; for (int i = 0, n = this->paths_size(); i < n; i++) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->paths(i).data(), this->paths(i).length(), + this->paths(i).data(), static_cast(this->paths(i).length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.FieldMask.paths"); ::google::protobuf::internal::WireFormatLite::WriteString( @@ -271,7 +271,7 @@ void FieldMask::SerializeWithCachedSizes( // repeated string paths = 1; for (int i = 0, n = this->paths_size(); i < n; i++) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->paths(i).data(), this->paths(i).length(), + this->paths(i).data(), static_cast(this->paths(i).length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.FieldMask.paths"); target = ::google::protobuf::internal::WireFormatLite:: diff --git a/src/google/protobuf/generated_message_reflection.h b/src/google/protobuf/generated_message_reflection.h index 12b73ca3..abeb3d55 100644 --- a/src/google/protobuf/generated_message_reflection.h +++ b/src/google/protobuf/generated_message_reflection.h @@ -150,7 +150,8 @@ struct ReflectionSchema { } uint32 GetOneofCaseOffset(const OneofDescriptor* oneof_descriptor) const { - return oneof_case_offset_ + (oneof_descriptor->index() * sizeof(uint32)); + return oneof_case_offset_ + + static_cast(oneof_descriptor->index() * sizeof(uint32)); } bool HasHasbits() const { return has_bits_offset_ != -1; } diff --git a/src/google/protobuf/map_entry_lite.h b/src/google/protobuf/map_entry_lite.h index c466cc7b..7aad9a1c 100644 --- a/src/google/protobuf/map_entry_lite.h +++ b/src/google/protobuf/map_entry_lite.h @@ -250,11 +250,11 @@ class MapEntryImpl : public Base { int GetCachedSize() const { int size = 0; size += has_key() - ? kTagSize + KeyTypeHandler::GetCachedSize(key()) + ? static_cast(kTagSize + KeyTypeHandler::GetCachedSize(key())) : 0; size += has_value() - ? kTagSize + ValueTypeHandler::GetCachedSize( - value()) + ? static_cast(kTagSize + ValueTypeHandler::GetCachedSize( + value())) : 0; return size; } diff --git a/src/google/protobuf/map_field_inl.h b/src/google/protobuf/map_field_inl.h index 8c5da3c6..0cfed72f 100644 --- a/src/google/protobuf/map_field_inl.h +++ b/src/google/protobuf/map_field_inl.h @@ -168,7 +168,7 @@ template ::size() const { MapFieldBase::SyncMapWithRepeatedField(); - return impl_.GetMap().size(); + return static_cast(impl_.GetMap().size()); } template * MutableMap() { return &map_; } // Convenient methods for generated message implementation. - int size() const { return map_.size(); } + int size() const { return static_cast(map_.size()); } void Clear() { return map_.clear(); } void MergeFrom(const MapFieldLite& other) { for (typename Map::const_iterator it = other.map_.begin(); diff --git a/src/google/protobuf/map_type_handler.h b/src/google/protobuf/map_type_handler.h index 301b37fe..990136ff 100644 --- a/src/google/protobuf/map_type_handler.h +++ b/src/google/protobuf/map_type_handler.h @@ -284,7 +284,7 @@ MapTypeHandler::ByteSize( template \ inline int MapTypeHandler::ByteSize( \ const MapEntryAccessorType& value) { \ - return WireFormatLite::DeclaredType##Size(value); \ + return static_cast(WireFormatLite::DeclaredType##Size(value)); \ } GOOGLE_PROTOBUF_BYTE_SIZE(STRING, String) @@ -320,7 +320,8 @@ template inline int MapTypeHandler::GetCachedSize( const MapEntryAccessorType& value) { - return WireFormatLite::LengthDelimitedSize(value.GetCachedSize()); + return static_cast( + WireFormatLite::LengthDelimitedSize(value.GetCachedSize())); } #define GET_CACHED_SIZE(FieldType, DeclaredType) \ @@ -328,7 +329,7 @@ MapTypeHandler::GetCachedSize( inline int \ MapTypeHandler::GetCachedSize( \ const MapEntryAccessorType& value) { \ - return WireFormatLite::DeclaredType##Size(value); \ + return static_cast(WireFormatLite::DeclaredType##Size(value)); \ } GET_CACHED_SIZE(STRING, String) diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc index 3244444a..8ecb2d19 100644 --- a/src/google/protobuf/source_context.pb.cc +++ b/src/google/protobuf/source_context.pb.cc @@ -218,7 +218,7 @@ bool SourceContext::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_file_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->file_name().data(), this->file_name().length(), + this->file_name().data(), static_cast(this->file_name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.SourceContext.file_name")); } else { @@ -257,7 +257,7 @@ void SourceContext::SerializeWithCachedSizes( // string file_name = 1; if (this->file_name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->file_name().data(), this->file_name().length(), + this->file_name().data(), static_cast(this->file_name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.SourceContext.file_name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -276,7 +276,7 @@ void SourceContext::SerializeWithCachedSizes( // string file_name = 1; if (this->file_name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->file_name().data(), this->file_name().length(), + this->file_name().data(), static_cast(this->file_name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.SourceContext.file_name"); target = diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc index 207e9efe..3905d891 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -340,7 +340,7 @@ bool Struct::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, &parser)); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - parser.key().data(), parser.key().length(), + parser.key().data(), static_cast(parser.key().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Struct.FieldsEntry.key")); } else { @@ -385,7 +385,7 @@ void Struct::SerializeWithCachedSizes( struct Utf8Check { static void Check(ConstPtr p) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - p->first.data(), p->first.length(), + p->first.data(), static_cast(p->first.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Struct.FieldsEntry.key"); } @@ -449,7 +449,7 @@ void Struct::SerializeWithCachedSizes( struct Utf8Check { static void Check(ConstPtr p) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - p->first.data(), p->first.length(), + p->first.data(), static_cast(p->first.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Struct.FieldsEntry.key"); } @@ -834,7 +834,7 @@ bool Value::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_string_value())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->string_value().data(), this->string_value().length(), + this->string_value().data(), static_cast(this->string_value().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Value.string_value")); } else { @@ -923,7 +923,7 @@ void Value::SerializeWithCachedSizes( // string string_value = 3; if (has_string_value()) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->string_value().data(), this->string_value().length(), + this->string_value().data(), static_cast(this->string_value().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Value.string_value"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -970,7 +970,7 @@ void Value::SerializeWithCachedSizes( // string string_value = 3; if (has_string_value()) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->string_value().data(), this->string_value().length(), + this->string_value().data(), static_cast(this->string_value().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Value.string_value"); target = diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index 8f017a89..0344a6a1 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -514,7 +514,7 @@ bool Type::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Type.name")); } else { @@ -543,7 +543,7 @@ bool Type::MergePartialFromCodedStream( input, this->add_oneofs())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->oneofs(this->oneofs_size() - 1).data(), - this->oneofs(this->oneofs_size() - 1).length(), + static_cast(this->oneofs(this->oneofs_size() - 1).length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Type.oneofs")); } else { @@ -621,7 +621,7 @@ void Type::SerializeWithCachedSizes( // string name = 1; if (this->name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -637,7 +637,7 @@ void Type::SerializeWithCachedSizes( // repeated string oneofs = 3; for (int i = 0, n = this->oneofs_size(); i < n; i++) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->oneofs(i).data(), this->oneofs(i).length(), + this->oneofs(i).data(), static_cast(this->oneofs(i).length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.oneofs"); ::google::protobuf::internal::WireFormatLite::WriteString( @@ -674,7 +674,7 @@ void Type::SerializeWithCachedSizes( // string name = 1; if (this->name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.name"); target = @@ -692,7 +692,7 @@ void Type::SerializeWithCachedSizes( // repeated string oneofs = 3; for (int i = 0, n = this->oneofs_size(); i < n; i++) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->oneofs(i).data(), this->oneofs(i).length(), + this->oneofs(i).data(), static_cast(this->oneofs(i).length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.oneofs"); target = ::google::protobuf::internal::WireFormatLite:: @@ -1328,7 +1328,7 @@ bool Field::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Field.name")); } else { @@ -1344,7 +1344,7 @@ bool Field::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_type_url())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->type_url().data(), this->type_url().length(), + this->type_url().data(), static_cast(this->type_url().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Field.type_url")); } else { @@ -1400,7 +1400,7 @@ bool Field::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_json_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->json_name().data(), this->json_name().length(), + this->json_name().data(), static_cast(this->json_name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Field.json_name")); } else { @@ -1416,7 +1416,7 @@ bool Field::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_default_value())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->default_value().data(), this->default_value().length(), + this->default_value().data(), static_cast(this->default_value().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Field.default_value")); } else { @@ -1472,7 +1472,7 @@ void Field::SerializeWithCachedSizes( // string name = 4; if (this->name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1482,7 +1482,7 @@ void Field::SerializeWithCachedSizes( // string type_url = 6; if (this->type_url().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->type_url().data(), this->type_url().length(), + this->type_url().data(), static_cast(this->type_url().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.type_url"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1508,7 +1508,7 @@ void Field::SerializeWithCachedSizes( // string json_name = 10; if (this->json_name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->json_name().data(), this->json_name().length(), + this->json_name().data(), static_cast(this->json_name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.json_name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1518,7 +1518,7 @@ void Field::SerializeWithCachedSizes( // string default_value = 11; if (this->default_value().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->default_value().data(), this->default_value().length(), + this->default_value().data(), static_cast(this->default_value().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.default_value"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1554,7 +1554,7 @@ void Field::SerializeWithCachedSizes( // string name = 4; if (this->name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.name"); target = @@ -1565,7 +1565,7 @@ void Field::SerializeWithCachedSizes( // string type_url = 6; if (this->type_url().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->type_url().data(), this->type_url().length(), + this->type_url().data(), static_cast(this->type_url().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.type_url"); target = @@ -1593,7 +1593,7 @@ void Field::SerializeWithCachedSizes( // string json_name = 10; if (this->json_name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->json_name().data(), this->json_name().length(), + this->json_name().data(), static_cast(this->json_name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.json_name"); target = @@ -1604,7 +1604,7 @@ void Field::SerializeWithCachedSizes( // string default_value = 11; if (this->default_value().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->default_value().data(), this->default_value().length(), + this->default_value().data(), static_cast(this->default_value().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.default_value"); target = @@ -2340,7 +2340,7 @@ bool Enum::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Enum.name")); } else { @@ -2430,7 +2430,7 @@ void Enum::SerializeWithCachedSizes( // string name = 1; if (this->name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Enum.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -2473,7 +2473,7 @@ void Enum::SerializeWithCachedSizes( // string name = 1; if (this->name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Enum.name"); target = @@ -2959,7 +2959,7 @@ bool EnumValue::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.EnumValue.name")); } else { @@ -3024,7 +3024,7 @@ void EnumValue::SerializeWithCachedSizes( // string name = 1; if (this->name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.EnumValue.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -3054,7 +3054,7 @@ void EnumValue::SerializeWithCachedSizes( // string name = 1; if (this->name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.EnumValue.name"); target = @@ -3460,7 +3460,7 @@ bool Option::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Option.name")); } else { @@ -3511,7 +3511,7 @@ void Option::SerializeWithCachedSizes( // string name = 1; if (this->name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Option.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -3536,7 +3536,7 @@ void Option::SerializeWithCachedSizes( // string name = 1; if (this->name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->name().data(), this->name().length(), + this->name().data(), static_cast(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Option.name"); target = diff --git a/src/google/protobuf/wire_format_lite_inl.h b/src/google/protobuf/wire_format_lite_inl.h index 05049017..f7b98d1d 100644 --- a/src/google/protobuf/wire_format_lite_inl.h +++ b/src/google/protobuf/wire_format_lite_inl.h @@ -268,7 +268,7 @@ inline bool WireFormatLite::ReadRepeatedFixedSizePrimitive( if (size > 0) { const uint8* buffer = reinterpret_cast(void_pointer); // 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(sizeof(value)); // parentheses around (std::min) prevents macro expansion of min(...) int elements_available = @@ -344,8 +344,8 @@ inline bool WireFormatLite::ReadPackedFixedSizePrimitive( int length; if (!input->ReadVarintSizeAsInt(&length)) return false; const int old_entries = values->size(); - const int new_entries = length / sizeof(CType); - const int new_bytes = new_entries * sizeof(CType); + const int new_entries = length / static_cast(sizeof(CType)); + const int new_bytes = new_entries * static_cast(sizeof(CType)); if (new_bytes != length) return false; // We would *like* to pre-allocate the buffer to write into (for // speed), but *must* avoid performing a very large allocation due @@ -695,7 +695,7 @@ inline uint8* WireFormatLite::WriteFixedNoTagToArray( GOOGLE_DCHECK_GT(n, 0); const T* ii = value.unsafe_data(); - const int bytes = n * sizeof(ii[0]); + const int bytes = n * static_cast(sizeof(ii[0])); memcpy(target, ii, bytes); return target + bytes; #else diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc index 12c04fd5..245f7653 100644 --- a/src/google/protobuf/wrappers.pb.cc +++ b/src/google/protobuf/wrappers.pb.cc @@ -2209,7 +2209,7 @@ bool StringValue::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_value())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->value().data(), this->value().length(), + this->value().data(), static_cast(this->value().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.StringValue.value")); } else { @@ -2248,7 +2248,7 @@ void StringValue::SerializeWithCachedSizes( // string value = 1; if (this->value().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->value().data(), this->value().length(), + this->value().data(), static_cast(this->value().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.StringValue.value"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -2267,7 +2267,7 @@ void StringValue::SerializeWithCachedSizes( // string value = 1; if (this->value().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->value().data(), this->value().length(), + this->value().data(), static_cast(this->value().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.StringValue.value"); target = -- cgit v1.2.3 From e3c807d4e752b477b707f5d021264faf9b127304 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Fri, 23 Jun 2017 12:56:44 -0700 Subject: Fix more implicit type conversions in public headers and generated code. --- src/google/protobuf/api.pb.cc | 75 +-- src/google/protobuf/compiler/cpp/cpp_enum_field.cc | 30 +- src/google/protobuf/compiler/cpp/cpp_map_field.cc | 9 +- src/google/protobuf/compiler/cpp/cpp_message.cc | 14 +- .../protobuf/compiler/cpp/cpp_message_field.cc | 14 +- .../protobuf/compiler/cpp/cpp_primitive_field.cc | 8 +- src/google/protobuf/compiler/plugin.pb.cc | 42 +- src/google/protobuf/compiler/profile.pb.cc | 42 +- src/google/protobuf/descriptor.pb.cc | 550 ++++++++++++--------- src/google/protobuf/duration.pb.cc | 14 +- src/google/protobuf/dynamic_message.h | 8 +- src/google/protobuf/generated_message_reflection.h | 18 +- src/google/protobuf/map.h | 2 +- src/google/protobuf/map_entry_lite.h | 11 +- src/google/protobuf/map_type_handler.h | 3 +- src/google/protobuf/repeated_field.h | 6 +- src/google/protobuf/struct.pb.cc | 30 +- src/google/protobuf/stubs/fastmem.h | 3 +- src/google/protobuf/stubs/hash.h | 2 +- src/google/protobuf/stubs/port.h | 8 +- src/google/protobuf/stubs/stringpiece.h | 20 +- src/google/protobuf/timestamp.pb.cc | 14 +- src/google/protobuf/type.pb.cc | 108 ++-- src/google/protobuf/unknown_field_set.h | 6 +- src/google/protobuf/wire_format_lite.h | 10 +- src/google/protobuf/wire_format_lite_inl.h | 8 +- 26 files changed, 606 insertions(+), 449 deletions(-) (limited to 'src/google/protobuf/compiler/cpp') diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc index ce937cd1..30dd8dbc 100644 --- a/src/google/protobuf/api.pb.cc +++ b/src/google/protobuf/api.pb.cc @@ -240,8 +240,9 @@ Api::Api(const Api& from) void Api::SharedCtor() { name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); version_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&source_context_, 0, reinterpret_cast(&syntax_) - - reinterpret_cast(&source_context_) + sizeof(syntax_)); + ::memset(&source_context_, 0, static_cast( + reinterpret_cast(&syntax_) - + reinterpret_cast(&source_context_)) + sizeof(syntax_)); _cached_size_ = 0; } @@ -438,15 +439,17 @@ void Api::SerializeWithCachedSizes( } // 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(this->methods_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->methods(i), output); + 2, this->methods(static_cast(i)), output); } // 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(this->options_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 3, this->options(i), output); + 3, this->options(static_cast(i)), output); } // string version = 4; @@ -466,9 +469,10 @@ void Api::SerializeWithCachedSizes( } // 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(this->mixins_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 6, this->mixins(i), output); + 6, this->mixins(static_cast(i)), output); } // .google.protobuf.Syntax syntax = 7; @@ -498,17 +502,19 @@ void Api::SerializeWithCachedSizes( } // 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(this->methods_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 2, this->methods(i), deterministic, target); + 2, this->methods(static_cast(i)), deterministic, target); } // 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(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 3, this->options(i), deterministic, target); + 3, this->options(static_cast(i)), deterministic, target); } // string version = 4; @@ -530,10 +536,11 @@ void Api::SerializeWithCachedSizes( } // 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(this->mixins_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 6, this->mixins(i), deterministic, target); + 6, this->mixins(static_cast(i)), deterministic, target); } // .google.protobuf.Syntax syntax = 7; @@ -552,34 +559,34 @@ size_t Api::ByteSizeLong() const { // repeated .google.protobuf.Method methods = 2; { - unsigned int count = this->methods_size(); + unsigned int count = static_cast(this->methods_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->methods(i)); + this->methods(static_cast(i))); } } // repeated .google.protobuf.Option options = 3; { - unsigned int count = this->options_size(); + unsigned int count = static_cast(this->options_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->options(i)); + this->options(static_cast(i))); } } // repeated .google.protobuf.Mixin mixins = 6; { - unsigned int count = this->mixins_size(); + unsigned int count = static_cast(this->mixins_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->mixins(i)); + this->mixins(static_cast(i))); } } @@ -989,8 +996,8 @@ Method::Method(const Method& from) response_type_url_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.response_type_url_); } ::memcpy(&request_streaming_, &from.request_streaming_, - reinterpret_cast(&syntax_) - - reinterpret_cast(&request_streaming_) + sizeof(syntax_)); + static_cast(reinterpret_cast(&syntax_) - + reinterpret_cast(&request_streaming_)) + sizeof(syntax_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.Method) } @@ -998,8 +1005,9 @@ void Method::SharedCtor() { name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); request_type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); response_type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&request_streaming_, 0, reinterpret_cast(&syntax_) - - reinterpret_cast(&request_streaming_) + sizeof(syntax_)); + ::memset(&request_streaming_, 0, static_cast( + reinterpret_cast(&syntax_) - + reinterpret_cast(&request_streaming_)) + sizeof(syntax_)); _cached_size_ = 0; } @@ -1043,8 +1051,9 @@ void Method::Clear() { name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); request_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); response_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&request_streaming_, 0, reinterpret_cast(&syntax_) - - reinterpret_cast(&request_streaming_) + sizeof(syntax_)); + ::memset(&request_streaming_, 0, static_cast( + reinterpret_cast(&syntax_) - + reinterpret_cast(&request_streaming_)) + sizeof(syntax_)); } bool Method::MergePartialFromCodedStream( @@ -1228,9 +1237,10 @@ void Method::SerializeWithCachedSizes( } // 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(this->options_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 6, this->options(i), output); + 6, this->options(static_cast(i)), output); } // .google.protobuf.Syntax syntax = 7; @@ -1292,10 +1302,11 @@ void Method::SerializeWithCachedSizes( } // 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(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 6, this->options(i), deterministic, target); + 6, this->options(static_cast(i)), deterministic, target); } // .google.protobuf.Syntax syntax = 7; @@ -1314,12 +1325,12 @@ size_t Method::ByteSizeLong() const { // repeated .google.protobuf.Option options = 6; { - unsigned int count = this->options_size(); + unsigned int count = static_cast(this->options_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->options(i)); + this->options(static_cast(i))); } } diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc index 023213a9..0d3fdcbe 100644 --- a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc @@ -143,12 +143,14 @@ GenerateMergeFromCodedStream(io::Printer* printer) const { if (UseUnknownFieldSet(descriptor_->file(), options_)) { printer->Print(variables_, "} else {\n" - " mutable_unknown_fields()->AddVarint($number$, value);\n"); + " mutable_unknown_fields()->AddVarint(\n" + " $number$, static_cast<::google::protobuf::uint64>(value));\n"); } else { printer->Print( "} else {\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_))); } printer->Print(variables_, @@ -344,12 +346,14 @@ GenerateMergeFromCodedStream(io::Printer* printer) const { if (UseUnknownFieldSet(descriptor_->file(), options_)) { printer->Print(variables_, "} else {\n" - " mutable_unknown_fields()->AddVarint($number$, value);\n"); + " mutable_unknown_fields()->AddVarint(\n" + " $number$, static_cast<::google::protobuf::uint64>(value));\n"); } else { printer->Print( "} else {\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"); } @@ -391,7 +395,7 @@ GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const { "::google::protobuf::uint32 length;\n" "DO_(input->ReadVarint32(&length));\n" "::google::protobuf::io::CodedInputStream::Limit limit = " - "input->PushLimit(length);\n" + "input->PushLimit(static_cast(length));\n" "while (input->BytesUntilLimit() > 0) {\n" " int value;\n" " DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n" @@ -407,11 +411,13 @@ GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const { " } else {\n"); if (UseUnknownFieldSet(descriptor_->file(), options_)) { printer->Print(variables_, - " mutable_unknown_fields()->AddVarint($number$, value);\n"); + " mutable_unknown_fields()->AddVarint(\n" + " $number$, static_cast<::google::protobuf::uint64>(value));\n"); } else { printer->Print(variables_, " 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"); @@ -432,7 +438,8 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const { " $number$,\n" " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" " output);\n" - " output->WriteVarint32(_$name$_cached_byte_size_);\n" + " output->WriteVarint32(\n" + " static_cast<::google::protobuf::uint32>(_$name$_cached_byte_size_));\n" "}\n"); } printer->Print(variables_, @@ -460,7 +467,8 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" " target);\n" " 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" " this->$name$_, target);\n" "}\n"); @@ -476,12 +484,12 @@ GenerateByteSize(io::Printer* printer) const { printer->Print(variables_, "{\n" " size_t data_size = 0;\n" - " unsigned int count = this->$name$_size();"); + " unsigned int count = static_cast(this->$name$_size());"); printer->Indent(); printer->Print(variables_, "for (unsigned int i = 0; i < count; i++) {\n" " data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(\n" - " this->$name$(i));\n" + " this->$name$(static_cast(i)));\n" "}\n"); if (descriptor_->is_packed()) { diff --git a/src/google/protobuf/compiler/cpp/cpp_map_field.cc b/src/google/protobuf/compiler/cpp/cpp_map_field.cc index ee0ed164..d76db169 100644 --- a/src/google/protobuf/compiler/cpp/cpp_map_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_map_field.cc @@ -409,13 +409,14 @@ void MapFieldGenerator::GenerateSerializeWithCachedSizes( " for (::google::protobuf::Map< $key_cpp$, $val_cpp$ >::const_iterator\n" " it = this->$name$().begin();\n" " it != this->$name$().end(); ++it, ++n) {\n" - " items[n] = SortItem(&*it);\n" + " items[static_cast(n)] = SortItem(&*it);\n" " }\n" - " ::std::sort(&items[0], &items[n], Less());\n"); + " ::std::sort(&items[0], &items[static_cast(n)], Less());\n"); printer->Indent(); GenerateSerializationLoop(printer, variables, SupportsArenas(descriptor_), - utf8_check, "for (size_type i = 0; i < n; i++)", - string_key ? "items[i]" : "items[i].second", false); + utf8_check, "for (size_type i = 0; i < n; i++)", + string_key ? "items[static_cast(i)]" : + "items[static_cast(i)].second", false); printer->Outdent(); printer->Print( "} else {\n"); diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc index d9524f64..1ab87638 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -2308,12 +2308,13 @@ void MessageGenerator::GenerateConstructorBody(io::Printer* printer, if (copy_constructor) { pod_template = "::memcpy(&$first$_, &from.$first$_,\n" - " reinterpret_cast(&$last$_) -\n" - " reinterpret_cast(&$first$_) + sizeof($last$_));\n"; + " static_cast(reinterpret_cast(&$last$_) -\n" + " reinterpret_cast(&$first$_)) + sizeof($last$_));\n"; } else { pod_template = - "::memset(&$first$_, 0, reinterpret_cast(&$last$_) -\n" - " reinterpret_cast(&$first$_) + sizeof($last$_));\n"; + "::memset(&$first$_, 0, static_cast(\n" + " reinterpret_cast(&$last$_) -\n" + " reinterpret_cast(&$first$_)) + sizeof($last$_));\n"; } for (int i = 0; i < optimized_order_.size(); ++i) { @@ -2750,8 +2751,9 @@ GenerateClear(io::Printer* printer) { FieldName(optimized_order_[memset_run_end]); printer->Print( - "::memset(&$first$_, 0, reinterpret_cast(&$last$_) -\n" - " reinterpret_cast(&$first$_) + sizeof($last$_));\n", + "::memset(&$first$_, 0, static_cast(\n" + " reinterpret_cast(&$last$_) -\n" + " reinterpret_cast(&$first$_)) + sizeof($last$_));\n", "first", first_field_name, "last", last_field_name); } diff --git a/src/google/protobuf/compiler/cpp/cpp_message_field.cc b/src/google/protobuf/compiler/cpp/cpp_message_field.cc index fc3c4564..ed1719cc 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message_field.cc @@ -1084,19 +1084,21 @@ GenerateMergeFromCodedStream(io::Printer* printer) const { void RepeatedMessageFieldGenerator:: GenerateSerializeWithCachedSizes(io::Printer* printer) const { 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(this->$name$_size()); i < n; i++) {\n" " ::google::protobuf::internal::WireFormatLite::Write$stream_writer$(\n" - " $number$, this->$name$(i), output);\n" + " $number$, this->$name$(static_cast(i)), output);\n" "}\n"); } void RepeatedMessageFieldGenerator:: GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { 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(this->$name$_size()); i < n; i++) {\n" " target = ::google::protobuf::internal::WireFormatLite::\n" " InternalWrite$declared_type$NoVirtualToArray(\n" - " $number$, this->$name$(i), deterministic, target);\n" + " $number$, this->$name$(static_cast(i)), deterministic, target);\n" "}\n"); } @@ -1104,14 +1106,14 @@ void RepeatedMessageFieldGenerator:: GenerateByteSize(io::Printer* printer) const { printer->Print(variables_, "{\n" - " unsigned int count = this->$name$_size();\n"); + " unsigned int count = static_cast(this->$name$_size());\n"); printer->Indent(); printer->Print(variables_, "total_size += $tag_size$UL * count;\n" "for (unsigned int i = 0; i < count; i++) {\n" " total_size +=\n" " ::google::protobuf::internal::WireFormatLite::$declared_type$SizeNoVirtual(\n" - " this->$name$(i));\n" + " this->$name$(static_cast(i)));\n" "}\n"); printer->Outdent(); printer->Print("}\n"); diff --git a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc index df7c1730..83bc096f 100644 --- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc @@ -382,7 +382,8 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const { "$number$, " "::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, " "output);\n" - " output->WriteVarint32(_$name$_cached_byte_size_);\n"); + " output->WriteVarint32(static_cast<::google::protobuf::uint32>(\n" + " _$name$_cached_byte_size_));\n"); if (FixedSize(descriptor_->type()) > 0) { // TODO(ckennelly): Use RepeatedField::unsafe_data() via @@ -422,7 +423,8 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" " target);\n" " target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(\n" - " _$name$_cached_byte_size_, target);\n" + " static_cast<::google::protobuf::uint32>(\n" + " _$name$_cached_byte_size_), target);\n" " target = ::google::protobuf::internal::WireFormatLite::\n" " Write$declared_type$NoTagToArray(this->$name$_, target);\n" "}\n"); @@ -444,7 +446,7 @@ GenerateByteSize(io::Printer* printer) const { " $declared_type$Size(this->$name$_);\n"); } else { printer->Print(variables_, - "unsigned int count = this->$name$_size();\n" + "unsigned int count = static_cast(this->$name$_size());\n" "size_t data_size = $fixed_size$UL * count;\n"); } diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index 1f6755ff..87fcc40f 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -239,16 +239,17 @@ Version::Version(const Version& from) suffix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.suffix_); } ::memcpy(&major_, &from.major_, - reinterpret_cast(&patch_) - - reinterpret_cast(&major_) + sizeof(patch_)); + static_cast(reinterpret_cast(&patch_) - + reinterpret_cast(&major_)) + sizeof(patch_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.Version) } void Version::SharedCtor() { _cached_size_ = 0; suffix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&major_, 0, reinterpret_cast(&patch_) - - reinterpret_cast(&major_) + sizeof(patch_)); + ::memset(&major_, 0, static_cast( + reinterpret_cast(&patch_) - + reinterpret_cast(&major_)) + sizeof(patch_)); } Version::~Version() { @@ -290,8 +291,9 @@ void Version::Clear() { (*suffix_.UnsafeRawStringPointer())->clear(); } if (_has_bits_[0 / 32] & 14u) { - ::memset(&major_, 0, reinterpret_cast(&patch_) - - reinterpret_cast(&major_) + sizeof(patch_)); + ::memset(&major_, 0, static_cast( + reinterpret_cast(&patch_) - + reinterpret_cast(&major_)) + sizeof(patch_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -950,9 +952,10 @@ void CodeGeneratorRequest::SerializeWithCachedSizes( } // 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(this->proto_file_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 15, this->proto_file(i), output); + 15, this->proto_file(static_cast(i)), output); } if (_internal_metadata_.have_unknown_fields()) { @@ -998,10 +1001,11 @@ void CodeGeneratorRequest::SerializeWithCachedSizes( } // 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(this->proto_file_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 15, this->proto_file(i), deterministic, target); + 15, this->proto_file(static_cast(i)), deterministic, target); } if (_internal_metadata_.have_unknown_fields()) { @@ -1031,12 +1035,12 @@ size_t CodeGeneratorRequest::ByteSizeLong() const { // repeated .google.protobuf.FileDescriptorProto proto_file = 15; { - unsigned int count = this->proto_file_size(); + unsigned int count = static_cast(this->proto_file_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->proto_file(i)); + this->proto_file(static_cast(i))); } } @@ -2082,9 +2086,10 @@ void CodeGeneratorResponse::SerializeWithCachedSizes( } // 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(this->file_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 15, this->file(i), output); + 15, this->file(static_cast(i)), output); } if (_internal_metadata_.have_unknown_fields()) { @@ -2113,10 +2118,11 @@ void CodeGeneratorResponse::SerializeWithCachedSizes( } // 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(this->file_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 15, this->file(i), deterministic, target); + 15, this->file(static_cast(i)), deterministic, target); } if (_internal_metadata_.have_unknown_fields()) { @@ -2138,12 +2144,12 @@ size_t CodeGeneratorResponse::ByteSizeLong() const { } // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; { - unsigned int count = this->file_size(); + unsigned int count = static_cast(this->file_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->file(i)); + this->file(static_cast(i))); } } diff --git a/src/google/protobuf/compiler/profile.pb.cc b/src/google/protobuf/compiler/profile.pb.cc index 1f1d72fb..223dcc21 100644 --- a/src/google/protobuf/compiler/profile.pb.cc +++ b/src/google/protobuf/compiler/profile.pb.cc @@ -205,16 +205,17 @@ FieldAccessInfo::FieldAccessInfo(const FieldAccessInfo& from) name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); } ::memcpy(&getters_count_, &from.getters_count_, - reinterpret_cast(&configs_count_) - - reinterpret_cast(&getters_count_) + sizeof(configs_count_)); + static_cast(reinterpret_cast(&configs_count_) - + reinterpret_cast(&getters_count_)) + sizeof(configs_count_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.FieldAccessInfo) } void FieldAccessInfo::SharedCtor() { _cached_size_ = 0; name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&getters_count_, 0, reinterpret_cast(&configs_count_) - - reinterpret_cast(&getters_count_) + sizeof(configs_count_)); + ::memset(&getters_count_, 0, static_cast( + reinterpret_cast(&configs_count_) - + reinterpret_cast(&getters_count_)) + sizeof(configs_count_)); } FieldAccessInfo::~FieldAccessInfo() { @@ -256,8 +257,9 @@ void FieldAccessInfo::Clear() { (*name_.UnsafeRawStringPointer())->clear(); } if (_has_bits_[0 / 32] & 14u) { - ::memset(&getters_count_, 0, reinterpret_cast(&configs_count_) - - reinterpret_cast(&getters_count_) + sizeof(configs_count_)); + ::memset(&getters_count_, 0, static_cast( + reinterpret_cast(&configs_count_) - + reinterpret_cast(&getters_count_)) + sizeof(configs_count_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -875,9 +877,10 @@ void MessageAccessInfo::SerializeWithCachedSizes( } // 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(this->field_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 3, this->field(i), output); + 3, this->field(static_cast(i)), output); } if (_internal_metadata_.have_unknown_fields()) { @@ -911,10 +914,11 @@ void MessageAccessInfo::SerializeWithCachedSizes( } // 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(this->field_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 3, this->field(i), deterministic, target); + 3, this->field(static_cast(i)), deterministic, target); } if (_internal_metadata_.have_unknown_fields()) { @@ -936,12 +940,12 @@ size_t MessageAccessInfo::ByteSizeLong() const { } // repeated .google.protobuf.compiler.FieldAccessInfo field = 3; { - unsigned int count = this->field_size(); + unsigned int count = static_cast(this->field_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->field(i)); + this->field(static_cast(i))); } } @@ -1279,9 +1283,10 @@ void AccessInfo::SerializeWithCachedSizes( (void) cached_has_bits; // 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(this->message_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 1, this->message(i), output); + 1, this->message(static_cast(i)), output); } if (_internal_metadata_.have_unknown_fields()) { @@ -1298,10 +1303,11 @@ void AccessInfo::SerializeWithCachedSizes( (void) cached_has_bits; // 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(this->message_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 1, this->message(i), deterministic, target); + 1, this->message(static_cast(i)), deterministic, target); } if (_internal_metadata_.have_unknown_fields()) { @@ -1323,12 +1329,12 @@ size_t AccessInfo::ByteSizeLong() const { } // repeated .google.protobuf.compiler.MessageAccessInfo message = 1; { - unsigned int count = this->message_size(); + unsigned int count = static_cast(this->message_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->message(i)); + this->message(static_cast(i))); } } diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index dbe56986..6e4e4088 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -1112,9 +1112,10 @@ void FileDescriptorSet::SerializeWithCachedSizes( (void) cached_has_bits; // repeated .google.protobuf.FileDescriptorProto file = 1; - for (unsigned int i = 0, n = this->file_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->file_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 1, this->file(i), output); + 1, this->file(static_cast(i)), output); } if (_internal_metadata_.have_unknown_fields()) { @@ -1131,10 +1132,11 @@ void FileDescriptorSet::SerializeWithCachedSizes( (void) cached_has_bits; // repeated .google.protobuf.FileDescriptorProto file = 1; - for (unsigned int i = 0, n = this->file_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->file_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 1, this->file(i), deterministic, target); + 1, this->file(static_cast(i)), deterministic, target); } if (_internal_metadata_.have_unknown_fields()) { @@ -1156,12 +1158,12 @@ size_t FileDescriptorSet::ByteSizeLong() const { } // repeated .google.protobuf.FileDescriptorProto file = 1; { - unsigned int count = this->file_size(); + unsigned int count = static_cast(this->file_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->file(i)); + this->file(static_cast(i))); } } @@ -1335,8 +1337,9 @@ void FileDescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); syntax_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&options_, 0, reinterpret_cast(&source_code_info_) - - reinterpret_cast(&options_) + sizeof(source_code_info_)); + ::memset(&options_, 0, static_cast( + reinterpret_cast(&source_code_info_) - + reinterpret_cast(&options_)) + sizeof(source_code_info_)); } FileDescriptorProto::~FileDescriptorProto() { @@ -1657,27 +1660,31 @@ void FileDescriptorProto::SerializeWithCachedSizes( } // repeated .google.protobuf.DescriptorProto message_type = 4; - for (unsigned int i = 0, n = this->message_type_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->message_type_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 4, this->message_type(i), output); + 4, this->message_type(static_cast(i)), output); } // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - for (unsigned int i = 0, n = this->enum_type_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->enum_type_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 5, this->enum_type(i), output); + 5, this->enum_type(static_cast(i)), output); } // repeated .google.protobuf.ServiceDescriptorProto service = 6; - for (unsigned int i = 0, n = this->service_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->service_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 6, this->service(i), output); + 6, this->service(static_cast(i)), output); } // repeated .google.protobuf.FieldDescriptorProto extension = 7; - for (unsigned int i = 0, n = this->extension_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->extension_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 7, this->extension(i), output); + 7, this->extension(static_cast(i)), output); } // optional .google.protobuf.FileOptions options = 8; @@ -1761,31 +1768,35 @@ void FileDescriptorProto::SerializeWithCachedSizes( } // repeated .google.protobuf.DescriptorProto message_type = 4; - for (unsigned int i = 0, n = this->message_type_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->message_type_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 4, this->message_type(i), deterministic, target); + 4, this->message_type(static_cast(i)), deterministic, target); } // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - for (unsigned int i = 0, n = this->enum_type_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->enum_type_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 5, this->enum_type(i), deterministic, target); + 5, this->enum_type(static_cast(i)), deterministic, target); } // repeated .google.protobuf.ServiceDescriptorProto service = 6; - for (unsigned int i = 0, n = this->service_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->service_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 6, this->service(i), deterministic, target); + 6, this->service(static_cast(i)), deterministic, target); } // repeated .google.protobuf.FieldDescriptorProto extension = 7; - for (unsigned int i = 0, n = this->extension_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->extension_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 7, this->extension(i), deterministic, target); + 7, this->extension(static_cast(i)), deterministic, target); } // optional .google.protobuf.FileOptions options = 8; @@ -1848,45 +1859,45 @@ size_t FileDescriptorProto::ByteSizeLong() const { // repeated .google.protobuf.DescriptorProto message_type = 4; { - unsigned int count = this->message_type_size(); + unsigned int count = static_cast(this->message_type_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->message_type(i)); + this->message_type(static_cast(i))); } } // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; { - unsigned int count = this->enum_type_size(); + unsigned int count = static_cast(this->enum_type_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->enum_type(i)); + this->enum_type(static_cast(i))); } } // repeated .google.protobuf.ServiceDescriptorProto service = 6; { - unsigned int count = this->service_size(); + unsigned int count = static_cast(this->service_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->service(i)); + this->service(static_cast(i))); } } // repeated .google.protobuf.FieldDescriptorProto extension = 7; { - unsigned int count = this->extension_size(); + unsigned int count = static_cast(this->extension_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->extension(i)); + this->extension(static_cast(i))); } } @@ -2611,15 +2622,16 @@ DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(const DescriptorP _cached_size_(0) { _internal_metadata_.MergeFrom(from._internal_metadata_); ::memcpy(&start_, &from.start_, - reinterpret_cast(&end_) - - reinterpret_cast(&start_) + sizeof(end_)); + static_cast(reinterpret_cast(&end_) - + reinterpret_cast(&start_)) + sizeof(end_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ExtensionRange) } void DescriptorProto_ExtensionRange::SharedCtor() { _cached_size_ = 0; - ::memset(&start_, 0, reinterpret_cast(&end_) - - reinterpret_cast(&start_) + sizeof(end_)); + ::memset(&start_, 0, static_cast( + reinterpret_cast(&end_) - + reinterpret_cast(&start_)) + sizeof(end_)); } DescriptorProto_ExtensionRange::~DescriptorProto_ExtensionRange() { @@ -2656,8 +2668,9 @@ DescriptorProto_ExtensionRange* DescriptorProto_ExtensionRange::New(::google::pr void DescriptorProto_ExtensionRange::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ExtensionRange) if (_has_bits_[0 / 32] & 3u) { - ::memset(&start_, 0, reinterpret_cast(&end_) - - reinterpret_cast(&start_) + sizeof(end_)); + ::memset(&start_, 0, static_cast( + reinterpret_cast(&end_) - + reinterpret_cast(&start_)) + sizeof(end_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -2948,15 +2961,16 @@ DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(const DescriptorPro _cached_size_(0) { _internal_metadata_.MergeFrom(from._internal_metadata_); ::memcpy(&start_, &from.start_, - reinterpret_cast(&end_) - - reinterpret_cast(&start_) + sizeof(end_)); + static_cast(reinterpret_cast(&end_) - + reinterpret_cast(&start_)) + sizeof(end_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ReservedRange) } void DescriptorProto_ReservedRange::SharedCtor() { _cached_size_ = 0; - ::memset(&start_, 0, reinterpret_cast(&end_) - - reinterpret_cast(&start_) + sizeof(end_)); + ::memset(&start_, 0, static_cast( + reinterpret_cast(&end_) - + reinterpret_cast(&start_)) + sizeof(end_)); } DescriptorProto_ReservedRange::~DescriptorProto_ReservedRange() { @@ -2993,8 +3007,9 @@ DescriptorProto_ReservedRange* DescriptorProto_ReservedRange::New(::google::prot void DescriptorProto_ReservedRange::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ReservedRange) if (_has_bits_[0 / 32] & 3u) { - ::memset(&start_, 0, reinterpret_cast(&end_) - - reinterpret_cast(&start_) + sizeof(end_)); + ::memset(&start_, 0, static_cast( + reinterpret_cast(&end_) - + reinterpret_cast(&start_)) + sizeof(end_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -3556,33 +3571,38 @@ void DescriptorProto::SerializeWithCachedSizes( } // repeated .google.protobuf.FieldDescriptorProto field = 2; - for (unsigned int i = 0, n = this->field_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->field_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->field(i), output); + 2, this->field(static_cast(i)), output); } // repeated .google.protobuf.DescriptorProto nested_type = 3; - for (unsigned int i = 0, n = this->nested_type_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->nested_type_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 3, this->nested_type(i), output); + 3, this->nested_type(static_cast(i)), output); } // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - for (unsigned int i = 0, n = this->enum_type_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->enum_type_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 4, this->enum_type(i), output); + 4, this->enum_type(static_cast(i)), output); } // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - for (unsigned int i = 0, n = this->extension_range_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->extension_range_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 5, this->extension_range(i), output); + 5, this->extension_range(static_cast(i)), output); } // repeated .google.protobuf.FieldDescriptorProto extension = 6; - for (unsigned int i = 0, n = this->extension_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->extension_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 6, this->extension(i), output); + 6, this->extension(static_cast(i)), output); } // optional .google.protobuf.MessageOptions options = 7; @@ -3592,15 +3612,17 @@ void DescriptorProto::SerializeWithCachedSizes( } // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; - for (unsigned int i = 0, n = this->oneof_decl_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->oneof_decl_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 8, this->oneof_decl(i), output); + 8, this->oneof_decl(static_cast(i)), output); } // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; - for (unsigned int i = 0, n = this->reserved_range_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->reserved_range_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 9, this->reserved_range(i), output); + 9, this->reserved_range(static_cast(i)), output); } // repeated string reserved_name = 10; @@ -3639,38 +3661,43 @@ void DescriptorProto::SerializeWithCachedSizes( } // repeated .google.protobuf.FieldDescriptorProto field = 2; - for (unsigned int i = 0, n = this->field_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->field_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 2, this->field(i), deterministic, target); + 2, this->field(static_cast(i)), deterministic, target); } // repeated .google.protobuf.DescriptorProto nested_type = 3; - for (unsigned int i = 0, n = this->nested_type_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->nested_type_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 3, this->nested_type(i), deterministic, target); + 3, this->nested_type(static_cast(i)), deterministic, target); } // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - for (unsigned int i = 0, n = this->enum_type_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->enum_type_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 4, this->enum_type(i), deterministic, target); + 4, this->enum_type(static_cast(i)), deterministic, target); } // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - for (unsigned int i = 0, n = this->extension_range_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->extension_range_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 5, this->extension_range(i), deterministic, target); + 5, this->extension_range(static_cast(i)), deterministic, target); } // repeated .google.protobuf.FieldDescriptorProto extension = 6; - for (unsigned int i = 0, n = this->extension_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->extension_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 6, this->extension(i), deterministic, target); + 6, this->extension(static_cast(i)), deterministic, target); } // optional .google.protobuf.MessageOptions options = 7; @@ -3681,17 +3708,19 @@ void DescriptorProto::SerializeWithCachedSizes( } // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; - for (unsigned int i = 0, n = this->oneof_decl_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->oneof_decl_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 8, this->oneof_decl(i), deterministic, target); + 8, this->oneof_decl(static_cast(i)), deterministic, target); } // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; - for (unsigned int i = 0, n = this->reserved_range_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->reserved_range_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 9, this->reserved_range(i), deterministic, target); + 9, this->reserved_range(static_cast(i)), deterministic, target); } // repeated string reserved_name = 10; @@ -3723,78 +3752,78 @@ size_t DescriptorProto::ByteSizeLong() const { } // repeated .google.protobuf.FieldDescriptorProto field = 2; { - unsigned int count = this->field_size(); + unsigned int count = static_cast(this->field_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->field(i)); + this->field(static_cast(i))); } } // repeated .google.protobuf.DescriptorProto nested_type = 3; { - unsigned int count = this->nested_type_size(); + unsigned int count = static_cast(this->nested_type_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->nested_type(i)); + this->nested_type(static_cast(i))); } } // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; { - unsigned int count = this->enum_type_size(); + unsigned int count = static_cast(this->enum_type_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->enum_type(i)); + this->enum_type(static_cast(i))); } } // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; { - unsigned int count = this->extension_range_size(); + unsigned int count = static_cast(this->extension_range_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->extension_range(i)); + this->extension_range(static_cast(i))); } } // repeated .google.protobuf.FieldDescriptorProto extension = 6; { - unsigned int count = this->extension_size(); + unsigned int count = static_cast(this->extension_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->extension(i)); + this->extension(static_cast(i))); } } // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; { - unsigned int count = this->oneof_decl_size(); + unsigned int count = static_cast(this->oneof_decl_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->oneof_decl(i)); + this->oneof_decl(static_cast(i))); } } // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; { - unsigned int count = this->reserved_range_size(); + unsigned int count = static_cast(this->reserved_range_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->reserved_range(i)); + this->reserved_range(static_cast(i))); } } @@ -4369,8 +4398,8 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from) options_ = NULL; } ::memcpy(&number_, &from.number_, - reinterpret_cast(&type_) - - reinterpret_cast(&number_) + sizeof(type_)); + static_cast(reinterpret_cast(&type_) - + reinterpret_cast(&number_)) + sizeof(type_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldDescriptorProto) } @@ -4381,8 +4410,9 @@ void FieldDescriptorProto::SharedCtor() { type_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); default_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); json_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&options_, 0, reinterpret_cast(&oneof_index_) - - reinterpret_cast(&options_) + sizeof(oneof_index_)); + ::memset(&options_, 0, static_cast( + reinterpret_cast(&oneof_index_) - + reinterpret_cast(&options_)) + sizeof(oneof_index_)); label_ = 1; type_ = 1; } @@ -4455,8 +4485,9 @@ void FieldDescriptorProto::Clear() { } } if (_has_bits_[0 / 32] & 192u) { - ::memset(&number_, 0, reinterpret_cast(&oneof_index_) - - reinterpret_cast(&number_) + sizeof(oneof_index_)); + ::memset(&number_, 0, static_cast( + reinterpret_cast(&oneof_index_) - + reinterpret_cast(&number_)) + sizeof(oneof_index_)); } if (_has_bits_[8 / 32] & 768u) { label_ = 1; @@ -4533,7 +4564,8 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( if (::google::protobuf::FieldDescriptorProto_Label_IsValid(value)) { set_label(static_cast< ::google::protobuf::FieldDescriptorProto_Label >(value)); } else { - mutable_unknown_fields()->AddVarint(4, value); + mutable_unknown_fields()->AddVarint( + 4, static_cast<::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -4552,7 +4584,8 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( if (::google::protobuf::FieldDescriptorProto_Type_IsValid(value)) { set_type(static_cast< ::google::protobuf::FieldDescriptorProto_Type >(value)); } else { - mutable_unknown_fields()->AddVarint(5, value); + mutable_unknown_fields()->AddVarint( + 5, static_cast<::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -6123,9 +6156,10 @@ void EnumDescriptorProto::SerializeWithCachedSizes( } // repeated .google.protobuf.EnumValueDescriptorProto value = 2; - for (unsigned int i = 0, n = this->value_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->value_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->value(i), output); + 2, this->value(static_cast(i)), output); } // optional .google.protobuf.EnumOptions options = 3; @@ -6160,10 +6194,11 @@ void EnumDescriptorProto::SerializeWithCachedSizes( } // repeated .google.protobuf.EnumValueDescriptorProto value = 2; - for (unsigned int i = 0, n = this->value_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->value_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 2, this->value(i), deterministic, target); + 2, this->value(static_cast(i)), deterministic, target); } // optional .google.protobuf.EnumOptions options = 3; @@ -6192,12 +6227,12 @@ size_t EnumDescriptorProto::ByteSizeLong() const { } // repeated .google.protobuf.EnumValueDescriptorProto value = 2; { - unsigned int count = this->value_size(); + unsigned int count = static_cast(this->value_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->value(i)); + this->value(static_cast(i))); } } @@ -6480,8 +6515,9 @@ EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProt void EnumValueDescriptorProto::SharedCtor() { _cached_size_ = 0; name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&options_, 0, reinterpret_cast(&number_) - - reinterpret_cast(&options_) + sizeof(number_)); + ::memset(&options_, 0, static_cast( + reinterpret_cast(&number_) - + reinterpret_cast(&options_)) + sizeof(number_)); } EnumValueDescriptorProto::~EnumValueDescriptorProto() { @@ -7119,9 +7155,10 @@ void ServiceDescriptorProto::SerializeWithCachedSizes( } // repeated .google.protobuf.MethodDescriptorProto method = 2; - for (unsigned int i = 0, n = this->method_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->method_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->method(i), output); + 2, this->method(static_cast(i)), output); } // optional .google.protobuf.ServiceOptions options = 3; @@ -7156,10 +7193,11 @@ void ServiceDescriptorProto::SerializeWithCachedSizes( } // repeated .google.protobuf.MethodDescriptorProto method = 2; - for (unsigned int i = 0, n = this->method_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->method_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 2, this->method(i), deterministic, target); + 2, this->method(static_cast(i)), deterministic, target); } // optional .google.protobuf.ServiceOptions options = 3; @@ -7188,12 +7226,12 @@ size_t ServiceDescriptorProto::ByteSizeLong() const { } // repeated .google.protobuf.MethodDescriptorProto method = 2; { - unsigned int count = this->method_size(); + unsigned int count = static_cast(this->method_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->method(i)); + this->method(static_cast(i))); } } @@ -7481,8 +7519,8 @@ MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from) options_ = NULL; } ::memcpy(&client_streaming_, &from.client_streaming_, - reinterpret_cast(&server_streaming_) - - reinterpret_cast(&client_streaming_) + sizeof(server_streaming_)); + static_cast(reinterpret_cast(&server_streaming_) - + reinterpret_cast(&client_streaming_)) + sizeof(server_streaming_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.MethodDescriptorProto) } @@ -7491,8 +7529,9 @@ void MethodDescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); input_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); output_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&options_, 0, reinterpret_cast(&server_streaming_) - - reinterpret_cast(&options_) + sizeof(server_streaming_)); + ::memset(&options_, 0, static_cast( + reinterpret_cast(&server_streaming_) - + reinterpret_cast(&options_)) + sizeof(server_streaming_)); } MethodDescriptorProto::~MethodDescriptorProto() { @@ -7553,8 +7592,9 @@ void MethodDescriptorProto::Clear() { } } if (_has_bits_[0 / 32] & 48u) { - ::memset(&client_streaming_, 0, reinterpret_cast(&server_streaming_) - - reinterpret_cast(&client_streaming_) + sizeof(server_streaming_)); + ::memset(&client_streaming_, 0, static_cast( + reinterpret_cast(&server_streaming_) - + reinterpret_cast(&client_streaming_)) + sizeof(server_streaming_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -8311,8 +8351,8 @@ FileOptions::FileOptions(const FileOptions& from) php_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_namespace_); } ::memcpy(&java_multiple_files_, &from.java_multiple_files_, - reinterpret_cast(&optimize_for_) - - reinterpret_cast(&java_multiple_files_) + sizeof(optimize_for_)); + static_cast(reinterpret_cast(&optimize_for_) - + reinterpret_cast(&java_multiple_files_)) + sizeof(optimize_for_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.FileOptions) } @@ -8326,8 +8366,9 @@ void FileOptions::SharedCtor() { swift_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); php_class_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); php_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&java_multiple_files_, 0, reinterpret_cast(&cc_enable_arenas_) - - reinterpret_cast(&java_multiple_files_) + sizeof(cc_enable_arenas_)); + ::memset(&java_multiple_files_, 0, static_cast( + reinterpret_cast(&cc_enable_arenas_) - + reinterpret_cast(&java_multiple_files_)) + sizeof(cc_enable_arenas_)); optimize_for_ = 1; } @@ -8409,8 +8450,9 @@ void FileOptions::Clear() { } } if (_has_bits_[8 / 32] & 65280u) { - ::memset(&java_multiple_files_, 0, reinterpret_cast(&cc_enable_arenas_) - - reinterpret_cast(&java_multiple_files_) + sizeof(cc_enable_arenas_)); + ::memset(&java_multiple_files_, 0, static_cast( + reinterpret_cast(&cc_enable_arenas_) - + reinterpret_cast(&java_multiple_files_)) + sizeof(cc_enable_arenas_)); } optimize_for_ = 1; _has_bits_.Clear(); @@ -8470,7 +8512,8 @@ bool FileOptions::MergePartialFromCodedStream( if (::google::protobuf::FileOptions_OptimizeMode_IsValid(value)) { set_optimize_for(static_cast< ::google::protobuf::FileOptions_OptimizeMode >(value)); } else { - mutable_unknown_fields()->AddVarint(9, value); + mutable_unknown_fields()->AddVarint( + 9, static_cast<::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -8859,9 +8902,10 @@ void FileOptions::SerializeWithCachedSizes( } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast(i)), output); } // Extension range [1000, 536870912) @@ -9017,10 +9061,11 @@ void FileOptions::SerializeWithCachedSizes( } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 999, this->uninterpreted_option(i), deterministic, target); + 999, this->uninterpreted_option(static_cast(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -9048,12 +9093,12 @@ size_t FileOptions::ByteSizeLong() const { } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; { - unsigned int count = this->uninterpreted_option_size(); + unsigned int count = static_cast(this->uninterpreted_option_size()); total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->uninterpreted_option(i)); + this->uninterpreted_option(static_cast(i))); } } @@ -10101,15 +10146,16 @@ MessageOptions::MessageOptions(const MessageOptions& from) _internal_metadata_.MergeFrom(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); ::memcpy(&message_set_wire_format_, &from.message_set_wire_format_, - reinterpret_cast(&map_entry_) - - reinterpret_cast(&message_set_wire_format_) + sizeof(map_entry_)); + static_cast(reinterpret_cast(&map_entry_) - + reinterpret_cast(&message_set_wire_format_)) + sizeof(map_entry_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.MessageOptions) } void MessageOptions::SharedCtor() { _cached_size_ = 0; - ::memset(&message_set_wire_format_, 0, reinterpret_cast(&map_entry_) - - reinterpret_cast(&message_set_wire_format_) + sizeof(map_entry_)); + ::memset(&message_set_wire_format_, 0, static_cast( + reinterpret_cast(&map_entry_) - + reinterpret_cast(&message_set_wire_format_)) + sizeof(map_entry_)); } MessageOptions::~MessageOptions() { @@ -10148,8 +10194,9 @@ void MessageOptions::Clear() { _extensions_.Clear(); uninterpreted_option_.Clear(); if (_has_bits_[0 / 32] & 15u) { - ::memset(&message_set_wire_format_, 0, reinterpret_cast(&map_entry_) - - reinterpret_cast(&message_set_wire_format_) + sizeof(map_entry_)); + ::memset(&message_set_wire_format_, 0, static_cast( + reinterpret_cast(&map_entry_) - + reinterpret_cast(&message_set_wire_format_)) + sizeof(map_entry_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -10288,9 +10335,10 @@ void MessageOptions::SerializeWithCachedSizes( } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast(i)), output); } // Extension range [1000, 536870912) @@ -10332,10 +10380,11 @@ void MessageOptions::SerializeWithCachedSizes( } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 999, this->uninterpreted_option(i), deterministic, target); + 999, this->uninterpreted_option(static_cast(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -10363,12 +10412,12 @@ size_t MessageOptions::ByteSizeLong() const { } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; { - unsigned int count = this->uninterpreted_option_size(); + unsigned int count = static_cast(this->uninterpreted_option_size()); total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->uninterpreted_option(i)); + this->uninterpreted_option(static_cast(i))); } } @@ -10647,15 +10696,16 @@ FieldOptions::FieldOptions(const FieldOptions& from) _internal_metadata_.MergeFrom(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); ::memcpy(&ctype_, &from.ctype_, - reinterpret_cast(&jstype_) - - reinterpret_cast(&ctype_) + sizeof(jstype_)); + static_cast(reinterpret_cast(&jstype_) - + reinterpret_cast(&ctype_)) + sizeof(jstype_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldOptions) } void FieldOptions::SharedCtor() { _cached_size_ = 0; - ::memset(&ctype_, 0, reinterpret_cast(&jstype_) - - reinterpret_cast(&ctype_) + sizeof(jstype_)); + ::memset(&ctype_, 0, static_cast( + reinterpret_cast(&jstype_) - + reinterpret_cast(&ctype_)) + sizeof(jstype_)); } FieldOptions::~FieldOptions() { @@ -10694,8 +10744,9 @@ void FieldOptions::Clear() { _extensions_.Clear(); uninterpreted_option_.Clear(); if (_has_bits_[0 / 32] & 63u) { - ::memset(&ctype_, 0, reinterpret_cast(&jstype_) - - reinterpret_cast(&ctype_) + sizeof(jstype_)); + ::memset(&ctype_, 0, static_cast( + reinterpret_cast(&jstype_) - + reinterpret_cast(&ctype_)) + sizeof(jstype_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -10722,7 +10773,8 @@ bool FieldOptions::MergePartialFromCodedStream( if (::google::protobuf::FieldOptions_CType_IsValid(value)) { set_ctype(static_cast< ::google::protobuf::FieldOptions_CType >(value)); } else { - mutable_unknown_fields()->AddVarint(1, value); + mutable_unknown_fields()->AddVarint( + 1, static_cast<::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -10783,7 +10835,8 @@ bool FieldOptions::MergePartialFromCodedStream( if (::google::protobuf::FieldOptions_JSType_IsValid(value)) { set_jstype(static_cast< ::google::protobuf::FieldOptions_JSType >(value)); } else { - mutable_unknown_fields()->AddVarint(6, value); + mutable_unknown_fields()->AddVarint( + 6, static_cast<::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -10884,9 +10937,10 @@ void FieldOptions::SerializeWithCachedSizes( } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast(i)), output); } // Extension range [1000, 536870912) @@ -10940,10 +10994,11 @@ void FieldOptions::SerializeWithCachedSizes( } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 999, this->uninterpreted_option(i), deterministic, target); + 999, this->uninterpreted_option(static_cast(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -10971,12 +11026,12 @@ size_t FieldOptions::ByteSizeLong() const { } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; { - unsigned int count = this->uninterpreted_option_size(); + unsigned int count = static_cast(this->uninterpreted_option_size()); total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->uninterpreted_option(i)); + this->uninterpreted_option(static_cast(i))); } } @@ -11420,9 +11475,10 @@ void OneofOptions::SerializeWithCachedSizes( (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast(i)), output); } // Extension range [1000, 536870912) @@ -11443,10 +11499,11 @@ void OneofOptions::SerializeWithCachedSizes( (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 999, this->uninterpreted_option(i), deterministic, target); + 999, this->uninterpreted_option(static_cast(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -11474,12 +11531,12 @@ size_t OneofOptions::ByteSizeLong() const { } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; { - unsigned int count = this->uninterpreted_option_size(); + unsigned int count = static_cast(this->uninterpreted_option_size()); total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->uninterpreted_option(i)); + this->uninterpreted_option(static_cast(i))); } } @@ -11616,15 +11673,16 @@ EnumOptions::EnumOptions(const EnumOptions& from) _internal_metadata_.MergeFrom(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); ::memcpy(&allow_alias_, &from.allow_alias_, - reinterpret_cast(&deprecated_) - - reinterpret_cast(&allow_alias_) + sizeof(deprecated_)); + static_cast(reinterpret_cast(&deprecated_) - + reinterpret_cast(&allow_alias_)) + sizeof(deprecated_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumOptions) } void EnumOptions::SharedCtor() { _cached_size_ = 0; - ::memset(&allow_alias_, 0, reinterpret_cast(&deprecated_) - - reinterpret_cast(&allow_alias_) + sizeof(deprecated_)); + ::memset(&allow_alias_, 0, static_cast( + reinterpret_cast(&deprecated_) - + reinterpret_cast(&allow_alias_)) + sizeof(deprecated_)); } EnumOptions::~EnumOptions() { @@ -11663,8 +11721,9 @@ void EnumOptions::Clear() { _extensions_.Clear(); uninterpreted_option_.Clear(); if (_has_bits_[0 / 32] & 3u) { - ::memset(&allow_alias_, 0, reinterpret_cast(&deprecated_) - - reinterpret_cast(&allow_alias_) + sizeof(deprecated_)); + ::memset(&allow_alias_, 0, static_cast( + reinterpret_cast(&deprecated_) - + reinterpret_cast(&allow_alias_)) + sizeof(deprecated_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -11765,9 +11824,10 @@ void EnumOptions::SerializeWithCachedSizes( } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast(i)), output); } // Extension range [1000, 536870912) @@ -11799,10 +11859,11 @@ void EnumOptions::SerializeWithCachedSizes( } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 999, this->uninterpreted_option(i), deterministic, target); + 999, this->uninterpreted_option(static_cast(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -11830,12 +11891,12 @@ size_t EnumOptions::ByteSizeLong() const { } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; { - unsigned int count = this->uninterpreted_option_size(); + unsigned int count = static_cast(this->uninterpreted_option_size()); total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->uninterpreted_option(i)); + this->uninterpreted_option(static_cast(i))); } } @@ -12167,9 +12228,10 @@ void EnumValueOptions::SerializeWithCachedSizes( } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast(i)), output); } // Extension range [1000, 536870912) @@ -12196,10 +12258,11 @@ void EnumValueOptions::SerializeWithCachedSizes( } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 999, this->uninterpreted_option(i), deterministic, target); + 999, this->uninterpreted_option(static_cast(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -12227,12 +12290,12 @@ size_t EnumValueOptions::ByteSizeLong() const { } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; { - unsigned int count = this->uninterpreted_option_size(); + unsigned int count = static_cast(this->uninterpreted_option_size()); total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->uninterpreted_option(i)); + this->uninterpreted_option(static_cast(i))); } } @@ -12525,9 +12588,10 @@ void ServiceOptions::SerializeWithCachedSizes( } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast(i)), output); } // Extension range [1000, 536870912) @@ -12554,10 +12618,11 @@ void ServiceOptions::SerializeWithCachedSizes( } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 999, this->uninterpreted_option(i), deterministic, target); + 999, this->uninterpreted_option(static_cast(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -12585,12 +12650,12 @@ size_t ServiceOptions::ByteSizeLong() const { } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; { - unsigned int count = this->uninterpreted_option_size(); + unsigned int count = static_cast(this->uninterpreted_option_size()); total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->uninterpreted_option(i)); + this->uninterpreted_option(static_cast(i))); } } @@ -12760,15 +12825,16 @@ MethodOptions::MethodOptions(const MethodOptions& from) _internal_metadata_.MergeFrom(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); ::memcpy(&deprecated_, &from.deprecated_, - reinterpret_cast(&idempotency_level_) - - reinterpret_cast(&deprecated_) + sizeof(idempotency_level_)); + static_cast(reinterpret_cast(&idempotency_level_) - + reinterpret_cast(&deprecated_)) + sizeof(idempotency_level_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.MethodOptions) } void MethodOptions::SharedCtor() { _cached_size_ = 0; - ::memset(&deprecated_, 0, reinterpret_cast(&idempotency_level_) - - reinterpret_cast(&deprecated_) + sizeof(idempotency_level_)); + ::memset(&deprecated_, 0, static_cast( + reinterpret_cast(&idempotency_level_) - + reinterpret_cast(&deprecated_)) + sizeof(idempotency_level_)); } MethodOptions::~MethodOptions() { @@ -12807,8 +12873,9 @@ void MethodOptions::Clear() { _extensions_.Clear(); uninterpreted_option_.Clear(); if (_has_bits_[0 / 32] & 3u) { - ::memset(&deprecated_, 0, reinterpret_cast(&idempotency_level_) - - reinterpret_cast(&deprecated_) + sizeof(idempotency_level_)); + ::memset(&deprecated_, 0, static_cast( + reinterpret_cast(&idempotency_level_) - + reinterpret_cast(&deprecated_)) + sizeof(idempotency_level_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -12849,7 +12916,8 @@ bool MethodOptions::MergePartialFromCodedStream( if (::google::protobuf::MethodOptions_IdempotencyLevel_IsValid(value)) { set_idempotency_level(static_cast< ::google::protobuf::MethodOptions_IdempotencyLevel >(value)); } else { - mutable_unknown_fields()->AddVarint(34, value); + mutable_unknown_fields()->AddVarint( + 34, static_cast<::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -12915,9 +12983,10 @@ void MethodOptions::SerializeWithCachedSizes( } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast(i)), output); } // Extension range [1000, 536870912) @@ -12950,10 +13019,11 @@ void MethodOptions::SerializeWithCachedSizes( } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 999, this->uninterpreted_option(i), deterministic, target); + 999, this->uninterpreted_option(static_cast(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -12981,12 +13051,12 @@ size_t MethodOptions::ByteSizeLong() const { } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; { - unsigned int count = this->uninterpreted_option_size(); + unsigned int count = static_cast(this->uninterpreted_option_size()); total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->uninterpreted_option(i)); + this->uninterpreted_option(static_cast(i))); } } @@ -13621,8 +13691,8 @@ UninterpretedOption::UninterpretedOption(const UninterpretedOption& from) aggregate_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.aggregate_value_); } ::memcpy(&positive_int_value_, &from.positive_int_value_, - reinterpret_cast(&double_value_) - - reinterpret_cast(&positive_int_value_) + sizeof(double_value_)); + static_cast(reinterpret_cast(&double_value_) - + reinterpret_cast(&positive_int_value_)) + sizeof(double_value_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption) } @@ -13631,8 +13701,9 @@ void UninterpretedOption::SharedCtor() { identifier_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); aggregate_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&positive_int_value_, 0, reinterpret_cast(&double_value_) - - reinterpret_cast(&positive_int_value_) + sizeof(double_value_)); + ::memset(&positive_int_value_, 0, static_cast( + reinterpret_cast(&double_value_) - + reinterpret_cast(&positive_int_value_)) + sizeof(double_value_)); } UninterpretedOption::~UninterpretedOption() { @@ -13687,8 +13758,9 @@ void UninterpretedOption::Clear() { } } if (_has_bits_[0 / 32] & 56u) { - ::memset(&positive_int_value_, 0, reinterpret_cast(&double_value_) - - reinterpret_cast(&positive_int_value_) + sizeof(double_value_)); + ::memset(&positive_int_value_, 0, static_cast( + reinterpret_cast(&double_value_) - + reinterpret_cast(&positive_int_value_)) + sizeof(double_value_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -13831,9 +13903,10 @@ void UninterpretedOption::SerializeWithCachedSizes( (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; - for (unsigned int i = 0, n = this->name_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->name_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->name(i), output); + 2, this->name(static_cast(i)), output); } cached_has_bits = _has_bits_[0]; @@ -13892,10 +13965,11 @@ void UninterpretedOption::SerializeWithCachedSizes( (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; - for (unsigned int i = 0, n = this->name_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->name_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 2, this->name(i), deterministic, target); + 2, this->name(static_cast(i)), deterministic, target); } cached_has_bits = _has_bits_[0]; @@ -13962,12 +14036,12 @@ size_t UninterpretedOption::ByteSizeLong() const { } // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; { - unsigned int count = this->name_size(); + unsigned int count = static_cast(this->name_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->name(i)); + this->name(static_cast(i))); } } @@ -14629,7 +14703,8 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( // repeated int32 path = 1 [packed = true]; if (this->path_size() > 0) { ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); - output->WriteVarint32(_path_cached_byte_size_); + output->WriteVarint32(static_cast<::google::protobuf::uint32>( + _path_cached_byte_size_)); } for (int i = 0, n = this->path_size(); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteInt32NoTag( @@ -14639,7 +14714,8 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( // repeated int32 span = 2 [packed = true]; if (this->span_size() > 0) { ::google::protobuf::internal::WireFormatLite::WriteTag(2, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); - output->WriteVarint32(_span_cached_byte_size_); + output->WriteVarint32(static_cast<::google::protobuf::uint32>( + _span_cached_byte_size_)); } for (int i = 0, n = this->span_size(); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteInt32NoTag( @@ -14697,7 +14773,8 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, target); target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - _path_cached_byte_size_, target); + static_cast<::google::protobuf::uint32>( + _path_cached_byte_size_), target); target = ::google::protobuf::internal::WireFormatLite:: WriteInt32NoTagToArray(this->path_, target); } @@ -14709,7 +14786,8 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, target); target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - _span_cached_byte_size_, target); + static_cast<::google::protobuf::uint32>( + _span_cached_byte_size_), target); target = ::google::protobuf::internal::WireFormatLite:: WriteInt32NoTagToArray(this->span_, target); } @@ -15280,9 +15358,10 @@ void SourceCodeInfo::SerializeWithCachedSizes( (void) cached_has_bits; // repeated .google.protobuf.SourceCodeInfo.Location location = 1; - for (unsigned int i = 0, n = this->location_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->location_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 1, this->location(i), output); + 1, this->location(static_cast(i)), output); } if (_internal_metadata_.have_unknown_fields()) { @@ -15299,10 +15378,11 @@ void SourceCodeInfo::SerializeWithCachedSizes( (void) cached_has_bits; // repeated .google.protobuf.SourceCodeInfo.Location location = 1; - for (unsigned int i = 0, n = this->location_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->location_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 1, this->location(i), deterministic, target); + 1, this->location(static_cast(i)), deterministic, target); } if (_internal_metadata_.have_unknown_fields()) { @@ -15324,12 +15404,12 @@ size_t SourceCodeInfo::ByteSizeLong() const { } // repeated .google.protobuf.SourceCodeInfo.Location location = 1; { - unsigned int count = this->location_size(); + unsigned int count = static_cast(this->location_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->location(i)); + this->location(static_cast(i))); } } @@ -15463,16 +15543,17 @@ GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeIn source_file_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.source_file_); } ::memcpy(&begin_, &from.begin_, - reinterpret_cast(&end_) - - reinterpret_cast(&begin_) + sizeof(end_)); + static_cast(reinterpret_cast(&end_) - + reinterpret_cast(&begin_)) + sizeof(end_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo.Annotation) } void GeneratedCodeInfo_Annotation::SharedCtor() { _cached_size_ = 0; source_file_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&begin_, 0, reinterpret_cast(&end_) - - reinterpret_cast(&begin_) + sizeof(end_)); + ::memset(&begin_, 0, static_cast( + reinterpret_cast(&end_) - + reinterpret_cast(&begin_)) + sizeof(end_)); } GeneratedCodeInfo_Annotation::~GeneratedCodeInfo_Annotation() { @@ -15515,8 +15596,9 @@ void GeneratedCodeInfo_Annotation::Clear() { (*source_file_.UnsafeRawStringPointer())->clear(); } if (_has_bits_[0 / 32] & 6u) { - ::memset(&begin_, 0, reinterpret_cast(&end_) - - reinterpret_cast(&begin_) + sizeof(end_)); + ::memset(&begin_, 0, static_cast( + reinterpret_cast(&end_) - + reinterpret_cast(&begin_)) + sizeof(end_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -15625,7 +15707,8 @@ void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes( // repeated int32 path = 1 [packed = true]; if (this->path_size() > 0) { ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); - output->WriteVarint32(_path_cached_byte_size_); + output->WriteVarint32(static_cast<::google::protobuf::uint32>( + _path_cached_byte_size_)); } for (int i = 0, n = this->path_size(); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteInt32NoTag( @@ -15673,7 +15756,8 @@ void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, target); target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - _path_cached_byte_size_, target); + static_cast<::google::protobuf::uint32>( + _path_cached_byte_size_), target); target = ::google::protobuf::internal::WireFormatLite:: WriteInt32NoTagToArray(this->path_, target); } @@ -16102,9 +16186,10 @@ void GeneratedCodeInfo::SerializeWithCachedSizes( (void) cached_has_bits; // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; - for (unsigned int i = 0, n = this->annotation_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->annotation_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 1, this->annotation(i), output); + 1, this->annotation(static_cast(i)), output); } if (_internal_metadata_.have_unknown_fields()) { @@ -16121,10 +16206,11 @@ void GeneratedCodeInfo::SerializeWithCachedSizes( (void) cached_has_bits; // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; - for (unsigned int i = 0, n = this->annotation_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->annotation_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 1, this->annotation(i), deterministic, target); + 1, this->annotation(static_cast(i)), deterministic, target); } if (_internal_metadata_.have_unknown_fields()) { @@ -16146,12 +16232,12 @@ size_t GeneratedCodeInfo::ByteSizeLong() const { } // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; { - unsigned int count = this->annotation_size(); + unsigned int count = static_cast(this->annotation_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->annotation(i)); + this->annotation(static_cast(i))); } } diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc index ae1a5e08..1933c6d2 100644 --- a/src/google/protobuf/duration.pb.cc +++ b/src/google/protobuf/duration.pb.cc @@ -164,14 +164,15 @@ Duration::Duration(const Duration& from) _cached_size_(0) { _internal_metadata_.MergeFrom(from._internal_metadata_); ::memcpy(&seconds_, &from.seconds_, - reinterpret_cast(&nanos_) - - reinterpret_cast(&seconds_) + sizeof(nanos_)); + static_cast(reinterpret_cast(&nanos_) - + reinterpret_cast(&seconds_)) + sizeof(nanos_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.Duration) } void Duration::SharedCtor() { - ::memset(&seconds_, 0, reinterpret_cast(&nanos_) - - reinterpret_cast(&seconds_) + sizeof(nanos_)); + ::memset(&seconds_, 0, static_cast( + reinterpret_cast(&nanos_) - + reinterpret_cast(&seconds_)) + sizeof(nanos_)); _cached_size_ = 0; } @@ -215,8 +216,9 @@ Duration* Duration::New(::google::protobuf::Arena* arena) const { void Duration::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Duration) - ::memset(&seconds_, 0, reinterpret_cast(&nanos_) - - reinterpret_cast(&seconds_) + sizeof(nanos_)); + ::memset(&seconds_, 0, static_cast( + reinterpret_cast(&nanos_) - + reinterpret_cast(&seconds_)) + sizeof(nanos_)); } bool Duration::MergePartialFromCodedStream( diff --git a/src/google/protobuf/dynamic_message.h b/src/google/protobuf/dynamic_message.h index 816170ea..eed8e5bd 100644 --- a/src/google/protobuf/dynamic_message.h +++ b/src/google/protobuf/dynamic_message.h @@ -156,20 +156,20 @@ class LIBPROTOBUF_EXPORT DynamicMapSorter { int map_size, const Reflection* reflection, const FieldDescriptor* field) { - std::vector result(map_size); + std::vector result(static_cast(map_size)); const RepeatedPtrField& map_field = reflection->GetRepeatedPtrField(message, field); - int i = 0; + size_t i = 0; for (RepeatedPtrField::const_pointer_iterator it = map_field.pointer_begin(); it != map_field.pointer_end(); ) { result[i++] = *it++; } - GOOGLE_DCHECK_EQ(result.size(), static_cast(i)); + GOOGLE_DCHECK_EQ(result.size(), i); MapEntryMessageComparator comparator(field->message_type()); std::sort(result.begin(), result.end(), comparator); // Complain if the keys aren't in ascending order. #ifndef NDEBUG - for (int j = 1; j < map_size; j++) { + for (size_t j = 1; j < static_cast(map_size); j++) { if (!comparator(result[j - 1], result[j])) { GOOGLE_LOG(ERROR) << (comparator(result[j], result[j - 1]) ? "internal error in map key sorting" : diff --git a/src/google/protobuf/generated_message_reflection.h b/src/google/protobuf/generated_message_reflection.h index abeb3d55..6045b3aa 100644 --- a/src/google/protobuf/generated_message_reflection.h +++ b/src/google/protobuf/generated_message_reflection.h @@ -129,7 +129,7 @@ class WeakFieldMap; // weak_field_map.h struct ReflectionSchema { public: // Size of a google::protobuf::Message object of this type. - uint32 GetObjectSize() const { return object_size_; } + uint32 GetObjectSize() const { return static_cast(object_size_); } // 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. @@ -141,8 +141,9 @@ struct ReflectionSchema { // Offset of any field. uint32 GetFieldOffset(const FieldDescriptor* field) const { if (field->containing_oneof()) { - size_t offset = field->containing_type()->field_count() + - field->containing_oneof()->index(); + size_t offset = + static_cast(field->containing_type()->field_count() + + field->containing_oneof()->index()); return offsets_[offset]; } else { return GetFieldOffsetNonOneof(field); @@ -150,8 +151,9 @@ struct ReflectionSchema { } uint32 GetOneofCaseOffset(const OneofDescriptor* oneof_descriptor) const { - return oneof_case_offset_ + - static_cast(oneof_descriptor->index() * sizeof(uint32)); + return static_cast(oneof_case_offset_) + + static_cast( + static_cast(oneof_descriptor->index()) * sizeof(uint32)); } bool HasHasbits() const { return has_bits_offset_ != -1; } @@ -165,7 +167,7 @@ struct ReflectionSchema { // Byte offset of the hasbits array. uint32 HasBitsOffset() const { GOOGLE_DCHECK(HasHasbits()); - return has_bits_offset_; + return static_cast(has_bits_offset_); } // The offset of the InternalMetadataWithArena member. @@ -173,7 +175,7 @@ struct ReflectionSchema { // The schema doesn't contain enough information to distinguish between // these two cases. uint32 GetMetadataOffset() const { - return metadata_offset_; + return static_cast(metadata_offset_); } // Whether this message has an ExtensionSet. @@ -182,7 +184,7 @@ struct ReflectionSchema { // The offset of the ExtensionSet in this message. uint32 GetExtensionSetOffset() const { GOOGLE_DCHECK(HasExtensionSet()); - return extensions_offset_; + return static_cast(extensions_offset_); } // The off set of WeakFieldMap when the message contains weak fields. diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index e5a32c5c..28eaf031 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -158,7 +158,7 @@ class Map { private: void Init() { - elements_ = Arena::Create(arena_, 0, hasher(), Allocator(arena_)); + elements_ = Arena::Create(arena_, 0u, hasher(), Allocator(arena_)); } // re-implement std::allocator to use arena allocator for memory allocation. diff --git a/src/google/protobuf/map_entry_lite.h b/src/google/protobuf/map_entry_lite.h index 7aad9a1c..15104490 100644 --- a/src/google/protobuf/map_entry_lite.h +++ b/src/google/protobuf/map_entry_lite.h @@ -226,8 +226,10 @@ class MapEntryImpl : public Base { size_t ByteSizeLong() const { size_t size = 0; - size += has_key() ? kTagSize + KeyTypeHandler::ByteSize(key()) : 0; - size += has_value() ? kTagSize + ValueTypeHandler::ByteSize(value()) : 0; + size += has_key() ? + kTagSize + static_cast(KeyTypeHandler::ByteSize(key())) : 0; + size += has_value() ? + kTagSize + static_cast(ValueTypeHandler::ByteSize(value())) : 0; return size; } @@ -250,11 +252,10 @@ class MapEntryImpl : public Base { int GetCachedSize() const { int size = 0; size += has_key() - ? static_cast(kTagSize + KeyTypeHandler::GetCachedSize(key())) + ? static_cast(kTagSize) + KeyTypeHandler::GetCachedSize(key()) : 0; size += has_value() - ? static_cast(kTagSize + ValueTypeHandler::GetCachedSize( - value())) + ? static_cast(kTagSize) + ValueTypeHandler::GetCachedSize(value()) : 0; return size; } diff --git a/src/google/protobuf/map_type_handler.h b/src/google/protobuf/map_type_handler.h index 990136ff..aa365991 100644 --- a/src/google/protobuf/map_type_handler.h +++ b/src/google/protobuf/map_type_handler.h @@ -321,7 +321,8 @@ inline int MapTypeHandler::GetCachedSize( const MapEntryAccessorType& value) { return static_cast( - WireFormatLite::LengthDelimitedSize(value.GetCachedSize())); + WireFormatLite::LengthDelimitedSize( + static_cast(value.GetCachedSize()))); } #define GET_CACHED_SIZE(FieldType, DeclaredType) \ diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index a1013f63..02ee3cc9 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -1335,7 +1335,7 @@ void RepeatedField::Reserve(int new_size) { static_cast(new_size), (std::numeric_limits::max() - kRepHeaderSize) / sizeof(Element)) << "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(new_size); if (arena == NULL) { rep_ = static_cast(::operator new(bytes)); } else { @@ -1399,7 +1399,7 @@ void ElementCopier::operator()( template struct ElementCopier { void operator()(Element* to, const Element* from, int array_size) { - memcpy(to, from, array_size * sizeof(Element)); + memcpy(to, from, static_cast(array_size) * sizeof(Element)); } }; @@ -1651,7 +1651,7 @@ inline void RepeatedPtrFieldBase::SwapElements(int index1, int index2) { template inline size_t RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong() const { - size_t allocated_bytes = total_size_ * sizeof(void*); + size_t allocated_bytes = static_cast(total_size_) * sizeof(void*); if (rep_ != NULL) { for (int i = 0; i < rep_->allocated_size; ++i) { allocated_bytes += TypeHandler::SpaceUsedLong( diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc index 3905d891..26684c57 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -400,19 +400,19 @@ void Struct::SerializeWithCachedSizes( for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator it = this->fields().begin(); it != this->fields().end(); ++it, ++n) { - items[n] = SortItem(&*it); + items[static_cast(n)] = SortItem(&*it); } - ::std::sort(&items[0], &items[n], Less()); + ::std::sort(&items[0], &items[static_cast(n)], Less()); ::google::protobuf::scoped_ptr entry; for (size_type i = 0; i < n; i++) { entry.reset(fields_.NewEntryWrapper( - items[i]->first, items[i]->second)); + items[static_cast(i)]->first, items[static_cast(i)]->second)); ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 1, *entry, output); if (entry->GetArena() != NULL) { entry.release(); } - Utf8Check::Check(items[i]); + Utf8Check::Check(items[static_cast(i)]); } } else { ::google::protobuf::scoped_ptr entry; @@ -464,13 +464,13 @@ void Struct::SerializeWithCachedSizes( for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator it = this->fields().begin(); it != this->fields().end(); ++it, ++n) { - items[n] = SortItem(&*it); + items[static_cast(n)] = SortItem(&*it); } - ::std::sort(&items[0], &items[n], Less()); + ::std::sort(&items[0], &items[static_cast(n)], Less()); ::google::protobuf::scoped_ptr entry; for (size_type i = 0; i < n; i++) { entry.reset(fields_.NewEntryWrapper( - items[i]->first, items[i]->second)); + items[static_cast(i)]->first, items[static_cast(i)]->second)); target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( 1, *entry, deterministic, target); @@ -478,7 +478,7 @@ void Struct::SerializeWithCachedSizes( if (entry->GetArena() != NULL) { entry.release(); } - Utf8Check::Check(items[i]); + Utf8Check::Check(items[static_cast(i)]); } } else { ::google::protobuf::scoped_ptr entry; @@ -1673,9 +1673,10 @@ void ListValue::SerializeWithCachedSizes( (void) cached_has_bits; // 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(this->values_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 1, this->values(i), output); + 1, this->values(static_cast(i)), output); } // @@protoc_insertion_point(serialize_end:google.protobuf.ListValue) @@ -1688,10 +1689,11 @@ void ListValue::SerializeWithCachedSizes( (void) cached_has_bits; // 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(this->values_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 1, this->values(i), deterministic, target); + 1, this->values(static_cast(i)), deterministic, target); } // @@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; { - unsigned int count = this->values_size(); + unsigned int count = static_cast(this->values_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->values(i)); + this->values(static_cast(i))); } } diff --git a/src/google/protobuf/stubs/fastmem.h b/src/google/protobuf/stubs/fastmem.h index 763a6e60..1f1f6ed3 100644 --- a/src/google/protobuf/stubs/fastmem.h +++ b/src/google/protobuf/stubs/fastmem.h @@ -111,7 +111,8 @@ inline int fastmemcmp_inlined(const char *a, const char *b, size_t n) { b += sizeof(uint32); } while (a < a_limit) { - int d = static_cast(*a++) - static_cast(*b++); + int d = + static_cast(static_cast(*a++) - static_cast(*b++)); if (d) return d; } return 0; diff --git a/src/google/protobuf/stubs/hash.h b/src/google/protobuf/stubs/hash.h index be998b29..a997e04b 100644 --- a/src/google/protobuf/stubs/hash.h +++ b/src/google/protobuf/stubs/hash.h @@ -348,7 +348,7 @@ struct hash { inline size_t operator()(const char* str) const { size_t result = 0; for (; *str != '\0'; str++) { - result = 5 * result + *str; + result = 5 * result + static_cast(*str); } return result; } diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h index 0afd55d7..7879aed4 100644 --- a/src/google/protobuf/stubs/port.h +++ b/src/google/protobuf/stubs/port.h @@ -354,7 +354,7 @@ class Bits { public: static uint32 Log2FloorNonZero(uint32 n) { #if defined(__GNUC__) - return 31 ^ __builtin_clz(n); + return 31 ^ static_cast(__builtin_clz(n)); #elif defined(COMPILER_MSVC) && defined(_M_IX86) _asm { bsr ebx, n @@ -373,7 +373,7 @@ class Bits { // To work around this, when we build for NaCl we use the portable // implementation instead. #if defined(__GNUC__) && !defined(GOOGLE_PROTOBUF_OS_NACL) - return 63 ^ __builtin_clzll(n); + return 63 ^ static_cast(__builtin_clzll(n)); #else return Log2FloorNonZero64_Portable(n); #endif @@ -400,9 +400,9 @@ class Bits { const uint32 topbits = static_cast(n >> 32); if (topbits == 0) { // Top bits are zero, so scan in bottom bits - return Log2FloorNonZero(static_cast(n)); + return static_cast(Log2FloorNonZero(static_cast(n))); } else { - return 32 + Log2FloorNonZero(topbits); + return 32 + static_cast(Log2FloorNonZero(topbits)); } } }; diff --git a/src/google/protobuf/stubs/stringpiece.h b/src/google/protobuf/stubs/stringpiece.h index 8910688b..563ff75d 100644 --- a/src/google/protobuf/stubs/stringpiece.h +++ b/src/google/protobuf/stubs/stringpiece.h @@ -292,7 +292,7 @@ class LIBPROTOBUF_EXPORT StringPiece { int compare(StringPiece x) const { const stringpiece_ssize_type min_size = length_ < x.length_ ? length_ : x.length_; - int r = memcmp(ptr_, x.ptr_, min_size); + int r = memcmp(ptr_, x.ptr_, static_cast(min_size)); if (r < 0) return -1; if (r > 0) return 1; if (length_ < x.length_) return -1; @@ -310,7 +310,7 @@ class LIBPROTOBUF_EXPORT StringPiece { // "as_string()" method defined here for existing code. string ToString() const { if (ptr_ == NULL) return string(); - return string(data(), size()); + return string(data(), static_cast(size())); } operator string() const { @@ -321,12 +321,14 @@ class LIBPROTOBUF_EXPORT StringPiece { void AppendToString(string* target) 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(x.length_)) == 0); } bool ends_with(StringPiece x) const { return ((length_ >= x.length_) && - (memcmp(ptr_ + (length_-x.length_), x.ptr_, x.length_) == 0)); + (memcmp(ptr_ + (length_-x.length_), x.ptr_, + static_cast(x.length_)) == 0)); } // 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 || - memcmp(x.data(), y.data(), len) == 0; + memcmp(x.data(), y.data(), static_cast(len)) == 0; } 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) { const stringpiece_ssize_type min_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(min_size)); return (r < 0) || (r == 0 && x.size() < y.size()); } @@ -458,7 +460,9 @@ struct StringPiecePod { return size_; } - std::string ToString() const { return std::string(data_, size_); } + std::string ToString() const { + return std::string(data_, static_cast(size_)); + } private: const char* data_; stringpiece_ssize_type size_; @@ -473,7 +477,7 @@ template<> struct hash { size_t operator()(const StringPiece& s) const { size_t result = 0; for (const char *str = s.data(), *end = str + s.size(); str < end; str++) { - result = 5 * result + *str; + result = 5 * result + static_cast(*str); } return result; } diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc index b2fe28a4..80ddc5bf 100644 --- a/src/google/protobuf/timestamp.pb.cc +++ b/src/google/protobuf/timestamp.pb.cc @@ -164,14 +164,15 @@ Timestamp::Timestamp(const Timestamp& from) _cached_size_(0) { _internal_metadata_.MergeFrom(from._internal_metadata_); ::memcpy(&seconds_, &from.seconds_, - reinterpret_cast(&nanos_) - - reinterpret_cast(&seconds_) + sizeof(nanos_)); + static_cast(reinterpret_cast(&nanos_) - + reinterpret_cast(&seconds_)) + sizeof(nanos_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.Timestamp) } void Timestamp::SharedCtor() { - ::memset(&seconds_, 0, reinterpret_cast(&nanos_) - - reinterpret_cast(&seconds_) + sizeof(nanos_)); + ::memset(&seconds_, 0, static_cast( + reinterpret_cast(&nanos_) - + reinterpret_cast(&seconds_)) + sizeof(nanos_)); _cached_size_ = 0; } @@ -215,8 +216,9 @@ Timestamp* Timestamp::New(::google::protobuf::Arena* arena) const { void Timestamp::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Timestamp) - ::memset(&seconds_, 0, reinterpret_cast(&nanos_) - - reinterpret_cast(&seconds_) + sizeof(nanos_)); + ::memset(&seconds_, 0, static_cast( + reinterpret_cast(&nanos_) - + reinterpret_cast(&seconds_)) + sizeof(nanos_)); } bool Timestamp::MergePartialFromCodedStream( diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index 0344a6a1..8a53d76a 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -437,8 +437,9 @@ Type::Type(const Type& from) void Type::SharedCtor() { name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&source_context_, 0, reinterpret_cast(&syntax_) - - reinterpret_cast(&source_context_) + sizeof(syntax_)); + ::memset(&source_context_, 0, static_cast( + reinterpret_cast(&syntax_) - + reinterpret_cast(&source_context_)) + sizeof(syntax_)); _cached_size_ = 0; } @@ -629,9 +630,10 @@ void Type::SerializeWithCachedSizes( } // 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(this->fields_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->fields(i), output); + 2, this->fields(static_cast(i)), output); } // repeated string oneofs = 3; @@ -645,9 +647,10 @@ void Type::SerializeWithCachedSizes( } // 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(this->options_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 4, this->options(i), output); + 4, this->options(static_cast(i)), output); } // .google.protobuf.SourceContext source_context = 5; @@ -683,10 +686,11 @@ void Type::SerializeWithCachedSizes( } // 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(this->fields_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 2, this->fields(i), deterministic, target); + 2, this->fields(static_cast(i)), deterministic, target); } // repeated string oneofs = 3; @@ -700,10 +704,11 @@ void Type::SerializeWithCachedSizes( } // 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(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 4, this->options(i), deterministic, target); + 4, this->options(static_cast(i)), deterministic, target); } // .google.protobuf.SourceContext source_context = 5; @@ -729,12 +734,12 @@ size_t Type::ByteSizeLong() const { // repeated .google.protobuf.Field fields = 2; { - unsigned int count = this->fields_size(); + unsigned int count = static_cast(this->fields_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->fields(i)); + this->fields(static_cast(i))); } } @@ -748,12 +753,12 @@ size_t Type::ByteSizeLong() const { // repeated .google.protobuf.Option options = 4; { - unsigned int count = this->options_size(); + unsigned int count = static_cast(this->options_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->options(i)); + this->options(static_cast(i))); } } @@ -1199,8 +1204,8 @@ Field::Field(const Field& from) GetArenaNoVirtual()); } ::memcpy(&kind_, &from.kind_, - reinterpret_cast(&packed_) - - reinterpret_cast(&kind_) + sizeof(packed_)); + static_cast(reinterpret_cast(&packed_) - + reinterpret_cast(&kind_)) + sizeof(packed_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.Field) } @@ -1209,8 +1214,9 @@ void Field::SharedCtor() { type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); json_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); default_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&kind_, 0, reinterpret_cast(&packed_) - - reinterpret_cast(&kind_) + sizeof(packed_)); + ::memset(&kind_, 0, static_cast( + reinterpret_cast(&packed_) - + reinterpret_cast(&kind_)) + sizeof(packed_)); _cached_size_ = 0; } @@ -1263,8 +1269,9 @@ void Field::Clear() { type_url_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); json_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); default_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); - ::memset(&kind_, 0, reinterpret_cast(&packed_) - - reinterpret_cast(&kind_) + sizeof(packed_)); + ::memset(&kind_, 0, static_cast( + reinterpret_cast(&packed_) - + reinterpret_cast(&kind_)) + sizeof(packed_)); } bool Field::MergePartialFromCodedStream( @@ -1500,9 +1507,10 @@ void Field::SerializeWithCachedSizes( } // 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(this->options_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 9, this->options(i), output); + 9, this->options(static_cast(i)), output); } // string json_name = 10; @@ -1584,10 +1592,11 @@ void Field::SerializeWithCachedSizes( } // 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(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 9, this->options(i), deterministic, target); + 9, this->options(static_cast(i)), deterministic, target); } // string json_name = 10; @@ -1622,12 +1631,12 @@ size_t Field::ByteSizeLong() const { // repeated .google.protobuf.Option options = 9; { - unsigned int count = this->options_size(); + unsigned int count = static_cast(this->options_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->options(i)); + this->options(static_cast(i))); } } @@ -2264,8 +2273,9 @@ Enum::Enum(const Enum& from) void Enum::SharedCtor() { name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&source_context_, 0, reinterpret_cast(&syntax_) - - reinterpret_cast(&source_context_) + sizeof(syntax_)); + ::memset(&source_context_, 0, static_cast( + reinterpret_cast(&syntax_) - + reinterpret_cast(&source_context_)) + sizeof(syntax_)); _cached_size_ = 0; } @@ -2438,15 +2448,17 @@ void Enum::SerializeWithCachedSizes( } // 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(this->enumvalue_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->enumvalue(i), output); + 2, this->enumvalue(static_cast(i)), output); } // 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(this->options_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 3, this->options(i), output); + 3, this->options(static_cast(i)), output); } // .google.protobuf.SourceContext source_context = 4; @@ -2482,17 +2494,19 @@ void Enum::SerializeWithCachedSizes( } // 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(this->enumvalue_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 2, this->enumvalue(i), deterministic, target); + 2, this->enumvalue(static_cast(i)), deterministic, target); } // 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(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 3, this->options(i), deterministic, target); + 3, this->options(static_cast(i)), deterministic, target); } // .google.protobuf.SourceContext source_context = 4; @@ -2518,23 +2532,23 @@ size_t Enum::ByteSizeLong() const { // repeated .google.protobuf.EnumValue enumvalue = 2; { - unsigned int count = this->enumvalue_size(); + unsigned int count = static_cast(this->enumvalue_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->enumvalue(i)); + this->enumvalue(static_cast(i))); } } // repeated .google.protobuf.Option options = 3; { - unsigned int count = this->options_size(); + unsigned int count = static_cast(this->options_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->options(i)); + this->options(static_cast(i))); } } @@ -3037,9 +3051,10 @@ void EnumValue::SerializeWithCachedSizes( } // 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(this->options_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 3, this->options(i), output); + 3, this->options(static_cast(i)), output); } // @@protoc_insertion_point(serialize_end:google.protobuf.EnumValue) @@ -3068,10 +3083,11 @@ void EnumValue::SerializeWithCachedSizes( } // 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(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 3, this->options(i), deterministic, target); + 3, this->options(static_cast(i)), deterministic, target); } // @@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; { - unsigned int count = this->options_size(); + unsigned int count = static_cast(this->options_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->options(i)); + this->options(static_cast(i))); } } diff --git a/src/google/protobuf/unknown_field_set.h b/src/google/protobuf/unknown_field_set.h index 002ea8e8..beb4c9ec 100644 --- a/src/google/protobuf/unknown_field_set.h +++ b/src/google/protobuf/unknown_field_set.h @@ -282,10 +282,10 @@ inline int UnknownFieldSet::field_count() const { } inline const UnknownField& UnknownFieldSet::field(int index) const { GOOGLE_DCHECK(fields_ != NULL); - return (*fields_)[index]; + return (*fields_)[static_cast(index)]; } inline UnknownField* UnknownFieldSet::mutable_field(int index) { - return &(*fields_)[index]; + return &(*fields_)[static_cast(index)]; } 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(number_); } inline UnknownField::Type UnknownField::type() const { return static_cast(type_); } diff --git a/src/google/protobuf/wire_format_lite.h b/src/google/protobuf/wire_format_lite.h index ce55f266..56c6f7fc 100644 --- a/src/google/protobuf/wire_format_lite.h +++ b/src/google/protobuf/wire_format_lite.h @@ -787,7 +787,7 @@ inline int WireFormatLite::GetTagFieldNumber(uint32 tag) { inline size_t WireFormatLite::TagSize(int field_number, WireFormatLite::FieldType type) { size_t result = io::CodedOutputStream::VarintSize32( - field_number << kTagTypeBits); + static_cast(field_number << kTagTypeBits)); if (type == TYPE_GROUP) { // Groups have both a start and an end tag. return result * 2; @@ -846,20 +846,20 @@ inline double WireFormatLite::DecodeDouble(uint64 value) { inline uint32 WireFormatLite::ZigZagEncode32(int32 n) { // Note: the right-shift must be arithmetic - return (static_cast(n) << 1) ^ (n >> 31); + return static_cast((n << 1) ^ (n >> 31)); } inline int32 WireFormatLite::ZigZagDecode32(uint32 n) { - return (n >> 1) ^ -static_cast(n & 1); + return static_cast(n >> 1) ^ -static_cast(n & 1); } inline uint64 WireFormatLite::ZigZagEncode64(int64 n) { // Note: the right-shift must be arithmetic - return (static_cast(n) << 1) ^ (n >> 63); + return static_cast((n << 1) ^ (n >> 63)); } inline int64 WireFormatLite::ZigZagDecode64(uint64 n) { - return (n >> 1) ^ -static_cast(n & 1); + return static_cast(n >> 1) ^ -static_cast(n & 1); } // String is for UTF-8 text only, but, even so, ReadString() can simply diff --git a/src/google/protobuf/wire_format_lite_inl.h b/src/google/protobuf/wire_format_lite_inl.h index f7b98d1d..c044def8 100644 --- a/src/google/protobuf/wire_format_lite_inl.h +++ b/src/google/protobuf/wire_format_lite_inl.h @@ -696,7 +696,7 @@ inline uint8* WireFormatLite::WriteFixedNoTagToArray( const T* ii = value.unsafe_data(); const int bytes = n * static_cast(sizeof(ii[0])); - memcpy(target, ii, bytes); + memcpy(target, ii, static_cast(bytes)); return target + bytes; #else return WritePrimitiveNoTagToArray(value, Writer, target); @@ -954,7 +954,7 @@ inline uint8* WireFormatLite::InternalWriteMessageToArray( uint8* target) { target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target); target = io::CodedOutputStream::WriteVarint32ToArray( - value.GetCachedSize(), target); + static_cast(value.GetCachedSize()), target); return value.InternalSerializeWithCachedSizesToArray(deterministic, target); } @@ -975,7 +975,9 @@ inline uint8* WireFormatLite::InternalWriteMessageNoVirtualToArray( bool deterministic, uint8* target) { target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target); target = io::CodedOutputStream::WriteVarint32ToArray( - value.MessageType_WorkAroundCppLookupDefect::GetCachedSize(), target); + static_cast( + value.MessageType_WorkAroundCppLookupDefect::GetCachedSize()), + target); return value.MessageType_WorkAroundCppLookupDefect:: InternalSerializeWithCachedSizesToArray(deterministic, target); } -- cgit v1.2.3 From d3bbf1c8a98fe01c115f525c516e575d87c11a47 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Thu, 13 Jul 2017 11:20:11 -0700 Subject: Add space between arrow and casted type (#3353) --- src/google/protobuf/compiler/cpp/cpp_enum_field.cc | 18 ++++++------- .../protobuf/compiler/cpp/cpp_primitive_field.cc | 6 ++--- src/google/protobuf/descriptor.pb.cc | 30 +++++++++++----------- 3 files changed, 27 insertions(+), 27 deletions(-) (limited to 'src/google/protobuf/compiler/cpp') diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc index 0d3fdcbe..960730ca 100644 --- a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc @@ -144,13 +144,13 @@ GenerateMergeFromCodedStream(io::Printer* printer) const { printer->Print(variables_, "} else {\n" " mutable_unknown_fields()->AddVarint(\n" - " $number$, static_cast<::google::protobuf::uint64>(value));\n"); + " $number$, static_cast< ::google::protobuf::uint64>(value));\n"); } else { printer->Print( "} else {\n" " unknown_fields_stream.WriteVarint32($tag$u);\n" " unknown_fields_stream.WriteVarint32(\n" - " static_cast<::google::protobuf::uint32>(value));\n", + " static_cast< ::google::protobuf::uint32>(value));\n", "tag", SimpleItoa(internal::WireFormat::MakeTag(descriptor_))); } printer->Print(variables_, @@ -347,13 +347,13 @@ GenerateMergeFromCodedStream(io::Printer* printer) const { printer->Print(variables_, "} else {\n" " mutable_unknown_fields()->AddVarint(\n" - " $number$, static_cast<::google::protobuf::uint64>(value));\n"); + " $number$, static_cast< ::google::protobuf::uint64>(value));\n"); } else { printer->Print( "} else {\n" " unknown_fields_stream.WriteVarint32(tag);\n" " unknown_fields_stream.WriteVarint32(\n" - " static_cast<::google::protobuf::uint32>(value));\n"); + " static_cast< ::google::protobuf::uint32>(value));\n"); } printer->Print("}\n"); } @@ -412,12 +412,12 @@ GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const { if (UseUnknownFieldSet(descriptor_->file(), options_)) { printer->Print(variables_, " mutable_unknown_fields()->AddVarint(\n" - " $number$, static_cast<::google::protobuf::uint64>(value));\n"); + " $number$, static_cast< ::google::protobuf::uint64>(value));\n"); } else { printer->Print(variables_, " unknown_fields_stream.WriteVarint32(tag);\n" " unknown_fields_stream.WriteVarint32(\n" - " static_cast<::google::protobuf::uint32>(value));\n"); + " static_cast< ::google::protobuf::uint32>(value));\n"); } printer->Print( " }\n"); @@ -439,7 +439,7 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const { " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" " output);\n" " output->WriteVarint32(\n" - " static_cast<::google::protobuf::uint32>(_$name$_cached_byte_size_));\n" + " static_cast< ::google::protobuf::uint32>(_$name$_cached_byte_size_));\n" "}\n"); } printer->Print(variables_, @@ -467,7 +467,7 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" " target);\n" " target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(" - " static_cast<::google::protobuf::uint32>(\n" + " static_cast< ::google::protobuf::uint32>(\n" " _$name$_cached_byte_size_), target);\n" " target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(\n" " this->$name$_, target);\n" @@ -497,7 +497,7 @@ GenerateByteSize(io::Printer* printer) const { "if (data_size > 0) {\n" " total_size += $tag_size$ +\n" " ::google::protobuf::internal::WireFormatLite::Int32Size(\n" - " static_cast(data_size));\n" + " static_cast< ::google::protobuf::int32>(data_size));\n" "}\n" "int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);\n" "GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n" diff --git a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc index 83bc096f..e45f35b3 100644 --- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc @@ -382,7 +382,7 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const { "$number$, " "::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, " "output);\n" - " output->WriteVarint32(static_cast<::google::protobuf::uint32>(\n" + " output->WriteVarint32(static_cast< ::google::protobuf::uint32>(\n" " _$name$_cached_byte_size_));\n"); if (FixedSize(descriptor_->type()) > 0) { @@ -423,7 +423,7 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" " target);\n" " target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(\n" - " static_cast<::google::protobuf::uint32>(\n" + " static_cast< ::google::protobuf::uint32>(\n" " _$name$_cached_byte_size_), target);\n" " target = ::google::protobuf::internal::WireFormatLite::\n" " Write$declared_type$NoTagToArray(this->$name$_, target);\n" @@ -455,7 +455,7 @@ GenerateByteSize(io::Printer* printer) const { "if (data_size > 0) {\n" " total_size += $tag_size$ +\n" " ::google::protobuf::internal::WireFormatLite::Int32Size(\n" - " static_cast(data_size));\n" + " static_cast< ::google::protobuf::int32>(data_size));\n" "}\n" "int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);\n" "GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n" diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 6e4e4088..48a256dd 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -4565,7 +4565,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( set_label(static_cast< ::google::protobuf::FieldDescriptorProto_Label >(value)); } else { mutable_unknown_fields()->AddVarint( - 4, static_cast<::google::protobuf::uint64>(value)); + 4, static_cast< ::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -4585,7 +4585,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( set_type(static_cast< ::google::protobuf::FieldDescriptorProto_Type >(value)); } else { mutable_unknown_fields()->AddVarint( - 5, static_cast<::google::protobuf::uint64>(value)); + 5, static_cast< ::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -8513,7 +8513,7 @@ bool FileOptions::MergePartialFromCodedStream( set_optimize_for(static_cast< ::google::protobuf::FileOptions_OptimizeMode >(value)); } else { mutable_unknown_fields()->AddVarint( - 9, static_cast<::google::protobuf::uint64>(value)); + 9, static_cast< ::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -10774,7 +10774,7 @@ bool FieldOptions::MergePartialFromCodedStream( set_ctype(static_cast< ::google::protobuf::FieldOptions_CType >(value)); } else { mutable_unknown_fields()->AddVarint( - 1, static_cast<::google::protobuf::uint64>(value)); + 1, static_cast< ::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -10836,7 +10836,7 @@ bool FieldOptions::MergePartialFromCodedStream( set_jstype(static_cast< ::google::protobuf::FieldOptions_JSType >(value)); } else { mutable_unknown_fields()->AddVarint( - 6, static_cast<::google::protobuf::uint64>(value)); + 6, static_cast< ::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -12917,7 +12917,7 @@ bool MethodOptions::MergePartialFromCodedStream( set_idempotency_level(static_cast< ::google::protobuf::MethodOptions_IdempotencyLevel >(value)); } else { mutable_unknown_fields()->AddVarint( - 34, static_cast<::google::protobuf::uint64>(value)); + 34, static_cast< ::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -14703,7 +14703,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( // repeated int32 path = 1 [packed = true]; if (this->path_size() > 0) { ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); - output->WriteVarint32(static_cast<::google::protobuf::uint32>( + output->WriteVarint32(static_cast< ::google::protobuf::uint32>( _path_cached_byte_size_)); } for (int i = 0, n = this->path_size(); i < n; i++) { @@ -14714,7 +14714,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( // repeated int32 span = 2 [packed = true]; if (this->span_size() > 0) { ::google::protobuf::internal::WireFormatLite::WriteTag(2, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); - output->WriteVarint32(static_cast<::google::protobuf::uint32>( + output->WriteVarint32(static_cast< ::google::protobuf::uint32>( _span_cached_byte_size_)); } for (int i = 0, n = this->span_size(); i < n; i++) { @@ -14773,7 +14773,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, target); target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - static_cast<::google::protobuf::uint32>( + static_cast< ::google::protobuf::uint32>( _path_cached_byte_size_), target); target = ::google::protobuf::internal::WireFormatLite:: WriteInt32NoTagToArray(this->path_, target); @@ -14786,7 +14786,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, target); target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - static_cast<::google::protobuf::uint32>( + static_cast< ::google::protobuf::uint32>( _span_cached_byte_size_), target); target = ::google::protobuf::internal::WireFormatLite:: WriteInt32NoTagToArray(this->span_, target); @@ -14849,7 +14849,7 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const { if (data_size > 0) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - static_cast(data_size)); + static_cast< ::google::protobuf::int32>(data_size)); } int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); @@ -14865,7 +14865,7 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const { if (data_size > 0) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - static_cast(data_size)); + static_cast< ::google::protobuf::int32>(data_size)); } int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); @@ -15707,7 +15707,7 @@ void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes( // repeated int32 path = 1 [packed = true]; if (this->path_size() > 0) { ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); - output->WriteVarint32(static_cast<::google::protobuf::uint32>( + output->WriteVarint32(static_cast< ::google::protobuf::uint32>( _path_cached_byte_size_)); } for (int i = 0, n = this->path_size(); i < n; i++) { @@ -15756,7 +15756,7 @@ void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, target); target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - static_cast<::google::protobuf::uint32>( + static_cast< ::google::protobuf::uint32>( _path_cached_byte_size_), target); target = ::google::protobuf::internal::WireFormatLite:: WriteInt32NoTagToArray(this->path_, target); @@ -15808,7 +15808,7 @@ size_t GeneratedCodeInfo_Annotation::ByteSizeLong() const { if (data_size > 0) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - static_cast(data_size)); + static_cast< ::google::protobuf::int32>(data_size)); } int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); -- cgit v1.2.3