From 0400cca3236de1ca303af38bf81eab332d042b7c Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Tue, 13 Mar 2018 16:37:29 -0700 Subject: Integrated internal changes from Google --- src/google/protobuf/any.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/google/protobuf/any.cc') diff --git a/src/google/protobuf/any.cc b/src/google/protobuf/any.cc index 83edba57..b94529e6 100644 --- a/src/google/protobuf/any.cc +++ b/src/google/protobuf/any.cc @@ -32,6 +32,7 @@ #include + namespace google { namespace protobuf { namespace internal { @@ -84,15 +85,23 @@ bool AnyMetadata::InternalIs(const Descriptor* descriptor) const { return full_name == descriptor->full_name(); } -bool ParseAnyTypeUrl(const string& type_url, string* full_type_name) { +bool ParseAnyTypeUrl(const string& type_url, string* url_prefix, + string* full_type_name) { size_t pos = type_url.find_last_of("/"); if (pos == string::npos || pos + 1 == type_url.size()) { return false; } + if (url_prefix) { + *url_prefix = type_url.substr(0, pos + 1); + } *full_type_name = type_url.substr(pos + 1); return true; } +bool ParseAnyTypeUrl(const string& type_url, string* full_type_name) { + return ParseAnyTypeUrl(type_url, NULL, full_type_name); +} + bool GetAnyFieldDescriptors(const Message& message, const FieldDescriptor** type_url_field, -- cgit v1.2.3