Permalink
Browse files

Apply THRIFT-993's patch from Rich Salz (reverting the oneway caching):

(THRIFT-993) Some improvements in C++ stubs for oneway operations



git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1064303 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 03ec1e4 commit b547141797f17159fdb61abfb22e817b121fde8f Christian Lavoie committed Jan 27, 2011
Showing with 11 additions and 12 deletions.
  1. +11 −12 compiler/cpp/src/generate/t_cpp_generator.cc
View
23 compiler/cpp/src/generate/t_cpp_generator.cc
@@ -2794,8 +2794,11 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
}
out <<
"void " << tservice->get_name() << "Processor" << class_suffix << "::" <<
- "process_" << tfunction->get_name() << "(int32_t seqid, " <<
- prot_type << "* iprot, " << prot_type << "* oprot, void* callContext)" << endl;
+ "process_" << tfunction->get_name() << "(" <<
+ "int32_t" << (tfunction->is_oneway() ? ", " : " seqid, ") <<
+ prot_type << "* iprot, " <<
+ prot_type << "*" << (tfunction->is_oneway() ? ", " : " oprot, ")
+ << "void* callContext)" << endl;
scope_up(out);
if (gen_templates_ && !specialized) {
@@ -2882,16 +2885,12 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
if (!tfunction->is_oneway()) {
for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
out << " catch (" << type_name((*x_iter)->get_type()) << " &" << (*x_iter)->get_name() << ") {" << endl;
- if (!tfunction->is_oneway()) {
- indent_up();
- out <<
- indent() << "result." << (*x_iter)->get_name() << " = " << (*x_iter)->get_name() << ";" << endl <<
- indent() << "result.__isset." << (*x_iter)->get_name() << " = true;" << endl;
- indent_down();
- out << indent() << "}";
- } else {
- out << "}";
- }
+ indent_up();
+ out <<
+ indent() << "result." << (*x_iter)->get_name() << " = " << (*x_iter)->get_name() << ";" << endl <<
+ indent() << "result.__isset." << (*x_iter)->get_name() << " = true;" << endl;
+ indent_down();
+ out << indent() << "}";
}
}

0 comments on commit b547141

Please sign in to comment.