Make LazyField::ByteSizeLong consistent with eager message.
PiperOrigin-RevId: 589227028
diff --git a/src/google/protobuf/extension_set.cc b/src/google/protobuf/extension_set.cc
index 0a67b05..5328fa0 100644
--- a/src/google/protobuf/extension_set.cc
+++ b/src/google/protobuf/extension_set.cc
@@ -1452,12 +1452,9 @@
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 @@
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;
}