aboutsummaryrefslogtreecommitdiff
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
commit74959d4796b12d419bb86de781a2a6e6d6e8ce24 (patch)
tree515c4bc8952791c93cae314082155460e6c184e8 /src
parente005be6554108ab24ed0059b15c459a6c6e9b66c (diff)
downloadprotobuf-74959d4796b12d419bb86de781a2a6e6d6e8ce24.tar.gz
protobuf-74959d4796b12d419bb86de781a2a6e6d6e8ce24.tar.bz2
protobuf-74959d4796b12d419bb86de781a2a6e6d6e8ce24.zip
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 9898aaf2..e044e890 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) {