There was some incorrect else if logic added to the CPP generated code, which this patch replaces with the proper functionality.
Patch: Thomas Wiggins
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@
1292508 13f79535-47bb-0310-9956-
ffa450edef68
indent(out) <<
"xfer += oprot->writeStructBegin(\"" << name << "\");" << endl;
- bool first = true;
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
bool check_if_set = (*f_iter)->get_req() == t_field::T_OPTIONAL ||
(*f_iter)->get_type()->is_xception();
if (check_if_set) {
- if (first) {
- first = false;
- out <<
- endl <<
- indent() << "if ";
- } else {
- out <<
- " else if ";
- }
- out << "(this->__isset." << (*f_iter)->get_name() << ") {" << endl;
+ out << endl << indent() << "if (this->__isset." << (*f_iter)->get_name() << ") {" << endl;
indent_up();
} else {
- if (!first)
- out << endl;
- first = true;
+ out << endl;
}
// Write field header
}
}
- if (!first) {
- out << endl;
- }
+ out << endl;
// Write the struct map
out <<