aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Cai <maxtroy@google.com>2014-01-16 12:04:21 +0000
committerMax Cai <maxtroy@google.com>2014-01-16 12:41:26 +0000
commitf4523ddb8a4e6f1008bfec2ee9e39629be792639 (patch)
treecaafb95d8d88c96d22422fac3b878254e5e7eeb7 /src
parentd888895a3b5cf764856d3a94ed526bf9994c1800 (diff)
downloadexternal_protobuf-f4523ddb8a4e6f1008bfec2ee9e39629be792639.zip
external_protobuf-f4523ddb8a4e6f1008bfec2ee9e39629be792639.tar.gz
external_protobuf-f4523ddb8a4e6f1008bfec2ee9e39629be792639.tar.bz2
Fix repeated packed field merging code for non-packed data.
Enum fix is already included in the previous commit. Bug: https://code.google.com/p/android/issues/detail?id=64893 Change-Id: I9fecff3c8822918a019028eb57fa39b361a2c960
Diffstat (limited to 'src')
-rw-r--r--src/google/protobuf/compiler/javanano/javanano_primitive_field.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc b/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc
index 9898aaf..e044e89 100644
--- a/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc
@@ -261,6 +261,9 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, const Params param
(*variables)["tag"] = SimpleItoa(WireFormat::MakeTag(descriptor));
(*variables)["tag_size"] = SimpleItoa(
WireFormat::TagSize(descriptor->number(), descriptor->type()));
+ (*variables)["non_packed_tag"] = SimpleItoa(
+ internal::WireFormatLite::MakeTag(descriptor->number(),
+ internal::WireFormat::WireTypeForFieldType(descriptor->type())));
int fixed_size = FixedSize(descriptor->type());
if (fixed_size != -1) {
(*variables)["fixed_size"] = SimpleItoa(fixed_size);
@@ -748,7 +751,7 @@ GenerateMergingCode(io::Printer* printer) const {
// First, figure out the length of the array, then parse.
printer->Print(variables_,
"int arrayLength = com.google.protobuf.nano.WireFormatNano\n"
- " .getRepeatedFieldArrayLength(input, $tag$);\n"
+ " .getRepeatedFieldArrayLength(input, $non_packed_tag$);\n"
"int i = this.$name$ == null ? 0 : this.$name$.length;\n");
if (GetJavaType(descriptor_) == JAVATYPE_BYTES) {