You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by be...@apache.org on 2013/09/23 18:56:14 UTC
git commit: THRIFT-2201: Ternary operator returns different types
(build error for some compilers) Client: java compiler,
ruby compiler Patch: Randy Abernathy
Updated Branches:
refs/heads/master 376d817ab -> 836d95f9f
THRIFT-2201: Ternary operator returns different types (build error for
some compilers)
Client: java compiler, ruby compiler
Patch: Randy Abernathy
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/836d95f9
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/836d95f9
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/836d95f9
Branch: refs/heads/master
Commit: 836d95f9f00be73c6936d407977796181d1a506c
Parents: 376d817
Author: Ben Craig <be...@apache.org>
Authored: Mon Sep 23 11:53:47 2013 -0500
Committer: Ben Craig <be...@apache.org>
Committed: Mon Sep 23 11:53:47 2013 -0500
----------------------------------------------------------------------
compiler/cpp/src/generate/t_java_generator.cc | 3 +--
compiler/cpp/src/generate/t_rb_generator.cc | 6 ++----
2 files changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/836d95f9/compiler/cpp/src/generate/t_java_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc
index e443dc0..ec9e1fc 100644
--- a/compiler/cpp/src/generate/t_java_generator.cc
+++ b/compiler/cpp/src/generate/t_java_generator.cc
@@ -2824,10 +2824,9 @@ void t_java_generator::generate_process_async_function(t_service* tservice,
t_struct* xs = tfunction->get_xceptions();
const std::vector<t_field*>& xceptions = xs->get_members();
vector<t_field*>::const_iterator x_iter;
- bool first = true;
if (xceptions.size() > 0) {
for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
- first ? first = false : indent(f_service_) << "else ";
+ if (x_iter != xceptions.begin()) indent(f_service_) << "else ";
indent(f_service_) << "if (e instanceof " << type_name((*x_iter)->get_type(), false, false)<<") {" << endl;
indent(f_service_) << indent() << "result." << (*x_iter)->get_name() << " = (" << type_name((*x_iter)->get_type(), false, false) << ") e;" << endl;
indent(f_service_) << indent() << "result.set" << get_cap_name((*x_iter)->get_name()) << get_cap_name("isSet") << "(true);" << endl;
http://git-wip-us.apache.org/repos/asf/thrift/blob/836d95f9/compiler/cpp/src/generate/t_rb_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_rb_generator.cc b/compiler/cpp/src/generate/t_rb_generator.cc
index 082f316..2a6a472 100644
--- a/compiler/cpp/src/generate/t_rb_generator.cc
+++ b/compiler/cpp/src/generate/t_rb_generator.cc
@@ -359,21 +359,19 @@ void t_rb_generator::generate_enum(t_enum* tenum) {
// Create a hash mapping values back to their names (as strings) since ruby has no native enum type
f_types_.indent() << "VALUE_MAP = {";
- bool first = true;
for(c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
// Populate the hash
int value = (*c_iter)->get_value();
- first ? first = false : f_types_ << ", ";
+ if (c_iter != constants.begin()) f_types_ << ", ";
f_types_ << value << " => \"" << capitalize((*c_iter)->get_name()) << "\"";
}
f_types_ << "}" << endl;
// Create a set with valid values for this enum
f_types_.indent() << "VALID_VALUES = Set.new([";
- first = true;
for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
// Populate the set
- first ? first = false : f_types_ << ", ";
+ if (c_iter != constants.begin()) f_types_ << ", ";
f_types_ << capitalize((*c_iter)->get_name());
}
f_types_ << "]).freeze" << endl;