Contrib: Fix protoc-bnet generator to initialize all fields in the constructor

This commit is contained in:
Shauren
2017-01-19 17:36:30 +01:00
parent eccbbe304c
commit cdbe140f91
3 changed files with 7 additions and 3 deletions

View File

@@ -174,7 +174,7 @@ void BnetFileGenerator::GenerateHeader(pb::io::Printer* printer)
printer->Print("#include <type_traits>\n");
}
else
printer->Print("#include \"Define.h\" // for TC_SHARED_API\n");
printer->Print("#include \"Define.h\" // for TC_PROTO_API\n");
printer->Print("// @@protoc_insertion_point(includes)\n");

View File

@@ -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::

View File

@@ -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::