Skip to content

Commit

Permalink
Change Any::PackFrom to avoid bringing the full runtime.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 603079735
  • Loading branch information
protobuf-github-bot authored and deannagarcia committed Jun 20, 2024
1 parent 7ab9e9c commit f9fe742
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/google/protobuf/any.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ bool AnyMetadata::PackFrom(Arena* arena, const Message& message) {

bool AnyMetadata::PackFrom(Arena* arena, const Message& message,
absl::string_view type_url_prefix) {
type_url_->Set(
GetTypeUrl(message.GetDescriptor()->full_name(), type_url_prefix), arena);
type_url_->Set(GetTypeUrl(message.GetTypeName(), type_url_prefix), arena);
return message.SerializeToString(value_->Mutable(arena));
}

bool AnyMetadata::UnpackTo(Message* message) const {
if (!InternalIs(message->GetDescriptor()->full_name())) {
if (!InternalIs(message->GetTypeName())) {
return false;
}
return message->ParseFromString(value_->Get());
Expand Down

0 comments on commit f9fe742

Please sign in to comment.