aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/message_lite.cc
diff options
context:
space:
mode:
authorJisi Liu <jisi.liu@gmail.com>2016-03-30 11:39:59 -0700
committerJisi Liu <jisi.liu@gmail.com>2016-03-30 11:39:59 -0700
commit3b3c8abb9635eb3ea078a821a99c9ef29d66dff7 (patch)
tree7d2ec154f15c9f9153d890e76b6cf30e471ea488 /src/google/protobuf/message_lite.cc
parent78105897a8f01c7be9cf8502b6c58d47eb1ccdd7 (diff)
downloadprotobuf-3b3c8abb9635eb3ea078a821a99c9ef29d66dff7.tar.gz
protobuf-3b3c8abb9635eb3ea078a821a99c9ef29d66dff7.tar.bz2
protobuf-3b3c8abb9635eb3ea078a821a99c9ef29d66dff7.zip
Integrate google internal changes.
Diffstat (limited to 'src/google/protobuf/message_lite.cc')
-rw-r--r--src/google/protobuf/message_lite.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/google/protobuf/message_lite.cc b/src/google/protobuf/message_lite.cc
index 5bd8bcfb..fe124c45 100644
--- a/src/google/protobuf/message_lite.cc
+++ b/src/google/protobuf/message_lite.cc
@@ -62,13 +62,15 @@ namespace {
// provide a useful error message.
void ByteSizeConsistencyError(int byte_size_before_serialization,
int byte_size_after_serialization,
- int bytes_produced_by_serialization) {
+ int bytes_produced_by_serialization,
+ const MessageLite& message) {
GOOGLE_CHECK_EQ(byte_size_before_serialization, byte_size_after_serialization)
- << "Protocol message was modified concurrently during serialization.";
+ << message.GetTypeName()
+ << " was modified concurrently during serialization.";
GOOGLE_CHECK_EQ(bytes_produced_by_serialization, byte_size_before_serialization)
<< "Byte size calculation and serialization were inconsistent. This "
"may indicate a bug in protocol buffers or it may be caused by "
- "concurrent modification of the message.";
+ "concurrent modification of " << message.GetTypeName() << ".";
GOOGLE_LOG(FATAL) << "This shouldn't be called if all the sizes are equal.";
}
@@ -248,7 +250,7 @@ bool MessageLite::SerializePartialToCodedStream(
if (buffer != NULL) {
uint8* end = SerializeWithCachedSizesToArray(buffer);
if (end - buffer != size) {
- ByteSizeConsistencyError(size, ByteSize(), end - buffer);
+ ByteSizeConsistencyError(size, ByteSize(), end - buffer, *this);
}
return true;
} else {
@@ -261,7 +263,7 @@ bool MessageLite::SerializePartialToCodedStream(
if (final_byte_count - original_byte_count != size) {
ByteSizeConsistencyError(size, ByteSize(),
- final_byte_count - original_byte_count);
+ final_byte_count - original_byte_count, *this);
}
return true;
@@ -299,7 +301,7 @@ bool MessageLite::AppendPartialToString(string* output) const {
reinterpret_cast<uint8*>(io::mutable_string_data(output) + old_size);
uint8* end = SerializeWithCachedSizesToArray(start);
if (end - start != byte_size) {
- ByteSizeConsistencyError(byte_size, ByteSize(), end - start);
+ ByteSizeConsistencyError(byte_size, ByteSize(), end - start, *this);
}
return true;
}
@@ -325,7 +327,7 @@ bool MessageLite::SerializePartialToArray(void* data, int size) const {
uint8* start = reinterpret_cast<uint8*>(data);
uint8* end = SerializeWithCachedSizesToArray(start);
if (end - start != byte_size) {
- ByteSizeConsistencyError(byte_size, ByteSize(), end - start);
+ ByteSizeConsistencyError(byte_size, ByteSize(), end - start, *this);
}
return true;
}