diff options
Diffstat (limited to 'src/google/protobuf/wire_format.cc')
-rw-r--r-- | src/google/protobuf/wire_format.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/google/protobuf/wire_format.cc b/src/google/protobuf/wire_format.cc index 219d1f27..99ea619b 100644 --- a/src/google/protobuf/wire_format.cc +++ b/src/google/protobuf/wire_format.cc @@ -648,8 +648,7 @@ bool WireFormat::SerializeFieldWithCachedSizes( // Handle strings separately so that we can get string references // instead of copying. - case FieldDescriptor::TYPE_STRING: - case FieldDescriptor::TYPE_BYTES: { + case FieldDescriptor::TYPE_STRING: { string scratch; const string& value = field->is_repeated() ? message_reflection->GetRepeatedStringReference( @@ -658,6 +657,16 @@ bool WireFormat::SerializeFieldWithCachedSizes( if (!WriteString(field->number(), value, output)) return false; break; } + + case FieldDescriptor::TYPE_BYTES: { + string scratch; + const string& value = field->is_repeated() ? + message_reflection->GetRepeatedStringReference( + message, field, j, &scratch) : + message_reflection->GetStringReference(message, field, &scratch); + if (!WriteBytes(field->number(), value, output)) return false; + break; + } } } |