any_lite.cc (protobuf-all-3.19.4) | : | any_lite.cc (protobuf-all-3.20.1) | ||
---|---|---|---|---|
skipping to change at line 31 | skipping to change at line 31 | |||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
#include <google/protobuf/any.h> | ||||
#include <google/protobuf/io/zero_copy_stream_impl_lite.h> | #include <google/protobuf/io/zero_copy_stream_impl_lite.h> | |||
#include <google/protobuf/stubs/strutil.h> | ||||
#include <google/protobuf/any.h> | ||||
#include <google/protobuf/arenastring.h> | #include <google/protobuf/arenastring.h> | |||
#include <google/protobuf/generated_message_util.h> | #include <google/protobuf/generated_message_util.h> | |||
#include <google/protobuf/stubs/strutil.h> | ||||
namespace google { | namespace google { | |||
namespace protobuf { | namespace protobuf { | |||
namespace internal { | namespace internal { | |||
std::string GetTypeUrl(StringPiece message_name, | std::string GetTypeUrl(StringPiece message_name, | |||
StringPiece type_url_prefix) { | StringPiece type_url_prefix) { | |||
if (!type_url_prefix.empty() && | if (!type_url_prefix.empty() && | |||
type_url_prefix[type_url_prefix.size() - 1] == '/') { | type_url_prefix[type_url_prefix.size() - 1] == '/') { | |||
return StrCat(type_url_prefix, message_name); | return StrCat(type_url_prefix, message_name); | |||
skipping to change at line 59 | skipping to change at line 58 | |||
} | } | |||
} | } | |||
const char kAnyFullTypeName[] = "google.protobuf.Any"; | const char kAnyFullTypeName[] = "google.protobuf.Any"; | |||
const char kTypeGoogleApisComPrefix[] = "type.googleapis.com/"; | const char kTypeGoogleApisComPrefix[] = "type.googleapis.com/"; | |||
const char kTypeGoogleProdComPrefix[] = "type.googleprod.com/"; | const char kTypeGoogleProdComPrefix[] = "type.googleprod.com/"; | |||
bool AnyMetadata::InternalPackFrom(Arena* arena, const MessageLite& message, | bool AnyMetadata::InternalPackFrom(Arena* arena, const MessageLite& message, | |||
StringPiece type_url_prefix, | StringPiece type_url_prefix, | |||
StringPiece type_name) { | StringPiece type_name) { | |||
type_url_->Set(&::google::protobuf::internal::GetEmptyString(), | type_url_->Set(GetTypeUrl(type_name, type_url_prefix), arena); | |||
GetTypeUrl(type_name, type_url_prefix), arena); | return message.SerializeToString(value_->Mutable(arena)); | |||
return message.SerializeToString( | ||||
value_->Mutable(ArenaStringPtr::EmptyDefault{}, arena)); | ||||
} | } | |||
bool AnyMetadata::InternalUnpackTo(StringPiece type_name, | bool AnyMetadata::InternalUnpackTo(StringPiece type_name, | |||
MessageLite* message) const { | MessageLite* message) const { | |||
if (!InternalIs(type_name)) { | if (!InternalIs(type_name)) { | |||
return false; | return false; | |||
} | } | |||
return message->ParseFromString(value_->Get()); | return message->ParseFromString(value_->Get()); | |||
} | } | |||
End of changes. 4 change blocks. | ||||
7 lines changed or deleted | 4 lines changed or added |