From be14bf2b78c5b77b1c2ebe5053a11f532df4087d Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Wed, 12 Sep 2018 23:55:07 -0400 Subject: [PATCH] Fix compile error in generated_message_util.cc --- src/google/protobuf/generated_message_util.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/google/protobuf/generated_message_util.cc b/src/google/protobuf/generated_message_util.cc index ba8ec6d423..32afb7dba5 100644 --- a/src/google/protobuf/generated_message_util.cc +++ b/src/google/protobuf/generated_message_util.cc @@ -620,6 +620,7 @@ bool IsNull(const void* ptr) { void SerializeInternal(const uint8* base, const FieldMetadata* field_metadata_table, int32 num_fields, io::CodedOutputStream* output) { + SpecialSerializer func = nullptr; for (int i = 0; i < num_fields; i++) { const FieldMetadata& field_metadata = field_metadata_table[i]; const uint8* ptr = base + field_metadata.offset; @@ -646,9 +647,9 @@ void SerializeInternal(const uint8* base, // Special cases case FieldMetadata::kSpecial: - reinterpret_cast( - const_cast(field_metadata.ptr))( - base, field_metadata.offset, field_metadata.tag, + func = reinterpret_cast( + const_cast(field_metadata.ptr)); + func (base, field_metadata.offset, field_metadata.tag, field_metadata.has_offset, output); break; default: @@ -664,6 +665,7 @@ uint8* SerializeInternalToArray(const uint8* base, uint8* buffer) { ArrayOutput array_output = {buffer, is_deterministic}; ArrayOutput* output = &array_output; + SpecialSerializer func = nullptr; for (int i = 0; i < num_fields; i++) { const FieldMetadata& field_metadata = field_metadata_table[i]; const uint8* ptr = base + field_metadata.offset; @@ -692,9 +694,9 @@ uint8* SerializeInternalToArray(const uint8* base, io::ArrayOutputStream array_stream(array_output.ptr, INT_MAX); io::CodedOutputStream output(&array_stream); output.SetSerializationDeterministic(is_deterministic); - reinterpret_cast( - const_cast(field_metadata.ptr))( - base, field_metadata.offset, field_metadata.tag, + func = reinterpret_cast( + const_cast(field_metadata.ptr)); + func (base, field_metadata.offset, field_metadata.tag, field_metadata.has_offset, &output); array_output.ptr += output.ByteCount(); } break;