Make LazyField::ByteSizeLong consistent with eager message.

PiperOrigin-RevId: 589227028
pull/15019/head
Protobuf Team Bot 12 months ago committed by Copybara-Service
parent 4c32845eb5
commit a17c248775
  1. 17
      src/google/protobuf/extension_set.cc

@ -1452,12 +1452,9 @@ size_t ExtensionSet::Extension::ByteSize(int number) const {
HANDLE_TYPE(GROUP, Group, *message_value);
#undef HANDLE_TYPE
case WireFormatLite::TYPE_MESSAGE: {
if (is_lazy) {
// LazyField::ByteSizeLong includes sizeof(length).
result += lazymessage_value->ByteSizeLong();
} else {
result += WireFormatLite::MessageSize(*message_value);
}
result += WireFormatLite::LengthDelimitedSize(
is_lazy ? lazymessage_value->ByteSizeLong()
: message_value->ByteSizeLong());
break;
}
@ -1919,11 +1916,9 @@ size_t ExtensionSet::Extension::MessageSetItemByteSize(int number) const {
our_size += io::CodedOutputStream::VarintSize32(number);
// message
if (is_lazy) {
our_size += lazymessage_value->ByteSizeLong();
} else {
our_size += WireFormatLite::MessageSize(*message_value);
}
our_size += WireFormatLite::LengthDelimitedSize(
is_lazy ? lazymessage_value->ByteSizeLong()
: message_value->ByteSizeLong());
return our_size;
}

Loading…
Cancel
Save