mirror of
https://github.com/protobuf-c/protobuf-c.git
synced 2024-12-27 13:31:02 +08:00
protoc-c: don't use FullName helpers for non-full names
FullName* methods are designed to split a full name based on '.' in the name. name() does not have '.' separators, so call CamelToLower and CamelToUpper in place of FullNameToLower and FullNameToUpper.
This commit is contained in:
parent
1b4e45e445
commit
4f39ca6e0c
@ -119,7 +119,7 @@ void FieldGenerator::GenerateDescriptorInitializerGeneric(io::Printer* printer,
|
||||
variables["descriptor_addr"] = descriptor_addr;
|
||||
variables["value"] = SimpleItoa(descriptor_->number());
|
||||
if (oneof != NULL)
|
||||
variables["oneofname"] = FullNameToLower(oneof->name());
|
||||
variables["oneofname"] = CamelToLower(oneof->name());
|
||||
|
||||
if (FieldSyntax(descriptor_) == 3 &&
|
||||
descriptor_->label() == FieldDescriptor::LABEL_OPTIONAL) {
|
||||
|
@ -153,7 +153,7 @@ GenerateStructDefinition(io::Printer* printer) {
|
||||
const OneofDescriptor *oneof = descriptor_->oneof_decl(i);
|
||||
vars["opt_comma"] = ",";
|
||||
|
||||
vars["oneofname"] = FullNameToUpper(oneof->name());
|
||||
vars["oneofname"] = CamelToUpper(oneof->name());
|
||||
vars["foneofname"] = FullNameToC(oneof->full_name());
|
||||
|
||||
printer->Print("typedef enum {\n");
|
||||
@ -161,7 +161,7 @@ GenerateStructDefinition(io::Printer* printer) {
|
||||
printer->Print(vars, "$ucclassname$__$oneofname$__NOT_SET = 0,\n");
|
||||
for (int j = 0; j < oneof->field_count(); j++) {
|
||||
const FieldDescriptor *field = oneof->field(j);
|
||||
vars["fieldname"] = FullNameToUpper(field->name());
|
||||
vars["fieldname"] = CamelToUpper(field->name());
|
||||
vars["fieldnum"] = SimpleItoa(field->number());
|
||||
bool isLast = j == oneof->field_count() - 1;
|
||||
if (isLast) {
|
||||
@ -204,7 +204,7 @@ GenerateStructDefinition(io::Printer* printer) {
|
||||
// Generate unions from oneofs.
|
||||
for (int i = 0; i < descriptor_->oneof_decl_count(); i++) {
|
||||
const OneofDescriptor *oneof = descriptor_->oneof_decl(i);
|
||||
vars["oneofname"] = FullNameToLower(oneof->name());
|
||||
vars["oneofname"] = CamelToLower(oneof->name());
|
||||
vars["foneofname"] = FullNameToC(oneof->full_name());
|
||||
|
||||
printer->Print(vars, "$foneofname$Case $oneofname$_case;\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user