diff options
Diffstat (limited to 'src')
84 files changed, 1728 insertions, 1014 deletions
diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc index a7a1258c..7ac946e0 100644 --- a/src/google/protobuf/any.pb.cc +++ b/src/google/protobuf/any.pb.cc @@ -237,7 +237,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<int>(this->type_url().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Any.type_url")); } else { @@ -287,7 +287,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<int>(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<int>(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 0b36f430..e767bf67 100644 --- a/src/google/protobuf/api.pb.cc +++ b/src/google/protobuf/api.pb.cc @@ -228,8 +228,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<char*>(&syntax_) - - reinterpret_cast<char*>(&source_context_) + sizeof(syntax_)); + ::memset(&source_context_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&syntax_) - + reinterpret_cast<char*>(&source_context_)) + sizeof(syntax_)); _cached_size_ = 0; } @@ -303,7 +304,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Api.name")); } else { @@ -343,7 +344,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<int>(this->version().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Api.version")); } else { @@ -420,7 +421,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Api.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -428,21 +429,23 @@ 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<unsigned int>(this->methods_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->methods(i), output); + 2, this->methods(static_cast<int>(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<unsigned int>(this->options_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 3, this->options(i), output); + 3, this->options(static_cast<int>(i)), output); } // string version = 4; if (this->version().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->version().data(), this->version().length(), + this->version().data(), static_cast<int>(this->version().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Api.version"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -456,9 +459,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<unsigned int>(this->mixins_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 6, this->mixins(i), output); + 6, this->mixins(static_cast<int>(i)), output); } // .google.protobuf.Syntax syntax = 7; @@ -483,7 +487,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Api.name"); target = @@ -492,23 +496,25 @@ 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<unsigned int>(this->methods_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 2, this->methods(i), deterministic, target); + 2, this->methods(static_cast<int>(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<unsigned int>(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 3, this->options(i), deterministic, target); + 3, this->options(static_cast<int>(i)), deterministic, target); } // string version = 4; if (this->version().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->version().data(), this->version().length(), + this->version().data(), static_cast<int>(this->version().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Api.version"); target = @@ -524,10 +530,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<unsigned int>(this->mixins_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 6, this->mixins(i), deterministic, target); + 6, this->mixins(static_cast<int>(i)), deterministic, target); } // .google.protobuf.Syntax syntax = 7; @@ -555,34 +562,34 @@ size_t Api::ByteSizeLong() const { } // repeated .google.protobuf.Method methods = 2; { - unsigned int count = this->methods_size(); + unsigned int count = static_cast<unsigned int>(this->methods_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->methods(i)); + this->methods(static_cast<int>(i))); } } // repeated .google.protobuf.Option options = 3; { - unsigned int count = this->options_size(); + unsigned int count = static_cast<unsigned int>(this->options_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->options(i)); + this->options(static_cast<int>(i))); } } // repeated .google.protobuf.Mixin mixins = 6; { - unsigned int count = this->mixins_size(); + unsigned int count = static_cast<unsigned int>(this->mixins_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->mixins(i)); + this->mixins(static_cast<int>(i))); } } @@ -995,8 +1002,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<char*>(&syntax_) - - reinterpret_cast<char*>(&request_streaming_) + sizeof(syntax_)); + static_cast<size_t>(reinterpret_cast<char*>(&syntax_) - + reinterpret_cast<char*>(&request_streaming_)) + sizeof(syntax_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.Method) } @@ -1004,8 +1011,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<char*>(&syntax_) - - reinterpret_cast<char*>(&request_streaming_) + sizeof(syntax_)); + ::memset(&request_streaming_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&syntax_) - + reinterpret_cast<char*>(&request_streaming_)) + sizeof(syntax_)); _cached_size_ = 0; } @@ -1053,8 +1061,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<char*>(&syntax_) - - reinterpret_cast<char*>(&request_streaming_) + sizeof(syntax_)); + ::memset(&request_streaming_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&syntax_) - + reinterpret_cast<char*>(&request_streaming_)) + sizeof(syntax_)); _internal_metadata_.Clear(); } @@ -1075,7 +1084,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Method.name")); } else { @@ -1091,7 +1100,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<int>(this->request_type_url().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Method.request_type_url")); } else { @@ -1121,7 +1130,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<int>(this->response_type_url().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Method.response_type_url")); } else { @@ -1200,7 +1209,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1210,7 +1219,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<int>(this->request_type_url().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.request_type_url"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1225,7 +1234,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<int>(this->response_type_url().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.response_type_url"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1238,9 +1247,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<unsigned int>(this->options_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 6, this->options(i), output); + 6, this->options(static_cast<int>(i)), output); } // .google.protobuf.Syntax syntax = 7; @@ -1265,7 +1275,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.name"); target = @@ -1276,7 +1286,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<int>(this->request_type_url().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.request_type_url"); target = @@ -1292,7 +1302,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<int>(this->response_type_url().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.response_type_url"); target = @@ -1306,10 +1316,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<unsigned int>(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 6, this->options(i), deterministic, target); + 6, this->options(static_cast<int>(i)), deterministic, target); } // .google.protobuf.Syntax syntax = 7; @@ -1337,12 +1348,12 @@ size_t Method::ByteSizeLong() const { } // repeated .google.protobuf.Option options = 6; { - unsigned int count = this->options_size(); + unsigned int count = static_cast<unsigned int>(this->options_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->options(i)); + this->options(static_cast<int>(i))); } } @@ -1810,7 +1821,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Mixin.name")); } else { @@ -1826,7 +1837,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<int>(this->root().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Mixin.root")); } else { @@ -1864,7 +1875,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Mixin.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1874,7 +1885,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<int>(this->root().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Mixin.root"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1897,7 +1908,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Mixin.name"); target = @@ -1908,7 +1919,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<int>(this->root().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Mixin.root"); target = diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h index 1497a6c5..f8a94705 100644 --- a/src/google/protobuf/arena.h +++ b/src/google/protobuf/arena.h @@ -810,13 +810,13 @@ class LIBPROTOBUF_EXPORT Arena { } template <typename T> static void CreateInArenaStorageInternal( - T* ptr, Arena* arena, google::protobuf::internal::false_type) { + T* ptr, Arena* /* arena */, google::protobuf::internal::false_type) { new (ptr) T(); } template <typename T> static void RegisterDestructorInternal( - T* ptr, Arena* arena, google::protobuf::internal::true_type) {} + T* /* ptr */, Arena* /* arena */, google::protobuf::internal::true_type) {} template <typename T> static void RegisterDestructorInternal( T* ptr, Arena* arena, google::protobuf::internal::false_type) { diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc index afe63a77..0ef8c0d8 100644 --- a/src/google/protobuf/compiler/command_line_interface.cc +++ b/src/google/protobuf/compiler/command_line_interface.cc @@ -1182,6 +1182,12 @@ CommandLineInterface::ParseArguments(int argc, const char* const argv[]) { arguments.push_back(argv[i]); } + // if no arguments are given, show help + if(arguments.empty()) { + PrintHelpText(); + return PARSE_ARGUMENT_DONE_AND_EXIT; // Exit without running compiler. + } + // Iterate through all arguments and parse them. for (int i = 0; i < arguments.size(); ++i) { string name, value; diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc index e99e7e55..08a635fa 100644 --- a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc @@ -145,12 +145,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_, @@ -356,12 +358,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"); } @@ -403,7 +407,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<int>(length));\n" "while (input->BytesUntilLimit() > 0) {\n" " int value;\n" " DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n" @@ -419,11 +423,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"); @@ -444,7 +450,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_, @@ -472,7 +479,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"); @@ -488,19 +496,20 @@ 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<unsigned int>(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<int>(i)));\n" "}\n"); if (descriptor_->is_packed()) { printer->Print(variables_, "if (data_size > 0) {\n" " total_size += $tag_size$ +\n" - " ::google::protobuf::internal::WireFormatLite::Int32Size(data_size);\n" + " ::google::protobuf::internal::WireFormatLite::Int32Size(\n" + " static_cast< ::google::protobuf::int32>(data_size));\n" "}\n" "int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);\n" "GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n" diff --git a/src/google/protobuf/compiler/cpp/cpp_map_field.cc b/src/google/protobuf/compiler/cpp/cpp_map_field.cc index 5d461401..da33d29b 100644 --- a/src/google/protobuf/compiler/cpp/cpp_map_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_map_field.cc @@ -261,7 +261,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<google::protobuf::uint32>(data.size()));\n" " unknown_fields_stream.WriteString(data);\n"); } @@ -272,12 +273,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<int>(", 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<int>(", value, ".length()),\n") + .data(), + printer); } // If entry is allocated by arena, its desctructor should be avoided. @@ -381,14 +386,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<int>(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<int>(p->second.length()),\n", printer); } printer->Outdent(); printer->Outdent(); @@ -409,13 +414,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<ptrdiff_t>(n)] = SortItem(&*it);\n" " }\n" - " ::std::sort(&items[0], &items[n], Less());\n"); + " ::std::sort(&items[0], &items[static_cast<ptrdiff_t>(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<ptrdiff_t>(i)]" : + "items[static_cast<ptrdiff_t>(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 752673d0..e82eebbe 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -2609,12 +2609,13 @@ void MessageGenerator::GenerateConstructorBody(io::Printer* printer, if (copy_constructor) { pod_template = "::memcpy(&$first$_, &from.$first$_,\n" - " reinterpret_cast<char*>(&$last$_) -\n" - " reinterpret_cast<char*>(&$first$_) + sizeof($last$_));\n"; + " static_cast<size_t>(reinterpret_cast<char*>(&$last$_) -\n" + " reinterpret_cast<char*>(&$first$_)) + sizeof($last$_));\n"; } else { pod_template = - "::memset(&$first$_, 0, reinterpret_cast<char*>(&$last$_) -\n" - " reinterpret_cast<char*>(&$first$_) + sizeof($last$_));\n"; + "::memset(&$first$_, 0, static_cast<size_t>(\n" + " reinterpret_cast<char*>(&$last$_) -\n" + " reinterpret_cast<char*>(&$first$_)) + sizeof($last$_));\n"; } for (int i = 0; i < optimized_order_.size(); ++i) { @@ -3075,8 +3076,9 @@ GenerateClear(io::Printer* printer) { FieldName(optimized_order_[memset_run_end]); printer->Print( - "::memset(&$first$_, 0, reinterpret_cast<char*>(&$last$_) -\n" - " reinterpret_cast<char*>(&$first$_) + sizeof($last$_));\n", + "::memset(&$first$_, 0, static_cast<size_t>(\n" + " reinterpret_cast<char*>(&$last$_) -\n" + " reinterpret_cast<char*>(&$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 e45470fb..5b260caa 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message_field.cc @@ -1091,19 +1091,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<unsigned int>(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<int>(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<unsigned int>(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<int>(i)), deterministic, target);\n" "}\n"); } @@ -1111,14 +1113,14 @@ void RepeatedMessageFieldGenerator:: GenerateByteSize(io::Printer* printer) const { printer->Print(variables_, "{\n" - " unsigned int count = this->$name$_size();\n"); + " unsigned int count = static_cast<unsigned int>(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<int>(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 07ac0bb4..b05fcc4e 100644 --- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc @@ -392,7 +392,8 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const { "$number$, " "::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, " "output);\n" - " output->WriteVarint32(_$name$_cached_byte_size_);\n"); + " output->WriteVarint32(static_cast< ::google::protobuf::uint32>(\n" + " _$name$_cached_byte_size_));\n"); if (FixedSize(descriptor_->type()) > 0) { // TODO(ckennelly): Use RepeatedField<T>::unsafe_data() via @@ -432,7 +433,8 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" " target);\n" " target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(\n" - " _$name$_cached_byte_size_, target);\n" + " static_cast< ::google::protobuf::uint32>(\n" + " _$name$_cached_byte_size_), target);\n" " target = ::google::protobuf::internal::WireFormatLite::\n" " Write$declared_type$NoTagToArray(this->$name$_, target);\n" "}\n"); @@ -454,7 +456,7 @@ GenerateByteSize(io::Printer* printer) const { " $declared_type$Size(this->$name$_);\n"); } else { printer->Print(variables_, - "unsigned int count = this->$name$_size();\n" + "unsigned int count = static_cast<unsigned int>(this->$name$_size());\n" "size_t data_size = $fixed_size$UL * count;\n"); } @@ -462,7 +464,8 @@ GenerateByteSize(io::Printer* printer) const { printer->Print(variables_, "if (data_size > 0) {\n" " total_size += $tag_size$ +\n" - " ::google::protobuf::internal::WireFormatLite::Int32Size(data_size);\n" + " ::google::protobuf::internal::WireFormatLite::Int32Size(\n" + " static_cast< ::google::protobuf::int32>(data_size));\n" "}\n" "int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);\n" "GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n" diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc index c23dd6fd..fec13b6d 100644 --- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc @@ -499,7 +499,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<int>(this->$name$().length()),\n", + printer); } } @@ -508,7 +509,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<int>(this->$name$().length()),\n", + printer); } printer->Print(variables_, "::google::protobuf::internal::WireFormatLite::Write$declared_type$MaybeAliased(\n" @@ -520,7 +522,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<int>(this->$name$().length()),\n", + printer); } printer->Print(variables_, "target =\n" @@ -832,7 +835,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<int>(this->$name$().length()),\n", + printer); } } @@ -1038,7 +1042,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<int>(this->$name$(this->$name$_size() - 1).length()),\n", printer); } } @@ -1051,7 +1055,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<int>(this->$name$(i).length()),\n", + printer); } printer->Outdent(); printer->Print(variables_, @@ -1068,7 +1073,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<int>(this->$name$(i).length()),\n", + printer); } printer->Outdent(); printer->Print(variables_, diff --git a/src/google/protobuf/compiler/csharp/csharp_field_base.cc b/src/google/protobuf/compiler/csharp/csharp_field_base.cc index ebb8fbc2..ecf29ece 100644 --- a/src/google/protobuf/compiler/csharp/csharp_field_base.cc +++ b/src/google/protobuf/compiler/csharp/csharp_field_base.cc @@ -54,7 +54,7 @@ namespace compiler { namespace csharp { void FieldGeneratorBase::SetCommonFieldVariables( - map<string, string>* variables) { + std::map<string, string>* variables) { // Note: this will be valid even though the tag emitted for packed and unpacked versions of // repeated fields varies by wire format. The wire format is encoded in the bottom 3 bits, which // never effects the tag size. @@ -92,7 +92,7 @@ void FieldGeneratorBase::SetCommonFieldVariables( } void FieldGeneratorBase::SetCommonOneofFieldVariables( - map<string, string>* variables) { + std::map<string, string>* variables) { (*variables)["oneof_name"] = oneof_name(); (*variables)["has_property_check"] = oneof_name() + "Case_ == " + oneof_property_name() + diff --git a/src/google/protobuf/compiler/csharp/csharp_field_base.h b/src/google/protobuf/compiler/csharp/csharp_field_base.h index 4109f3ca..df26853b 100644 --- a/src/google/protobuf/compiler/csharp/csharp_field_base.h +++ b/src/google/protobuf/compiler/csharp/csharp_field_base.h @@ -66,14 +66,14 @@ class FieldGeneratorBase : public SourceGeneratorBase { protected: const FieldDescriptor* descriptor_; const int fieldOrdinal_; - map<string, string> variables_; + std::map<string, string> variables_; void AddDeprecatedFlag(io::Printer* printer); void AddNullCheck(io::Printer* printer); void AddNullCheck(io::Printer* printer, const std::string& name); void AddPublicMemberAttributes(io::Printer* printer); - void SetCommonOneofFieldVariables(map<string, string>* variables); + void SetCommonOneofFieldVariables(std::map<string, string>* variables); std::string oneof_property_name(); std::string oneof_name(); @@ -89,7 +89,7 @@ class FieldGeneratorBase : public SourceGeneratorBase { std::string capitalized_type_name(); private: - void SetCommonFieldVariables(map<string, string>* variables); + void SetCommonFieldVariables(std::map<string, string>* variables); std::string GetStringDefaultValueInternal(); std::string GetBytesDefaultValueInternal(); diff --git a/src/google/protobuf/compiler/csharp/csharp_message.cc b/src/google/protobuf/compiler/csharp/csharp_message.cc index 0f00a438..5ef0e4e8 100644 --- a/src/google/protobuf/compiler/csharp/csharp_message.cc +++ b/src/google/protobuf/compiler/csharp/csharp_message.cc @@ -105,7 +105,7 @@ void MessageGenerator::AddDeprecatedFlag(io::Printer* printer) { } void MessageGenerator::Generate(io::Printer* printer) { - map<string, string> vars; + std::map<string, string> vars; vars["class_name"] = class_name(); vars["access_level"] = class_access_level(); @@ -280,7 +280,7 @@ bool MessageGenerator::HasNestedGeneratedTypes() } void MessageGenerator::GenerateCloningCode(io::Printer* printer) { - map<string, string> vars; + std::map<string, string> vars; WriteGeneratedCodeAttributes(printer); vars["class_name"] = class_name(); printer->Print( @@ -333,7 +333,7 @@ void MessageGenerator::GenerateFreezingCode(io::Printer* printer) { } void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) { - map<string, string> vars; + std::map<string, string> vars; vars["class_name"] = class_name(); // Equality @@ -432,7 +432,7 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) { // Note: These are separate from GenerateMessageSerializationMethods() // because they need to be generated even for messages that are optimized // for code size. - map<string, string> vars; + std::map<string, string> vars; vars["class_name"] = class_name(); WriteGeneratedCodeAttributes(printer); diff --git a/src/google/protobuf/compiler/java/java_message_builder.cc b/src/google/protobuf/compiler/java/java_message_builder.cc index 5368c1df..f9bbfbf4 100644 --- a/src/google/protobuf/compiler/java/java_message_builder.cc +++ b/src/google/protobuf/compiler/java/java_message_builder.cc @@ -462,7 +462,7 @@ GenerateCommonBuilderMethods(io::Printer* printer) { "}\n" "public Builder setField(\n" " com.google.protobuf.Descriptors.FieldDescriptor field,\n" - " Object value) {\n" + " java.lang.Object value) {\n" " return (Builder) super.setField(field, value);\n" "}\n" "public Builder clearField(\n" @@ -475,12 +475,12 @@ GenerateCommonBuilderMethods(io::Printer* printer) { "}\n" "public Builder setRepeatedField(\n" " com.google.protobuf.Descriptors.FieldDescriptor field,\n" - " int index, Object value) {\n" + " int index, java.lang.Object value) {\n" " return (Builder) super.setRepeatedField(field, index, value);\n" "}\n" "public Builder addRepeatedField(\n" " com.google.protobuf.Descriptors.FieldDescriptor field,\n" - " Object value) {\n" + " java.lang.Object value) {\n" " return (Builder) super.addRepeatedField(field, value);\n" "}\n"); diff --git a/src/google/protobuf/compiler/java/java_options.h b/src/google/protobuf/compiler/java/java_options.h index 7bce1447..e4e7d5e2 100644 --- a/src/google/protobuf/compiler/java/java_options.h +++ b/src/google/protobuf/compiler/java/java_options.h @@ -59,10 +59,10 @@ struct Options { bool annotate_code; // Name of a file where we will write a list of generated .meta file names, // one per line. - string annotation_list_file; + std::string annotation_list_file; // Name of a file where we will write a list of generated file names, one // per line. - string output_list_file; + std::string output_list_file; }; } // namespace java diff --git a/src/google/protobuf/compiler/java/java_shared_code_generator.cc b/src/google/protobuf/compiler/java/java_shared_code_generator.cc index 7bd5ad7a..f73bfb04 100644 --- a/src/google/protobuf/compiler/java/java_shared_code_generator.cc +++ b/src/google/protobuf/compiler/java/java_shared_code_generator.cc @@ -182,10 +182,16 @@ void SharedCodeGenerator::GenerateDescriptors(io::Printer* printer) { std::vector<std::pair<string, string> > dependencies; for (int i = 0; i < file_->dependency_count(); i++) { string filename = file_->dependency(i)->name(); - string classname = FileJavaPackage(file_->dependency(i)) + "." + - name_resolver_->GetDescriptorClassName( - file_->dependency(i)); - dependencies.push_back(std::make_pair(filename, classname)); + string package = FileJavaPackage(file_->dependency(i)); + string classname = name_resolver_->GetDescriptorClassName( + file_->dependency(i)); + string full_name; + if (package.empty()) { + full_name = classname; + } else { + full_name = package + "." + classname; + } + dependencies.push_back(std::make_pair(filename, full_name)); } // ----------------------------------------------------------------- diff --git a/src/google/protobuf/compiler/javanano/javanano_enum_field.cc b/src/google/protobuf/compiler/javanano/javanano_enum_field.cc index 7666db38..26bc7f85 100644 --- a/src/google/protobuf/compiler/javanano/javanano_enum_field.cc +++ b/src/google/protobuf/compiler/javanano/javanano_enum_field.cc @@ -52,7 +52,7 @@ namespace { // TODO(kenton): Factor out a "SetCommonFieldVariables()" to get rid of // repeat code between this and the other field types. void SetEnumVariables(const Params& params, - const FieldDescriptor* descriptor, map<string, string>* variables) { + const FieldDescriptor* descriptor, std::map<string, string>* variables) { (*variables)["name"] = RenameJavaKeywords(UnderscoresToCamelCase(descriptor)); (*variables)["capitalized_name"] = diff --git a/src/google/protobuf/compiler/javanano/javanano_enum_field.h b/src/google/protobuf/compiler/javanano/javanano_enum_field.h index b94790d6..1be25d10 100644 --- a/src/google/protobuf/compiler/javanano/javanano_enum_field.h +++ b/src/google/protobuf/compiler/javanano/javanano_enum_field.h @@ -62,7 +62,7 @@ class EnumFieldGenerator : public FieldGenerator { private: const FieldDescriptor* descriptor_; - map<string, string> variables_; + std::map<string, string> variables_; vector<string> canonical_values_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator); @@ -85,7 +85,7 @@ class AccessorEnumFieldGenerator : public FieldGenerator { private: const FieldDescriptor* descriptor_; - map<string, string> variables_; + std::map<string, string> variables_; vector<string> canonical_values_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(AccessorEnumFieldGenerator); @@ -112,7 +112,7 @@ class RepeatedEnumFieldGenerator : public FieldGenerator { void GenerateRepeatedDataSizeCode(io::Printer* printer) const; const FieldDescriptor* descriptor_; - map<string, string> variables_; + std::map<string, string> variables_; vector<string> canonical_values_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator); diff --git a/src/google/protobuf/compiler/javanano/javanano_extension.cc b/src/google/protobuf/compiler/javanano/javanano_extension.cc index 0b9d1d8d..4c61f915 100644 --- a/src/google/protobuf/compiler/javanano/javanano_extension.cc +++ b/src/google/protobuf/compiler/javanano/javanano_extension.cc @@ -78,7 +78,7 @@ const char* GetTypeConstantName(const FieldDescriptor::Type type) { } // namespace void SetVariables(const FieldDescriptor* descriptor, const Params params, - map<string, string>* variables) { + std::map<string, string>* variables) { (*variables)["extends"] = ClassName(params, descriptor->containing_type()); (*variables)["name"] = RenameJavaKeywords(UnderscoresToCamelCase(descriptor)); bool repeated = descriptor->is_repeated(); diff --git a/src/google/protobuf/compiler/javanano/javanano_extension.h b/src/google/protobuf/compiler/javanano/javanano_extension.h index 4843e296..f4e9eb2d 100644 --- a/src/google/protobuf/compiler/javanano/javanano_extension.h +++ b/src/google/protobuf/compiler/javanano/javanano_extension.h @@ -61,7 +61,7 @@ class ExtensionGenerator { private: const Params& params_; const FieldDescriptor* descriptor_; - map<string, string> variables_; + std::map<string, string> variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator); }; diff --git a/src/google/protobuf/compiler/javanano/javanano_field.cc b/src/google/protobuf/compiler/javanano/javanano_field.cc index 85257f3f..e31d1177 100644 --- a/src/google/protobuf/compiler/javanano/javanano_field.cc +++ b/src/google/protobuf/compiler/javanano/javanano_field.cc @@ -151,7 +151,7 @@ const FieldGenerator& FieldGeneratorMap::get( } void SetCommonOneofVariables(const FieldDescriptor* descriptor, - map<string, string>* variables) { + std::map<string, string>* variables) { (*variables)["oneof_name"] = UnderscoresToCamelCase(descriptor->containing_oneof()); (*variables)["oneof_capitalized_name"] = @@ -169,7 +169,7 @@ void SetCommonOneofVariables(const FieldDescriptor* descriptor, } void GenerateOneofFieldEquals(const FieldDescriptor* descriptor, - const map<string, string>& variables, + const std::map<string, string>& variables, io::Printer* printer) { if (GetJavaType(descriptor) == JAVATYPE_BYTES) { printer->Print(variables, @@ -190,7 +190,7 @@ void GenerateOneofFieldEquals(const FieldDescriptor* descriptor, } void GenerateOneofFieldHashCode(const FieldDescriptor* descriptor, - const map<string, string>& variables, + const std::map<string, string>& variables, io::Printer* printer) { if (GetJavaType(descriptor) == JAVATYPE_BYTES) { printer->Print(variables, diff --git a/src/google/protobuf/compiler/javanano/javanano_field.h b/src/google/protobuf/compiler/javanano/javanano_field.h index 57c221f4..347c888c 100644 --- a/src/google/protobuf/compiler/javanano/javanano_field.h +++ b/src/google/protobuf/compiler/javanano/javanano_field.h @@ -114,12 +114,12 @@ class FieldGeneratorMap { }; void SetCommonOneofVariables(const FieldDescriptor* descriptor, - map<string, string>* variables); + std::map<string, string>* variables); void GenerateOneofFieldEquals(const FieldDescriptor* descriptor, - const map<string, string>& variables, + const std::map<string, string>& variables, io::Printer* printer); void GenerateOneofFieldHashCode(const FieldDescriptor* descriptor, - const map<string, string>& variables, + const std::map<string, string>& variables, io::Printer* printer); } // namespace javanano diff --git a/src/google/protobuf/compiler/javanano/javanano_helpers.cc b/src/google/protobuf/compiler/javanano/javanano_helpers.cc index 5018250c..1927ba12 100644 --- a/src/google/protobuf/compiler/javanano/javanano_helpers.cc +++ b/src/google/protobuf/compiler/javanano/javanano_helpers.cc @@ -567,7 +567,7 @@ string GenerateDifferentBit(int bit_index) { } void SetBitOperationVariables(const string name, - int bitIndex, map<string, string>* variables) { + int bitIndex, std::map<string, string>* variables) { (*variables)["get_" + name] = GenerateGetBit(bitIndex); (*variables)["set_" + name] = GenerateSetBit(bitIndex); (*variables)["clear_" + name] = GenerateClearBit(bitIndex); diff --git a/src/google/protobuf/compiler/javanano/javanano_helpers.h b/src/google/protobuf/compiler/javanano/javanano_helpers.h index 014c85ae..04b2d633 100644 --- a/src/google/protobuf/compiler/javanano/javanano_helpers.h +++ b/src/google/protobuf/compiler/javanano/javanano_helpers.h @@ -181,7 +181,7 @@ string GenerateDifferentBit(int bit_index); // the given name of the bit, to the appropriate Java expressions for the given // bit index. void SetBitOperationVariables(const string name, - int bitIndex, map<string, string>* variables); + int bitIndex, std::map<string, string>* variables); inline bool IsMapEntry(const Descriptor* descriptor) { // TODO(liujisi): Add an option to turn on maps for proto2 syntax as well. diff --git a/src/google/protobuf/compiler/javanano/javanano_map_field.cc b/src/google/protobuf/compiler/javanano/javanano_map_field.cc index 83b2b0ce..a4ab8858 100644 --- a/src/google/protobuf/compiler/javanano/javanano_map_field.cc +++ b/src/google/protobuf/compiler/javanano/javanano_map_field.cc @@ -84,7 +84,7 @@ const FieldDescriptor* ValueField(const FieldDescriptor* descriptor) { } void SetMapVariables(const Params& params, - const FieldDescriptor* descriptor, map<string, string>* variables) { + const FieldDescriptor* descriptor, std::map<string, string>* variables) { const FieldDescriptor* key = KeyField(descriptor); const FieldDescriptor* value = ValueField(descriptor); (*variables)["name"] = diff --git a/src/google/protobuf/compiler/javanano/javanano_map_field.h b/src/google/protobuf/compiler/javanano/javanano_map_field.h index c01bde38..81e5915d 100644 --- a/src/google/protobuf/compiler/javanano/javanano_map_field.h +++ b/src/google/protobuf/compiler/javanano/javanano_map_field.h @@ -58,7 +58,7 @@ class MapFieldGenerator : public FieldGenerator { private: const FieldDescriptor* descriptor_; - map<string, string> variables_; + std::map<string, string> variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldGenerator); }; diff --git a/src/google/protobuf/compiler/javanano/javanano_message.cc b/src/google/protobuf/compiler/javanano/javanano_message.cc index f81f7f9a..78421887 100644 --- a/src/google/protobuf/compiler/javanano/javanano_message.cc +++ b/src/google/protobuf/compiler/javanano/javanano_message.cc @@ -182,7 +182,7 @@ void MessageGenerator::Generate(io::Printer* printer) { } // oneof - map<string, string> vars; + std::map<string, string> vars; vars["message_name"] = descriptor_->name(); for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { const OneofDescriptor* oneof_desc = descriptor_->oneof_decl(i); diff --git a/src/google/protobuf/compiler/javanano/javanano_message_field.cc b/src/google/protobuf/compiler/javanano/javanano_message_field.cc index d1d04b52..2ed8a3aa 100644 --- a/src/google/protobuf/compiler/javanano/javanano_message_field.cc +++ b/src/google/protobuf/compiler/javanano/javanano_message_field.cc @@ -54,7 +54,7 @@ namespace { // TODO(kenton): Factor out a "SetCommonFieldVariables()" to get rid of // repeat code between this and the other field types. void SetMessageVariables(const Params& params, - const FieldDescriptor* descriptor, map<string, string>* variables) { + const FieldDescriptor* descriptor, std::map<string, string>* variables) { (*variables)["name"] = RenameJavaKeywords(UnderscoresToCamelCase(descriptor)); (*variables)["capitalized_name"] = diff --git a/src/google/protobuf/compiler/javanano/javanano_message_field.h b/src/google/protobuf/compiler/javanano/javanano_message_field.h index e074735c..0ae8879b 100644 --- a/src/google/protobuf/compiler/javanano/javanano_message_field.h +++ b/src/google/protobuf/compiler/javanano/javanano_message_field.h @@ -62,7 +62,7 @@ class MessageFieldGenerator : public FieldGenerator { private: const FieldDescriptor* descriptor_; - map<string, string> variables_; + std::map<string, string> variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator); }; @@ -85,7 +85,7 @@ class MessageOneofFieldGenerator : public FieldGenerator { private: const FieldDescriptor* descriptor_; - map<string, string> variables_; + std::map<string, string> variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageOneofFieldGenerator); }; @@ -108,7 +108,7 @@ class RepeatedMessageFieldGenerator : public FieldGenerator { private: const FieldDescriptor* descriptor_; - map<string, string> variables_; + std::map<string, string> variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator); }; diff --git a/src/google/protobuf/compiler/javanano/javanano_params.h b/src/google/protobuf/compiler/javanano/javanano_params.h index e3b4bb93..3594767d 100644 --- a/src/google/protobuf/compiler/javanano/javanano_params.h +++ b/src/google/protobuf/compiler/javanano/javanano_params.h @@ -47,8 +47,8 @@ enum eMultipleFiles { JAVANANO_MUL_UNSET, JAVANANO_MUL_FALSE, JAVANANO_MUL_TRUE // Parameters for used by the generators class Params { public: - typedef map<string, string> NameMap; - typedef set<string> NameSet; + typedef std::map<string, string> NameMap; + typedef std::set<string> NameSet; private: string empty_; string base_name_; diff --git a/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc b/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc index 978abf2c..66a0ff05 100644 --- a/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc +++ b/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc @@ -166,7 +166,7 @@ bool AllAscii(const string& text) { void SetPrimitiveVariables(const FieldDescriptor* descriptor, const Params params, - map<string, string>* variables) { + std::map<string, string>* variables) { (*variables)["name"] = RenameJavaKeywords(UnderscoresToCamelCase(descriptor)); (*variables)["capitalized_name"] = diff --git a/src/google/protobuf/compiler/javanano/javanano_primitive_field.h b/src/google/protobuf/compiler/javanano/javanano_primitive_field.h index a01981dd..d7d72d57 100644 --- a/src/google/protobuf/compiler/javanano/javanano_primitive_field.h +++ b/src/google/protobuf/compiler/javanano/javanano_primitive_field.h @@ -65,7 +65,7 @@ class PrimitiveFieldGenerator : public FieldGenerator { void GenerateSerializationConditional(io::Printer* printer) const; const FieldDescriptor* descriptor_; - map<string, string> variables_; + std::map<string, string> variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator); }; @@ -89,7 +89,7 @@ class AccessorPrimitiveFieldGenerator : public FieldGenerator { private: const FieldDescriptor* descriptor_; - map<string, string> variables_; + std::map<string, string> variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(AccessorPrimitiveFieldGenerator); }; @@ -111,7 +111,7 @@ class PrimitiveOneofFieldGenerator : public FieldGenerator { private: const FieldDescriptor* descriptor_; - map<string, string> variables_; + std::map<string, string> variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveOneofFieldGenerator); }; @@ -137,7 +137,7 @@ class RepeatedPrimitiveFieldGenerator : public FieldGenerator { void GenerateRepeatedDataSizeCode(io::Printer* printer) const; const FieldDescriptor* descriptor_; - map<string, string> variables_; + std::map<string, string> variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator); }; diff --git a/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc index 7a774a09..8899a13a 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc @@ -46,7 +46,7 @@ namespace objectivec { namespace { void SetEnumVariables(const FieldDescriptor* descriptor, - map<string, string>* variables) { + std::map<string, string>* variables) { string type = EnumName(descriptor->enum_type()); (*variables)["storage_type"] = type; // For non repeated fields, if it was defined in a different file, the @@ -118,7 +118,7 @@ void EnumFieldGenerator::GenerateCFunctionImplementations( } void EnumFieldGenerator::DetermineForwardDeclarations( - set<string>* fwd_decls) const { + std::set<string>* fwd_decls) const { SingleFieldGenerator::DetermineForwardDeclarations(fwd_decls); // If it is an enum defined in a different file, then we'll need a forward // declaration for it. When it is in our file, all the enums are output diff --git a/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h b/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h index 946faa81..ae56c069 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h @@ -47,7 +47,7 @@ class EnumFieldGenerator : public SingleFieldGenerator { public: virtual void GenerateCFunctionDeclarations(io::Printer* printer) const; virtual void GenerateCFunctionImplementations(io::Printer* printer) const; - virtual void DetermineForwardDeclarations(set<string>* fwd_decls) const; + virtual void DetermineForwardDeclarations(std::set<string>* fwd_decls) const; protected: EnumFieldGenerator(const FieldDescriptor* descriptor, const Options& options); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_extension.cc b/src/google/protobuf/compiler/objectivec/objectivec_extension.cc index 73e4b86e..b788d0a3 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_extension.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_extension.cc @@ -59,7 +59,7 @@ ExtensionGenerator::ExtensionGenerator(const string& root_class_name, ExtensionGenerator::~ExtensionGenerator() {} void ExtensionGenerator::GenerateMembersHeader(io::Printer* printer) { - map<string, string> vars; + std::map<string, string> vars; vars["method_name"] = method_name_; SourceLocation location; if (descriptor_->GetSourceLocation(&location)) { @@ -77,7 +77,7 @@ void ExtensionGenerator::GenerateMembersHeader(io::Printer* printer) { void ExtensionGenerator::GenerateStaticVariablesInitialization( io::Printer* printer) { - map<string, string> vars; + std::map<string, string> vars; vars["root_class_and_method_name"] = root_class_and_method_name_; vars["extended_type"] = ClassName(descriptor_->containing_type()); vars["number"] = SimpleItoa(descriptor_->number()); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_field.cc index 9f7e84f2..b6123fad 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_field.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_field.cc @@ -49,7 +49,7 @@ namespace objectivec { namespace { void SetCommonFieldVariables(const FieldDescriptor* descriptor, - map<string, string>* variables) { + std::map<string, string>* variables) { string camel_case_name = FieldName(descriptor); string raw_field_name; if (descriptor->type() == FieldDescriptor::TYPE_GROUP) { @@ -178,7 +178,7 @@ void FieldGenerator::GenerateCFunctionImplementations( } void FieldGenerator::DetermineForwardDeclarations( - set<string>* fwd_decls) const { + std::set<string>* fwd_decls) const { // Nothing } diff --git a/src/google/protobuf/compiler/objectivec/objectivec_field.h b/src/google/protobuf/compiler/objectivec/objectivec_field.h index a3a4b1b6..6bd5db2e 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_field.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_field.h @@ -67,7 +67,7 @@ class FieldGenerator { virtual void GenerateCFunctionImplementations(io::Printer* printer) const; // Exposed for subclasses, should always call it on the parent class also. - virtual void DetermineForwardDeclarations(set<string>* fwd_decls) const; + virtual void DetermineForwardDeclarations(std::set<string>* fwd_decls) const; // Used during generation, not intended to be extended by subclasses. void GenerateFieldDescription( @@ -100,7 +100,7 @@ class FieldGenerator { virtual bool WantsHasProperty(void) const = 0; const FieldDescriptor* descriptor_; - map<string, string> variables_; + std::map<string, string> variables_; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_file.cc b/src/google/protobuf/compiler/objectivec/objectivec_file.cc index 7ad127bb..954b2688 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_file.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_file.cc @@ -89,7 +89,7 @@ bool FileContainsExtensions(const FileDescriptor* file) { void PruneFileAndDepsMarkingAsVisited( const FileDescriptor* file, vector<const FileDescriptor*>* files, - set<const FileDescriptor*>* files_visited) { + std::set<const FileDescriptor*>* files_visited) { vector<const FileDescriptor*>::iterator iter = std::find(files->begin(), files->end(), file); if (iter != files->end()) { @@ -105,7 +105,7 @@ void PruneFileAndDepsMarkingAsVisited( void CollectMinimalFileDepsContainingExtensionsWorker( const FileDescriptor* file, vector<const FileDescriptor*>* files, - set<const FileDescriptor*>* files_visited) { + std::set<const FileDescriptor*>* files_visited) { if (files_visited->find(file) != files_visited->end()) { return; } @@ -138,7 +138,7 @@ void CollectMinimalFileDepsContainingExtensionsWorker( void CollectMinimalFileDepsContainingExtensions( const FileDescriptor* file, vector<const FileDescriptor*>* files) { - set<const FileDescriptor*> files_visited; + std::set<const FileDescriptor*> files_visited; for (int i = 0; i < file->dependency_count(); i++) { const FileDescriptor* dep = file->dependency(i); CollectMinimalFileDepsContainingExtensionsWorker(dep, files, @@ -229,12 +229,12 @@ void FileGenerator::GenerateHeader(io::Printer *printer) { "CF_EXTERN_C_BEGIN\n" "\n"); - set<string> fwd_decls; + std::set<string> fwd_decls; for (vector<MessageGenerator *>::iterator iter = message_generators_.begin(); iter != message_generators_.end(); ++iter) { (*iter)->DetermineForwardDeclarations(&fwd_decls); } - for (set<string>::const_iterator i(fwd_decls.begin()); + for (std::set<string>::const_iterator i(fwd_decls.begin()); i != fwd_decls.end(); ++i) { printer->Print("$value$;\n", "value", *i); } @@ -325,7 +325,7 @@ void FileGenerator::GenerateSource(io::Printer *printer) { // #import the headers for anything that a plain dependency of this proto // file (that means they were just an include, not a "public" include). - set<string> public_import_names; + std::set<string> public_import_names; for (int i = 0; i < file_->public_dependency_count(); i++) { public_import_names.insert(file_->public_dependency(i)->name()); } @@ -468,7 +468,7 @@ void FileGenerator::GenerateSource(io::Printer *printer) { // File descriptor only needed if there are messages to use it. if (message_generators_.size() > 0) { - map<string, string> vars; + std::map<string, string> vars; vars["root_class_name"] = root_class_name_; vars["package"] = file_->package(); vars["objc_prefix"] = FileClassPrefix(file_); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc index 1ea2676a..e347ef1e 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc @@ -196,7 +196,7 @@ const char* const kReservedWordList[] = { // method declared in protos. The main cases are methods // that take no arguments, or setFoo:/hasFoo: type methods. "clear", "data", "delimitedData", "descriptor", "extensionRegistry", - "extensionsCurrentlySet", "isInitialized", "serializedSize", + "extensionsCurrentlySet", "initialized", "isInitialized", "serializedSize", "sortedExtensionsInUse", "unknownFields", // MacTypes.h names @@ -980,13 +980,13 @@ namespace { class ExpectedPrefixesCollector : public LineConsumer { public: - ExpectedPrefixesCollector(map<string, string>* inout_package_to_prefix_map) + ExpectedPrefixesCollector(std::map<string, string>* inout_package_to_prefix_map) : prefix_map_(inout_package_to_prefix_map) {} virtual bool ConsumeLine(const StringPiece& line, string* out_error); private: - map<string, string>* prefix_map_; + std::map<string, string>* prefix_map_; }; bool ExpectedPrefixesCollector::ConsumeLine( @@ -1009,7 +1009,7 @@ bool ExpectedPrefixesCollector::ConsumeLine( } bool LoadExpectedPackagePrefixes(const Options &generation_options, - map<string, string>* prefix_map, + std::map<string, string>* prefix_map, string* out_error) { if (generation_options.expected_prefixes_path.empty()) { return true; @@ -1023,7 +1023,7 @@ bool LoadExpectedPackagePrefixes(const Options &generation_options, bool ValidateObjCClassPrefix( const FileDescriptor* file, const string& expected_prefixes_path, - const map<string, string>& expected_package_prefixes, + const std::map<string, string>& expected_package_prefixes, string* out_error) { const string prefix = file->options().objc_class_prefix(); const string package = file->package(); @@ -1033,7 +1033,7 @@ bool ValidateObjCClassPrefix( // Check: Error - See if there was an expected prefix for the package and // report if it doesn't match (wrong or missing). - map<string, string>::const_iterator package_match = + std::map<string, string>::const_iterator package_match = expected_package_prefixes.find(package); if (package_match != expected_package_prefixes.end()) { // There was an entry, and... @@ -1082,7 +1082,7 @@ bool ValidateObjCClassPrefix( // Look for any other package that uses the same prefix. string other_package_for_prefix; - for (map<string, string>::const_iterator i = expected_package_prefixes.begin(); + for (std::map<string, string>::const_iterator i = expected_package_prefixes.begin(); i != expected_package_prefixes.end(); ++i) { if (i->second == prefix) { other_package_for_prefix = i->first; @@ -1150,7 +1150,7 @@ bool ValidateObjCClassPrefixes(const vector<const FileDescriptor*>& files, const Options& generation_options, string* out_error) { // Load the expected package prefixes, if available, to validate against. - map<string, string> expected_package_prefixes; + std::map<string, string> expected_package_prefixes; if (!LoadExpectedPackagePrefixes(generation_options, &expected_package_prefixes, out_error)) { @@ -1519,7 +1519,7 @@ void ImportWriter::AddFile(const FileDescriptor* file, ParseFrameworkMappings(); } - map<string, string>::iterator proto_lookup = + std::map<string, string>::iterator proto_lookup = proto_file_to_framework_name_.find(file->name()); if (proto_lookup != proto_file_to_framework_name_.end()) { other_framework_imports_.push_back( @@ -1640,7 +1640,7 @@ bool ImportWriter::ProtoFrameworkCollector::ConsumeLine( StringPiece proto_file(proto_file_list, start, offset - start); StringPieceTrimWhitespace(&proto_file); if (proto_file.size() != 0) { - map<string, string>::iterator existing_entry = + std::map<string, string>::iterator existing_entry = map_->find(proto_file.ToString()); if (existing_entry != map_->end()) { std::cerr << "warning: duplicate proto file reference, replacing framework entry for '" diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h index c99262a1..daea7609 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h @@ -262,20 +262,20 @@ class LIBPROTOC_EXPORT ImportWriter { private: class ProtoFrameworkCollector : public LineConsumer { public: - ProtoFrameworkCollector(map<string, string>* inout_proto_file_to_framework_name) + ProtoFrameworkCollector(std::map<string, string>* inout_proto_file_to_framework_name) : map_(inout_proto_file_to_framework_name) {} virtual bool ConsumeLine(const StringPiece& line, string* out_error); private: - map<string, string>* map_; + std::map<string, string>* map_; }; void ParseFrameworkMappings(); const string generate_for_named_framework_; const string named_framework_to_proto_path_mappings_path_; - map<string, string> proto_file_to_framework_name_; + std::map<string, string> proto_file_to_framework_name_; bool need_to_parse_mapping_file_; vector<string> protobuf_framework_imports_; diff --git a/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc index 0bc9dc10..bcaf5709 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc @@ -162,7 +162,7 @@ void MapFieldGenerator::FinishInitialization(void) { } void MapFieldGenerator::DetermineForwardDeclarations( - set<string>* fwd_decls) const { + std::set<string>* fwd_decls) const { RepeatedFieldGenerator::DetermineForwardDeclarations(fwd_decls); const FieldDescriptor* value_descriptor = descriptor_->message_type()->FindFieldByName("value"); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_map_field.h b/src/google/protobuf/compiler/objectivec/objectivec_map_field.h index bc68a682..6664d849 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_map_field.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_map_field.h @@ -51,7 +51,7 @@ class MapFieldGenerator : public RepeatedFieldGenerator { MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options); virtual ~MapFieldGenerator(); - virtual void DetermineForwardDeclarations(set<string>* fwd_decls) const; + virtual void DetermineForwardDeclarations(std::set<string>* fwd_decls) const; private: scoped_ptr<FieldGenerator> value_field_generator_; diff --git a/src/google/protobuf/compiler/objectivec/objectivec_message.cc b/src/google/protobuf/compiler/objectivec/objectivec_message.cc index 0a554a83..4f22e290 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_message.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_message.cc @@ -233,7 +233,7 @@ void MessageGenerator::GenerateStaticVariablesInitialization( } } -void MessageGenerator::DetermineForwardDeclarations(set<string>* fwd_decls) { +void MessageGenerator::DetermineForwardDeclarations(std::set<string>* fwd_decls) { if (!IsMapEntryMessage(descriptor_)) { for (int i = 0; i < descriptor_->field_count(); i++) { const FieldDescriptor* fieldDescriptor = descriptor_->field(i); @@ -514,7 +514,7 @@ void MessageGenerator::GenerateSource(io::Printer* printer) { " };\n"); } - map<string, string> vars; + std::map<string, string> vars; vars["classname"] = class_name_; vars["rootclassname"] = root_classname_; vars["fields"] = has_fields ? "fields" : "NULL"; diff --git a/src/google/protobuf/compiler/objectivec/objectivec_message.h b/src/google/protobuf/compiler/objectivec/objectivec_message.h index 0fb78bc0..8f317ac0 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_message.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_message.h @@ -64,7 +64,7 @@ class MessageGenerator { void GenerateMessageHeader(io::Printer* printer); void GenerateSource(io::Printer* printer); void GenerateExtensionRegistrationSource(io::Printer* printer); - void DetermineForwardDeclarations(set<string>* fwd_decls); + void DetermineForwardDeclarations(std::set<string>* fwd_decls); // Checks if the message or a nested message includes a oneof definition. bool IncludesOneOfDefinition() const; diff --git a/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc index d6ccd6d1..699d25b3 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc @@ -45,7 +45,7 @@ namespace objectivec { namespace { void SetMessageVariables(const FieldDescriptor* descriptor, - map<string, string>* variables) { + std::map<string, string>* variables) { const string& message_type = ClassName(descriptor->message_type()); (*variables)["type"] = message_type; (*variables)["containing_class"] = ClassName(descriptor->containing_type()); @@ -67,7 +67,7 @@ MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor, MessageFieldGenerator::~MessageFieldGenerator() {} void MessageFieldGenerator::DetermineForwardDeclarations( - set<string>* fwd_decls) const { + std::set<string>* fwd_decls) const { ObjCObjFieldGenerator::DetermineForwardDeclarations(fwd_decls); // Class name is already in "storage_type". fwd_decls->insert("@class " + variable("storage_type")); @@ -95,7 +95,7 @@ RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator( RepeatedMessageFieldGenerator::~RepeatedMessageFieldGenerator() {} void RepeatedMessageFieldGenerator::DetermineForwardDeclarations( - set<string>* fwd_decls) const { + std::set<string>* fwd_decls) const { RepeatedFieldGenerator::DetermineForwardDeclarations(fwd_decls); // Class name is already in "storage_type". fwd_decls->insert("@class " + variable("storage_type")); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_message_field.h b/src/google/protobuf/compiler/objectivec/objectivec_message_field.h index d2dba153..50f4b6d4 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_message_field.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_message_field.h @@ -51,7 +51,7 @@ class MessageFieldGenerator : public ObjCObjFieldGenerator { virtual bool WantsHasProperty(void) const; public: - virtual void DetermineForwardDeclarations(set<string>* fwd_decls) const; + virtual void DetermineForwardDeclarations(std::set<string>* fwd_decls) const; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator); @@ -67,7 +67,7 @@ class RepeatedMessageFieldGenerator : public RepeatedFieldGenerator { virtual ~RepeatedMessageFieldGenerator(); public: - virtual void DetermineForwardDeclarations(set<string>* fwd_decls) const; + virtual void DetermineForwardDeclarations(std::set<string>* fwd_decls) const; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_oneof.h b/src/google/protobuf/compiler/objectivec/objectivec_oneof.h index 3d9df4db..ff353a6c 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_oneof.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_oneof.h @@ -67,7 +67,7 @@ class OneofGenerator { private: const OneofDescriptor* descriptor_; - map<string, string> variables_; + std::map<string, string> variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(OneofGenerator); }; diff --git a/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc index d49350f4..aa8ac324 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc @@ -118,7 +118,7 @@ const char* PrimitiveArrayTypeName(const FieldDescriptor* descriptor) { } void SetPrimitiveVariables(const FieldDescriptor* descriptor, - map<string, string>* variables) { + std::map<string, string>* variables) { std::string primitive_name = PrimitiveTypeName(descriptor); (*variables)["type"] = primitive_name; (*variables)["storage_type"] = primitive_name; diff --git a/src/google/protobuf/compiler/parser.cc b/src/google/protobuf/compiler/parser.cc index 23e9e62b..bb4a44c3 100644 --- a/src/google/protobuf/compiler/parser.cc +++ b/src/google/protobuf/compiler/parser.cc @@ -1391,7 +1391,7 @@ bool Parser::ParseOption(Message* options, value_location.AddPath( UninterpretedOption::kNegativeIntValueFieldNumber); uninterpreted_option->set_negative_int_value( - -static_cast<int64>(value)); + static_cast<int64>(-value)); } else { value_location.AddPath( UninterpretedOption::kPositiveIntValueFieldNumber); diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc index ea850c0f..60e6fce9 100644 --- a/src/google/protobuf/compiler/php/php_generator.cc +++ b/src/google/protobuf/compiler/php/php_generator.cc @@ -49,8 +49,11 @@ const std::string kDescriptorMetadataFile = "GPBMetadata/Google/Protobuf/Internal/Descriptor.php"; const std::string kDescriptorDirName = "Google/Protobuf/Internal"; const std::string kDescriptorPackageName = "Google\\Protobuf\\Internal"; -const char* const kReservedNames[] = {"Empty", "ECHO"}; -const int kReservedNamesSize = 2; +const char* const kReservedNames[] = {"ARRAY", "Empty", "ECHO"}; +const int kReservedNamesSize = 3; +const int kFieldSetter = 1; +const int kFieldGetter = 2; +const int kFieldProperty = 3; namespace google { namespace protobuf { @@ -71,12 +74,18 @@ std::string EscapeDollor(const string& to_escape); std::string BinaryToHex(const string& binary); void Indent(io::Printer* printer); void Outdent(io::Printer* printer); -void GenerateMessageDocComment(io::Printer* printer, const Descriptor* message); -void GenerateFieldDocComment(io::Printer* printer, - const FieldDescriptor* field); -void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_); +void GenerateMessageDocComment(io::Printer* printer, const Descriptor* message, + int is_descriptor); +void GenerateFieldDocComment(io::Printer* printer, const FieldDescriptor* field, + int is_descriptor, int function_type); +void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_, + int is_descriptor); void GenerateEnumValueDocComment(io::Printer* printer, const EnumValueDescriptor* value); +void GenerateServiceDocComment(io::Printer* printer, + const ServiceDescriptor* service); +void GenerateServiceMethodDocComment(io::Printer* printer, + const MethodDescriptor* method); std::string RenameEmpty(const std::string& name) { if (name == "Empty") { @@ -134,6 +143,25 @@ std::string ClassNamePrefix(const string& classname, return ""; } +template <typename DescriptorType> +std::string NamespacedName(const string& classname, + const DescriptorType* desc, bool is_descriptor) { + if (desc->file()->options().has_php_namespace()) { + const string& php_namespace = desc->file()->options().php_namespace(); + if (php_namespace != "") { + return php_namespace + '\\' + classname; + } else { + return classname; + } + } + + if (desc->file()->package() == "") { + return classname; + } else { + return PhpName(desc->file()->package(), is_descriptor) + '\\' + + classname; + } +} template <typename DescriptorType> std::string FullClassName(const DescriptorType* desc, bool is_descriptor) { @@ -144,13 +172,13 @@ std::string FullClassName(const DescriptorType* desc, bool is_descriptor) { containing = containing->containing_type(); } classname = ClassNamePrefix(classname, desc) + classname; + return NamespacedName(classname, desc, is_descriptor); +} - if (desc->file()->package() == "") { - return classname; - } else { - return PhpName(desc->file()->package(), is_descriptor) + '\\' + - classname; - } +std::string FullClassName(const ServiceDescriptor* desc, bool is_descriptor) { + string classname = desc->name(); + classname = ClassNamePrefix(classname, desc) + classname; + return NamespacedName(classname, desc, is_descriptor); } std::string PhpName(const std::string& full_name, bool is_descriptor) { @@ -258,6 +286,17 @@ std::string GeneratedEnumFileName(const EnumDescriptor* en, return result + ".php"; } +std::string GeneratedServiceFileName(const ServiceDescriptor* service, + bool is_descriptor) { + std::string result = FullClassName(service, is_descriptor) + "Interface"; + for (int i = 0; i < result.size(); i++) { + if (result[i] == '\\') { + result[i] = '/'; + } + } + return result + ".php"; +} + std::string IntToString(int32 value) { std::ostringstream os; os << value; @@ -297,6 +336,87 @@ std::string TypeName(const FieldDescriptor* field) { } } +std::string PhpSetterTypeName(const FieldDescriptor* field, bool is_descriptor) { + if (field->is_map()) { + return "array|\\Google\\Protobuf\\Internal\\MapField"; + } + string type; + switch (field->type()) { + case FieldDescriptor::TYPE_INT32: + case FieldDescriptor::TYPE_UINT32: + case FieldDescriptor::TYPE_SINT32: + case FieldDescriptor::TYPE_FIXED32: + case FieldDescriptor::TYPE_SFIXED32: + case FieldDescriptor::TYPE_ENUM: + type = "int"; + break; + case FieldDescriptor::TYPE_INT64: + case FieldDescriptor::TYPE_UINT64: + case FieldDescriptor::TYPE_SINT64: + case FieldDescriptor::TYPE_FIXED64: + case FieldDescriptor::TYPE_SFIXED64: + type = "int|string"; + break; + case FieldDescriptor::TYPE_DOUBLE: + case FieldDescriptor::TYPE_FLOAT: + type = "float"; + break; + case FieldDescriptor::TYPE_BOOL: + type = "bool"; + break; + case FieldDescriptor::TYPE_STRING: + case FieldDescriptor::TYPE_BYTES: + type = "string"; + break; + case FieldDescriptor::TYPE_MESSAGE: + type = "\\" + FullClassName(field->message_type(), is_descriptor); + break; + case FieldDescriptor::TYPE_GROUP: + return "null"; + default: assert(false); return ""; + } + if (field->is_repeated()) { + // accommodate for edge case with multiple types. + size_t start_pos = type.find("|"); + if (start_pos != std::string::npos) { + type.replace(start_pos, 1, "[]|"); + } + type += "[]|\\Google\\Protobuf\\Internal\\RepeatedField"; + } + return type; +} + +std::string PhpGetterTypeName(const FieldDescriptor* field, bool is_descriptor) { + if (field->is_map()) { + return "\\Google\\Protobuf\\Internal\\MapField"; + } + if (field->is_repeated()) { + return "\\Google\\Protobuf\\Internal\\RepeatedField"; + } + switch (field->type()) { + case FieldDescriptor::TYPE_INT32: + case FieldDescriptor::TYPE_UINT32: + case FieldDescriptor::TYPE_SINT32: + case FieldDescriptor::TYPE_FIXED32: + case FieldDescriptor::TYPE_SFIXED32: + case FieldDescriptor::TYPE_ENUM: return "int"; + case FieldDescriptor::TYPE_INT64: + case FieldDescriptor::TYPE_UINT64: + case FieldDescriptor::TYPE_SINT64: + case FieldDescriptor::TYPE_FIXED64: + case FieldDescriptor::TYPE_SFIXED64: return "int|string"; + case FieldDescriptor::TYPE_DOUBLE: + case FieldDescriptor::TYPE_FLOAT: return "float"; + case FieldDescriptor::TYPE_BOOL: return "bool"; + case FieldDescriptor::TYPE_STRING: + case FieldDescriptor::TYPE_BYTES: return "string"; + case FieldDescriptor::TYPE_MESSAGE: + return "\\" + FullClassName(field->message_type(), is_descriptor); + case FieldDescriptor::TYPE_GROUP: return "null"; + default: assert(false); return ""; + } +} + std::string EnumOrMessageSuffix( const FieldDescriptor* field, bool is_descriptor) { if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { @@ -381,7 +501,7 @@ void Outdent(io::Printer* printer) { void GenerateField(const FieldDescriptor* field, io::Printer* printer, bool is_descriptor) { if (field->is_repeated()) { - GenerateFieldDocComment(printer, field); + GenerateFieldDocComment(printer, field, is_descriptor, kFieldProperty); printer->Print( "private $^name^;\n", "name", field->name()); @@ -389,7 +509,7 @@ void GenerateField(const FieldDescriptor* field, io::Printer* printer, // Oneof fields are handled by GenerateOneofField. return; } else { - GenerateFieldDocComment(printer, field); + GenerateFieldDocComment(printer, field, is_descriptor, kFieldProperty); printer->Print( "private $^name^ = ^default^;\n", "name", field->name(), @@ -417,7 +537,7 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, // Generate getter. if (oneof != NULL) { - GenerateFieldDocComment(printer, field); + GenerateFieldDocComment(printer, field, is_descriptor, kFieldGetter); printer->Print( "public function get^camel_name^()\n" "{\n" @@ -426,7 +546,7 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, "camel_name", UnderscoresToCamelCase(field->name(), true), "number", IntToString(field->number())); } else { - GenerateFieldDocComment(printer, field); + GenerateFieldDocComment(printer, field, is_descriptor, kFieldGetter); printer->Print( "public function get^camel_name^()\n" "{\n" @@ -437,14 +557,11 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, } // Generate setter. - GenerateFieldDocComment(printer, field); + GenerateFieldDocComment(printer, field, is_descriptor, kFieldSetter); printer->Print( - "public function set^camel_name^(^var^)\n" + "public function set^camel_name^($var)\n" "{\n", - "camel_name", UnderscoresToCamelCase(field->name(), true), - "var", (field->is_repeated() || - field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) ? - "&$var": "$var"); + "camel_name", UnderscoresToCamelCase(field->name(), true)); Indent(printer); @@ -530,6 +647,8 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, "field_name", field->name()); } + printer->Print("\nreturn $this;\n"); + Outdent(printer); printer->Print( @@ -566,6 +685,16 @@ void GenerateEnumToPool(const EnumDescriptor* en, io::Printer* printer) { Outdent(printer); } +void GenerateServiceMethod(const MethodDescriptor* method, + io::Printer* printer) { + printer->Print( + "public function ^camel_name^(\\^request_name^ $request);\n\n", + "camel_name", UnderscoresToCamelCase(method->name(), false), + "request_name", FullClassName( + method->input_type(), false) + ); +} + void GenerateMessageToPool(const string& name_prefix, const Descriptor* message, io::Printer* printer) { // Don't generate MapEntry messages -- we use the PHP extension's native @@ -747,7 +876,7 @@ void GenerateUseDeclaration(bool is_descriptor, io::Printer* printer) { "use Google\\Protobuf\\Internal\\GPBType;\n" "use Google\\Protobuf\\Internal\\GPBWire;\n" "use Google\\Protobuf\\Internal\\RepeatedField;\n" - "use Google\\Protobuf\\Internal\\InputStream;\n\n" + "use Google\\Protobuf\\Internal\\InputStream;\n" "use Google\\Protobuf\\Internal\\GPBUtil;\n\n"); } } @@ -820,13 +949,20 @@ void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en, std::string fullname = FilenameToClassname(filename); int lastindex = fullname.find_last_of("\\"); - if (!file->package().empty()) { + if (file->options().has_php_namespace()) { + const string& php_namespace = file->options().php_namespace(); + if (!php_namespace.empty()) { + printer.Print( + "namespace ^name^;\n\n", + "name", php_namespace); + } + } else if (!file->package().empty()) { printer.Print( "namespace ^name^;\n\n", "name", fullname.substr(0, lastindex)); } - GenerateEnumDocComment(&printer, en); + GenerateEnumDocComment(&printer, en, is_descriptor); if (lastindex != string::npos) { printer.Print( @@ -872,7 +1008,14 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message, std::string fullname = FilenameToClassname(filename); int lastindex = fullname.find_last_of("\\"); - if (!file->package().empty()) { + if (file->options().has_php_namespace()) { + const string& php_namespace = file->options().php_namespace(); + if (!php_namespace.empty()) { + printer.Print( + "namespace ^name^;\n\n", + "name", php_namespace); + } + } else if (!file->package().empty()) { printer.Print( "namespace ^name^;\n\n", "name", fullname.substr(0, lastindex)); @@ -880,7 +1023,7 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message, GenerateUseDeclaration(is_descriptor, &printer); - GenerateMessageDocComment(&printer, message); + GenerateMessageDocComment(&printer, message, is_descriptor); if (lastindex != string::npos) { printer.Print( "class ^name^ extends \\Google\\Protobuf\\Internal\\Message\n" @@ -928,6 +1071,9 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message, for (int i = 0; i < message->oneof_decl_count(); i++) { const OneofDescriptor* oneof = message->oneof_decl(i); printer.Print( + "/**\n" + " * @return string\n" + " */\n" "public function get^camel_name^()\n" "{\n" " return $this->whichOneof(\"^name^\");\n" @@ -950,6 +1096,58 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message, } } +void GenerateServiceFile(const FileDescriptor* file, + const ServiceDescriptor* service, bool is_descriptor, + GeneratorContext* generator_context) { + std::string filename = GeneratedServiceFileName(service, is_descriptor); + scoped_ptr<io::ZeroCopyOutputStream> output( + generator_context->Open(filename)); + io::Printer printer(output.get(), '^'); + + GenerateHead(file, &printer); + + std::string fullname = FilenameToClassname(filename); + int lastindex = fullname.find_last_of("\\"); + + if (file->options().has_php_namespace()) { + const string& php_namespace = file->options().php_namespace(); + if (!php_namespace.empty()) { + printer.Print( + "namespace ^name^;\n\n", + "name", php_namespace); + } + } else if (!file->package().empty()) { + printer.Print( + "namespace ^name^;\n\n", + "name", fullname.substr(0, lastindex)); + } + + GenerateServiceDocComment(&printer, service); + + if (lastindex != string::npos) { + printer.Print( + "interface ^name^\n" + "{\n", + "name", fullname.substr(lastindex + 1)); + } else { + printer.Print( + "interface ^name^\n" + "{\n", + "name", fullname); + } + + Indent(&printer); + + for (int i = 0; i < service->method_count(); i++) { + const MethodDescriptor* method = service->method(i); + GenerateServiceMethodDocComment(&printer, method); + GenerateServiceMethod(method, &printer); + } + + Outdent(&printer); + printer.Print("}\n\n"); +} + void GenerateFile(const FileDescriptor* file, bool is_descriptor, GeneratorContext* generator_context) { GenerateMetadataFile(file, is_descriptor, generator_context); @@ -961,6 +1159,12 @@ void GenerateFile(const FileDescriptor* file, bool is_descriptor, GenerateEnumFile(file, file->enum_type(i), is_descriptor, generator_context); } + if (file->options().php_generic_services()) { + for (int i = 0; i < file->service_count(); i++) { + GenerateServiceFile(file, file->service(i), is_descriptor, + generator_context); + } + } } static string EscapePhpdoc(const string& input) { @@ -994,22 +1198,6 @@ static string EscapePhpdoc(const string& input) { // does not have a corresponding @Deprecated annotation. result.append("@"); break; - case '<': - // Avoid interpretation as HTML. - result.append("<"); - break; - case '>': - // Avoid interpretation as HTML. - result.append(">"); - break; - case '&': - // Avoid interpretation as HTML. - result.append("&"); - break; - case '\\': - // Java interprets Unicode escape sequences anywhere! - result.append("\"); - break; default: result.push_back(c); break; @@ -1028,7 +1216,7 @@ static void GenerateDocCommentBodyForLocation( if (!comments.empty()) { // TODO(teboring): Ideally we should parse the comment text as Markdown and // write it back as HTML, but this requires a Markdown parser. For now - // we just use <pre> to get fixed-width text formatting. + // we just use the proto comments unchanged. // If the comment itself contains block comment start or end markers, // HTML-escape them so that they don't accidentally close the doc comment. @@ -1039,7 +1227,6 @@ static void GenerateDocCommentBodyForLocation( lines.pop_back(); } - printer->Print(" * <pre>\n"); for (int i = 0; i < lines.size(); i++) { // Most lines should start with a space. Watch out for lines that start // with a /, since putting that right after the leading asterisk will @@ -1051,7 +1238,6 @@ static void GenerateDocCommentBodyForLocation( } } printer->Print( - " * </pre>\n" " *\n"); } } @@ -1077,17 +1263,28 @@ static string FirstLineOf(const string& value) { } void GenerateMessageDocComment(io::Printer* printer, - const Descriptor* message) { + const Descriptor* message, int is_descriptor) { printer->Print("/**\n"); GenerateDocCommentBody(printer, message); printer->Print( + " * Generated from protobuf message <code>^messagename^</code>\n" + " */\n", + "fullname", EscapePhpdoc(PhpName(message->full_name(), is_descriptor)), + "messagename", EscapePhpdoc(message->full_name())); +} + +void GenerateServiceDocComment(io::Printer* printer, + const ServiceDescriptor* service) { + printer->Print("/**\n"); + GenerateDocCommentBody(printer, service); + printer->Print( " * Protobuf type <code>^fullname^</code>\n" " */\n", - "fullname", EscapePhpdoc(message->full_name())); + "fullname", EscapePhpdoc(service->full_name())); } -void GenerateFieldDocComment(io::Printer* printer, - const FieldDescriptor* field) { +void GenerateFieldDocComment(io::Printer* printer, const FieldDescriptor* field, + int is_descriptor, int function_type) { // In theory we should have slightly different comments for setters, getters, // etc., but in practice everyone already knows the difference between these // so it's redundant information. @@ -1099,18 +1296,27 @@ void GenerateFieldDocComment(io::Printer* printer, printer->Print("/**\n"); GenerateDocCommentBody(printer, field); printer->Print( - " * <code>^def^</code>\n", + " * Generated from protobuf field <code>^def^</code>\n", "def", EscapePhpdoc(FirstLineOf(field->DebugString()))); + if (function_type == kFieldSetter) { + printer->Print(" * @param ^php_type^ $var\n", + "php_type", PhpSetterTypeName(field, is_descriptor)); + printer->Print(" * @return $this\n"); + } else if (function_type == kFieldGetter) { + printer->Print(" * @return ^php_type^\n", + "php_type", PhpGetterTypeName(field, is_descriptor)); + } printer->Print(" */\n"); } -void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_) { +void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_, + int is_descriptor) { printer->Print("/**\n"); GenerateDocCommentBody(printer, enum_); printer->Print( " * Protobuf enum <code>^fullname^</code>\n" " */\n", - "fullname", EscapePhpdoc(enum_->full_name())); + "fullname", EscapePhpdoc(PhpName(enum_->full_name(), is_descriptor))); } void GenerateEnumValueDocComment(io::Printer* printer, @@ -1118,11 +1324,28 @@ void GenerateEnumValueDocComment(io::Printer* printer, printer->Print("/**\n"); GenerateDocCommentBody(printer, value); printer->Print( - " * <code>^def^</code>\n" + " * Generated from protobuf enum <code>^def^</code>\n" " */\n", "def", EscapePhpdoc(FirstLineOf(value->DebugString()))); } +void GenerateServiceMethodDocComment(io::Printer* printer, + const MethodDescriptor* method) { + printer->Print("/**\n"); + GenerateDocCommentBody(printer, method); + printer->Print( + " * Method <code>^method_name^</code>\n" + " *\n", + "method_name", EscapePhpdoc(UnderscoresToCamelCase(method->name(), false))); + printer->Print( + " * @param \\^input_type^ $request\n", + "input_type", EscapePhpdoc(FullClassName(method->input_type(), false))); + printer->Print( + " * @return \\^return_type^\n" + " */\n", + "return_type", EscapePhpdoc(FullClassName(method->output_type(), false))); +} + bool Generator::Generate(const FileDescriptor* file, const string& parameter, GeneratorContext* generator_context, string* error) const { diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index 6cc96b30..170148db 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -225,16 +225,17 @@ Version::Version(const Version& from) suffix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.suffix_); } ::memcpy(&major_, &from.major_, - reinterpret_cast<char*>(&patch_) - - reinterpret_cast<char*>(&major_) + sizeof(patch_)); + static_cast<size_t>(reinterpret_cast<char*>(&patch_) - + reinterpret_cast<char*>(&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<char*>(&patch_) - - reinterpret_cast<char*>(&major_) + sizeof(patch_)); + ::memset(&major_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&patch_) - + reinterpret_cast<char*>(&major_)) + sizeof(patch_)); } Version::~Version() { @@ -281,8 +282,9 @@ void Version::Clear() { } cached_has_bits = _has_bits_[0]; if (cached_has_bits & 14u) { - ::memset(&major_, 0, reinterpret_cast<char*>(&patch_) - - reinterpret_cast<char*>(&major_) + sizeof(patch_)); + ::memset(&major_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&patch_) - + reinterpret_cast<char*>(&major_)) + sizeof(patch_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -347,7 +349,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<int>(this->suffix().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.compiler.Version.suffix"); } else { @@ -401,7 +403,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<int>(this->suffix().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.Version.suffix"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -440,7 +442,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<int>(this->suffix().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.Version.suffix"); target = @@ -838,7 +840,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<int>(this->file_to_generate(this->file_to_generate_size() - 1).length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); } else { @@ -854,7 +856,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<int>(this->parameter().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.compiler.CodeGeneratorRequest.parameter"); } else { @@ -916,7 +918,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<int>(this->file_to_generate(i).length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); ::google::protobuf::internal::WireFormatLite::WriteString( @@ -927,7 +929,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<int>(this->parameter().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorRequest.parameter"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -941,9 +943,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<unsigned int>(this->proto_file_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 15, this->proto_file(i), output); + 15, this->proto_file(static_cast<int>(i)), output); } if (_internal_metadata_.have_unknown_fields()) { @@ -962,7 +965,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<int>(this->file_to_generate(i).length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); target = ::google::protobuf::internal::WireFormatLite:: @@ -973,7 +976,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<int>(this->parameter().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorRequest.parameter"); target = @@ -989,10 +992,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<unsigned int>(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<int>(i)), deterministic, target); } if (_internal_metadata_.have_unknown_fields()) { @@ -1022,12 +1026,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<unsigned int>(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<int>(i))); } } @@ -1462,7 +1466,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.compiler.CodeGeneratorResponse.File.name"); } else { @@ -1478,7 +1482,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<int>(this->insertion_point().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); } else { @@ -1494,7 +1498,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<int>(this->content().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.compiler.CodeGeneratorResponse.File.content"); } else { @@ -1533,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorResponse.File.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1543,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<int>(this->insertion_point().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1553,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<int>(this->content().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorResponse.File.content"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1577,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorResponse.File.name"); target = @@ -1588,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<int>(this->insertion_point().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); target = @@ -1599,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<int>(this->content().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorResponse.File.content"); target = @@ -2022,7 +2026,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<int>(this->error().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.compiler.CodeGeneratorResponse.error"); } else { @@ -2073,7 +2077,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<int>(this->error().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorResponse.error"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -2081,9 +2085,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<unsigned int>(this->file_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 15, this->file(i), output); + 15, this->file(static_cast<int>(i)), output); } if (_internal_metadata_.have_unknown_fields()) { @@ -2103,7 +2108,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<int>(this->error().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.compiler.CodeGeneratorResponse.error"); target = @@ -2112,10 +2117,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<unsigned int>(this->file_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 15, this->file(i), deterministic, target); + 15, this->file(static_cast<int>(i)), deterministic, target); } if (_internal_metadata_.have_unknown_fields()) { @@ -2137,12 +2143,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<unsigned int>(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<int>(i))); } } diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 6a3f5f86..92e28f66 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -309,29 +309,33 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, cc_generic_services_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_generic_services_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, py_generic_services_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, php_generic_services_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, deprecated_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, cc_enable_arenas_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, objc_class_prefix_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, csharp_namespace_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, swift_prefix_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, php_class_prefix_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, php_namespace_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, uninterpreted_option_), 0, 1, - 7, 8, 9, - 15, - 2, 10, + 17, + 2, 11, 12, 13, 14, + 15, + 16, 3, 4, 5, 6, + 7, ~0u, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, _has_bits_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, _internal_metadata_), @@ -498,20 +502,20 @@ static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTR { 133, 141, sizeof(EnumValueDescriptorProto)}, { 144, 152, sizeof(ServiceDescriptorProto)}, { 155, 166, sizeof(MethodDescriptorProto)}, - { 172, 194, sizeof(FileOptions)}, - { 211, 221, sizeof(MessageOptions)}, - { 226, 238, sizeof(FieldOptions)}, - { 245, 251, sizeof(OneofOptions)}, - { 252, 260, sizeof(EnumOptions)}, - { 263, 270, sizeof(EnumValueOptions)}, - { 272, 279, sizeof(ServiceOptions)}, - { 281, 289, sizeof(MethodOptions)}, - { 292, 299, sizeof(UninterpretedOption_NamePart)}, - { 301, 313, sizeof(UninterpretedOption)}, - { 320, 330, sizeof(SourceCodeInfo_Location)}, - { 335, 341, sizeof(SourceCodeInfo)}, - { 342, 351, sizeof(GeneratedCodeInfo_Annotation)}, - { 355, 361, sizeof(GeneratedCodeInfo)}, + { 172, 196, sizeof(FileOptions)}, + { 215, 225, sizeof(MessageOptions)}, + { 230, 242, sizeof(FieldOptions)}, + { 249, 255, sizeof(OneofOptions)}, + { 256, 264, sizeof(EnumOptions)}, + { 267, 274, sizeof(EnumValueOptions)}, + { 276, 283, sizeof(ServiceOptions)}, + { 285, 293, sizeof(MethodOptions)}, + { 296, 303, sizeof(UninterpretedOption_NamePart)}, + { 305, 317, sizeof(UninterpretedOption)}, + { 324, 334, sizeof(SourceCodeInfo_Location)}, + { 339, 345, sizeof(SourceCodeInfo)}, + { 346, 355, sizeof(GeneratedCodeInfo_Annotation)}, + { 359, 365, sizeof(GeneratedCodeInfo)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { @@ -693,7 +697,7 @@ void AddDescriptorsImpl() { "\022\023\n\013output_type\030\003 \001(\t\022/\n\007options\030\004 \001(\0132\036" ".google.protobuf.MethodOptions\022\037\n\020client" "_streaming\030\005 \001(\010:\005false\022\037\n\020server_stream" - "ing\030\006 \001(\010:\005false\"\264\005\n\013FileOptions\022\024\n\014java" + "ing\030\006 \001(\010:\005false\"\360\005\n\013FileOptions\022\024\n\014java" "_package\030\001 \001(\t\022\034\n\024java_outer_classname\030\010" " \001(\t\022\"\n\023java_multiple_files\030\n \001(\010:\005false" "\022)\n\035java_generate_equals_and_hash\030\024 \001(\010B" @@ -703,74 +707,76 @@ void AddDescriptorsImpl() { "_package\030\013 \001(\t\022\"\n\023cc_generic_services\030\020 " "\001(\010:\005false\022$\n\025java_generic_services\030\021 \001(" "\010:\005false\022\"\n\023py_generic_services\030\022 \001(\010:\005f" - "alse\022\031\n\ndeprecated\030\027 \001(\010:\005false\022\037\n\020cc_en" - "able_arenas\030\037 \001(\010:\005false\022\031\n\021objc_class_p" - "refix\030$ \001(\t\022\030\n\020csharp_namespace\030% \001(\t\022\024\n" - "\014swift_prefix\030\' \001(\t\022\030\n\020php_class_prefix\030" - "( \001(\t\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.g" - "oogle.protobuf.UninterpretedOption\":\n\014Op" - "timizeMode\022\t\n\005SPEED\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014" - "LITE_RUNTIME\020\003*\t\010\350\007\020\200\200\200\200\002J\004\010&\020\'\"\362\001\n\016Mess" - "ageOptions\022&\n\027message_set_wire_format\030\001 " - "\001(\010:\005false\022.\n\037no_standard_descriptor_acc" - "essor\030\002 \001(\010:\005false\022\031\n\ndeprecated\030\003 \001(\010:\005" - "false\022\021\n\tmap_entry\030\007 \001(\010\022C\n\024uninterprete" - "d_option\030\347\007 \003(\0132$.google.protobuf.Uninte" - "rpretedOption*\t\010\350\007\020\200\200\200\200\002J\004\010\010\020\tJ\004\010\t\020\n\"\236\003\n" - "\014FieldOptions\022:\n\005ctype\030\001 \001(\0162#.google.pr" - "otobuf.FieldOptions.CType:\006STRING\022\016\n\006pac" - "ked\030\002 \001(\010\022\?\n\006jstype\030\006 \001(\0162$.google.proto" - "buf.FieldOptions.JSType:\tJS_NORMAL\022\023\n\004la" - "zy\030\005 \001(\010:\005false\022\031\n\ndeprecated\030\003 \001(\010:\005fal" - "se\022\023\n\004weak\030\n \001(\010:\005false\022C\n\024uninterpreted" - "_option\030\347\007 \003(\0132$.google.protobuf.Uninter" - "pretedOption\"/\n\005CType\022\n\n\006STRING\020\000\022\010\n\004COR" - "D\020\001\022\020\n\014STRING_PIECE\020\002\"5\n\006JSType\022\r\n\tJS_NO" - "RMAL\020\000\022\r\n\tJS_STRING\020\001\022\r\n\tJS_NUMBER\020\002*\t\010\350" - "\007\020\200\200\200\200\002J\004\010\004\020\005\"^\n\014OneofOptions\022C\n\024uninter" - "preted_option\030\347\007 \003(\0132$.google.protobuf.U" - "ninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"\223\001\n\013EnumOp" - "tions\022\023\n\013allow_alias\030\002 \001(\010\022\031\n\ndeprecated" - "\030\003 \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007" - " \003(\0132$.google.protobuf.UninterpretedOpti" - "on*\t\010\350\007\020\200\200\200\200\002J\004\010\005\020\006\"}\n\020EnumValueOptions\022" - "\031\n\ndeprecated\030\001 \001(\010:\005false\022C\n\024uninterpre" - "ted_option\030\347\007 \003(\0132$.google.protobuf.Unin" - "terpretedOption*\t\010\350\007\020\200\200\200\200\002\"{\n\016ServiceOpt" - "ions\022\031\n\ndeprecated\030! \001(\010:\005false\022C\n\024unint" - "erpreted_option\030\347\007 \003(\0132$.google.protobuf" - ".UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"\255\002\n\rMeth" - "odOptions\022\031\n\ndeprecated\030! \001(\010:\005false\022_\n\021" - "idempotency_level\030\" \001(\0162/.google.protobu" - "f.MethodOptions.IdempotencyLevel:\023IDEMPO" - "TENCY_UNKNOWN\022C\n\024uninterpreted_option\030\347\007" - " \003(\0132$.google.protobuf.UninterpretedOpti" - "on\"P\n\020IdempotencyLevel\022\027\n\023IDEMPOTENCY_UN" - "KNOWN\020\000\022\023\n\017NO_SIDE_EFFECTS\020\001\022\016\n\nIDEMPOTE" - "NT\020\002*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023UninterpretedOption\022" - ";\n\004name\030\002 \003(\0132-.google.protobuf.Uninterp" - "retedOption.NamePart\022\030\n\020identifier_value" - "\030\003 \001(\t\022\032\n\022positive_int_value\030\004 \001(\004\022\032\n\022ne" - "gative_int_value\030\005 \001(\003\022\024\n\014double_value\030\006" - " \001(\001\022\024\n\014string_value\030\007 \001(\014\022\027\n\017aggregate_" - "value\030\010 \001(\t\0323\n\010NamePart\022\021\n\tname_part\030\001 \002" - "(\t\022\024\n\014is_extension\030\002 \002(\010\"\325\001\n\016SourceCodeI" - "nfo\022:\n\010location\030\001 \003(\0132(.google.protobuf." - "SourceCodeInfo.Location\032\206\001\n\010Location\022\020\n\004" - "path\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020lead" - "ing_comments\030\003 \001(\t\022\031\n\021trailing_comments\030" - "\004 \001(\t\022!\n\031leading_detached_comments\030\006 \003(\t" - "\"\247\001\n\021GeneratedCodeInfo\022A\n\nannotation\030\001 \003" - "(\0132-.google.protobuf.GeneratedCodeInfo.A" - "nnotation\032O\n\nAnnotation\022\020\n\004path\030\001 \003(\005B\002\020" - "\001\022\023\n\013source_file\030\002 \001(\t\022\r\n\005begin\030\003 \001(\005\022\013\n" - "\003end\030\004 \001(\005B\214\001\n\023com.google.protobufB\020Desc" - "riptorProtosH\001Z>github.com/golang/protob" - "uf/protoc-gen-go/descriptor;descriptor\242\002" - "\003GPB\252\002\032Google.Protobuf.Reflection" + "alse\022#\n\024php_generic_services\030\023 \001(\010:\005fals" + "e\022\031\n\ndeprecated\030\027 \001(\010:\005false\022\037\n\020cc_enabl" + "e_arenas\030\037 \001(\010:\005false\022\031\n\021objc_class_pref" + "ix\030$ \001(\t\022\030\n\020csharp_namespace\030% \001(\t\022\024\n\014sw" + "ift_prefix\030\' \001(\t\022\030\n\020php_class_prefix\030( \001" + "(\t\022\025\n\rphp_namespace\030) \001(\t\022C\n\024uninterpret" + "ed_option\030\347\007 \003(\0132$.google.protobuf.Unint" + "erpretedOption\":\n\014OptimizeMode\022\t\n\005SPEED\020" + "\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014LITE_RUNTIME\020\003*\t\010\350\007\020" + "\200\200\200\200\002J\004\010&\020\'\"\362\001\n\016MessageOptions\022&\n\027messag" + "e_set_wire_format\030\001 \001(\010:\005false\022.\n\037no_sta" + "ndard_descriptor_accessor\030\002 \001(\010:\005false\022\031" + "\n\ndeprecated\030\003 \001(\010:\005false\022\021\n\tmap_entry\030\007" + " \001(\010\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.go" + "ogle.protobuf.UninterpretedOption*\t\010\350\007\020\200" + "\200\200\200\002J\004\010\010\020\tJ\004\010\t\020\n\"\236\003\n\014FieldOptions\022:\n\005cty" + "pe\030\001 \001(\0162#.google.protobuf.FieldOptions." + "CType:\006STRING\022\016\n\006packed\030\002 \001(\010\022\?\n\006jstype\030" + "\006 \001(\0162$.google.protobuf.FieldOptions.JST" + "ype:\tJS_NORMAL\022\023\n\004lazy\030\005 \001(\010:\005false\022\031\n\nd" + "eprecated\030\003 \001(\010:\005false\022\023\n\004weak\030\n \001(\010:\005fa" + "lse\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.goo" + "gle.protobuf.UninterpretedOption\"/\n\005CTyp" + "e\022\n\n\006STRING\020\000\022\010\n\004CORD\020\001\022\020\n\014STRING_PIECE\020" + "\002\"5\n\006JSType\022\r\n\tJS_NORMAL\020\000\022\r\n\tJS_STRING\020" + "\001\022\r\n\tJS_NUMBER\020\002*\t\010\350\007\020\200\200\200\200\002J\004\010\004\020\005\"^\n\014One" + "ofOptions\022C\n\024uninterpreted_option\030\347\007 \003(\013" + "2$.google.protobuf.UninterpretedOption*\t" + "\010\350\007\020\200\200\200\200\002\"\223\001\n\013EnumOptions\022\023\n\013allow_alias" + "\030\002 \001(\010\022\031\n\ndeprecated\030\003 \001(\010:\005false\022C\n\024uni" + "nterpreted_option\030\347\007 \003(\0132$.google.protob" + "uf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002J\004\010\005\020\006\"" + "}\n\020EnumValueOptions\022\031\n\ndeprecated\030\001 \001(\010:" + "\005false\022C\n\024uninterpreted_option\030\347\007 \003(\0132$." + "google.protobuf.UninterpretedOption*\t\010\350\007" + "\020\200\200\200\200\002\"{\n\016ServiceOptions\022\031\n\ndeprecated\030!" + " \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007 \003" + "(\0132$.google.protobuf.UninterpretedOption" + "*\t\010\350\007\020\200\200\200\200\002\"\255\002\n\rMethodOptions\022\031\n\ndepreca" + "ted\030! \001(\010:\005false\022_\n\021idempotency_level\030\" " + "\001(\0162/.google.protobuf.MethodOptions.Idem" + "potencyLevel:\023IDEMPOTENCY_UNKNOWN\022C\n\024uni" + "nterpreted_option\030\347\007 \003(\0132$.google.protob" + "uf.UninterpretedOption\"P\n\020IdempotencyLev" + "el\022\027\n\023IDEMPOTENCY_UNKNOWN\020\000\022\023\n\017NO_SIDE_E" + "FFECTS\020\001\022\016\n\nIDEMPOTENT\020\002*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023" + "UninterpretedOption\022;\n\004name\030\002 \003(\0132-.goog" + "le.protobuf.UninterpretedOption.NamePart" + "\022\030\n\020identifier_value\030\003 \001(\t\022\032\n\022positive_i" + "nt_value\030\004 \001(\004\022\032\n\022negative_int_value\030\005 \001" + "(\003\022\024\n\014double_value\030\006 \001(\001\022\024\n\014string_value" + "\030\007 \001(\014\022\027\n\017aggregate_value\030\010 \001(\t\0323\n\010NameP" + "art\022\021\n\tname_part\030\001 \002(\t\022\024\n\014is_extension\030\002" + " \002(\010\"\325\001\n\016SourceCodeInfo\022:\n\010location\030\001 \003(" + "\0132(.google.protobuf.SourceCodeInfo.Locat" + "ion\032\206\001\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004sp" + "an\030\002 \003(\005B\002\020\001\022\030\n\020leading_comments\030\003 \001(\t\022\031" + "\n\021trailing_comments\030\004 \001(\t\022!\n\031leading_det" + "ached_comments\030\006 \003(\t\"\247\001\n\021GeneratedCodeIn" + "fo\022A\n\nannotation\030\001 \003(\0132-.google.protobuf" + ".GeneratedCodeInfo.Annotation\032O\n\nAnnotat" + "ion\022\020\n\004path\030\001 \003(\005B\002\020\001\022\023\n\013source_file\030\002 \001" + "(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003end\030\004 \001(\005B\214\001\n\023com.g" + "oogle.protobufB\020DescriptorProtosH\001Z>gith" + "ub.com/golang/protobuf/protoc-gen-go/des" + "criptor;descriptor\242\002\003GPB\252\002\032Google.Protob" + "uf.Reflection" }; ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( - descriptor, 5753); + descriptor, 5813); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/descriptor.proto", &protobuf_RegisterTypes); } @@ -1076,9 +1082,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<unsigned int>(this->file_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 1, this->file(i), output); + 1, this->file(static_cast<int>(i)), output); } if (_internal_metadata_.have_unknown_fields()) { @@ -1095,10 +1102,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<unsigned int>(this->file_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 1, this->file(i), deterministic, target); + 1, this->file(static_cast<int>(i)), deterministic, target); } if (_internal_metadata_.have_unknown_fields()) { @@ -1120,12 +1128,12 @@ size_t FileDescriptorSet::ByteSizeLong() const { } // repeated .google.protobuf.FileDescriptorProto file = 1; { - unsigned int count = this->file_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } @@ -1300,8 +1308,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<char*>(&source_code_info_) - - reinterpret_cast<char*>(&options_) + sizeof(source_code_info_)); + ::memset(&options_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&source_code_info_) - + reinterpret_cast<char*>(&options_)) + sizeof(source_code_info_)); } FileDescriptorProto::~FileDescriptorProto() { @@ -1397,7 +1406,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileDescriptorProto.name"); } else { @@ -1413,7 +1422,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<int>(this->package().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileDescriptorProto.package"); } else { @@ -1430,7 +1439,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<int>(this->dependency(this->dependency_size() - 1).length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileDescriptorProto.dependency"); } else { @@ -1556,7 +1565,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<int>(this->syntax().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileDescriptorProto.syntax"); } else { @@ -1595,7 +1604,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileDescriptorProto.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1605,7 +1614,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<int>(this->package().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileDescriptorProto.package"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1615,7 +1624,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<int>(this->dependency(i).length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileDescriptorProto.dependency"); ::google::protobuf::internal::WireFormatLite::WriteString( @@ -1623,27 +1632,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<unsigned int>(this->message_type_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 4, this->message_type(i), output); + 4, this->message_type(static_cast<int>(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<unsigned int>(this->enum_type_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 5, this->enum_type(i), output); + 5, this->enum_type(static_cast<int>(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<unsigned int>(this->service_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 6, this->service(i), output); + 6, this->service(static_cast<int>(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<unsigned int>(this->extension_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 7, this->extension(i), output); + 7, this->extension(static_cast<int>(i)), output); } // optional .google.protobuf.FileOptions options = 8; @@ -1673,7 +1686,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<int>(this->syntax().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileDescriptorProto.syntax"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1697,7 +1710,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileDescriptorProto.name"); target = @@ -1708,7 +1721,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<int>(this->package().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileDescriptorProto.package"); target = @@ -1719,7 +1732,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<int>(this->dependency(i).length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileDescriptorProto.dependency"); target = ::google::protobuf::internal::WireFormatLite:: @@ -1727,31 +1740,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<unsigned int>(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<int>(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<unsigned int>(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<int>(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<unsigned int>(this->service_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 6, this->service(i), deterministic, target); + 6, this->service(static_cast<int>(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<unsigned int>(this->extension_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 7, this->extension(i), deterministic, target); + 7, this->extension(static_cast<int>(i)), deterministic, target); } // optional .google.protobuf.FileOptions options = 8; @@ -1779,7 +1796,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<int>(this->syntax().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileDescriptorProto.syntax"); target = @@ -1814,45 +1831,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<unsigned int>(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<int>(i))); } } // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; { - unsigned int count = this->enum_type_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } // repeated .google.protobuf.ServiceDescriptorProto service = 6; { - unsigned int count = this->service_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } // repeated .google.protobuf.FieldDescriptorProto extension = 7; { - unsigned int count = this->extension_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } @@ -2586,15 +2603,16 @@ DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(const DescriptorP options_ = NULL; } ::memcpy(&start_, &from.start_, - reinterpret_cast<char*>(&end_) - - reinterpret_cast<char*>(&start_) + sizeof(end_)); + static_cast<size_t>(reinterpret_cast<char*>(&end_) - + reinterpret_cast<char*>(&start_)) + sizeof(end_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ExtensionRange) } void DescriptorProto_ExtensionRange::SharedCtor() { _cached_size_ = 0; - ::memset(&options_, 0, reinterpret_cast<char*>(&end_) - - reinterpret_cast<char*>(&options_) + sizeof(end_)); + ::memset(&options_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&end_) - + reinterpret_cast<char*>(&options_)) + sizeof(end_)); } DescriptorProto_ExtensionRange::~DescriptorProto_ExtensionRange() { @@ -2641,8 +2659,9 @@ void DescriptorProto_ExtensionRange::Clear() { } cached_has_bits = _has_bits_[0]; if (cached_has_bits & 6u) { - ::memset(&start_, 0, reinterpret_cast<char*>(&end_) - - reinterpret_cast<char*>(&start_) + sizeof(end_)); + ::memset(&start_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&end_) - + reinterpret_cast<char*>(&start_)) + sizeof(end_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -3017,15 +3036,16 @@ DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(const DescriptorPro _cached_size_(0) { _internal_metadata_.MergeFrom(from._internal_metadata_); ::memcpy(&start_, &from.start_, - reinterpret_cast<char*>(&end_) - - reinterpret_cast<char*>(&start_) + sizeof(end_)); + static_cast<size_t>(reinterpret_cast<char*>(&end_) - + reinterpret_cast<char*>(&start_)) + sizeof(end_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ReservedRange) } void DescriptorProto_ReservedRange::SharedCtor() { _cached_size_ = 0; - ::memset(&start_, 0, reinterpret_cast<char*>(&end_) - - reinterpret_cast<char*>(&start_) + sizeof(end_)); + ::memset(&start_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&end_) - + reinterpret_cast<char*>(&start_)) + sizeof(end_)); } DescriptorProto_ReservedRange::~DescriptorProto_ReservedRange() { @@ -3067,8 +3087,9 @@ void DescriptorProto_ReservedRange::Clear() { cached_has_bits = _has_bits_[0]; if (cached_has_bits & 3u) { - ::memset(&start_, 0, reinterpret_cast<char*>(&end_) - - reinterpret_cast<char*>(&start_) + sizeof(end_)); + ::memset(&start_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&end_) - + reinterpret_cast<char*>(&start_)) + sizeof(end_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -3470,7 +3491,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.DescriptorProto.name"); } else { @@ -3583,7 +3604,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<int>(this->reserved_name(this->reserved_name_size() - 1).length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.DescriptorProto.reserved_name"); } else { @@ -3622,7 +3643,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.DescriptorProto.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -3630,33 +3651,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<unsigned int>(this->field_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->field(i), output); + 2, this->field(static_cast<int>(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<unsigned int>(this->nested_type_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 3, this->nested_type(i), output); + 3, this->nested_type(static_cast<int>(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<unsigned int>(this->enum_type_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 4, this->enum_type(i), output); + 4, this->enum_type(static_cast<int>(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<unsigned int>(this->extension_range_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 5, this->extension_range(i), output); + 5, this->extension_range(static_cast<int>(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<unsigned int>(this->extension_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 6, this->extension(i), output); + 6, this->extension(static_cast<int>(i)), output); } // optional .google.protobuf.MessageOptions options = 7; @@ -3666,21 +3692,23 @@ 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<unsigned int>(this->oneof_decl_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 8, this->oneof_decl(i), output); + 8, this->oneof_decl(static_cast<int>(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<unsigned int>(this->reserved_range_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 9, this->reserved_range(i), output); + 9, this->reserved_range(static_cast<int>(i)), output); } // 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<int>(this->reserved_name(i).length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.DescriptorProto.reserved_name"); ::google::protobuf::internal::WireFormatLite::WriteString( @@ -3704,7 +3732,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.DescriptorProto.name"); target = @@ -3713,38 +3741,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<unsigned int>(this->field_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 2, this->field(i), deterministic, target); + 2, this->field(static_cast<int>(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<unsigned int>(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<int>(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<unsigned int>(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<int>(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<unsigned int>(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<int>(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<unsigned int>(this->extension_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 6, this->extension(i), deterministic, target); + 6, this->extension(static_cast<int>(i)), deterministic, target); } // optional .google.protobuf.MessageOptions options = 7; @@ -3755,23 +3788,25 @@ 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<unsigned int>(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<int>(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<unsigned int>(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<int>(i)), deterministic, target); } // 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<int>(this->reserved_name(i).length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.DescriptorProto.reserved_name"); target = ::google::protobuf::internal::WireFormatLite:: @@ -3797,78 +3832,78 @@ size_t DescriptorProto::ByteSizeLong() const { } // repeated .google.protobuf.FieldDescriptorProto field = 2; { - unsigned int count = this->field_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } // repeated .google.protobuf.DescriptorProto nested_type = 3; { - unsigned int count = this->nested_type_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; { - unsigned int count = this->enum_type_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; { - unsigned int count = this->extension_range_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } // repeated .google.protobuf.FieldDescriptorProto extension = 6; { - unsigned int count = this->extension_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; { - unsigned int count = this->oneof_decl_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; { - unsigned int count = this->reserved_range_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } @@ -4518,9 +4553,10 @@ void ExtensionRangeOptions::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<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast<int>(i)), output); } // Extension range [1000, 536870912) @@ -4541,10 +4577,11 @@ void ExtensionRangeOptions::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<unsigned int>(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<int>(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -4572,12 +4609,12 @@ size_t ExtensionRangeOptions::ByteSizeLong() const { } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; { - unsigned int count = this->uninterpreted_option_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } @@ -4745,8 +4782,8 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from) options_ = NULL; } ::memcpy(&number_, &from.number_, - reinterpret_cast<char*>(&type_) - - reinterpret_cast<char*>(&number_) + sizeof(type_)); + static_cast<size_t>(reinterpret_cast<char*>(&type_) - + reinterpret_cast<char*>(&number_)) + sizeof(type_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldDescriptorProto) } @@ -4757,8 +4794,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<char*>(&oneof_index_) - - reinterpret_cast<char*>(&options_) + sizeof(oneof_index_)); + ::memset(&options_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&oneof_index_) - + reinterpret_cast<char*>(&options_)) + sizeof(oneof_index_)); label_ = 1; type_ = 1; } @@ -4834,8 +4872,9 @@ void FieldDescriptorProto::Clear() { } } if (cached_has_bits & 192u) { - ::memset(&number_, 0, reinterpret_cast<char*>(&oneof_index_) - - reinterpret_cast<char*>(&number_) + sizeof(oneof_index_)); + ::memset(&number_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&oneof_index_) - + reinterpret_cast<char*>(&number_)) + sizeof(oneof_index_)); } if (cached_has_bits & 768u) { label_ = 1; @@ -4862,7 +4901,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FieldDescriptorProto.name"); } else { @@ -4878,7 +4917,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<int>(this->extendee().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FieldDescriptorProto.extendee"); } else { @@ -4912,7 +4951,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; @@ -4931,7 +4971,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; @@ -4946,7 +4987,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<int>(this->type_name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FieldDescriptorProto.type_name"); } else { @@ -4962,7 +5003,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<int>(this->default_value().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FieldDescriptorProto.default_value"); } else { @@ -5004,7 +5045,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<int>(this->json_name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FieldDescriptorProto.json_name"); } else { @@ -5043,7 +5084,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -5053,7 +5094,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<int>(this->extendee().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.extendee"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -5080,7 +5121,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<int>(this->type_name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.type_name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -5090,7 +5131,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<int>(this->default_value().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.default_value"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -5111,7 +5152,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<int>(this->json_name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.json_name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -5135,7 +5176,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.name"); target = @@ -5146,7 +5187,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<int>(this->extendee().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.extendee"); target = @@ -5174,7 +5215,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<int>(this->type_name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.type_name"); target = @@ -5185,7 +5226,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<int>(this->default_value().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.default_value"); target = @@ -5208,7 +5249,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<int>(this->json_name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FieldDescriptorProto.json_name"); target = @@ -5999,7 +6040,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.OneofDescriptorProto.name"); } else { @@ -6050,7 +6091,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.OneofDescriptorProto.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -6080,7 +6121,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.OneofDescriptorProto.name"); target = @@ -6435,7 +6476,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.EnumDescriptorProto.name"); } else { @@ -6498,7 +6539,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.EnumDescriptorProto.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -6506,9 +6547,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<unsigned int>(this->value_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->value(i), output); + 2, this->value(static_cast<int>(i)), output); } // optional .google.protobuf.EnumOptions options = 3; @@ -6534,7 +6576,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.EnumDescriptorProto.name"); target = @@ -6543,10 +6585,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<unsigned int>(this->value_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 2, this->value(i), deterministic, target); + 2, this->value(static_cast<int>(i)), deterministic, target); } // optional .google.protobuf.EnumOptions options = 3; @@ -6575,12 +6618,12 @@ size_t EnumDescriptorProto::ByteSizeLong() const { } // repeated .google.protobuf.EnumValueDescriptorProto value = 2; { - unsigned int count = this->value_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } @@ -6865,8 +6908,9 @@ EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProt void EnumValueDescriptorProto::SharedCtor() { _cached_size_ = 0; name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&options_, 0, reinterpret_cast<char*>(&number_) - - reinterpret_cast<char*>(&options_) + sizeof(number_)); + ::memset(&options_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&number_) - + reinterpret_cast<char*>(&options_)) + sizeof(number_)); } EnumValueDescriptorProto::~EnumValueDescriptorProto() { @@ -6941,7 +6985,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.EnumValueDescriptorProto.name"); } else { @@ -7006,7 +7050,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.EnumValueDescriptorProto.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -7041,7 +7085,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.EnumValueDescriptorProto.name"); target = @@ -7437,7 +7481,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.ServiceDescriptorProto.name"); } else { @@ -7500,7 +7544,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.ServiceDescriptorProto.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -7508,9 +7552,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<unsigned int>(this->method_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->method(i), output); + 2, this->method(static_cast<int>(i)), output); } // optional .google.protobuf.ServiceOptions options = 3; @@ -7536,7 +7581,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.ServiceDescriptorProto.name"); target = @@ -7545,10 +7590,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<unsigned int>(this->method_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 2, this->method(i), deterministic, target); + 2, this->method(static_cast<int>(i)), deterministic, target); } // optional .google.protobuf.ServiceOptions options = 3; @@ -7577,12 +7623,12 @@ size_t ServiceDescriptorProto::ByteSizeLong() const { } // repeated .google.protobuf.MethodDescriptorProto method = 2; { - unsigned int count = this->method_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } @@ -7872,8 +7918,8 @@ MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from) options_ = NULL; } ::memcpy(&client_streaming_, &from.client_streaming_, - reinterpret_cast<char*>(&server_streaming_) - - reinterpret_cast<char*>(&client_streaming_) + sizeof(server_streaming_)); + static_cast<size_t>(reinterpret_cast<char*>(&server_streaming_) - + reinterpret_cast<char*>(&client_streaming_)) + sizeof(server_streaming_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.MethodDescriptorProto) } @@ -7882,8 +7928,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<char*>(&server_streaming_) - - reinterpret_cast<char*>(&options_) + sizeof(server_streaming_)); + ::memset(&options_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&server_streaming_) - + reinterpret_cast<char*>(&options_)) + sizeof(server_streaming_)); } MethodDescriptorProto::~MethodDescriptorProto() { @@ -7947,8 +7994,9 @@ void MethodDescriptorProto::Clear() { } } if (cached_has_bits & 48u) { - ::memset(&client_streaming_, 0, reinterpret_cast<char*>(&server_streaming_) - - reinterpret_cast<char*>(&client_streaming_) + sizeof(server_streaming_)); + ::memset(&client_streaming_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&server_streaming_) - + reinterpret_cast<char*>(&client_streaming_)) + sizeof(server_streaming_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -7971,7 +8019,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.MethodDescriptorProto.name"); } else { @@ -7987,7 +8035,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<int>(this->input_type().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.MethodDescriptorProto.input_type"); } else { @@ -8003,7 +8051,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<int>(this->output_type().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.MethodDescriptorProto.output_type"); } else { @@ -8082,7 +8130,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.MethodDescriptorProto.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -8092,7 +8140,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<int>(this->input_type().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.MethodDescriptorProto.input_type"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -8102,7 +8150,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<int>(this->output_type().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.MethodDescriptorProto.output_type"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -8142,7 +8190,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<int>(this->name().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.MethodDescriptorProto.name"); target = @@ -8153,7 +8201,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<int>(this->input_type().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.MethodDescriptorProto.input_type"); target = @@ -8164,7 +8212,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<int>(this->output_type().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.MethodDescriptorProto.output_type"); target = @@ -8646,12 +8694,14 @@ const int FileOptions::kGoPackageFieldNumber; const int FileOptions::kCcGenericServicesFieldNumber; const int FileOptions::kJavaGenericServicesFieldNumber; const int FileOptions::kPyGenericServicesFieldNumber; +const int FileOptions::kPhpGenericServicesFieldNumber; const int FileOptions::kDeprecatedFieldNumber; const int FileOptions::kCcEnableArenasFieldNumber; const int FileOptions::kObjcClassPrefixFieldNumber; const int FileOptions::kCsharpNamespaceFieldNumber; const int FileOptions::kSwiftPrefixFieldNumber; const int FileOptions::kPhpClassPrefixFieldNumber; +const int FileOptions::kPhpNamespaceFieldNumber; const int FileOptions::kUninterpretedOptionFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -8699,9 +8749,13 @@ FileOptions::FileOptions(const FileOptions& from) if (from.has_php_class_prefix()) { php_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_class_prefix_); } + php_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (from.has_php_namespace()) { + php_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_namespace_); + } ::memcpy(&java_multiple_files_, &from.java_multiple_files_, - reinterpret_cast<char*>(&optimize_for_) - - reinterpret_cast<char*>(&java_multiple_files_) + sizeof(optimize_for_)); + static_cast<size_t>(reinterpret_cast<char*>(&optimize_for_) - + reinterpret_cast<char*>(&java_multiple_files_)) + sizeof(optimize_for_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.FileOptions) } @@ -8714,8 +8768,10 @@ void FileOptions::SharedCtor() { csharp_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); swift_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); php_class_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&java_multiple_files_, 0, reinterpret_cast<char*>(&cc_enable_arenas_) - - reinterpret_cast<char*>(&java_multiple_files_) + sizeof(cc_enable_arenas_)); + php_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::memset(&java_multiple_files_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&cc_enable_arenas_) - + reinterpret_cast<char*>(&java_multiple_files_)) + sizeof(cc_enable_arenas_)); optimize_for_ = 1; } @@ -8732,6 +8788,7 @@ void FileOptions::SharedDtor() { csharp_namespace_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); swift_prefix_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); php_class_prefix_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + php_namespace_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } void FileOptions::SetCachedSize(int size) const { @@ -8766,7 +8823,7 @@ void FileOptions::Clear() { _extensions_.Clear(); uninterpreted_option_.Clear(); cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 127u) { + if (cached_has_bits & 255u) { if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(!java_package_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); (*java_package_.UnsafeRawStringPointer())->clear(); @@ -8795,11 +8852,18 @@ void FileOptions::Clear() { GOOGLE_DCHECK(!php_class_prefix_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); (*php_class_prefix_.UnsafeRawStringPointer())->clear(); } + if (cached_has_bits & 0x00000080u) { + GOOGLE_DCHECK(!php_namespace_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); + (*php_namespace_.UnsafeRawStringPointer())->clear(); + } } - java_multiple_files_ = false; if (cached_has_bits & 65280u) { - ::memset(&java_generate_equals_and_hash_, 0, reinterpret_cast<char*>(&cc_enable_arenas_) - - reinterpret_cast<char*>(&java_generate_equals_and_hash_) + sizeof(cc_enable_arenas_)); + ::memset(&java_multiple_files_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&deprecated_) - + reinterpret_cast<char*>(&java_multiple_files_)) + sizeof(deprecated_)); + } + if (cached_has_bits & 196608u) { + cc_enable_arenas_ = false; optimize_for_ = 1; } _has_bits_.Clear(); @@ -8823,7 +8887,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<int>(this->java_package().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileOptions.java_package"); } else { @@ -8839,7 +8903,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<int>(this->java_outer_classname().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileOptions.java_outer_classname"); } else { @@ -8859,7 +8923,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; @@ -8888,7 +8953,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<int>(this->go_package().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileOptions.go_package"); } else { @@ -8939,6 +9004,20 @@ bool FileOptions::MergePartialFromCodedStream( break; } + // optional bool php_generic_services = 19 [default = false]; + case 19: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(152u /* 152 & 0xFF */)) { + set_has_php_generic_services(); + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &php_generic_services_))); + } else { + goto handle_unusual; + } + break; + } + // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; case 20: { if (static_cast< ::google::protobuf::uint8>(tag) == @@ -9002,7 +9081,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<int>(this->objc_class_prefix().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileOptions.objc_class_prefix"); } else { @@ -9018,7 +9097,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<int>(this->csharp_namespace().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileOptions.csharp_namespace"); } else { @@ -9034,7 +9113,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<int>(this->swift_prefix().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileOptions.swift_prefix"); } else { @@ -9050,7 +9129,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<int>(this->php_class_prefix().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.FileOptions.php_class_prefix"); } else { @@ -9059,6 +9138,22 @@ bool FileOptions::MergePartialFromCodedStream( break; } + // optional string php_namespace = 41; + case 41: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(74u /* 330 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_php_namespace())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->php_namespace().data(), static_cast<int>(this->php_namespace().length()), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.FileOptions.php_namespace"); + } else { + goto handle_unusual; + } + break; + } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: { if (static_cast< ::google::protobuf::uint8>(tag) == @@ -9107,7 +9202,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<int>(this->java_package().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.java_package"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -9117,7 +9212,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<int>(this->java_outer_classname().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.java_outer_classname"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -9125,20 +9220,20 @@ void FileOptions::SerializeWithCachedSizes( } // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; - if (cached_has_bits & 0x00008000u) { + if (cached_has_bits & 0x00020000u) { ::google::protobuf::internal::WireFormatLite::WriteEnum( 9, this->optimize_for(), output); } // optional bool java_multiple_files = 10 [default = false]; - if (cached_has_bits & 0x00000080u) { + if (cached_has_bits & 0x00000100u) { ::google::protobuf::internal::WireFormatLite::WriteBool(10, this->java_multiple_files(), output); } // 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<int>(this->go_package().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.go_package"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -9146,44 +9241,49 @@ void FileOptions::SerializeWithCachedSizes( } // optional bool cc_generic_services = 16 [default = false]; - if (cached_has_bits & 0x00000400u) { + if (cached_has_bits & 0x00000800u) { ::google::protobuf::internal::WireFormatLite::WriteBool(16, this->cc_generic_services(), output); } // optional bool java_generic_services = 17 [default = false]; - if (cached_has_bits & 0x00000800u) { + if (cached_has_bits & 0x00001000u) { ::google::protobuf::internal::WireFormatLite::WriteBool(17, this->java_generic_services(), output); } // optional bool py_generic_services = 18 [default = false]; - if (cached_has_bits & 0x00001000u) { + if (cached_has_bits & 0x00002000u) { ::google::protobuf::internal::WireFormatLite::WriteBool(18, this->py_generic_services(), output); } + // optional bool php_generic_services = 19 [default = false]; + if (cached_has_bits & 0x00004000u) { + ::google::protobuf::internal::WireFormatLite::WriteBool(19, this->php_generic_services(), output); + } + // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; - if (cached_has_bits & 0x00000100u) { + if (cached_has_bits & 0x00000200u) { ::google::protobuf::internal::WireFormatLite::WriteBool(20, this->java_generate_equals_and_hash(), output); } // optional bool deprecated = 23 [default = false]; - if (cached_has_bits & 0x00002000u) { + if (cached_has_bits & 0x00008000u) { ::google::protobuf::internal::WireFormatLite::WriteBool(23, this->deprecated(), output); } // optional bool java_string_check_utf8 = 27 [default = false]; - if (cached_has_bits & 0x00000200u) { + if (cached_has_bits & 0x00000400u) { ::google::protobuf::internal::WireFormatLite::WriteBool(27, this->java_string_check_utf8(), output); } // optional bool cc_enable_arenas = 31 [default = false]; - if (cached_has_bits & 0x00004000u) { + if (cached_has_bits & 0x00010000u) { ::google::protobuf::internal::WireFormatLite::WriteBool(31, this->cc_enable_arenas(), output); } // 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<int>(this->objc_class_prefix().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.objc_class_prefix"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -9193,7 +9293,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<int>(this->csharp_namespace().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.csharp_namespace"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -9203,7 +9303,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<int>(this->swift_prefix().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.swift_prefix"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -9213,17 +9313,28 @@ 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<int>(this->php_class_prefix().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.php_class_prefix"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( 40, this->php_class_prefix(), output); } + // optional string php_namespace = 41; + if (cached_has_bits & 0x00000080u) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->php_namespace().data(), static_cast<int>(this->php_namespace().length()), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileOptions.php_namespace"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 41, this->php_namespace(), output); + } + // 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<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast<int>(i)), output); } // Extension range [1000, 536870912) @@ -9247,7 +9358,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<int>(this->java_package().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.java_package"); target = @@ -9258,7 +9369,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<int>(this->java_outer_classname().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.java_outer_classname"); target = @@ -9267,20 +9378,20 @@ void FileOptions::SerializeWithCachedSizes( } // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; - if (cached_has_bits & 0x00008000u) { + if (cached_has_bits & 0x00020000u) { target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( 9, this->optimize_for(), target); } // optional bool java_multiple_files = 10 [default = false]; - if (cached_has_bits & 0x00000080u) { + if (cached_has_bits & 0x00000100u) { target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(10, this->java_multiple_files(), target); } // 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<int>(this->go_package().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.go_package"); target = @@ -9289,44 +9400,49 @@ void FileOptions::SerializeWithCachedSizes( } // optional bool cc_generic_services = 16 [default = false]; - if (cached_has_bits & 0x00000400u) { + if (cached_has_bits & 0x00000800u) { target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(16, this->cc_generic_services(), target); } // optional bool java_generic_services = 17 [default = false]; - if (cached_has_bits & 0x00000800u) { + if (cached_has_bits & 0x00001000u) { target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(17, this->java_generic_services(), target); } // optional bool py_generic_services = 18 [default = false]; - if (cached_has_bits & 0x00001000u) { + if (cached_has_bits & 0x00002000u) { target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(18, this->py_generic_services(), target); } + // optional bool php_generic_services = 19 [default = false]; + if (cached_has_bits & 0x00004000u) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(19, this->php_generic_services(), target); + } + // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; - if (cached_has_bits & 0x00000100u) { + if (cached_has_bits & 0x00000200u) { target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(20, this->java_generate_equals_and_hash(), target); } // optional bool deprecated = 23 [default = false]; - if (cached_has_bits & 0x00002000u) { + if (cached_has_bits & 0x00008000u) { target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(23, this->deprecated(), target); } // optional bool java_string_check_utf8 = 27 [default = false]; - if (cached_has_bits & 0x00000200u) { + if (cached_has_bits & 0x00000400u) { target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(27, this->java_string_check_utf8(), target); } // optional bool cc_enable_arenas = 31 [default = false]; - if (cached_has_bits & 0x00004000u) { + if (cached_has_bits & 0x00010000u) { target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(31, this->cc_enable_arenas(), target); } // 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<int>(this->objc_class_prefix().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.objc_class_prefix"); target = @@ -9337,7 +9453,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<int>(this->csharp_namespace().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.csharp_namespace"); target = @@ -9348,7 +9464,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<int>(this->swift_prefix().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.swift_prefix"); target = @@ -9359,7 +9475,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<int>(this->php_class_prefix().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.FileOptions.php_class_prefix"); target = @@ -9367,11 +9483,23 @@ void FileOptions::SerializeWithCachedSizes( 40, this->php_class_prefix(), target); } + // optional string php_namespace = 41; + if (cached_has_bits & 0x00000080u) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->php_namespace().data(), static_cast<int>(this->php_namespace().length()), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileOptions.php_namespace"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 41, this->php_namespace(), target); + } + // 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<unsigned int>(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<int>(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -9399,12 +9527,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<unsigned int>(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<int>(i))); } } @@ -9458,13 +9586,20 @@ size_t FileOptions::ByteSizeLong() const { this->php_class_prefix()); } + // optional string php_namespace = 41; + if (has_php_namespace()) { + total_size += 2 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->php_namespace()); + } + + } + if (_has_bits_[8 / 32] & 65280u) { // optional bool java_multiple_files = 10 [default = false]; if (has_java_multiple_files()) { total_size += 1 + 1; } - } - if (_has_bits_[8 / 32] & 65280u) { // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; if (has_java_generate_equals_and_hash()) { total_size += 2 + 1; @@ -9490,11 +9625,18 @@ size_t FileOptions::ByteSizeLong() const { total_size += 2 + 1; } + // optional bool php_generic_services = 19 [default = false]; + if (has_php_generic_services()) { + total_size += 2 + 1; + } + // optional bool deprecated = 23 [default = false]; if (has_deprecated()) { total_size += 2 + 1; } + } + if (_has_bits_[16 / 32] & 196608u) { // optional bool cc_enable_arenas = 31 [default = false]; if (has_cc_enable_arenas()) { total_size += 2 + 1; @@ -9569,33 +9711,42 @@ void FileOptions::MergeFrom(const FileOptions& from) { php_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_class_prefix_); } if (cached_has_bits & 0x00000080u) { - java_multiple_files_ = from.java_multiple_files_; + set_has_php_namespace(); + php_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_namespace_); } - _has_bits_[0] |= cached_has_bits; } if (cached_has_bits & 65280u) { if (cached_has_bits & 0x00000100u) { - java_generate_equals_and_hash_ = from.java_generate_equals_and_hash_; + java_multiple_files_ = from.java_multiple_files_; } if (cached_has_bits & 0x00000200u) { - java_string_check_utf8_ = from.java_string_check_utf8_; + java_generate_equals_and_hash_ = from.java_generate_equals_and_hash_; } if (cached_has_bits & 0x00000400u) { - cc_generic_services_ = from.cc_generic_services_; + java_string_check_utf8_ = from.java_string_check_utf8_; } if (cached_has_bits & 0x00000800u) { - java_generic_services_ = from.java_generic_services_; + cc_generic_services_ = from.cc_generic_services_; } if (cached_has_bits & 0x00001000u) { - py_generic_services_ = from.py_generic_services_; + java_generic_services_ = from.java_generic_services_; } if (cached_has_bits & 0x00002000u) { - deprecated_ = from.deprecated_; + py_generic_services_ = from.py_generic_services_; } if (cached_has_bits & 0x00004000u) { - cc_enable_arenas_ = from.cc_enable_arenas_; + php_generic_services_ = from.php_generic_services_; } if (cached_has_bits & 0x00008000u) { + deprecated_ = from.deprecated_; + } + _has_bits_[0] |= cached_has_bits; + } + if (cached_has_bits & 196608u) { + if (cached_has_bits & 0x00010000u) { + cc_enable_arenas_ = from.cc_enable_arenas_; + } + if (cached_has_bits & 0x00020000u) { optimize_for_ = from.optimize_for_; } _has_bits_[0] |= cached_has_bits; @@ -9639,12 +9790,14 @@ void FileOptions::InternalSwap(FileOptions* other) { csharp_namespace_.Swap(&other->csharp_namespace_); swift_prefix_.Swap(&other->swift_prefix_); php_class_prefix_.Swap(&other->php_class_prefix_); + php_namespace_.Swap(&other->php_namespace_); swap(java_multiple_files_, other->java_multiple_files_); swap(java_generate_equals_and_hash_, other->java_generate_equals_and_hash_); swap(java_string_check_utf8_, other->java_string_check_utf8_); swap(cc_generic_services_, other->cc_generic_services_); swap(java_generic_services_, other->java_generic_services_); swap(py_generic_services_, other->py_generic_services_); + swap(php_generic_services_, other->php_generic_services_); swap(deprecated_, other->deprecated_); swap(cc_enable_arenas_, other->cc_enable_arenas_); swap(optimize_for_, other->optimize_for_); @@ -9790,13 +9943,13 @@ void FileOptions::set_allocated_java_outer_classname(::std::string* java_outer_c // optional bool java_multiple_files = 10 [default = false]; bool FileOptions::has_java_multiple_files() const { - return (_has_bits_[0] & 0x00000080u) != 0; + return (_has_bits_[0] & 0x00000100u) != 0; } void FileOptions::set_has_java_multiple_files() { - _has_bits_[0] |= 0x00000080u; + _has_bits_[0] |= 0x00000100u; } void FileOptions::clear_has_java_multiple_files() { - _has_bits_[0] &= ~0x00000080u; + _has_bits_[0] &= ~0x00000100u; } void FileOptions::clear_java_multiple_files() { java_multiple_files_ = false; @@ -9814,13 +9967,13 @@ void FileOptions::set_java_multiple_files(bool value) { // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; bool FileOptions::has_java_generate_equals_and_hash() const { - return (_has_bits_[0] & 0x00000100u) != 0; + return (_has_bits_[0] & 0x00000200u) != 0; } void FileOptions::set_has_java_generate_equals_and_hash() { - _has_bits_[0] |= 0x00000100u; + _has_bits_[0] |= 0x00000200u; } void FileOptions::clear_has_java_generate_equals_and_hash() { - _has_bits_[0] &= ~0x00000100u; + _has_bits_[0] &= ~0x00000200u; } void FileOptions::clear_java_generate_equals_and_hash() { java_generate_equals_and_hash_ = false; @@ -9838,13 +9991,13 @@ void FileOptions::set_java_generate_equals_and_hash(bool value) { // optional bool java_string_check_utf8 = 27 [default = false]; bool FileOptions::has_java_string_check_utf8() const { - return (_has_bits_[0] & 0x00000200u) != 0; + return (_has_bits_[0] & 0x00000400u) != 0; } void FileOptions::set_has_java_string_check_utf8() { - _has_bits_[0] |= 0x00000200u; + _has_bits_[0] |= 0x00000400u; } void FileOptions::clear_has_java_string_check_utf8() { - _has_bits_[0] &= ~0x00000200u; + _has_bits_[0] &= ~0x00000400u; } void FileOptions::clear_java_string_check_utf8() { java_string_check_utf8_ = false; @@ -9862,13 +10015,13 @@ void FileOptions::set_java_string_check_utf8(bool value) { // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; bool FileOptions::has_optimize_for() const { - return (_has_bits_[0] & 0x00008000u) != 0; + return (_has_bits_[0] & 0x00020000u) != 0; } void FileOptions::set_has_optimize_for() { - _has_bits_[0] |= 0x00008000u; + _has_bits_[0] |= 0x00020000u; } void FileOptions::clear_has_optimize_for() { - _has_bits_[0] &= ~0x00008000u; + _has_bits_[0] &= ~0x00020000u; } void FileOptions::clear_optimize_for() { optimize_for_ = 1; @@ -9950,13 +10103,13 @@ void FileOptions::set_allocated_go_package(::std::string* go_package) { // optional bool cc_generic_services = 16 [default = false]; bool FileOptions::has_cc_generic_services() const { - return (_has_bits_[0] & 0x00000400u) != 0; + return (_has_bits_[0] & 0x00000800u) != 0; } void FileOptions::set_has_cc_generic_services() { - _has_bits_[0] |= 0x00000400u; + _has_bits_[0] |= 0x00000800u; } void FileOptions::clear_has_cc_generic_services() { - _has_bits_[0] &= ~0x00000400u; + _has_bits_[0] &= ~0x00000800u; } void FileOptions::clear_cc_generic_services() { cc_generic_services_ = false; @@ -9974,13 +10127,13 @@ void FileOptions::set_cc_generic_services(bool value) { // optional bool java_generic_services = 17 [default = false]; bool FileOptions::has_java_generic_services() const { - return (_has_bits_[0] & 0x00000800u) != 0; + return (_has_bits_[0] & 0x00001000u) != 0; } void FileOptions::set_has_java_generic_services() { - _has_bits_[0] |= 0x00000800u; + _has_bits_[0] |= 0x00001000u; } void FileOptions::clear_has_java_generic_services() { - _has_bits_[0] &= ~0x00000800u; + _has_bits_[0] &= ~0x00001000u; } void FileOptions::clear_java_generic_services() { java_generic_services_ = false; @@ -9998,13 +10151,13 @@ void FileOptions::set_java_generic_services(bool value) { // optional bool py_generic_services = 18 [default = false]; bool FileOptions::has_py_generic_services() const { - return (_has_bits_[0] & 0x00001000u) != 0; + return (_has_bits_[0] & 0x00002000u) != 0; } void FileOptions::set_has_py_generic_services() { - _has_bits_[0] |= 0x00001000u; + _has_bits_[0] |= 0x00002000u; } void FileOptions::clear_has_py_generic_services() { - _has_bits_[0] &= ~0x00001000u; + _has_bits_[0] &= ~0x00002000u; } void FileOptions::clear_py_generic_services() { py_generic_services_ = false; @@ -10020,15 +10173,39 @@ void FileOptions::set_py_generic_services(bool value) { // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.py_generic_services) } +// optional bool php_generic_services = 19 [default = false]; +bool FileOptions::has_php_generic_services() const { + return (_has_bits_[0] & 0x00004000u) != 0; +} +void FileOptions::set_has_php_generic_services() { + _has_bits_[0] |= 0x00004000u; +} +void FileOptions::clear_has_php_generic_services() { + _has_bits_[0] &= ~0x00004000u; +} +void FileOptions::clear_php_generic_services() { + php_generic_services_ = false; + clear_has_php_generic_services(); +} +bool FileOptions::php_generic_services() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_generic_services) + return php_generic_services_; +} +void FileOptions::set_php_generic_services(bool value) { + set_has_php_generic_services(); + php_generic_services_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_generic_services) +} + // optional bool deprecated = 23 [default = false]; bool FileOptions::has_deprecated() const { - return (_has_bits_[0] & 0x00002000u) != 0; + return (_has_bits_[0] & 0x00008000u) != 0; } void FileOptions::set_has_deprecated() { - _has_bits_[0] |= 0x00002000u; + _has_bits_[0] |= 0x00008000u; } void FileOptions::clear_has_deprecated() { - _has_bits_[0] &= ~0x00002000u; + _has_bits_[0] &= ~0x00008000u; } void FileOptions::clear_deprecated() { deprecated_ = false; @@ -10046,13 +10223,13 @@ void FileOptions::set_deprecated(bool value) { // optional bool cc_enable_arenas = 31 [default = false]; bool FileOptions::has_cc_enable_arenas() const { - return (_has_bits_[0] & 0x00004000u) != 0; + return (_has_bits_[0] & 0x00010000u) != 0; } void FileOptions::set_has_cc_enable_arenas() { - _has_bits_[0] |= 0x00004000u; + _has_bits_[0] |= 0x00010000u; } void FileOptions::clear_has_cc_enable_arenas() { - _has_bits_[0] &= ~0x00004000u; + _has_bits_[0] &= ~0x00010000u; } void FileOptions::clear_cc_enable_arenas() { cc_enable_arenas_ = false; @@ -10320,6 +10497,69 @@ void FileOptions::set_allocated_php_class_prefix(::std::string* php_class_prefix // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_class_prefix) } +// optional string php_namespace = 41; +bool FileOptions::has_php_namespace() const { + return (_has_bits_[0] & 0x00000080u) != 0; +} +void FileOptions::set_has_php_namespace() { + _has_bits_[0] |= 0x00000080u; +} +void FileOptions::clear_has_php_namespace() { + _has_bits_[0] &= ~0x00000080u; +} +void FileOptions::clear_php_namespace() { + php_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_php_namespace(); +} +const ::std::string& FileOptions::php_namespace() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_namespace) + return php_namespace_.GetNoArena(); +} +void FileOptions::set_php_namespace(const ::std::string& value) { + set_has_php_namespace(); + php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_namespace) +} +#if LANG_CXX11 +void FileOptions::set_php_namespace(::std::string&& value) { + set_has_php_namespace(); + php_namespace_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.php_namespace) +} +#endif +void FileOptions::set_php_namespace(const char* value) { + GOOGLE_DCHECK(value != NULL); + set_has_php_namespace(); + php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.php_namespace) +} +void FileOptions::set_php_namespace(const char* value, size_t size) { + set_has_php_namespace(); + php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_namespace) +} +::std::string* FileOptions::mutable_php_namespace() { + set_has_php_namespace(); + // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_namespace) + return php_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +::std::string* FileOptions::release_php_namespace() { + // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_namespace) + clear_has_php_namespace(); + return php_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +void FileOptions::set_allocated_php_namespace(::std::string* php_namespace) { + if (php_namespace != NULL) { + set_has_php_namespace(); + } else { + clear_has_php_namespace(); + } + php_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_namespace); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_namespace) +} + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int FileOptions::uninterpreted_option_size() const { return uninterpreted_option_.size(); @@ -10379,15 +10619,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<char*>(&map_entry_) - - reinterpret_cast<char*>(&message_set_wire_format_) + sizeof(map_entry_)); + static_cast<size_t>(reinterpret_cast<char*>(&map_entry_) - + reinterpret_cast<char*>(&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<char*>(&map_entry_) - - reinterpret_cast<char*>(&message_set_wire_format_) + sizeof(map_entry_)); + ::memset(&message_set_wire_format_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&map_entry_) - + reinterpret_cast<char*>(&message_set_wire_format_)) + sizeof(map_entry_)); } MessageOptions::~MessageOptions() { @@ -10431,8 +10672,9 @@ void MessageOptions::Clear() { uninterpreted_option_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 15u) { - ::memset(&message_set_wire_format_, 0, reinterpret_cast<char*>(&map_entry_) - - reinterpret_cast<char*>(&message_set_wire_format_) + sizeof(map_entry_)); + ::memset(&message_set_wire_format_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&map_entry_) - + reinterpret_cast<char*>(&message_set_wire_format_)) + sizeof(map_entry_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -10570,9 +10812,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<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast<int>(i)), output); } // Extension range [1000, 536870912) @@ -10614,10 +10857,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<unsigned int>(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<int>(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -10645,12 +10889,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<unsigned int>(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<int>(i))); } } @@ -10930,15 +11174,16 @@ FieldOptions::FieldOptions(const FieldOptions& from) _internal_metadata_.MergeFrom(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); ::memcpy(&ctype_, &from.ctype_, - reinterpret_cast<char*>(&jstype_) - - reinterpret_cast<char*>(&ctype_) + sizeof(jstype_)); + static_cast<size_t>(reinterpret_cast<char*>(&jstype_) - + reinterpret_cast<char*>(&ctype_)) + sizeof(jstype_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldOptions) } void FieldOptions::SharedCtor() { _cached_size_ = 0; - ::memset(&ctype_, 0, reinterpret_cast<char*>(&jstype_) - - reinterpret_cast<char*>(&ctype_) + sizeof(jstype_)); + ::memset(&ctype_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&jstype_) - + reinterpret_cast<char*>(&ctype_)) + sizeof(jstype_)); } FieldOptions::~FieldOptions() { @@ -10982,8 +11227,9 @@ void FieldOptions::Clear() { uninterpreted_option_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 63u) { - ::memset(&ctype_, 0, reinterpret_cast<char*>(&jstype_) - - reinterpret_cast<char*>(&ctype_) + sizeof(jstype_)); + ::memset(&ctype_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&jstype_) - + reinterpret_cast<char*>(&ctype_)) + sizeof(jstype_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -11010,7 +11256,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; @@ -11071,7 +11318,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; @@ -11171,9 +11419,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<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast<int>(i)), output); } // Extension range [1000, 536870912) @@ -11227,10 +11476,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<unsigned int>(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<int>(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -11258,12 +11508,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<unsigned int>(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<int>(i))); } } @@ -11711,9 +11961,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<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast<int>(i)), output); } // Extension range [1000, 536870912) @@ -11734,10 +11985,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<unsigned int>(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<int>(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -11765,12 +12017,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<unsigned int>(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<int>(i))); } } @@ -11908,15 +12160,16 @@ EnumOptions::EnumOptions(const EnumOptions& from) _internal_metadata_.MergeFrom(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); ::memcpy(&allow_alias_, &from.allow_alias_, - reinterpret_cast<char*>(&deprecated_) - - reinterpret_cast<char*>(&allow_alias_) + sizeof(deprecated_)); + static_cast<size_t>(reinterpret_cast<char*>(&deprecated_) - + reinterpret_cast<char*>(&allow_alias_)) + sizeof(deprecated_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumOptions) } void EnumOptions::SharedCtor() { _cached_size_ = 0; - ::memset(&allow_alias_, 0, reinterpret_cast<char*>(&deprecated_) - - reinterpret_cast<char*>(&allow_alias_) + sizeof(deprecated_)); + ::memset(&allow_alias_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&deprecated_) - + reinterpret_cast<char*>(&allow_alias_)) + sizeof(deprecated_)); } EnumOptions::~EnumOptions() { @@ -11960,8 +12213,9 @@ void EnumOptions::Clear() { uninterpreted_option_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 3u) { - ::memset(&allow_alias_, 0, reinterpret_cast<char*>(&deprecated_) - - reinterpret_cast<char*>(&allow_alias_) + sizeof(deprecated_)); + ::memset(&allow_alias_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&deprecated_) - + reinterpret_cast<char*>(&allow_alias_)) + sizeof(deprecated_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -12061,9 +12315,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<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast<int>(i)), output); } // Extension range [1000, 536870912) @@ -12095,10 +12350,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<unsigned int>(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<int>(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -12126,12 +12382,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<unsigned int>(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<int>(i))); } } @@ -12467,9 +12723,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<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast<int>(i)), output); } // Extension range [1000, 536870912) @@ -12496,10 +12753,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<unsigned int>(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<int>(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -12527,12 +12785,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<unsigned int>(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<int>(i))); } } @@ -12829,9 +13087,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<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast<int>(i)), output); } // Extension range [1000, 536870912) @@ -12858,10 +13117,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<unsigned int>(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<int>(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -12889,12 +13149,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<unsigned int>(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<int>(i))); } } @@ -13065,15 +13325,16 @@ MethodOptions::MethodOptions(const MethodOptions& from) _internal_metadata_.MergeFrom(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); ::memcpy(&deprecated_, &from.deprecated_, - reinterpret_cast<char*>(&idempotency_level_) - - reinterpret_cast<char*>(&deprecated_) + sizeof(idempotency_level_)); + static_cast<size_t>(reinterpret_cast<char*>(&idempotency_level_) - + reinterpret_cast<char*>(&deprecated_)) + sizeof(idempotency_level_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.MethodOptions) } void MethodOptions::SharedCtor() { _cached_size_ = 0; - ::memset(&deprecated_, 0, reinterpret_cast<char*>(&idempotency_level_) - - reinterpret_cast<char*>(&deprecated_) + sizeof(idempotency_level_)); + ::memset(&deprecated_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&idempotency_level_) - + reinterpret_cast<char*>(&deprecated_)) + sizeof(idempotency_level_)); } MethodOptions::~MethodOptions() { @@ -13117,8 +13378,9 @@ void MethodOptions::Clear() { uninterpreted_option_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 3u) { - ::memset(&deprecated_, 0, reinterpret_cast<char*>(&idempotency_level_) - - reinterpret_cast<char*>(&deprecated_) + sizeof(idempotency_level_)); + ::memset(&deprecated_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&idempotency_level_) - + reinterpret_cast<char*>(&deprecated_)) + sizeof(idempotency_level_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -13159,7 +13421,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; @@ -13224,9 +13487,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<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 999, this->uninterpreted_option(i), output); + 999, this->uninterpreted_option(static_cast<int>(i)), output); } // Extension range [1000, 536870912) @@ -13259,10 +13523,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<unsigned int>(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<int>(i)), deterministic, target); } // Extension range [1000, 536870912) @@ -13290,12 +13555,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<unsigned int>(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<int>(i))); } } @@ -13581,7 +13846,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<int>(this->name_part().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.UninterpretedOption.NamePart.name_part"); } else { @@ -13634,7 +13899,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<int>(this->name_part().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.UninterpretedOption.NamePart.name_part"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -13663,7 +13928,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<int>(this->name_part().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.UninterpretedOption.NamePart.name_part"); target = @@ -13934,8 +14199,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<char*>(&double_value_) - - reinterpret_cast<char*>(&positive_int_value_) + sizeof(double_value_)); + static_cast<size_t>(reinterpret_cast<char*>(&double_value_) - + reinterpret_cast<char*>(&positive_int_value_)) + sizeof(double_value_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption) } @@ -13944,8 +14209,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<char*>(&double_value_) - - reinterpret_cast<char*>(&positive_int_value_) + sizeof(double_value_)); + ::memset(&positive_int_value_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&double_value_) - + reinterpret_cast<char*>(&positive_int_value_)) + sizeof(double_value_)); } UninterpretedOption::~UninterpretedOption() { @@ -14005,8 +14271,9 @@ void UninterpretedOption::Clear() { } } if (cached_has_bits & 56u) { - ::memset(&positive_int_value_, 0, reinterpret_cast<char*>(&double_value_) - - reinterpret_cast<char*>(&positive_int_value_) + sizeof(double_value_)); + ::memset(&positive_int_value_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&double_value_) - + reinterpret_cast<char*>(&positive_int_value_)) + sizeof(double_value_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -14041,7 +14308,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<int>(this->identifier_value().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.UninterpretedOption.identifier_value"); } else { @@ -14111,7 +14378,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<int>(this->aggregate_value().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.UninterpretedOption.aggregate_value"); } else { @@ -14147,16 +14414,17 @@ 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<unsigned int>(this->name_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->name(i), output); + 2, this->name(static_cast<int>(i)), output); } cached_has_bits = _has_bits_[0]; // 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<int>(this->identifier_value().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.UninterpretedOption.identifier_value"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -14187,7 +14455,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<int>(this->aggregate_value().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.UninterpretedOption.aggregate_value"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -14208,17 +14476,18 @@ 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<unsigned int>(this->name_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 2, this->name(i), deterministic, target); + 2, this->name(static_cast<int>(i)), deterministic, target); } cached_has_bits = _has_bits_[0]; // 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<int>(this->identifier_value().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.UninterpretedOption.identifier_value"); target = @@ -14251,7 +14520,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<int>(this->aggregate_value().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.UninterpretedOption.aggregate_value"); target = @@ -14278,12 +14547,12 @@ size_t UninterpretedOption::ByteSizeLong() const { } // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; { - unsigned int count = this->name_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } @@ -14880,7 +15149,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<int>(this->leading_comments().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.SourceCodeInfo.Location.leading_comments"); } else { @@ -14896,7 +15165,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<int>(this->trailing_comments().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.SourceCodeInfo.Location.trailing_comments"); } else { @@ -14913,7 +15182,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<int>(this->leading_detached_comments(this->leading_detached_comments_size() - 1).length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.SourceCodeInfo.Location.leading_detached_comments"); } else { @@ -14951,7 +15220,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( @@ -14961,7 +15231,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( @@ -14972,7 +15243,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<int>(this->leading_comments().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.SourceCodeInfo.Location.leading_comments"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -14982,7 +15253,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<int>(this->trailing_comments().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.SourceCodeInfo.Location.trailing_comments"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -14992,7 +15263,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<int>(this->leading_detached_comments(i).length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.SourceCodeInfo.Location.leading_detached_comments"); ::google::protobuf::internal::WireFormatLite::WriteString( @@ -15019,7 +15290,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); } @@ -15031,7 +15303,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); } @@ -15040,7 +15313,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<int>(this->leading_comments().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.SourceCodeInfo.Location.leading_comments"); target = @@ -15051,7 +15324,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<int>(this->trailing_comments().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.SourceCodeInfo.Location.trailing_comments"); target = @@ -15062,7 +15335,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<int>(this->leading_detached_comments(i).length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.SourceCodeInfo.Location.leading_detached_comments"); target = ::google::protobuf::internal::WireFormatLite:: @@ -15092,7 +15365,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< ::google::protobuf::int32>(data_size)); } int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); @@ -15107,7 +15381,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< ::google::protobuf::int32>(data_size)); } int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); @@ -15603,9 +15878,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<unsigned int>(this->location_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 1, this->location(i), output); + 1, this->location(static_cast<int>(i)), output); } if (_internal_metadata_.have_unknown_fields()) { @@ -15622,10 +15898,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<unsigned int>(this->location_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 1, this->location(i), deterministic, target); + 1, this->location(static_cast<int>(i)), deterministic, target); } if (_internal_metadata_.have_unknown_fields()) { @@ -15647,12 +15924,12 @@ size_t SourceCodeInfo::ByteSizeLong() const { } // repeated .google.protobuf.SourceCodeInfo.Location location = 1; { - unsigned int count = this->location_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } @@ -15787,16 +16064,17 @@ GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeIn source_file_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.source_file_); } ::memcpy(&begin_, &from.begin_, - reinterpret_cast<char*>(&end_) - - reinterpret_cast<char*>(&begin_) + sizeof(end_)); + static_cast<size_t>(reinterpret_cast<char*>(&end_) - + reinterpret_cast<char*>(&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<char*>(&end_) - - reinterpret_cast<char*>(&begin_) + sizeof(end_)); + ::memset(&begin_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&end_) - + reinterpret_cast<char*>(&begin_)) + sizeof(end_)); } GeneratedCodeInfo_Annotation::~GeneratedCodeInfo_Annotation() { @@ -15844,8 +16122,9 @@ void GeneratedCodeInfo_Annotation::Clear() { } cached_has_bits = _has_bits_[0]; if (cached_has_bits & 6u) { - ::memset(&begin_, 0, reinterpret_cast<char*>(&end_) - - reinterpret_cast<char*>(&begin_) + sizeof(end_)); + ::memset(&begin_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&end_) - + reinterpret_cast<char*>(&begin_)) + sizeof(end_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -15887,7 +16166,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<int>(this->source_file().length()), ::google::protobuf::internal::WireFormat::PARSE, "google.protobuf.GeneratedCodeInfo.Annotation.source_file"); } else { @@ -15953,7 +16232,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( @@ -15964,7 +16244,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<int>(this->source_file().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.GeneratedCodeInfo.Annotation.source_file"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -16001,7 +16281,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); } @@ -16010,7 +16291,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<int>(this->source_file().length()), ::google::protobuf::internal::WireFormat::SERIALIZE, "google.protobuf.GeneratedCodeInfo.Annotation.source_file"); target = @@ -16051,7 +16332,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< ::google::protobuf::int32>(data_size)); } int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); @@ -16432,9 +16714,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<unsigned int>(this->annotation_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 1, this->annotation(i), output); + 1, this->annotation(static_cast<int>(i)), output); } if (_internal_metadata_.have_unknown_fields()) { @@ -16451,10 +16734,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<unsigned int>(this->annotation_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 1, this->annotation(i), deterministic, target); + 1, this->annotation(static_cast<int>(i)), deterministic, target); } if (_internal_metadata_.have_unknown_fields()) { @@ -16476,12 +16760,12 @@ size_t GeneratedCodeInfo::ByteSizeLong() const { } // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; { - unsigned int count = this->annotation_size(); + unsigned int count = static_cast<unsigned int>(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<int>(i))); } } diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 9c11ccfc..cbc7458a 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -2555,6 +2555,21 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p ::std::string* release_php_class_prefix(); void set_allocated_php_class_prefix(::std::string* php_class_prefix); + // optional string php_namespace = 41; + bool has_php_namespace() const; + void clear_php_namespace(); + static const int kPhpNamespaceFieldNumber = 41; + const ::std::string& php_namespace() const; + void set_php_namespace(const ::std::string& value); + #if LANG_CXX11 + void set_php_namespace(::std::string&& value); + #endif + void set_php_namespace(const char* value); + void set_php_namespace(const char* value, size_t size); + ::std::string* mutable_php_namespace(); + ::std::string* release_php_namespace(); + void set_allocated_php_namespace(::std::string* php_namespace); + // optional bool java_multiple_files = 10 [default = false]; bool has_java_multiple_files() const; void clear_java_multiple_files(); @@ -2597,6 +2612,13 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p bool py_generic_services() const; void set_py_generic_services(bool value); + // optional bool php_generic_services = 19 [default = false]; + bool has_php_generic_services() const; + void clear_php_generic_services(); + static const int kPhpGenericServicesFieldNumber = 19; + bool php_generic_services() const; + void set_php_generic_services(bool value); + // optional bool deprecated = 23 [default = false]; bool has_deprecated() const; void clear_deprecated(); @@ -2641,6 +2663,8 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p void clear_has_java_generic_services(); void set_has_py_generic_services(); void clear_has_py_generic_services(); + void set_has_php_generic_services(); + void clear_has_php_generic_services(); void set_has_deprecated(); void clear_has_deprecated(); void set_has_cc_enable_arenas(); @@ -2653,6 +2677,8 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p void clear_has_swift_prefix(); void set_has_php_class_prefix(); void clear_has_php_class_prefix(); + void set_has_php_namespace(); + void clear_has_php_namespace(); ::google::protobuf::internal::ExtensionSet _extensions_; @@ -2667,12 +2693,14 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p ::google::protobuf::internal::ArenaStringPtr csharp_namespace_; ::google::protobuf::internal::ArenaStringPtr swift_prefix_; ::google::protobuf::internal::ArenaStringPtr php_class_prefix_; + ::google::protobuf::internal::ArenaStringPtr php_namespace_; bool java_multiple_files_; bool java_generate_equals_and_hash_; bool java_string_check_utf8_; bool cc_generic_services_; bool java_generic_services_; bool py_generic_services_; + bool php_generic_services_; bool deprecated_; bool cc_enable_arenas_; int optimize_for_; @@ -7177,13 +7205,13 @@ inline void FileOptions::set_allocated_java_outer_classname(::std::string* java_ // optional bool java_multiple_files = 10 [default = false]; inline bool FileOptions::has_java_multiple_files() const { - return (_has_bits_[0] & 0x00000080u) != 0; + return (_has_bits_[0] & 0x00000100u) != 0; } inline void FileOptions::set_has_java_multiple_files() { - _has_bits_[0] |= 0x00000080u; + _has_bits_[0] |= 0x00000100u; } inline void FileOptions::clear_has_java_multiple_files() { - _has_bits_[0] &= ~0x00000080u; + _has_bits_[0] &= ~0x00000100u; } inline void FileOptions::clear_java_multiple_files() { java_multiple_files_ = false; @@ -7201,13 +7229,13 @@ inline void FileOptions::set_java_multiple_files(bool value) { // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; inline bool FileOptions::has_java_generate_equals_and_hash() const { - return (_has_bits_[0] & 0x00000100u) != 0; + return (_has_bits_[0] & 0x00000200u) != 0; } inline void FileOptions::set_has_java_generate_equals_and_hash() { - _has_bits_[0] |= 0x00000100u; + _has_bits_[0] |= 0x00000200u; } inline void FileOptions::clear_has_java_generate_equals_and_hash() { - _has_bits_[0] &= ~0x00000100u; + _has_bits_[0] &= ~0x00000200u; } inline void FileOptions::clear_java_generate_equals_and_hash() { java_generate_equals_and_hash_ = false; @@ -7225,13 +7253,13 @@ inline void FileOptions::set_java_generate_equals_and_hash(bool value) { // optional bool java_string_check_utf8 = 27 [default = false]; inline bool FileOptions::has_java_string_check_utf8() const { - return (_has_bits_[0] & 0x00000200u) != 0; + return (_has_bits_[0] & 0x00000400u) != 0; } inline void FileOptions::set_has_java_string_check_utf8() { - _has_bits_[0] |= 0x00000200u; + _has_bits_[0] |= 0x00000400u; } inline void FileOptions::clear_has_java_string_check_utf8() { - _has_bits_[0] &= ~0x00000200u; + _has_bits_[0] &= ~0x00000400u; } inline void FileOptions::clear_java_string_check_utf8() { java_string_check_utf8_ = false; @@ -7249,13 +7277,13 @@ inline void FileOptions::set_java_string_check_utf8(bool value) { // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; inline bool FileOptions::has_optimize_for() const { - return (_has_bits_[0] & 0x00008000u) != 0; + return (_has_bits_[0] & 0x00020000u) != 0; } inline void FileOptions::set_has_optimize_for() { - _has_bits_[0] |= 0x00008000u; + _has_bits_[0] |= 0x00020000u; } inline void FileOptions::clear_has_optimize_for() { - _has_bits_[0] &= ~0x00008000u; + _has_bits_[0] &= ~0x00020000u; } inline void FileOptions::clear_optimize_for() { optimize_for_ = 1; @@ -7337,13 +7365,13 @@ inline void FileOptions::set_allocated_go_package(::std::string* go_package) { // optional bool cc_generic_services = 16 [default = false]; inline bool FileOptions::has_cc_generic_services() const { - return (_has_bits_[0] & 0x00000400u) != 0; + return (_has_bits_[0] & 0x00000800u) != 0; } inline void FileOptions::set_has_cc_generic_services() { - _has_bits_[0] |= 0x00000400u; + _has_bits_[0] |= 0x00000800u; } inline void FileOptions::clear_has_cc_generic_services() { - _has_bits_[0] &= ~0x00000400u; + _has_bits_[0] &= ~0x00000800u; } inline void FileOptions::clear_cc_generic_services() { cc_generic_services_ = false; @@ -7361,13 +7389,13 @@ inline void FileOptions::set_cc_generic_services(bool value) { // optional bool java_generic_services = 17 [default = false]; inline bool FileOptions::has_java_generic_services() const { - return (_has_bits_[0] & 0x00000800u) != 0; + return (_has_bits_[0] & 0x00001000u) != 0; } inline void FileOptions::set_has_java_generic_services() { - _has_bits_[0] |= 0x00000800u; + _has_bits_[0] |= 0x00001000u; } inline void FileOptions::clear_has_java_generic_services() { - _has_bits_[0] &= ~0x00000800u; + _has_bits_[0] &= ~0x00001000u; } inline void FileOptions::clear_java_generic_services() { java_generic_services_ = false; @@ -7385,13 +7413,13 @@ inline void FileOptions::set_java_generic_services(bool value) { // optional bool py_generic_services = 18 [default = false]; inline bool FileOptions::has_py_generic_services() const { - return (_has_bits_[0] & 0x00001000u) != 0; + return (_has_bits_[0] & 0x00002000u) != 0; } inline void FileOptions::set_has_py_generic_services() { - _has_bits_[0] |= 0x00001000u; + _has_bits_[0] |= 0x00002000u; } inline void FileOptions::clear_has_py_generic_services() { - _has_bits_[0] &= ~0x00001000u; + _has_bits_[0] &= ~0x00002000u; } inline void FileOptions::clear_py_generic_services() { py_generic_services_ = false; @@ -7407,15 +7435,39 @@ inline void FileOptions::set_py_generic_services(bool value) { // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.py_generic_services) } +// optional bool php_generic_services = 19 [default = false]; +inline bool FileOptions::has_php_generic_services() const { + return (_has_bits_[0] & 0x00004000u) != 0; +} +inline void FileOptions::set_has_php_generic_services() { + _has_bits_[0] |= 0x00004000u; +} +inline void FileOptions::clear_has_php_generic_services() { + _has_bits_[0] &= ~0x00004000u; +} +inline void FileOptions::clear_php_generic_services() { + php_generic_services_ = false; + clear_has_php_generic_services(); +} +inline bool FileOptions::php_generic_services() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_generic_services) + return php_generic_services_; +} +inline void FileOptions::set_php_generic_services(bool value) { + set_has_php_generic_services(); + php_generic_services_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_generic_services) +} + // optional bool deprecated = 23 [default = false]; inline bool FileOptions::has_deprecated() const { - return (_has_bits_[0] & 0x00002000u) != 0; + return (_has_bits_[0] & 0x00008000u) != 0; } inline void FileOptions::set_has_deprecated() { - _has_bits_[0] |= 0x00002000u; + _has_bits_[0] |= 0x00008000u; } inline void FileOptions::clear_has_deprecated() { - _has_bits_[0] &= ~0x00002000u; + _has_bits_[0] &= ~0x00008000u; } inline void FileOptions::clear_deprecated() { deprecated_ = false; @@ -7433,13 +7485,13 @@ inline void FileOptions::set_deprecated(bool value) { // optional bool cc_enable_arenas = 31 [default = false]; inline bool FileOptions::has_cc_enable_arenas() const { - return (_has_bits_[0] & 0x00004000u) != 0; + return (_has_bits_[0] & 0x00010000u) != 0; } inline void FileOptions::set_has_cc_enable_arenas() { - _has_bits_[0] |= 0x00004000u; + _has_bits_[0] |= 0x00010000u; } inline void FileOptions::clear_has_cc_enable_arenas() { - _has_bits_[0] &= ~0x00004000u; + _has_bits_[0] &= ~0x00010000u; } inline void FileOptions::clear_cc_enable_arenas() { cc_enable_arenas_ = false; @@ -7707,6 +7759,69 @@ inline void FileOptions::set_allocated_php_class_prefix(::std::string* php_class // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_class_prefix) } +// optional string php_namespace = 41; +inline bool FileOptions::has_php_namespace() const { + return (_has_bits_[0] & 0x00000080u) != 0; +} +inline void FileOptions::set_has_php_namespace() { + _has_bits_[0] |= 0x00000080u; +} +inline void FileOptions::clear_has_php_namespace() { + _has_bits_[0] &= ~0x00000080u; +} +inline void FileOptions::clear_php_namespace() { + php_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_php_namespace(); +} +inline const ::std::string& FileOptions::php_namespace() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_namespace) + return php_namespace_.GetNoArena(); +} +inline void FileOptions::set_php_namespace(const ::std::string& value) { + set_has_php_namespace(); + php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_namespace) +} +#if LANG_CXX11 +inline void FileOptions::set_php_namespace(::std::string&& value) { + set_has_php_namespace(); + php_namespace_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.php_namespace) +} +#endif +inline void FileOptions::set_php_namespace(const char* value) { + GOOGLE_DCHECK(value != NULL); + set_has_php_namespace(); + php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.php_namespace) +} +inline void FileOptions::set_php_namespace(const char* value, size_t size) { + set_has_php_namespace(); + php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_namespace) +} +inline ::std::string* FileOptions::mutable_php_namespace() { + set_has_php_namespace(); + // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_namespace) + return php_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* FileOptions::release_php_namespace() { + // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_namespace) + clear_has_php_namespace(); + return php_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void FileOptions::set_allocated_php_namespace(::std::string* php_namespace) { + if (php_namespace != NULL) { + set_has_php_namespace(); + } else { + clear_has_php_namespace(); + } + php_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_namespace); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_namespace) +} + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int FileOptions::uninterpreted_option_size() const { return uninterpreted_option_.size(); diff --git a/src/google/protobuf/descriptor.proto b/src/google/protobuf/descriptor.proto index 05028789..f1ec5735 100644 --- a/src/google/protobuf/descriptor.proto +++ b/src/google/protobuf/descriptor.proto @@ -361,6 +361,7 @@ message FileOptions { optional bool cc_generic_services = 16 [default=false]; optional bool java_generic_services = 17 [default=false]; optional bool py_generic_services = 18 [default=false]; + optional bool php_generic_services = 19 [default=false]; // Is this file deprecated? // Depending on the target platform, this can emit Deprecated annotations @@ -390,6 +391,11 @@ message FileOptions { // from this .proto. Default is empty. optional string php_class_prefix = 40; + // Use this option to change the namespace of php generated classes. Default + // is empty. When this option is empty, the package name will be used for + // determining the namespace. + optional string php_namespace = 41; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc index 46812a05..6e1f747e 100644 --- a/src/google/protobuf/duration.pb.cc +++ b/src/google/protobuf/duration.pb.cc @@ -154,14 +154,15 @@ Duration::Duration(const Duration& from) _cached_size_(0) { _internal_metadata_.MergeFrom(from._internal_metadata_); ::memcpy(&seconds_, &from.seconds_, - reinterpret_cast<char*>(&nanos_) - - reinterpret_cast<char*>(&seconds_) + sizeof(nanos_)); + static_cast<size_t>(reinterpret_cast<char*>(&nanos_) - + reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.Duration) } void Duration::SharedCtor() { - ::memset(&seconds_, 0, reinterpret_cast<char*>(&nanos_) - - reinterpret_cast<char*>(&seconds_) + sizeof(nanos_)); + ::memset(&seconds_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&nanos_) - + reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_)); _cached_size_ = 0; } @@ -210,8 +211,9 @@ void Duration::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - ::memset(&seconds_, 0, reinterpret_cast<char*>(&nanos_) - - reinterpret_cast<char*>(&seconds_) + sizeof(nanos_)); + ::memset(&seconds_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&nanos_) - + reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_)); _internal_metadata_.Clear(); } diff --git a/src/google/protobuf/dynamic_message.h b/src/google/protobuf/dynamic_message.h index 05722171..e29b148d 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<const Message*> result(map_size); + std::vector<const Message*> result(static_cast<size_t>(map_size)); const RepeatedPtrField<Message>& map_field = reflection->GetRepeatedPtrField<Message>(message, field); - int i = 0; + size_t i = 0; for (RepeatedPtrField<Message>::const_pointer_iterator it = map_field.pointer_begin(); it != map_field.pointer_end(); ) { result[i++] = *it++; } - GOOGLE_DCHECK_EQ(result.size(), static_cast<size_t>(i)); + GOOGLE_DCHECK_EQ(result.size(), i); MapEntryMessageComparator comparator(field->message_type()); std::stable_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<size_t>(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/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc index a3ec2d2b..43495a9d 100644 --- a/src/google/protobuf/field_mask.pb.cc +++ b/src/google/protobuf/field_mask.pb.cc @@ -210,7 +210,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<int>(this->paths(this->paths_size() - 1).length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.FieldMask.paths")); } else { @@ -248,7 +248,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<int>(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<int>(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 911c3a54..f6ce16a7 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<uint32>(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<size_t>(field->containing_type()->field_count() + + field->containing_oneof()->index()); return offsets_[offset]; } else { return GetFieldOffsetNonOneof(field); @@ -150,7 +151,9 @@ struct ReflectionSchema { } uint32 GetOneofCaseOffset(const OneofDescriptor* oneof_descriptor) const { - return oneof_case_offset_ + (oneof_descriptor->index() * sizeof(uint32)); + return static_cast<uint32>(oneof_case_offset_) + + static_cast<uint32>( + static_cast<size_t>(oneof_descriptor->index()) * sizeof(uint32)); } bool HasHasbits() const { return has_bits_offset_ != -1; } @@ -164,7 +167,7 @@ struct ReflectionSchema { // Byte offset of the hasbits array. uint32 HasBitsOffset() const { GOOGLE_DCHECK(HasHasbits()); - return has_bits_offset_; + return static_cast<uint32>(has_bits_offset_); } // The offset of the InternalMetadataWithArena member. @@ -172,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<uint32>(metadata_offset_); } // Whether this message has an ExtensionSet. @@ -181,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<uint32>(extensions_offset_); } // The off set of WeakFieldMap when the message contains weak fields. diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h index bce05a39..6d2599fb 100644 --- a/src/google/protobuf/io/coded_stream.h +++ b/src/google/protobuf/io/coded_stream.h @@ -1418,7 +1418,7 @@ inline bool CodedInputStream::Skip(int count) { } // namespace protobuf -#if _MSC_VER >= 1300 && !defined(__INTEL_COMPILER) +#if defined(_MSC_VER) && _MSC_VER >= 1300 && !defined(__INTEL_COMPILER) #pragma runtime_checks("c", restore) #endif // _MSC_VER && !defined(__INTEL_COMPILER) diff --git a/src/google/protobuf/io/tokenizer_unittest.cc b/src/google/protobuf/io/tokenizer_unittest.cc index cadeb696..e55288e2 100644 --- a/src/google/protobuf/io/tokenizer_unittest.cc +++ b/src/google/protobuf/io/tokenizer_unittest.cc @@ -341,7 +341,7 @@ inline std::ostream& operator<<(std::ostream& out, MultiTokenCase kMultiTokenCases[] = { // Test empty input. { "", { - { Tokenizer::TYPE_END , "" , 0, 0 }, + { Tokenizer::TYPE_END , "" , 0, 0, 0 }, }}, // Test all token types at the same time. diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index 2d561c24..6514a0cc 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -47,9 +47,6 @@ #include <google/protobuf/generated_enum_util.h> #include <google/protobuf/map_type_handler.h> #include <google/protobuf/stubs/hash.h> -#if __cpp_exceptions && LANG_CXX11 -#include <random> -#endif namespace google { namespace protobuf { @@ -161,7 +158,7 @@ class Map { private: void Init() { - elements_ = Arena::Create<InnerMap>(arena_, 0, hasher(), Allocator(arena_)); + elements_ = Arena::Create<InnerMap>(arena_, 0u, hasher(), Allocator(arena_)); } // re-implement std::allocator to use arena allocator for memory allocation. @@ -915,16 +912,6 @@ class Map { // Return a randomish value. size_type Seed() const { - // random_device can throw, so avoid it unless we are compiling with - // exceptions enabled. -#if __cpp_exceptions && LANG_CXX11 - try { - std::random_device rd; - std::knuth_b knuth(rd()); - std::uniform_int_distribution<size_type> u; - return u(knuth); - } catch (...) { } -#endif size_type s = static_cast<size_type>(reinterpret_cast<uintptr_t>(this)); #if defined(__x86_64__) && defined(__GNUC__) uint32 hi, lo; diff --git a/src/google/protobuf/map_entry_lite.h b/src/google/protobuf/map_entry_lite.h index d245cfc7..0bccf4d2 100644 --- a/src/google/protobuf/map_entry_lite.h +++ b/src/google/protobuf/map_entry_lite.h @@ -227,8 +227,10 @@ class MapEntryImpl : public Base { size_t ByteSizeLong() const { size_t size = 0; - size += has_key() ? kTagSize + KeyTypeHandler::ByteSize(key()) : 0; - size += has_value() ? kTagSize + ValueTypeHandler::ByteSize(value()) : 0; + size += has_key() ? + kTagSize + static_cast<size_t>(KeyTypeHandler::ByteSize(key())) : 0; + size += has_value() ? + kTagSize + static_cast<size_t>(ValueTypeHandler::ByteSize(value())) : 0; return size; } @@ -251,11 +253,10 @@ class MapEntryImpl : public Base { int GetCachedSize() const { int size = 0; size += has_key() - ? kTagSize + KeyTypeHandler::GetCachedSize(key()) + ? static_cast<int>(kTagSize) + KeyTypeHandler::GetCachedSize(key()) : 0; size += has_value() - ? kTagSize + ValueTypeHandler::GetCachedSize( - value()) + ? static_cast<int>(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..e317b5ed 100644 --- a/src/google/protobuf/map_field_inl.h +++ b/src/google/protobuf/map_field_inl.h @@ -168,7 +168,7 @@ template <typename Derived, typename Key, typename T, int MapField<Derived, Key, T, kKeyFieldType, kValueFieldType, default_enum_value>::size() const { MapFieldBase::SyncMapWithRepeatedField(); - return impl_.GetMap().size(); + return static_cast<int>(impl_.GetMap().size()); } template <typename Derived, typename Key, typename T, @@ -252,9 +252,9 @@ template <typename Derived, typename Key, typename T, WireFormatLite::FieldType kValueFieldType, int default_enum_value> void MapField<Derived, Key, T, kKeyFieldType, kValueFieldType, default_enum_value>::Swap(MapField* other) { - std::swap(MapFieldBase::repeated_field_, other->repeated_field_); + std::swap(this->MapFieldBase::repeated_field_, other->repeated_field_); impl_.Swap(&other->impl_); - std::swap(MapFieldBase::state_, other->state_); + std::swap(this->MapFieldBase::state_, other->state_); } template <typename Derived, typename Key, typename T, diff --git a/src/google/protobuf/map_field_lite.h b/src/google/protobuf/map_field_lite.h index 0ac7aeec..12d4e6ba 100644 --- a/src/google/protobuf/map_field_lite.h +++ b/src/google/protobuf/map_field_lite.h @@ -64,7 +64,7 @@ class MapFieldLite { Map<Key, T>* MutableMap() { return &map_; } // Convenient methods for generated message implementation. - int size() const { return map_.size(); } + int size() const { return static_cast<int>(map_.size()); } void Clear() { return map_.clear(); } void MergeFrom(const MapFieldLite& other) { for (typename Map<Key, T>::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 a10a7205..423c98f1 100644 --- a/src/google/protobuf/map_type_handler.h +++ b/src/google/protobuf/map_type_handler.h @@ -283,7 +283,7 @@ MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::ByteSize( template <typename Type> \ inline int MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::ByteSize( \ const MapEntryAccessorType& value) { \ - return WireFormatLite::DeclaredType##Size(value); \ + return static_cast<int>(WireFormatLite::DeclaredType##Size(value)); \ } GOOGLE_PROTOBUF_BYTE_SIZE(STRING, String) @@ -319,7 +319,9 @@ template <typename Type> inline int MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::GetCachedSize( const MapEntryAccessorType& value) { - return WireFormatLite::LengthDelimitedSize(value.GetCachedSize()); + return static_cast<int>( + WireFormatLite::LengthDelimitedSize( + static_cast<size_t>(value.GetCachedSize()))); } #define GET_CACHED_SIZE(FieldType, DeclaredType) \ @@ -327,7 +329,7 @@ MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::GetCachedSize( inline int \ MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::GetCachedSize( \ const MapEntryAccessorType& value) { \ - return WireFormatLite::DeclaredType##Size(value); \ + return static_cast<int>(WireFormatLite::DeclaredType##Size(value)); \ } GET_CACHED_SIZE(STRING, String) diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h index c65ff625..44fe0fde 100644 --- a/src/google/protobuf/message.h +++ b/src/google/protobuf/message.h @@ -963,7 +963,7 @@ class LIBPROTOBUF_EXPORT Reflection { // TODO(jieluo) - make the map APIs pure virtual after updating // all the subclasses. // Returns true if key is in map. Returns false if key is not in map field. - virtual bool ContainsMapKey(const Message& /* message*/, + virtual bool ContainsMapKey(const Message& /* message */, const FieldDescriptor* /* field */, const MapKey& /* key */) const { return false; @@ -981,7 +981,7 @@ class LIBPROTOBUF_EXPORT Reflection { // Delete and returns true if key is in the map field. Returns false // otherwise. - virtual bool DeleteMapValue(Message* /* mesage */, + virtual bool DeleteMapValue(Message* /* message */, const FieldDescriptor* /* field */, const MapKey& /* key */) const { return false; diff --git a/src/google/protobuf/metadata_lite.h b/src/google/protobuf/metadata_lite.h index 840c02e8..64fde0c6 100644 --- a/src/google/protobuf/metadata_lite.h +++ b/src/google/protobuf/metadata_lite.h @@ -167,7 +167,8 @@ class InternalMetadataWithArenaLite InternalMetadataWithArenaLite() {} explicit InternalMetadataWithArenaLite(Arena* arena) - : InternalMetadataWithArenaBase(arena) {} + : InternalMetadataWithArenaBase<string, + InternalMetadataWithArenaLite>(arena) {} void DoSwap(string* other) { mutable_unknown_fields()->swap(*other); diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index 20743fa9..d8003b8f 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -1331,7 +1331,7 @@ void RepeatedField<Element>::Reserve(int new_size) { static_cast<size_t>(new_size), (std::numeric_limits<size_t>::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<size_t>(new_size); if (arena == NULL) { rep_ = static_cast<Rep*>(::operator new(bytes)); } else { @@ -1395,7 +1395,7 @@ void ElementCopier<Element, HasTrivialCopy>::operator()( template <typename Element> struct ElementCopier<Element, true> { void operator()(Element* to, const Element* from, int array_size) { - memcpy(to, from, array_size * sizeof(Element)); + memcpy(to, from, static_cast<size_t>(array_size) * sizeof(Element)); } }; @@ -1647,7 +1647,7 @@ inline void RepeatedPtrFieldBase::SwapElements(int index1, int index2) { template <typename TypeHandler> inline size_t RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong() const { - size_t allocated_bytes = total_size_ * sizeof(void*); + size_t allocated_bytes = static_cast<size_t>(total_size_) * sizeof(void*); if (rep_ != NULL) { for (int i = 0; i < rep_->allocated_size; ++i) { allocated_bytes += TypeHandler::SpaceUsedLong( diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc index 3a7c5b50..130eb2ab 100644 --- a/src/google/protobuf/source_context.pb.cc +++ b/src/google/protobuf/source_context.pb.cc @@ -215,7 +215,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<int>(this->file_name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.SourceContext.file_name")); } else { @@ -253,7 +253,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<int>(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<int>(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 bb33a553..08029a46 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -331,7 +331,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<int>(parser.key().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Struct.FieldsEntry.key")); } else { @@ -375,7 +375,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<int>(p->first.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Struct.FieldsEntry.key"); } @@ -390,19 +390,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<ptrdiff_t>(n)] = SortItem(&*it); } - ::std::sort(&items[0], &items[n], Less()); + ::std::sort(&items[0], &items[static_cast<ptrdiff_t>(n)], Less()); ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry; for (size_type i = 0; i < n; i++) { entry.reset(fields_.NewEntryWrapper( - items[i]->first, items[i]->second)); + items[static_cast<ptrdiff_t>(i)]->first, items[static_cast<ptrdiff_t>(i)]->second)); ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 1, *entry, output); if (entry->GetArena() != NULL) { entry.release(); } - Utf8Check::Check(items[i]); + Utf8Check::Check(items[static_cast<ptrdiff_t>(i)]); } } else { ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry; @@ -443,7 +443,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<int>(p->first.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Struct.FieldsEntry.key"); } @@ -458,13 +458,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<ptrdiff_t>(n)] = SortItem(&*it); } - ::std::sort(&items[0], &items[n], Less()); + ::std::sort(&items[0], &items[static_cast<ptrdiff_t>(n)], Less()); ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry; for (size_type i = 0; i < n; i++) { entry.reset(fields_.NewEntryWrapper( - items[i]->first, items[i]->second)); + items[static_cast<ptrdiff_t>(i)]->first, items[static_cast<ptrdiff_t>(i)]->second)); target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( 1, *entry, deterministic, target); @@ -472,7 +472,7 @@ void Struct::SerializeWithCachedSizes( if (entry->GetArena() != NULL) { entry.release(); } - Utf8Check::Check(items[i]); + Utf8Check::Check(items[static_cast<ptrdiff_t>(i)]); } } else { ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry; @@ -843,7 +843,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<int>(this->string_value().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Value.string_value")); } else { @@ -931,7 +931,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<int>(this->string_value().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Value.string_value"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -982,7 +982,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<int>(this->string_value().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Value.string_value"); target = @@ -1712,9 +1712,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<unsigned int>(this->values_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 1, this->values(i), output); + 1, this->values(static_cast<int>(i)), output); } if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { @@ -1731,10 +1732,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<unsigned int>(this->values_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 1, this->values(i), deterministic, target); + 1, this->values(static_cast<int>(i)), deterministic, target); } if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { @@ -1756,12 +1758,12 @@ size_t ListValue::ByteSizeLong() const { } // repeated .google.protobuf.Value values = 1; { - unsigned int count = this->values_size(); + unsigned int count = static_cast<unsigned int>(this->values_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->values(i)); + this->values(static_cast<int>(i))); } } diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index 79d615df..f32fd228 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -228,10 +228,8 @@ class FatalException : public std::exception { // in some versions of MSVC. // TODO(acozzette): remove these using statements using std::istream; -using std::map; using std::ostream; using std::pair; -using std::set; using std::string; using std::vector; 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<uint32>(*a++) - static_cast<uint32>(*b++); + int d = + static_cast<int>(static_cast<uint32>(*a++) - static_cast<uint32>(*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..612b5861 100644 --- a/src/google/protobuf/stubs/hash.h +++ b/src/google/protobuf/stubs/hash.h @@ -40,10 +40,9 @@ #define GOOGLE_PROTOBUF_HAVE_HASH_MAP 1 #define GOOGLE_PROTOBUF_HAVE_HASH_SET 1 -#define GOOGLE_PROTOBUF_HAVE_64BIT_HASH 1 // Use C++11 unordered_{map|set} if available. -#if ((_LIBCPP_STD_VER >= 11) || \ +#if ((defined(_LIBCPP_STD_VER) && _LIBCPP_STD_VER >= 11) || \ (((__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X)) && \ (__GLIBCXX__ > 20090421))) # define GOOGLE_PROTOBUF_HAS_CXX11_HASH @@ -93,8 +92,11 @@ # define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set # endif +// GCC <= 4.1 does not define std::tr1::hash for `long long int` or `long long unsigned int` # if __GNUC__ == 4 && __GNUC__MINOR__ <= 1 -# undef GOOGLE_PROTOBUF_HAVE_64BIT_HASH +# define GOOGLE_PROTOBUF_MISSING_HASH +# include <map> +# include <set> # endif // Version checks for MSC. @@ -348,7 +350,7 @@ struct hash<const char*> { 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<size_t>(*str); } return result; } diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h index ca9a1501..dbc29861 100644 --- a/src/google/protobuf/stubs/port.h +++ b/src/google/protobuf/stubs/port.h @@ -252,9 +252,15 @@ static const uint64 kuint64max = GOOGLE_ULONGLONG(0xFFFFFFFFFFFFFFFF); #define GOOGLE_GUARDED_BY(x) #define GOOGLE_ATTRIBUTE_COLD +#ifdef GOOGLE_PROTOBUF_DONT_USE_UNALIGNED +# define GOOGLE_PROTOBUF_USE_UNALIGNED 0 +#else // x86 and x86-64 can perform unaligned loads/stores directly. -#if defined(_M_X64) || defined(__x86_64__) || \ - defined(_M_IX86) || defined(__i386__) +# define GOOGLE_PROTOBUF_USE_UNALIGNED defined(_M_X64) || \ + defined(__x86_64__) || defined(_M_IX86) || defined(__i386__) +#endif + +#if GOOGLE_PROTOBUF_USE_UNALIGNED #define GOOGLE_UNALIGNED_LOAD16(_p) (*reinterpret_cast<const uint16 *>(_p)) #define GOOGLE_UNALIGNED_LOAD32(_p) (*reinterpret_cast<const uint32 *>(_p)) @@ -348,7 +354,7 @@ class Bits { public: static uint32 Log2FloorNonZero(uint32 n) { #if defined(__GNUC__) - return 31 ^ __builtin_clz(n); + return 31 ^ static_cast<uint32>(__builtin_clz(n)); #elif defined(COMPILER_MSVC) && defined(_M_IX86) _asm { bsr ebx, n @@ -367,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<uint32>(__builtin_clzll(n)); #else return Log2FloorNonZero64_Portable(n); #endif @@ -394,9 +400,9 @@ class Bits { const uint32 topbits = static_cast<uint32>(n >> 32); if (topbits == 0) { // Top bits are zero, so scan in bottom bits - return Log2FloorNonZero(static_cast<uint32>(n)); + return static_cast<int>(Log2FloorNonZero(static_cast<uint32>(n))); } else { - return 32 + Log2FloorNonZero(topbits); + return 32 + static_cast<int>(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<size_t>(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_type>(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<size_t>(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<size_t>(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<size_t>(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<size_t>(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_t>(size_)); + } private: const char* data_; stringpiece_ssize_type size_; @@ -473,7 +477,7 @@ template<> struct hash<StringPiece> { 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<size_t>(*str); } return result; } diff --git a/src/google/protobuf/stubs/strutil.cc b/src/google/protobuf/stubs/strutil.cc index 336894b5..1a4d71c8 100644 --- a/src/google/protobuf/stubs/strutil.cc +++ b/src/google/protobuf/stubs/strutil.cc @@ -1401,7 +1401,7 @@ char* FloatToBuffer(float value, char* buffer) { float parsed_value; if (!safe_strtof(buffer, &parsed_value) || parsed_value != value) { int snprintf_result = - snprintf(buffer, kFloatToBufferSize, "%.*g", FLT_DIG+2, value); + snprintf(buffer, kFloatToBufferSize, "%.*g", FLT_DIG+3, value); // Should never overflow; see above. GOOGLE_DCHECK(snprintf_result > 0 && snprintf_result < kFloatToBufferSize); diff --git a/src/google/protobuf/testing/googletest.h b/src/google/protobuf/testing/googletest.h index 04b3019e..dc4401d0 100644 --- a/src/google/protobuf/testing/googletest.h +++ b/src/google/protobuf/testing/googletest.h @@ -85,7 +85,7 @@ class ScopedMemoryLog { const vector<string>& GetMessages(LogLevel error); private: - map<LogLevel, vector<string> > messages_; + std::map<LogLevel, vector<string> > messages_; LogHandler* old_handler_; static void HandleLog(LogLevel level, const char* filename, int line, diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc index 54f022a0..52ceec79 100644 --- a/src/google/protobuf/timestamp.pb.cc +++ b/src/google/protobuf/timestamp.pb.cc @@ -154,14 +154,15 @@ Timestamp::Timestamp(const Timestamp& from) _cached_size_(0) { _internal_metadata_.MergeFrom(from._internal_metadata_); ::memcpy(&seconds_, &from.seconds_, - reinterpret_cast<char*>(&nanos_) - - reinterpret_cast<char*>(&seconds_) + sizeof(nanos_)); + static_cast<size_t>(reinterpret_cast<char*>(&nanos_) - + reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.Timestamp) } void Timestamp::SharedCtor() { - ::memset(&seconds_, 0, reinterpret_cast<char*>(&nanos_) - - reinterpret_cast<char*>(&seconds_) + sizeof(nanos_)); + ::memset(&seconds_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&nanos_) - + reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_)); _cached_size_ = 0; } @@ -210,8 +211,9 @@ void Timestamp::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - ::memset(&seconds_, 0, reinterpret_cast<char*>(&nanos_) - - reinterpret_cast<char*>(&seconds_) + sizeof(nanos_)); + ::memset(&seconds_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&nanos_) - + reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_)); _internal_metadata_.Clear(); } diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index e28cec2e..4e6d0f8f 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -419,8 +419,9 @@ Type::Type(const Type& from) void Type::SharedCtor() { name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&source_context_, 0, reinterpret_cast<char*>(&syntax_) - - reinterpret_cast<char*>(&source_context_) + sizeof(syntax_)); + ::memset(&source_context_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&syntax_) - + reinterpret_cast<char*>(&source_context_)) + sizeof(syntax_)); _cached_size_ = 0; } @@ -500,7 +501,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Type.name")); } else { @@ -529,7 +530,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<int>(this->oneofs(this->oneofs_size() - 1).length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Type.oneofs")); } else { @@ -606,7 +607,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -614,15 +615,16 @@ 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<unsigned int>(this->fields_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->fields(i), output); + 2, this->fields(static_cast<int>(i)), output); } // 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<int>(this->oneofs(i).length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.oneofs"); ::google::protobuf::internal::WireFormatLite::WriteString( @@ -630,9 +632,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<unsigned int>(this->options_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 4, this->options(i), output); + 4, this->options(static_cast<int>(i)), output); } // .google.protobuf.SourceContext source_context = 5; @@ -663,7 +666,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.name"); target = @@ -672,16 +675,17 @@ 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<unsigned int>(this->fields_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 2, this->fields(i), deterministic, target); + 2, this->fields(static_cast<int>(i)), deterministic, target); } // 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<int>(this->oneofs(i).length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.oneofs"); target = ::google::protobuf::internal::WireFormatLite:: @@ -689,10 +693,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<unsigned int>(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 4, this->options(i), deterministic, target); + 4, this->options(static_cast<int>(i)), deterministic, target); } // .google.protobuf.SourceContext source_context = 5; @@ -727,12 +732,12 @@ size_t Type::ByteSizeLong() const { } // repeated .google.protobuf.Field fields = 2; { - unsigned int count = this->fields_size(); + unsigned int count = static_cast<unsigned int>(this->fields_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->fields(i)); + this->fields(static_cast<int>(i))); } } @@ -746,12 +751,12 @@ size_t Type::ByteSizeLong() const { // repeated .google.protobuf.Option options = 4; { - unsigned int count = this->options_size(); + unsigned int count = static_cast<unsigned int>(this->options_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->options(i)); + this->options(static_cast<int>(i))); } } @@ -1206,8 +1211,8 @@ Field::Field(const Field& from) GetArenaNoVirtual()); } ::memcpy(&kind_, &from.kind_, - reinterpret_cast<char*>(&packed_) - - reinterpret_cast<char*>(&kind_) + sizeof(packed_)); + static_cast<size_t>(reinterpret_cast<char*>(&packed_) - + reinterpret_cast<char*>(&kind_)) + sizeof(packed_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.Field) } @@ -1216,8 +1221,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<char*>(&packed_) - - reinterpret_cast<char*>(&kind_) + sizeof(packed_)); + ::memset(&kind_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&packed_) - + reinterpret_cast<char*>(&kind_)) + sizeof(packed_)); _cached_size_ = 0; } @@ -1275,8 +1281,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<char*>(&packed_) - - reinterpret_cast<char*>(&kind_) + sizeof(packed_)); + ::memset(&kind_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&packed_) - + reinterpret_cast<char*>(&kind_)) + sizeof(packed_)); _internal_metadata_.Clear(); } @@ -1341,7 +1348,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Field.name")); } else { @@ -1357,7 +1364,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<int>(this->type_url().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Field.type_url")); } else { @@ -1413,7 +1420,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<int>(this->json_name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Field.json_name")); } else { @@ -1429,7 +1436,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<int>(this->default_value().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Field.default_value")); } else { @@ -1484,7 +1491,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1494,7 +1501,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<int>(this->type_url().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.type_url"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1512,15 +1519,16 @@ 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<unsigned int>(this->options_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 9, this->options(i), output); + 9, this->options(static_cast<int>(i)), output); } // 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<int>(this->json_name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.json_name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1530,7 +1538,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<int>(this->default_value().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.default_value"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -1570,7 +1578,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.name"); target = @@ -1581,7 +1589,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<int>(this->type_url().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.type_url"); target = @@ -1600,16 +1608,17 @@ 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<unsigned int>(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 9, this->options(i), deterministic, target); + 9, this->options(static_cast<int>(i)), deterministic, target); } // 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<int>(this->json_name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.json_name"); target = @@ -1620,7 +1629,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<int>(this->default_value().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.default_value"); target = @@ -1647,12 +1656,12 @@ size_t Field::ByteSizeLong() const { } // repeated .google.protobuf.Option options = 9; { - unsigned int count = this->options_size(); + unsigned int count = static_cast<unsigned int>(this->options_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->options(i)); + this->options(static_cast<int>(i))); } } @@ -2321,8 +2330,9 @@ Enum::Enum(const Enum& from) void Enum::SharedCtor() { name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&source_context_, 0, reinterpret_cast<char*>(&syntax_) - - reinterpret_cast<char*>(&source_context_) + sizeof(syntax_)); + ::memset(&source_context_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&syntax_) - + reinterpret_cast<char*>(&source_context_)) + sizeof(syntax_)); _cached_size_ = 0; } @@ -2401,7 +2411,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Enum.name")); } else { @@ -2490,7 +2500,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Enum.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -2498,15 +2508,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<unsigned int>(this->enumvalue_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->enumvalue(i), output); + 2, this->enumvalue(static_cast<int>(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<unsigned int>(this->options_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 3, this->options(i), output); + 3, this->options(static_cast<int>(i)), output); } // .google.protobuf.SourceContext source_context = 4; @@ -2537,7 +2549,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Enum.name"); target = @@ -2546,17 +2558,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<unsigned int>(this->enumvalue_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 2, this->enumvalue(i), deterministic, target); + 2, this->enumvalue(static_cast<int>(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<unsigned int>(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 3, this->options(i), deterministic, target); + 3, this->options(static_cast<int>(i)), deterministic, target); } // .google.protobuf.SourceContext source_context = 4; @@ -2591,23 +2605,23 @@ size_t Enum::ByteSizeLong() const { } // repeated .google.protobuf.EnumValue enumvalue = 2; { - unsigned int count = this->enumvalue_size(); + unsigned int count = static_cast<unsigned int>(this->enumvalue_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->enumvalue(i)); + this->enumvalue(static_cast<int>(i))); } } // repeated .google.protobuf.Option options = 3; { - unsigned int count = this->options_size(); + unsigned int count = static_cast<unsigned int>(this->options_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->options(i)); + this->options(static_cast<int>(i))); } } @@ -3047,7 +3061,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.EnumValue.name")); } else { @@ -3111,7 +3125,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.EnumValue.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -3124,9 +3138,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<unsigned int>(this->options_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 3, this->options(i), output); + 3, this->options(static_cast<int>(i)), output); } if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { @@ -3145,7 +3160,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.EnumValue.name"); target = @@ -3159,10 +3174,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<unsigned int>(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 3, this->options(i), deterministic, target); + 3, this->options(static_cast<int>(i)), deterministic, target); } if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { @@ -3184,12 +3200,12 @@ size_t EnumValue::ByteSizeLong() const { } // repeated .google.protobuf.Option options = 3; { - unsigned int count = this->options_size(); + unsigned int count = static_cast<unsigned int>(this->options_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->options(i)); + this->options(static_cast<int>(i))); } } @@ -3572,7 +3588,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.Option.name")); } else { @@ -3622,7 +3638,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Option.name"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -3651,7 +3667,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<int>(this->name().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Option.name"); target = 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<size_t>(index)]; } inline UnknownField* UnknownFieldSet::mutable_field(int index) { - return &(*fields_)[index]; + return &(*fields_)[static_cast<size_t>(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<int>(number_); } inline UnknownField::Type UnknownField::type() const { return static_cast<Type>(type_); } diff --git a/src/google/protobuf/util/message_differencer.h b/src/google/protobuf/util/message_differencer.h index fdbf04e4..b7d4de00 100644 --- a/src/google/protobuf/util/message_differencer.h +++ b/src/google/protobuf/util/message_differencer.h @@ -241,18 +241,18 @@ class LIBPROTOBUF_EXPORT MessageDifferencer { // mutually exclusive. If a field has been both moved and modified, then // only ReportModified will be called. virtual void ReportMoved( - const Message& message1, - const Message& message2, - const std::vector<SpecificField>& field_path) { } + const Message& /* message1 */, + const Message& /* message2 */, + const std::vector<SpecificField>& /* field_path */) { } // Reports that two fields match. Useful for doing side-by-side diffs. // This function is mutually exclusive with ReportModified and ReportMoved. // Note that you must call set_report_matches(true) before calling Compare // to make use of this function. virtual void ReportMatched( - const Message& message1, - const Message& message2, - const std::vector<SpecificField>& field_path) { } + const Message& /* message1 */, + const Message& /* message2 */, + const std::vector<SpecificField>& /* field_path */) { } // Reports that two fields would have been compared, but the // comparison has been skipped because the field was marked as @@ -274,16 +274,16 @@ class LIBPROTOBUF_EXPORT MessageDifferencer { // the fields are equal or not (perhaps with a second call to // Compare()), if it cares. virtual void ReportIgnored( - const Message& message1, - const Message& message2, - const std::vector<SpecificField>& field_path) { } + const Message& /* message1 */, + const Message& /* message2 */, + const std::vector<SpecificField>& /* field_path */) { } // Report that an unknown field is ignored. (see comment above). // Note this is a different function since the last SpecificField in field // path has a null field. This could break existing Reporter. virtual void ReportUnknownFieldIgnored( - const Message& message1, const Message& message2, - const std::vector<SpecificField>& field_path) {} + const Message& /* message1 */, const Message& /* message2 */, + const std::vector<SpecificField>& /* field_path */) {} private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Reporter); @@ -297,9 +297,9 @@ class LIBPROTOBUF_EXPORT MessageDifferencer { virtual ~MapKeyComparator(); virtual bool IsMatch( - const Message& message1, - const Message& message2, - const std::vector<SpecificField>& parent_fields) const { + const Message& /* message1 */, + const Message& /* message2 */, + const std::vector<SpecificField>& /* parent_fields */) const { GOOGLE_CHECK(false) << "IsMatch() is not implemented."; return false; } @@ -321,18 +321,18 @@ class LIBPROTOBUF_EXPORT MessageDifferencer { // Returns true if the field should be ignored. virtual bool IsIgnored( - const Message& message1, - const Message& message2, - const FieldDescriptor* field, - const std::vector<SpecificField>& parent_fields) = 0; + const Message& /* message1 */, + const Message& /* message2 */, + const FieldDescriptor* /* field */, + const std::vector<SpecificField>& /* parent_fields */) = 0; // Returns true if the unknown field should be ignored. // Note: This will be called for unknown fields as well in which case // field.field will be null. virtual bool IsUnknownFieldIgnored( - const Message& message1, const Message& message2, - const SpecificField& field, - const std::vector<SpecificField>& parent_fields) { + const Message& /* message1 */, const Message& /* message2 */, + const SpecificField& /* field */, + const std::vector<SpecificField>& /* parent_fields */) { return false; } }; diff --git a/src/google/protobuf/wire_format_lite.h b/src/google/protobuf/wire_format_lite.h index 346d5b2a..3e079ea5 100644 --- a/src/google/protobuf/wire_format_lite.h +++ b/src/google/protobuf/wire_format_lite.h @@ -202,7 +202,7 @@ class LIBPROTOBUF_EXPORT WireFormatLite { // type-safe, though, so prefer it if possible. #define GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(FIELD_NUMBER, TYPE) \ static_cast<uint32>( \ - ((FIELD_NUMBER) << ::google::protobuf::internal::WireFormatLite::kTagTypeBits) \ + (static_cast<uint32>(FIELD_NUMBER) << ::google::protobuf::internal::WireFormatLite::kTagTypeBits) \ | (TYPE)) // These are the tags for the old MessageSet format, which was defined as: @@ -792,7 +792,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<uint32>(field_number << kTagTypeBits)); if (type == TYPE_GROUP) { // Groups have both a start and an end tag. return result * 2; @@ -851,20 +851,20 @@ inline double WireFormatLite::DecodeDouble(uint64 value) { inline uint32 WireFormatLite::ZigZagEncode32(int32 n) { // Note: the right-shift must be arithmetic - return (static_cast<uint32>(n) << 1) ^ (n >> 31); + return static_cast<uint32>((n << 1) ^ (n >> 31)); } inline int32 WireFormatLite::ZigZagDecode32(uint32 n) { - return (n >> 1) ^ -static_cast<int32>(n & 1); + return static_cast<int32>(n >> 1) ^ -static_cast<int32>(n & 1); } inline uint64 WireFormatLite::ZigZagEncode64(int64 n) { // Note: the right-shift must be arithmetic - return (static_cast<uint64>(n) << 1) ^ (n >> 63); + return static_cast<uint64>((n << 1) ^ (n >> 63)); } inline int64 WireFormatLite::ZigZagDecode64(uint64 n) { - return (n >> 1) ^ -static_cast<int64>(n & 1); + return static_cast<int64>(n >> 1) ^ -static_cast<int64>(n & 1); } // String is for UTF-8 text only, but, even so, ReadString() can simply diff --git a/src/google/protobuf/wire_format_lite_inl.h b/src/google/protobuf/wire_format_lite_inl.h index 05049017..c044def8 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<const uint8*>(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<int>(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<int>(sizeof(CType)); + const int new_bytes = new_entries * static_cast<int>(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,8 +695,8 @@ inline uint8* WireFormatLite::WriteFixedNoTagToArray( GOOGLE_DCHECK_GT(n, 0); const T* ii = value.unsafe_data(); - const int bytes = n * sizeof(ii[0]); - memcpy(target, ii, bytes); + const int bytes = n * static_cast<int>(sizeof(ii[0])); + memcpy(target, ii, static_cast<size_t>(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<uint32>(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<uint32>( + value.MessageType_WorkAroundCppLookupDefect::GetCachedSize()), + target); return value.MessageType_WorkAroundCppLookupDefect:: InternalSerializeWithCachedSizesToArray(deterministic, target); } diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc index 67d04409..b1db6e9f 100644 --- a/src/google/protobuf/wrappers.pb.cc +++ b/src/google/protobuf/wrappers.pb.cc @@ -2315,7 +2315,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<int>(this->value().length()), ::google::protobuf::internal::WireFormatLite::PARSE, "google.protobuf.StringValue.value")); } else { @@ -2353,7 +2353,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<int>(this->value().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.StringValue.value"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( @@ -2376,7 +2376,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<int>(this->value().length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.StringValue.value"); target = |