From 5a76e633ea9b5adb215e93fdc11e1c0c08b3fc74 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Thu, 17 Nov 2016 16:48:38 -0800 Subject: Integrated internal changes from Google --- src/google/protobuf/message_lite.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/google/protobuf/message_lite.cc') diff --git a/src/google/protobuf/message_lite.cc b/src/google/protobuf/message_lite.cc index 9d6da264..a42e9ec3 100644 --- a/src/google/protobuf/message_lite.cc +++ b/src/google/protobuf/message_lite.cc @@ -33,6 +33,8 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. +#include + #include #include #include @@ -237,21 +239,18 @@ bool MessageLite::SerializeToCodedStream(io::CodedOutputStream* output) const { return SerializePartialToCodedStream(output); } -size_t MessageLite::ByteSizeLong() const { - return internal::FromIntSize(ByteSize()); -} - bool MessageLite::SerializePartialToCodedStream( io::CodedOutputStream* output) const { const size_t size = ByteSizeLong(); // Force size to be cached. if (size > INT_MAX) { - GOOGLE_LOG(ERROR) << "Exceeded maximum protobuf size of 2GB."; + GOOGLE_LOG(ERROR) << "Exceeded maximum protobuf size of 2GB: " << size; return false; } uint8* buffer = output->GetDirectBufferForNBytesAndAdvance(size); if (buffer != NULL) { - uint8* end = SerializeWithCachedSizesToArray(buffer); + uint8* end = InternalSerializeWithCachedSizesToArray( + output->IsSerializationDeterministic(), buffer); if (end - buffer != size) { ByteSizeConsistencyError(size, ByteSizeLong(), end - buffer, *this); } @@ -294,7 +293,7 @@ bool MessageLite::AppendPartialToString(string* output) const { size_t old_size = output->size(); size_t byte_size = ByteSizeLong(); if (byte_size > INT_MAX) { - GOOGLE_LOG(ERROR) << "Exceeded maximum protobuf size of 2GB."; + GOOGLE_LOG(ERROR) << "Exceeded maximum protobuf size of 2GB: " << byte_size; return false; } -- cgit v1.2.3