diff options
| author | Shauren <shauren.trinity@gmail.com> | 2017-01-19 17:36:30 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2017-01-19 17:36:30 +0100 |
| commit | cdbe140f91d62447c060744b5de58f4d010f93ce (patch) | |
| tree | dc591b68786aa328699799fe86ff91c93fb11cdb /contrib/protoc-bnet/google/protobuf/compiler | |
| parent | eccbbe304ca277ec86dc16f3fe9b1c746748cba1 (diff) | |
Contrib: Fix protoc-bnet generator to initialize all fields in the constructor
Diffstat (limited to 'contrib/protoc-bnet/google/protobuf/compiler')
| -rw-r--r-- | contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_enum_field.cc | 4 | ||||
| -rw-r--r-- | contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_primitive_field.cc | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_enum_field.cc b/contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_enum_field.cc index 72f363bb378..ea15fd74744 100644 --- a/contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_enum_field.cc +++ b/contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_enum_field.cc @@ -285,7 +285,9 @@ GenerateSwappingCode(io::Printer* printer) const { void RepeatedEnumFieldGenerator:: GenerateConstructorCode(io::Printer* printer) const { - // Not needed for repeated fields. + if (descriptor_->options().packed()) { + printer->Print(variables_, "_$name$_cached_byte_size_ = 0;\n"); + } } void RepeatedEnumFieldGenerator:: diff --git a/contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_primitive_field.cc index f9f13cee742..244a7f178d9 100644 --- a/contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_primitive_field.cc +++ b/contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_primitive_field.cc @@ -335,7 +335,9 @@ GenerateSwappingCode(io::Printer* printer) const { void RepeatedPrimitiveFieldGenerator:: GenerateConstructorCode(io::Printer* printer) const { - // Not needed for repeated fields. + if (descriptor_->options().packed()) { + printer->Print(variables_, "_$name$_cached_byte_size_ = 0;\n"); + } } void RepeatedPrimitiveFieldGenerator:: |
