diff options
author | zeshuai007 <51382517@qq.com> | 2020-06-03 17:24:38 +0800 |
---|---|---|
committer | Jens Geyer <jensg@apache.org> | 2020-06-14 14:17:11 +0200 |
commit | 26681fbdb77f6dfaf2f2613d4ad860a224e84b71 (patch) | |
tree | b742ea0959bd5e90e1748323a870291ef8ad8e9f | |
parent | 3f78c70bbba82c733b1545d39eb5b489ac384e4c (diff) | |
download | thrift-26681fbdb77f6dfaf2f2613d4ad860a224e84b71.tar.gz |
THRIFT-5225: Use nullptr instead of NULL
Patch: Zezeng Wang
This closes #2168
73 files changed, 511 insertions, 511 deletions
diff --git a/compiler/cpp/src/thrift/generate/t_as3_generator.cc b/compiler/cpp/src/thrift/generate/t_as3_generator.cc index dd4d166ca..fa2967be9 100644 --- a/compiler/cpp/src/thrift/generate/t_as3_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_as3_generator.cc @@ -286,7 +286,7 @@ string t_as3_generator::as3_thrift_gen_imports(t_struct* tstruct, string& import // For each type check if it is from a differnet namespace for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { t_program* program = (*m_iter)->get_type()->get_program(); - if (program != NULL && program != program_) { + if (program != nullptr && program != program_) { string package = program->get_namespace("as3"); if (!package.empty()) { if (imports.find(package + "." + (*m_iter)->get_type()->get_name()) == string::npos) { @@ -311,7 +311,7 @@ string t_as3_generator::as3_thrift_gen_imports(t_service* tservice) { // For each type check if it is from a differnet namespace for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { t_program* program = (*f_iter)->get_returntype()->get_program(); - if (program != NULL && program != program_) { + if (program != nullptr && program != program_) { string package = program->get_namespace("as3"); if (!package.empty()) { if (imports.find(package + "." + (*f_iter)->get_returntype()->get_name()) == string::npos) { @@ -482,13 +482,13 @@ void t_as3_generator::print_const_value(std::ostream& out, indent_up(); } for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } string val = render_const_value(out, name, field_type, v_iter->second); @@ -753,7 +753,7 @@ void t_as3_generator::generate_as3_struct_definition(ostream& out, indent(out) << "public function " << tstruct->get_name() << "() {" << endl; indent_up(); for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { - if ((*m_iter)->get_value() != NULL) { + if ((*m_iter)->get_value() != nullptr) { indent(out) << "this._" << (*m_iter)->get_name() << " = " << (*m_iter)->get_value()->get_integer() << ";" << endl; } @@ -1432,7 +1432,7 @@ void t_as3_generator::generate_service(t_service* tservice) { f_service_ << endl << as3_type_imports() << as3_thrift_imports() << as3_thrift_gen_imports(tservice); - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { t_type* parent = tservice->get_extends(); string parent_namespace = parent->get_program()->get_namespace("as3"); if (!parent_namespace.empty() && parent_namespace != package_name_) { @@ -1458,7 +1458,7 @@ void t_as3_generator::generate_service(t_service* tservice) { f_service_ << endl << as3_type_imports() << as3_thrift_imports() << as3_thrift_gen_imports(tservice); - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { t_type* parent = tservice->get_extends(); string parent_namespace = parent->get_program()->get_namespace("as3"); if (!parent_namespace.empty() && parent_namespace != package_name_) { @@ -1515,7 +1515,7 @@ void t_as3_generator::generate_service(t_service* tservice) { */ void t_as3_generator::generate_service_interface(t_service* tservice) { string extends_iface = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends_iface = " extends " + tservice->get_extends()->get_name(); } @@ -1566,7 +1566,7 @@ void t_as3_generator::generate_service_helpers(t_service* tservice) { void t_as3_generator::generate_service_client(t_service* tservice) { string extends = ""; string extends_client = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = tservice->get_extends()->get_name(); extends_client = " extends " + extends + "Impl"; } @@ -1729,7 +1729,7 @@ void t_as3_generator::generate_service_server(t_service* tservice) { // Extends stuff string extends = ""; string extends_processor = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); extends_processor = " extends " + extends + "Processor"; } @@ -1765,7 +1765,7 @@ void t_as3_generator::generate_service_server(t_service* tservice) { // Generate the server implementation string override = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { override = "override "; } indent(f_service_) << override @@ -2335,7 +2335,7 @@ string t_as3_generator::type_name(t_type* ttype, bool in_container, bool in_init // Check for namespacing t_program* program = ttype->get_program(); - if (program != NULL && program != program_) { + if (program != nullptr && program != program_) { string package = program->get_namespace("as3"); if (!package.empty()) { return package + "." + ttype->get_name(); @@ -2389,7 +2389,7 @@ string t_as3_generator::declare_field(t_field* tfield, bool init) { string result = "var " + tfield->get_name() + ":" + type_name(tfield->get_type()); if (init) { t_type* ttype = get_true_type(tfield->get_type()); - if (ttype->is_base_type() && tfield->get_value() != NULL) { + if (ttype->is_base_type() && tfield->get_value() != nullptr) { std::ofstream dummy; result += " = " + render_const_value(dummy, tfield->get_name(), ttype, tfield->get_value()); } else if (ttype->is_base_type()) { @@ -2580,7 +2580,7 @@ void t_as3_generator::generate_isset_set(ostream& out, t_field* field) { std::string t_as3_generator::get_enum_class_name(t_type* type) { string package = ""; t_program* program = type->get_program(); - if (program != NULL && program != program_) { + if (program != nullptr && program != program_) { package = program->get_namespace("as3") + "."; } return package + type->get_name(); diff --git a/compiler/cpp/src/thrift/generate/t_c_glib_generator.cc b/compiler/cpp/src/thrift/generate/t_c_glib_generator.cc index f1531cc83..098cdb4af 100644 --- a/compiler/cpp/src/thrift/generate/t_c_glib_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_c_glib_generator.cc @@ -471,7 +471,7 @@ void t_c_glib_generator::generate_service(t_service* tservice) { // if we are inheriting from another service, include its header t_service* extends_service = tservice->get_extends(); - if (extends_service != NULL) { + if (extends_service != nullptr) { f_header_ << "#include \"" << this->nspace_lc << to_lower_case(initial_caps_to_underscores(extends_service->get_name())) << ".h\"" << endl; @@ -1012,7 +1012,7 @@ void t_c_glib_generator::generate_const_initializer(string name, // initialize any constants that may be referenced by this initializer for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; string field_name = ""; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { @@ -1022,7 +1022,7 @@ void t_c_glib_generator::generate_const_initializer(string name, break; } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } @@ -1054,7 +1054,7 @@ void t_c_glib_generator::generate_const_initializer(string name, scope_down(f_types_impl_); for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; string field_name = ""; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { @@ -1064,7 +1064,7 @@ void t_c_glib_generator::generate_const_initializer(string name, break; } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } @@ -1171,7 +1171,7 @@ void t_c_glib_generator::generate_const_initializer(string name, << indent() << "if (constant == NULL)" << endl; scope_up(f_types_impl_); f_types_impl_ << initializers.str() << endl - << indent() << "constant = " << generate_new_hash_from_type(etype, NULL) << endl + << indent() << "constant = " << generate_new_hash_from_type(etype, nullptr) << endl << appenders.str(); scope_down(f_types_impl_); f_types_impl_ << indent() << "return constant;" << endl; @@ -1273,7 +1273,7 @@ void t_c_glib_generator::generate_service_client(t_service* tservice) { string parent_class_name = "GObject"; string parent_type_name = "G_TYPE_OBJECT"; - // The service this service extends, or NULL if it extends no + // The service this service extends, or nullptr if it extends no // service t_service* extends_service = tservice->get_extends(); if (extends_service) { @@ -1851,7 +1851,7 @@ void t_c_glib_generator::generate_service_handler(t_service* tservice) { string args_indent; - // The service this service extends, or NULL if it extends no service + // The service this service extends, or nullptr if it extends no service t_service* extends_service = tservice->get_extends(); // Determine the name of our parent service (if any) and the handler class' @@ -2081,7 +2081,7 @@ void t_c_glib_generator::generate_service_processor(t_service* tservice) { string function_name; string args_indent; - // The service this service extends, or NULL if it extends no service + // The service this service extends, or nullptr if it extends no service t_service* extends_service = tservice->get_extends(); // Determine the name of our parent service (if any) and the @@ -3096,7 +3096,7 @@ void t_c_glib_generator::generate_object(t_struct* tstruct) { t_field* member = *m_iter; t_const_value* member_value = member->get_value(); - if (member_value != NULL) { + if (member_value != nullptr) { string member_name = member->get_name(); t_type* member_type = get_true_type(member->get_type()); @@ -3145,7 +3145,7 @@ void t_c_glib_generator::generate_object(t_struct* tstruct) { dval += "(" + type_name(t) + ")"; } t_const_value* cv = (*m_iter)->get_value(); - if (cv != NULL) { + if (cv != nullptr) { dval += constant_value("", t, cv); } else { dval += t->is_string() ? "NULL" : "0"; @@ -3167,7 +3167,7 @@ void t_c_glib_generator::generate_object(t_struct* tstruct) { } else if (t->is_container()) { string name = (*m_iter)->get_name(); string init_function; - t_type* etype = NULL; + t_type* etype = nullptr; if (t->is_map()) { t_type* key = ((t_map*)t)->get_key_type(); @@ -3175,7 +3175,7 @@ void t_c_glib_generator::generate_object(t_struct* tstruct) { init_function = generate_new_hash_from_type(key, value); } else if (t->is_set()) { etype = ((t_set*)t)->get_elem_type(); - init_function = generate_new_hash_from_type(etype, NULL); + init_function = generate_new_hash_from_type(etype, nullptr); } else if (t->is_list()) { etype = ((t_list*)t)->get_elem_type(); init_function = generate_new_array_from_type(etype); @@ -3412,7 +3412,7 @@ void t_c_glib_generator::generate_object(t_struct* tstruct) { break; } - if (member_value != NULL) { + if (member_value != nullptr) { default_value << (base_type == t_base_type::TYPE_DOUBLE ? member_value->get_double() : member_value->get_integer()); } else { @@ -3431,8 +3431,8 @@ void t_c_glib_generator::generate_object(t_struct* tstruct) { } else if (member_type->is_enum()) { t_enum_value* enum_min_value = ((t_enum*)member_type)->get_min_value(); t_enum_value* enum_max_value = ((t_enum*)member_type)->get_max_value(); - int min_value = (enum_min_value != NULL) ? enum_min_value->get_value() : 0; - int max_value = (enum_max_value != NULL) ? enum_max_value->get_value() : 0; + int min_value = (enum_min_value != nullptr) ? enum_min_value->get_value() : 0; + int max_value = (enum_max_value != nullptr) ? enum_max_value->get_value() : 0; args_indent += string(18, ' '); f_types_impl_ << "g_param_spec_int (\"" << member_name << "\"," << endl << args_indent @@ -4338,7 +4338,7 @@ void t_c_glib_generator::generate_deserialize_list_element(ostream& out, } string t_c_glib_generator::generate_free_func_from_type(t_type* ttype) { - if (ttype == NULL) + if (ttype == nullptr) return "NULL"; if (ttype->is_base_type()) { @@ -4404,7 +4404,7 @@ string t_c_glib_generator::generate_free_func_from_type(t_type* ttype) { } string t_c_glib_generator::generate_hash_func_from_type(t_type* ttype) { - if (ttype == NULL) + if (ttype == nullptr) return "NULL"; if (ttype->is_base_type()) { @@ -4442,7 +4442,7 @@ string t_c_glib_generator::generate_hash_func_from_type(t_type* ttype) { } string t_c_glib_generator::generate_cmp_func_from_type(t_type* ttype) { - if (ttype == NULL) + if (ttype == nullptr) return "NULL"; if (ttype->is_base_type()) { diff --git a/compiler/cpp/src/thrift/generate/t_cl_generator.cc b/compiler/cpp/src/thrift/generate/t_cl_generator.cc index ad7c0ef17..06b6b6563 100644 --- a/compiler/cpp/src/thrift/generate/t_cl_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_cl_generator.cc @@ -314,13 +314,13 @@ string t_cl_generator::render_const_value(t_type* type, t_const_value* value) { map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } @@ -396,7 +396,7 @@ void t_cl_generator::generate_cl_struct_internal(std::ostream& out, t_struct* ts out << endl << indent() << " "; } out << "(" << prefix((*m_iter)->get_name()) << " " << - ( (NULL != value) ? render_const_value(type, value) : "nil" ) << + ( (nullptr != value) ? render_const_value(type, value) : "nil" ) << " :id " << (*m_iter)->get_key(); if ( type->is_base_type() && "string" == typespec(type) ) if ( ((t_base_type*)type)->is_binary() ) @@ -441,7 +441,7 @@ void t_cl_generator::generate_service(t_service* tservice) { vector<t_function*> functions = tservice->get_functions(); vector<t_function*>::iterator f_iter; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends_client = type_name(tservice->get_extends()); } @@ -540,7 +540,7 @@ string t_cl_generator::type_name(t_type* ttype) { string prefix = ""; t_program* program = ttype->get_program(); - if (program != NULL && program != program_) + if (program != nullptr && program != program_) prefix = package_of(program) == package() ? "" : package_of(program) + ":"; string name = ttype->get_name(); diff --git a/compiler/cpp/src/thrift/generate/t_cpp_generator.cc b/compiler/cpp/src/thrift/generate/t_cpp_generator.cc index b657038d5..ceaa11f21 100644 --- a/compiler/cpp/src/thrift/generate/t_cpp_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_cpp_generator.cc @@ -606,7 +606,7 @@ void t_cpp_generator::generate_enum(t_enum* tenum) { << "_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(" << constants.size() << ", _k" << tenum->get_name() << "Values" << ", _k" << tenum->get_name() << "Names), " - << "::apache::thrift::TEnumIterator(-1, NULL, NULL));" << endl << endl; + << "::apache::thrift::TEnumIterator(-1, nullptr, nullptr));" << endl << endl; generate_enum_ostream_operator_decl(f_types_, tenum); generate_enum_ostream_operator(f_types_impl_, tenum); @@ -781,7 +781,7 @@ void t_cpp_generator::print_const_value(ostream& out, map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter; bool is_nonrequired_field = false; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; is_nonrequired_field = false; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { @@ -789,7 +789,7 @@ void t_cpp_generator::print_const_value(ostream& out, is_nonrequired_field = (*f_iter)->get_req() != t_field::T_REQUIRED; } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } string val = render_const_value(out, name, field_type, v_iter->second); @@ -1081,7 +1081,7 @@ void t_cpp_generator::generate_struct_declaration(ostream& out, if ((*m_iter)->get_req() == t_field::T_REQUIRED) { continue; } - string isSet = ((*m_iter)->get_value() != NULL) ? "true" : "false"; + string isSet = ((*m_iter)->get_value() != nullptr) ? "true" : "false"; if (first) { first = false; out << ": " << (*m_iter)->get_name() << "(" << isSet << ")"; @@ -1142,7 +1142,7 @@ void t_cpp_generator::generate_struct_declaration(ostream& out, } dval += (t->is_string() || is_reference(*m_iter)) ? "" : "0"; t_const_value* cv = (*m_iter)->get_value(); - if (cv != NULL) { + if (cv != nullptr) { dval = render_const_value(out, (*m_iter)->get_name(), t, cv); } if (!init_ctor) { @@ -1163,7 +1163,7 @@ void t_cpp_generator::generate_struct_declaration(ostream& out, if (!t->is_base_type()) { t_const_value* cv = (*m_iter)->get_value(); - if (cv != NULL) { + if (cv != nullptr) { print_const_value(out, (*m_iter)->get_name(), t, cv); } } @@ -1264,7 +1264,7 @@ void t_cpp_generator::generate_struct_declaration(ostream& out, if (is_user_struct && !has_custom_ostream(tstruct)) { out << indent() << "virtual "; - generate_struct_print_method_decl(out, NULL); + generate_struct_print_method_decl(out, nullptr); out << ";" << endl; } @@ -1830,7 +1830,7 @@ void t_cpp_generator::generate_service(t_service* tservice) { << endl; t_service* extends_service = tservice->get_extends(); - if (extends_service != NULL) { + if (extends_service != nullptr) { f_header_ << "#include \"" << get_include_prefix(*(extends_service->get_program())) << extends_service->get_name() << ".h\"" << endl; } @@ -1977,7 +1977,7 @@ void t_cpp_generator::generate_service_interface(t_service* tservice, string sty } string extends = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = " : virtual public " + type_name(tservice->get_extends()) + style + "If"; if (style == "CobCl" && gen_templates_) { // TODO(simpkins): If gen_templates_ is enabled, we currently assume all @@ -2042,7 +2042,7 @@ void t_cpp_generator::generate_service_interface_factory(t_service* tservice, st // type. Implementations can use dynamic_cast to cast the pointer to the // subclass type if desired. t_service* base_service = tservice; - while (base_service->get_extends() != NULL) { + while (base_service->get_extends() != nullptr) { base_service = base_service->get_extends(); } string base_if_name = type_name(base_service) + style + "If"; @@ -2050,7 +2050,7 @@ void t_cpp_generator::generate_service_interface_factory(t_service* tservice, st // Generate the abstract factory class string factory_name = service_if_name + "Factory"; string extends; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = " : virtual public " + type_name(tservice->get_extends()) + style + "IfFactory"; } @@ -2092,7 +2092,7 @@ void t_cpp_generator::generate_service_interface_factory(t_service* tservice, st */ void t_cpp_generator::generate_service_null(t_service* tservice, string style) { string extends = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = " , virtual public " + type_name(tservice->get_extends()) + style + "Null"; } f_header_ << "class " << service_name_ << style << "Null : virtual public " << service_name_ @@ -2278,7 +2278,7 @@ void t_cpp_generator::generate_service_multiface(t_service* tservice) { string extends = ""; string extends_multiface = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); extends_multiface = ", public " + extends + "Multiface"; } @@ -2399,7 +2399,7 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style) string extends = ""; string extends_client = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { // TODO(simpkins): If gen_templates_ is enabled, we currently assume all // parent services were also generated with templates enabled. extends = type_name(tservice->get_extends()); @@ -3055,7 +3055,7 @@ ProcessorGenerator::ProcessorGenerator(t_cpp_generator* generator, factory_class_name_ += "T"; } - if (service_->get_extends() != NULL) { + if (service_->get_extends() != nullptr) { extends_ = type_name(service_->get_extends()) + pstyle_ + "Processor"; if (generator_->gen_templates_) { // TODO(simpkins): If gen_templates_ is enabled, we currently assume all @@ -3071,7 +3071,7 @@ void ProcessorGenerator::generate_class_definition() { vector<t_function*>::iterator f_iter; string parent_class; - if (service_->get_extends() != NULL) { + if (service_->get_extends() != nullptr) { parent_class = extends_; } else { if (style_ == "Cob") { @@ -3122,7 +3122,7 @@ void ProcessorGenerator::generate_class_definition() { << " ProcessFunctions(ProcessFunction g, " << "SpecializedProcessFunction s) :" << endl << indent() << " generic(g)," << endl << indent() << " specialized(s) {}" << endl << indent() - << " ProcessFunctions() : generic(NULL), specialized(NULL) " + << " ProcessFunctions() : generic(nullptr), specialized(nullptr) " << "{}" << endl << indent() << "};" << endl << indent() << "typedef std::map<std::string, ProcessFunctions> " << "ProcessMap;" << endl; @@ -3183,7 +3183,7 @@ void ProcessorGenerator::generate_class_definition() { if (generator_->gen_templates_) { f_header_ << "ProcessFunctions(" << endl; if (generator_->gen_templates_only_) { - indent(f_header_) << " NULL," << endl; + indent(f_header_) << " nullptr," << endl; } else { indent(f_header_) << " &" << class_name_ << "::process_" << (*f_iter)->get_name() << "," << endl; @@ -3445,18 +3445,18 @@ void t_cpp_generator::generate_process_function(t_service* tservice, out << indent() << "(void) seqid;" << endl << indent() << "(void) oprot;" << endl; } - out << indent() << "void* ctx = NULL;" << endl << indent() - << "if (this->eventHandler_.get() != NULL) {" << endl << indent() + out << indent() << "void* ctx = nullptr;" << endl << indent() + << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() << " ctx = this->eventHandler_->getContext(" << service_func_name << ", callContext);" << endl << indent() << "}" << endl << indent() << "::apache::thrift::TProcessorContextFreer freer(" << "this->eventHandler_.get(), ctx, " << service_func_name << ");" << endl << endl - << indent() << "if (this->eventHandler_.get() != NULL) {" << endl << indent() + << indent() << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() << " this->eventHandler_->preRead(ctx, " << service_func_name << ");" << endl << indent() << "}" << endl << endl << indent() << argsname << " args;" << endl << indent() << "args.read(iprot);" << endl << indent() << "iprot->readMessageEnd();" << endl << indent() << "uint32_t bytes = iprot->getTransport()->readEnd();" << endl << endl << indent() - << "if (this->eventHandler_.get() != NULL) {" << endl << indent() + << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() << " this->eventHandler_->postRead(ctx, " << service_func_name << ", bytes);" << endl << indent() << "}" << endl << endl; @@ -3524,7 +3524,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice, } indent_up(); - out << indent() << "if (this->eventHandler_.get() != NULL) {" << endl << indent() + out << indent() << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() << " this->eventHandler_->handlerError(ctx, " << service_func_name << ");" << endl << indent() << "}" << endl; @@ -3542,7 +3542,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice, // Shortcut out here for oneway functions if (tfunction->is_oneway()) { - out << indent() << "if (this->eventHandler_.get() != NULL) {" << endl << indent() + out << indent() << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() << " this->eventHandler_->asyncComplete(ctx, " << service_func_name << ");" << endl << indent() << "}" << endl << endl << indent() << "return;" << endl; indent_down(); @@ -3551,14 +3551,14 @@ void t_cpp_generator::generate_process_function(t_service* tservice, } // Serialize the result into a struct - out << indent() << "if (this->eventHandler_.get() != NULL) {" << endl << indent() + out << indent() << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() << " this->eventHandler_->preWrite(ctx, " << service_func_name << ");" << endl << indent() << "}" << endl << endl << indent() << "oprot->writeMessageBegin(\"" << tfunction->get_name() << "\", ::apache::thrift::protocol::T_REPLY, seqid);" << endl << indent() << "result.write(oprot);" << endl << indent() << "oprot->writeMessageEnd();" << endl << indent() << "bytes = oprot->getTransport()->writeEnd();" << endl << indent() << "oprot->getTransport()->flush();" << endl << endl << indent() - << "if (this->eventHandler_.get() != NULL) {" << endl << indent() + << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() << " this->eventHandler_->postWrite(ctx, " << service_func_name << ", bytes);" << endl << indent() << "}" << endl; @@ -3597,32 +3597,32 @@ void t_cpp_generator::generate_process_function(t_service* tservice, } out << indent() << tservice->get_name() + "_" + tfunction->get_name() << "_args args;" << endl - << indent() << "void* ctx = NULL;" << endl << indent() - << "if (this->eventHandler_.get() != NULL) {" << endl << indent() - << " ctx = this->eventHandler_->getContext(" << service_func_name << ", NULL);" << endl + << indent() << "void* ctx = nullptr;" << endl << indent() + << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() + << " ctx = this->eventHandler_->getContext(" << service_func_name << ", nullptr);" << endl << indent() << "}" << endl << indent() << "::apache::thrift::TProcessorContextFreer freer(" << "this->eventHandler_.get(), ctx, " << service_func_name << ");" << endl << endl << indent() << "try {" << endl; indent_up(); - out << indent() << "if (this->eventHandler_.get() != NULL) {" << endl << indent() + out << indent() << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() << " this->eventHandler_->preRead(ctx, " << service_func_name << ");" << endl << indent() << "}" << endl << indent() << "args.read(iprot);" << endl << indent() << "iprot->readMessageEnd();" << endl << indent() << "uint32_t bytes = iprot->getTransport()->readEnd();" << endl << indent() - << "if (this->eventHandler_.get() != NULL) {" << endl << indent() + << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() << " this->eventHandler_->postRead(ctx, " << service_func_name << ", bytes);" << endl << indent() << "}" << endl; scope_down(out); // TODO(dreiss): Handle TExceptions? Expose to server? out << indent() << "catch (const std::exception&) {" << endl << indent() - << " if (this->eventHandler_.get() != NULL) {" << endl << indent() + << " if (this->eventHandler_.get() != nullptr) {" << endl << indent() << " this->eventHandler_->handlerError(ctx, " << service_func_name << ");" << endl << indent() << " }" << endl << indent() << " return cob(false);" << endl << indent() << "}" << endl; if (tfunction->is_oneway()) { - out << indent() << "if (this->eventHandler_.get() != NULL) {" << endl << indent() + out << indent() << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() << " this->eventHandler_->asyncComplete(ctx, " << service_func_name << ");" << endl << indent() << "}" << endl; } @@ -3715,19 +3715,19 @@ void t_cpp_generator::generate_process_function(t_service* tservice, << "*>(&_return);" << endl << indent() << "result.__isset.success = true;" << endl; } // Serialize the result into a struct - out << endl << indent() << "if (this->eventHandler_.get() != NULL) {" << endl << indent() - << " ctx = this->eventHandler_->getContext(" << service_func_name << ", NULL);" << endl + out << endl << indent() << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() + << " ctx = this->eventHandler_->getContext(" << service_func_name << ", nullptr);" << endl << indent() << "}" << endl << indent() << "::apache::thrift::TProcessorContextFreer freer(" << "this->eventHandler_.get(), ctx, " << service_func_name << ");" << endl << endl - << indent() << "if (this->eventHandler_.get() != NULL) {" << endl << indent() + << indent() << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() << " this->eventHandler_->preWrite(ctx, " << service_func_name << ");" << endl << indent() << "}" << endl << endl << indent() << "oprot->writeMessageBegin(\"" << tfunction->get_name() << "\", ::apache::thrift::protocol::T_REPLY, seqid);" << endl << indent() << "result.write(oprot);" << endl << indent() << "oprot->writeMessageEnd();" << endl << indent() << "uint32_t bytes = oprot->getTransport()->writeEnd();" << endl << indent() << "oprot->getTransport()->flush();" << endl << indent() - << "if (this->eventHandler_.get() != NULL) {" << endl << indent() + << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() << " this->eventHandler_->postWrite(ctx, " << service_func_name << ", bytes);" << endl << indent() << "}" << endl << indent() << "return cob(true);" << endl; scope_down(out); @@ -3756,8 +3756,8 @@ void t_cpp_generator::generate_process_function(t_service* tservice, } // Get the event handler context - out << endl << indent() << "if (this->eventHandler_.get() != NULL) {" << endl << indent() - << " ctx = this->eventHandler_->getContext(" << service_func_name << ", NULL);" << endl + out << endl << indent() << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() + << " ctx = this->eventHandler_->getContext(" << service_func_name << ", nullptr);" << endl << indent() << "}" << endl << indent() << "::apache::thrift::TProcessorContextFreer freer(" << "this->eventHandler_.get(), ctx, " << service_func_name << ");" << endl << endl; @@ -3783,7 +3783,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice, // Handle the case where an undeclared exception is thrown out << " catch (std::exception& e) {" << endl; indent_up(); - out << indent() << "if (this->eventHandler_.get() != NULL) {" << endl << indent() + out << indent() << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() << " this->eventHandler_->handlerError(ctx, " << service_func_name << ");" << endl << indent() << "}" << endl << endl << indent() << "::apache::thrift::TApplicationException x(e.what());" << endl << indent() @@ -3799,14 +3799,14 @@ void t_cpp_generator::generate_process_function(t_service* tservice, scope_down(out); // Serialize the result into a struct - out << indent() << "if (this->eventHandler_.get() != NULL) {" << endl << indent() + out << indent() << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() << " this->eventHandler_->preWrite(ctx, " << service_func_name << ");" << endl << indent() << "}" << endl << endl << indent() << "oprot->writeMessageBegin(\"" << tfunction->get_name() << "\", ::apache::thrift::protocol::T_REPLY, seqid);" << endl << indent() << "result.write(oprot);" << endl << indent() << "oprot->writeMessageEnd();" << endl << indent() << "uint32_t bytes = oprot->getTransport()->writeEnd();" << endl << indent() << "oprot->getTransport()->flush();" << endl << indent() - << "if (this->eventHandler_.get() != NULL) {" << endl << indent() + << "if (this->eventHandler_.get() != nullptr) {" << endl << indent() << " this->eventHandler_->postWrite(ctx, " << service_func_name << ", bytes);" << endl << indent() << "}" << endl << indent() << "return cob(true);" << endl; scope_down(out); @@ -4389,7 +4389,7 @@ string t_cpp_generator::type_name(t_type* ttype, bool in_typedef, bool arg) { // Check if it needs to be namespaced string pname; t_program* program = ttype->get_program(); - if (program != NULL && program != program_) { + if (program != nullptr && program != program_) { pname = class_prefix + namespace_prefix(program->get_namespace("cpp")) + ttype->get_name(); } else { pname = class_prefix + ttype->get_name(); diff --git a/compiler/cpp/src/thrift/generate/t_d_generator.cc b/compiler/cpp/src/thrift/generate/t_d_generator.cc index 65f4b445e..afae5b53d 100644 --- a/compiler/cpp/src/thrift/generate/t_d_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_d_generator.cc @@ -219,7 +219,7 @@ protected: f_service << "import " << suffix_if_reserved(render_package(*get_program())) << program_name_ << "_types;" << endl; t_service* extends_service = tservice->get_extends(); - if (extends_service != NULL) { + if (extends_service != nullptr) { f_service << "import " << suffix_if_reserved(render_package(*(extends_service->get_program()))) << suffix_if_reserved(extends_service->get_name()) << ";" << endl; } @@ -227,7 +227,7 @@ protected: f_service << endl; string extends = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = " : " + suffix_if_reserved(render_type_name(tservice->get_extends())); } @@ -299,7 +299,7 @@ protected: meta << "TParamMeta(`" << suffix_if_reserved((*p_iter)->get_name()) << "`, " << (*p_iter)->get_key(); t_const_value* cv = (*p_iter)->get_value(); - if (cv != NULL) { + if (cv != nullptr) { meta << ", q{" << render_const_value((*p_iter)->get_type(), cv) << "}"; } meta << ")"; @@ -475,7 +475,7 @@ private: t_const_value* cv = (*m_iter)->get_value(); t_field::e_req req = (*m_iter)->get_req(); out << ", " << render_req(req); - if (cv != NULL) { + if (cv != nullptr) { out << ", q{" << render_const_value((*m_iter)->get_type(), cv) << "}"; } out << ")"; @@ -568,13 +568,13 @@ private: const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map(); map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "Type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } diff --git a/compiler/cpp/src/thrift/generate/t_dart_generator.cc b/compiler/cpp/src/thrift/generate/t_dart_generator.cc index fbbb9e6d3..65d0f535f 100644 --- a/compiler/cpp/src/thrift/generate/t_dart_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_dart_generator.cc @@ -599,13 +599,13 @@ void t_dart_generator::print_const_value(std::ostream& out, out << type_name(type) << " " << name << " = new " << type_name(type) << "()"; indent_up(); for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } string val = render_const_value(out, name, field_type, v_iter->second); @@ -827,7 +827,7 @@ void t_dart_generator::generate_dart_struct_definition(ostream& out, scope_up(out); for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { t_type* t = get_true_type((*m_iter)->get_type()); - if ((*m_iter)->get_value() != NULL) { + if ((*m_iter)->get_value() != nullptr) { print_const_value(out, "this." + get_member_name((*m_iter)->get_name()), t, @@ -1409,7 +1409,7 @@ void t_dart_generator::generate_service(t_service* tservice) { */ void t_dart_generator::generate_service_interface(t_service* tservice) { string extends_iface = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends_iface = " extends " + get_ttype_class_name(tservice->get_extends()); } @@ -1454,7 +1454,7 @@ void t_dart_generator::generate_service_helpers(t_service* tservice) { void t_dart_generator::generate_service_client(t_service* tservice) { string extends = ""; string extends_client = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = get_ttype_class_name(tservice->get_extends()); extends_client = " extends " + extends + "Client"; } @@ -1587,7 +1587,7 @@ void t_dart_generator::generate_service_server(t_service* tservice) { // Extends stuff string extends = ""; string extends_processor = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = get_ttype_class_name(tservice->get_extends()); extends_processor = " extends " + extends + "Processor"; } @@ -2193,7 +2193,7 @@ string t_dart_generator::declare_field(t_field* tfield, bool init) { string result = type_name(tfield->get_type()) + " " + field_name; if (init) { t_type* ttype = get_true_type(tfield->get_type()); - if (ttype->is_base_type() && tfield->get_value() != NULL) { + if (ttype->is_base_type() && tfield->get_value() != nullptr) { std:: ofstream dummy; result += " = " + render_const_value(dummy, field_name, ttype, tfield->get_value()); } else if (ttype->is_base_type()) { diff --git a/compiler/cpp/src/thrift/generate/t_delphi_generator.cc b/compiler/cpp/src/thrift/generate/t_delphi_generator.cc index e5bd81a88..604b50a13 100644 --- a/compiler/cpp/src/thrift/generate/t_delphi_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_delphi_generator.cc @@ -956,9 +956,9 @@ void t_delphi_generator::generate_typedef(t_typedef* ttypedef) { } bool t_delphi_generator::is_fully_defined_type(t_type* ttype) { - if ((NULL != ttype->get_program()) && (ttype->get_program() != program_)) { + if ((nullptr != ttype->get_program()) && (ttype->get_program() != program_)) { t_scope* scope = ttype->get_program()->scope(); - if (NULL != scope->get_type(ttype->get_name())) { + if (nullptr != scope->get_type(ttype->get_name())) { // printf("type %s found in included scope %s\n", ttype->get_name().c_str(), // ttype->get_program()->get_name().c_str()); return true; @@ -1230,13 +1230,13 @@ void t_delphi_generator::print_const_def_value(std::ostream& vars, const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map(); map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } string val = render_const_value(vars, out, name, field_type, v_iter->second); @@ -1466,7 +1466,7 @@ void t_delphi_generator::generate_delphi_struct_impl(ostream& out, while (t->is_typedef()) { t = ((t_typedef*)t)->get_type(); } - if ((*m_iter)->get_value() != NULL) { + if ((*m_iter)->get_value() != nullptr) { initialize_field(vars, code, "F" + prop_name((*m_iter)->get_name(), is_exception), @@ -1934,7 +1934,7 @@ void t_delphi_generator::generate_service_interface(t_service* tservice, bool fo indent_up(); generate_delphi_doc(s_service, tservice); - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends(), true, true); extends_iface = extends + "." + iface_name; generate_delphi_doc(s_service, tservice); @@ -1996,7 +1996,7 @@ void t_delphi_generator::generate_service_client(t_service* tservice) { string implements = async_ ? "Iface, IAsync" : "Iface"; generate_delphi_doc(s_service, tservice); - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends(), true, true); extends_client = extends + ".TClient"; } @@ -2281,7 +2281,7 @@ void t_delphi_generator::generate_service_server(t_service* tservice) { string full_cls = normalize_clsnm(service_name_, "T") + ".TProcessorImpl"; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends(), true, true); extends_processor = extends + ".TProcessorImpl"; indent(s_service) << "TProcessorImpl = class(" << extends_processor << ", IProcessor)" << endl; @@ -2298,13 +2298,13 @@ void t_delphi_generator::generate_service_server(t_service* tservice) { indent_impl(s_service_impl) << "constructor " << full_cls << ".Create( iface_: Iface );" << endl; indent_impl(s_service_impl) << "begin" << endl; indent_up_impl(); - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { indent_impl(s_service_impl) << "inherited Create( iface_);" << endl; } else { indent_impl(s_service_impl) << "inherited Create;" << endl; } indent_impl(s_service_impl) << "Self.iface_ := iface_;" << endl; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { indent_impl(s_service_impl) << "ASSERT( processMap_ <> nil); // inherited" << endl; } else { indent_impl(s_service_impl) @@ -2330,7 +2330,7 @@ void t_delphi_generator::generate_service_server(t_service* tservice) { indent(s_service) << "iface_: Iface;" << endl; indent_down(); - if (tservice->get_extends() == NULL) { + if (tservice->get_extends() == nullptr) { indent(s_service) << "protected" << endl; indent_up(); indent(s_service) << "type" << endl; @@ -3078,7 +3078,7 @@ string t_delphi_generator::type_name(t_type* ttype, if (ttype->is_typedef()) { t_typedef* tdef = (t_typedef*)ttype; if (tdef->is_forward_typedef()) { // forward types according to THRIFT-2421 - if (tdef->get_type() != NULL) { + if (tdef->get_type() != nullptr) { return type_name(tdef->get_type(), b_cls, b_no_postfix, diff --git a/compiler/cpp/src/thrift/generate/t_erl_generator.cc b/compiler/cpp/src/thrift/generate/t_erl_generator.cc index 910a38a23..c96c1b2d5 100644 --- a/compiler/cpp/src/thrift/generate/t_erl_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_erl_generator.cc @@ -625,13 +625,13 @@ string t_erl_generator::render_const_value(t_type* type, t_const_value* value) { bool first = true; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } @@ -909,7 +909,7 @@ void t_erl_generator::generate_service(t_service* tservice) { hrl_header(f_service_hrl_, service_name_); - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { f_service_hrl_ << "-include(\"" << make_safe_for_module_name(tservice->get_extends()->get_name()) << "_thrift.hrl\"). % inherit " << endl; @@ -1013,7 +1013,7 @@ void t_erl_generator::generate_service_interface(t_service* tservice) { } // Inheritance - pass unknown functions to base class - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { indent(f_service_) << "function_info(Function, InfoType) ->" << endl; indent_up(); indent(f_service_) << make_safe_for_module_name(tservice->get_extends()->get_name()) diff --git a/compiler/cpp/src/thrift/generate/t_generator.cc b/compiler/cpp/src/thrift/generate/t_generator.cc index ca3f5dd68..f4b715085 100644 --- a/compiler/cpp/src/thrift/generate/t_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_generator.cc @@ -235,7 +235,7 @@ t_generator* t_generator_registry::get_generator(t_program* program, gen_map_t::iterator iter = the_map.find(language); if (iter == the_map.end()) { - return NULL; + return nullptr; } return iter->second->get_generator(program, parsed_options, options); diff --git a/compiler/cpp/src/thrift/generate/t_go_generator.cc b/compiler/cpp/src/thrift/generate/t_go_generator.cc index 4f8715159..c8540042e 100644 --- a/compiler/cpp/src/thrift/generate/t_go_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_go_generator.cc @@ -1193,7 +1193,7 @@ string t_go_generator::render_const_value(t_type* type, t_const_value* value, co map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; bool is_optional = false; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { @@ -1202,7 +1202,7 @@ string t_go_generator::render_const_value(t_type* type, t_const_value* value, co } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } out << endl << indent() << publicize(v_iter->first->get_string()) << ": " @@ -1303,7 +1303,7 @@ void t_go_generator::generate_go_struct_initializer(ostream& out, string publicized_name; t_const_value* def_value; get_publicized_name_and_def_value(member, &publicized_name, &def_value); - if (!pointer_field && def_value != NULL && !omit_initialization(member)) { + if (!pointer_field && def_value != nullptr && !omit_initialization(member)) { out << endl << indent() << publicized_name << ": " << render_field_initial_value(member, member->get_name(), pointer_field) << "," << endl; @@ -1441,7 +1441,7 @@ void t_go_generator::generate_go_struct_definition(ostream& out, string def_var_name = tstruct_name + "_" + publicized_name + "_DEFAULT"; if ((*m_iter)->get_req() == t_field::T_OPTIONAL || is_pointer_field(*m_iter)) { out << indent() << "var " << def_var_name << " " << goType; - if (def_value != NULL) { + if (def_value != nullptr) { out << " = " << render_const_value(fieldType, def_value, (*m_iter)->get_name()); } out << endl; @@ -1913,7 +1913,7 @@ void t_go_generator::generate_service_interface(t_service* tservice) { string serviceName(publicize(tservice->get_name())); string interfaceName = serviceName; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); size_t index = extends.rfind("."); @@ -1956,7 +1956,7 @@ void t_go_generator::generate_service_client(t_service* tservice) { string extends_client_new = ""; string serviceName(publicize(tservice->get_name())); - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); size_t index = extends.rfind("."); @@ -2149,7 +2149,7 @@ void t_go_generator::generate_service_remote(t_service* tservice) { // collect all functions including inherited functions t_service* parent = tservice; - while (parent != NULL) { + while (parent != nullptr) { vector<t_function*> p_functions = parent->get_functions(); functions.insert(functions.end(), p_functions.begin(), p_functions.end()); @@ -2639,7 +2639,7 @@ void t_go_generator::generate_service_server(t_service* tservice) { string extends_processor_new = ""; string serviceName(publicize(tservice->get_name())); - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); size_t index = extends.rfind("."); @@ -3446,7 +3446,7 @@ string t_go_generator::declare_argument(t_field* tfield) { std::ostringstream result; result << publicize(tfield->get_name()) << "="; - if (tfield->get_value() != NULL) { + if (tfield->get_value() != nullptr) { result << "thrift_spec[" << tfield->get_key() << "][4]"; } else { result << "nil"; @@ -3458,7 +3458,7 @@ string t_go_generator::declare_argument(t_field* tfield) { /** * Renders a struct field initial value. * - * @param tfield The field, which must have `tfield->get_value() != NULL` + * @param tfield The field, which must have `tfield->get_value() != nullptr` */ string t_go_generator::render_field_initial_value(t_field* tfield, const string& name, @@ -3560,7 +3560,7 @@ string t_go_generator::type_name(t_type* ttype) { string t_go_generator::module_name(t_type* ttype) { t_program* program = ttype->get_program(); - if (program != NULL && program != program_) { + if (program != nullptr && program != program_) { if (program->get_namespace("go").empty() || program_->get_namespace("go").empty() || program->get_namespace("go") != program_->get_namespace("go")) { diff --git a/compiler/cpp/src/thrift/generate/t_gv_generator.cc b/compiler/cpp/src/thrift/generate/t_gv_generator.cc index 2c0acf979..724a92742 100644 --- a/compiler/cpp/src/thrift/generate/t_gv_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_gv_generator.cc @@ -314,7 +314,7 @@ void t_gv_generator::generate_service(t_service* tservice) { for (; arg_iter != args.end(); arg_iter++) { f_out_ << "|<param_" << (*arg_iter)->get_name() << ">"; f_out_ << (*arg_iter)->get_name(); - if ((*arg_iter)->get_value() != NULL) { + if ((*arg_iter)->get_value() != nullptr) { f_out_ << " = "; print_const_value((*arg_iter)->get_type(), (*arg_iter)->get_value()); } diff --git a/compiler/cpp/src/thrift/generate/t_haxe_generator.cc b/compiler/cpp/src/thrift/generate/t_haxe_generator.cc index 13f2cd1ba..7f1bb6f75 100644 --- a/compiler/cpp/src/thrift/generate/t_haxe_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_haxe_generator.cc @@ -319,7 +319,7 @@ string t_haxe_generator::haxe_thrift_gen_imports(t_struct* tstruct, string& impo // For each type check if it is from a different namespace for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { t_program* program = (*m_iter)->get_type()->get_program(); - if (program != NULL && program != program_) { + if (program != nullptr && program != program_) { string package = program->get_namespace("haxe"); if (!package.empty()) { if (imports.find(package + "." + (*m_iter)->get_type()->get_name()) == string::npos) { @@ -344,7 +344,7 @@ string t_haxe_generator::haxe_thrift_gen_imports(t_service* tservice) { // For each type check if it is from a different namespace for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { t_program* program = (*f_iter)->get_returntype()->get_program(); - if (program != NULL && program != program_) { + if (program != nullptr && program != program_) { string package = program->get_namespace("haxe"); if (!package.empty()) { if (imports.find(package + "." + (*f_iter)->get_returntype()->get_name()) == string::npos) { @@ -514,13 +514,13 @@ void t_haxe_generator::print_const_value(std::ostream& out, indent_up(); } for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } string val = render_const_value(out, name, field_type, v_iter->second); @@ -788,7 +788,7 @@ void t_haxe_generator::generate_haxe_struct_definition(ostream& out, indent(out) << "super();" << endl; } for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { - if ((*m_iter)->get_value() != NULL) { + if ((*m_iter)->get_value() != nullptr) { indent(out) << "this." << (*m_iter)->get_name() << " = " << (*m_iter)->get_value()->get_integer() << ";" << endl; } @@ -1483,7 +1483,7 @@ void t_haxe_generator::generate_service(t_service* tservice) { f_service_ << endl << haxe_type_imports() << haxe_thrift_imports() << haxe_thrift_gen_imports(tservice); - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { t_type* parent = tservice->get_extends(); string parent_namespace = parent->get_program()->get_namespace("haxe"); if (!parent_namespace.empty() && parent_namespace != package_name_) { @@ -1504,7 +1504,7 @@ void t_haxe_generator::generate_service(t_service* tservice) { f_service_ << autogen_comment() << haxe_package() << ";" << endl << endl << haxe_type_imports() << haxe_thrift_imports() << haxe_thrift_gen_imports(tservice) << endl; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { t_type* parent = tservice->get_extends(); string parent_namespace = parent->get_program()->get_namespace("haxe"); if (!parent_namespace.empty() && parent_namespace != package_name_) { @@ -1629,7 +1629,7 @@ void t_haxe_generator::generate_service_method_signature_callback(t_function* tf */ void t_haxe_generator::generate_service_interface(t_service* tservice) { string extends_iface = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends_iface = " extends " + tservice->get_extends()->get_name(); } @@ -1674,7 +1674,7 @@ void t_haxe_generator::generate_service_helpers(t_service* tservice) { void t_haxe_generator::generate_service_client(t_service* tservice) { string extends = ""; string extends_client = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = get_cap_name(tservice->get_extends()->get_name()); extends_client = " extends " + extends + "Impl"; } @@ -1891,7 +1891,7 @@ void t_haxe_generator::generate_service_server(t_service* tservice) { // Extends stuff string extends = ""; string extends_processor = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = get_cap_name(type_name(tservice->get_extends())); extends_processor = " extends " + extends + "Processor"; } @@ -1932,7 +1932,7 @@ void t_haxe_generator::generate_service_server(t_service* tservice) { // Generate the server implementation string override = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { override = "override "; } indent(f_service_) << override @@ -2606,7 +2606,7 @@ string t_haxe_generator::type_name(t_type* ttype, bool in_container, bool in_ini // Check for namespacing t_program* program = ttype->get_program(); - if (program != NULL && program != program_) { + if (program != nullptr && program != program_) { string package = program->get_namespace("haxe"); if (!package.empty()) { return package + "." + ttype->get_name(); @@ -2660,7 +2660,7 @@ string t_haxe_generator::declare_field(t_field* tfield, bool init) { string result = "var " + tfield->get_name() + " : " + type_name(tfield->get_type()); if (init) { t_type* ttype = get_true_type(tfield->get_type()); - if (ttype->is_base_type() && tfield->get_value() != NULL) { + if (ttype->is_base_type() && tfield->get_value() != nullptr) { std::ofstream dummy; result += " = " + render_const_value(dummy, tfield->get_name(), ttype, tfield->get_value()); } else if (ttype->is_base_type()) { @@ -2966,7 +2966,7 @@ void t_haxe_generator::generate_isset_set(ostream& out, t_field* field) { std::string t_haxe_generator::get_enum_class_name(t_type* type) { string package = ""; t_program* program = type->get_program(); - if (program != NULL /*&& program != program_*/) { + if (program != nullptr /*&& program != program_*/) { package = program->get_namespace("haxe") + "."; } return package + type->get_name(); diff --git a/compiler/cpp/src/thrift/generate/t_hs_generator.cc b/compiler/cpp/src/thrift/generate/t_hs_generator.cc index 00c01a1ab..d314b8f2c 100644 --- a/compiler/cpp/src/thrift/generate/t_hs_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_hs_generator.cc @@ -367,7 +367,7 @@ void t_hs_generator::generate_const(t_const* tconst) { * validate_types method in main.cc */ string t_hs_generator::render_const_value(t_type* type, t_const_value* value) { - if (value == NULL) + if (value == nullptr) return type_to_default(type); type = get_true_type(type); @@ -411,7 +411,7 @@ string t_hs_generator::render_const_value(t_type* type, t_const_value* value) { int val = constant->get_value(); if (val == value->get_integer()) { t_program* prog = type->get_program(); - if (prog != NULL && prog != program_) + if (prog != nullptr && prog != program_) out << capitalize(prog->get_name()) << "_Types."; out << capitalize(constant->get_name()); break; @@ -427,13 +427,13 @@ string t_hs_generator::render_const_value(t_type* type, t_const_value* value) { bool first = true; for (auto v_iter : val) { - t_field* field = NULL; + t_field* field = nullptr; for (auto f_iter : fields) if (f_iter->get_name() == v_iter.first->get_string()) field = f_iter; - if (field == NULL) + if (field == nullptr) throw "type error: " + cname + " has no field " + v_iter.first->get_string(); string fname = v_iter.first->get_string(); @@ -676,7 +676,7 @@ void t_hs_generator::generate_hs_struct_reader(ostream& out, t_struct* tstruct) out << "P.error \"Missing required field: " << fname << "\""; } else { if ((field->get_req() == t_field::T_OPTIONAL - || ((t_type*)field->get_type())->is_xception()) && field->get_value() == NULL) { + || ((t_type*)field->get_type())->is_xception()) && field->get_value() == nullptr) { out << "P.Nothing"; } else { out << field_name(sname, fname) << " default_" << sname; @@ -941,7 +941,7 @@ void t_hs_generator::generate_hs_default(ostream& out, t_struct* tstruct) { indent(out) << field_name(name, mname) << " = "; if (field->get_req() == t_field::T_OPTIONAL || ((t_type*)field->get_type())->is_xception()) { - if (value == NULL) { + if (value == nullptr) { out << "P.Nothing"; } else { out << "P.Just " << render_const_value(type, value); @@ -973,7 +973,7 @@ void t_hs_generator::generate_service_interface(t_service* tservice) { f_iface_ << endl; string sname = capitalize(service_name_); - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { string extends = type_name(tservice->get_extends()); indent(f_iface_) << "import " << extends << "_Iface" << endl; @@ -1026,7 +1026,7 @@ void t_hs_generator::generate_service_client(t_service* tservice) { string sname = capitalize(service_name_); indent(f_client_) << "module " << sname << "_Client(" << exports << ") where" << endl; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); indent(f_client_) << "import " << extends << "_Client" << endl; } @@ -1156,7 +1156,7 @@ void t_hs_generator::generate_service_server(t_service* tservice) { } indent(f_service_) << "_ -> "; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { f_service_ << type_name(tservice->get_extends()) << ".proc_ handler (iprot,oprot) (name,typ,seqid)" << endl; @@ -1510,7 +1510,7 @@ string t_hs_generator::type_name(t_type* ttype, string function_prefix) { string prefix = ""; t_program* program = ttype->get_program(); - if (program != NULL && program != program_) + if (program != nullptr && program != program_) if (!ttype->is_service()) prefix = capitalize(program->get_name()) + "_Types."; diff --git a/compiler/cpp/src/thrift/generate/t_html_generator.cc b/compiler/cpp/src/thrift/generate/t_html_generator.cc index b61a712e3..3bff2c95a 100644 --- a/compiler/cpp/src/thrift/generate/t_html_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_html_generator.cc @@ -776,13 +776,13 @@ void t_html_generator::print_const_value(t_type* type, t_const_value* tvalue) { const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = tvalue->get_map(); map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + truetype->get_name() + " has no field " + v_iter->first->get_string(); } @@ -990,7 +990,7 @@ void t_html_generator::generate_struct(t_struct* tstruct) { } f_out_ << "</td><td>"; t_const_value* default_val = (*mem_iter)->get_value(); - if (default_val != NULL) { + if (default_val != nullptr) { f_out_ << "<code>"; print_const_value((*mem_iter)->get_type(), default_val); f_out_ << "</code>"; @@ -1049,7 +1049,7 @@ void t_html_generator::generate_service(t_service* tservice) { first = false; print_type((*arg_iter)->get_type()); f_out_ << " " << (*arg_iter)->get_name(); - if ((*arg_iter)->get_value() != NULL) { + if ((*arg_iter)->get_value() != nullptr) { f_out_ << " = "; print_const_value((*arg_iter)->get_type(), (*arg_iter)->get_value()); } diff --git a/compiler/cpp/src/thrift/generate/t_java_generator.cc b/compiler/cpp/src/thrift/generate/t_java_generator.cc index 24637d31c..87787025c 100644 --- a/compiler/cpp/src/thrift/generate/t_java_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_java_generator.cc @@ -305,7 +305,7 @@ public: t_type* type); enum isset_type { ISSET_NONE, ISSET_PRIMITIVE, ISSET_BITSET }; - isset_type needs_isset(t_struct* tstruct, std::string* outPrimitiveType = NULL); + isset_type needs_isset(t_struct* tstruct, std::string* outPrimitiveType = nullptr); /** * Helper rendering functions @@ -648,13 +648,13 @@ void t_java_generator::print_const_value(std::ostream& out, indent_up(); } for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } string val = render_const_value(out, field_type, v_iter->second); @@ -911,7 +911,7 @@ void t_java_generator::generate_union_constructor(ostream& out, t_struct* tstruc bool default_value = false; for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { t_type* type = get_true_type((*m_iter)->get_type()); - if ((*m_iter)->get_value() != NULL) { + if ((*m_iter)->get_value() != nullptr) { indent(out) << "super(_Fields." << constant_name((*m_iter)->get_name()) << ", " << render_const_value(out, type, (*m_iter)->get_value()) << ");" << endl; default_value = true; @@ -1546,7 +1546,7 @@ void t_java_generator::generate_java_struct_definition(ostream& out, indent_up(); for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { t_type* t = get_true_type((*m_iter)->get_type()); - if ((*m_iter)->get_value() != NULL) { + if ((*m_iter)->get_value() != nullptr) { print_const_value(out, "this." + (*m_iter)->get_name(), t, @@ -2882,7 +2882,7 @@ void t_java_generator::generate_service(t_service* tservice) { void t_java_generator::generate_service_interface(t_service* tservice) { string extends = ""; string extends_iface = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); extends_iface = " extends " + extends + ".Iface"; } @@ -2903,7 +2903,7 @@ void t_java_generator::generate_service_interface(t_service* tservice) { void t_java_generator::generate_service_async_interface(t_service* tservice) { string extends = ""; string extends_iface = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); extends_iface = " extends " + extends + " .AsyncIface"; } @@ -2943,7 +2943,7 @@ void t_java_generator::generate_service_helpers(t_service* tservice) { void t_java_generator::generate_service_client(t_service* tservice) { string extends = ""; string extends_client = ""; - if (tservice->get_extends() == NULL) { + if (tservice->get_extends() == nullptr) { extends_client = "org.apache.thrift.TServiceClient"; } else { extends = type_name(tservice->get_extends()); @@ -3106,7 +3106,7 @@ void t_java_generator::generate_service_client(t_service* tservice) { void t_java_generator::generate_service_async_client(t_service* tservice) { string extends = "org.apache.thrift.async.TAsyncClient"; string extends_client = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()) + ".AsyncClient"; } @@ -3282,7 +3282,7 @@ void t_java_generator::generate_service_server(t_service* tservice) { // Extends stuff string extends = ""; string extends_processor = ""; - if (tservice->get_extends() == NULL) { + if (tservice->get_extends() == nullptr) { extends_processor = "org.apache.thrift.TBaseProcessor<I>"; } else { extends = type_name(tservice->get_extends()); @@ -3345,7 +3345,7 @@ void t_java_generator::generate_service_async_server(t_service* tservice) { // Extends stuff string extends = ""; string extends_processor = ""; - if (tservice->get_extends() == NULL) { + if (tservice->get_extends() == nullptr) { extends_processor = "org.apache.thrift.TBaseAsyncProcessor<I>"; } else { extends = type_name(tservice->get_extends()); @@ -4299,7 +4299,7 @@ string t_java_generator::type_name(t_type* ttype, // Check for namespacing t_program* program = ttype->get_program(); - if ((program != NULL) && ((program != program_) || force_namespace)) { + if ((program != nullptr) && ((program != program_) || force_namespace)) { string package = program->get_namespace("java"); if (!package.empty()) { return package + "." + ttype->get_name(); @@ -4359,7 +4359,7 @@ string t_java_generator::declare_field(t_field* tfield, bool init, bool comment) } result += type_name(tfield->get_type()) + " " + tfield->get_name(); if (init) { - if (ttype->is_base_type() && tfield->get_value() != NULL) { + if (ttype->is_base_type() && tfield->get_value() != nullptr) { std::ofstream dummy; result += " = " + render_const_value(dummy, ttype, tfield->get_value()); } else if (ttype->is_base_type()) { @@ -4998,7 +4998,7 @@ t_java_generator::isset_type t_java_generator::needs_isset(t_struct* tstruct, if (count == 0) { return ISSET_NONE; } else if (count <= 64) { - if (outPrimitiveType != NULL) { + if (outPrimitiveType != nullptr) { if (count <= 8) *outPrimitiveType = "byte"; else if (count <= 16) @@ -5028,7 +5028,7 @@ void t_java_generator::generate_java_struct_clear(std::ostream& out, t_struct* t t_field* field = *m_iter; t_type* t = get_true_type(field->get_type()); - if (field->get_value() != NULL) { + if (field->get_value() != nullptr) { print_const_value(out, "this." + field->get_name(), t, field->get_value(), true, true); continue; } @@ -5420,7 +5420,7 @@ void t_java_generator::generate_java_scheme_lookup(ostream& out) { } void t_java_generator::generate_javax_generated_annotation(ostream& out) { - time_t seconds = time(NULL); + time_t seconds = time(nullptr); struct tm* now = localtime(&seconds); indent(out) << "@javax.annotation.Generated(value = \"" << autogen_summary() << "\""; if (undated_generated_annotations_) { diff --git a/compiler/cpp/src/thrift/generate/t_javame_generator.cc b/compiler/cpp/src/thrift/generate/t_javame_generator.cc index e1694abdf..b37a43bd0 100644 --- a/compiler/cpp/src/thrift/generate/t_javame_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_javame_generator.cc @@ -462,13 +462,13 @@ void t_javame_generator::print_const_value(std::ostream& out, indent_up(); } for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } string val = render_const_value(out, name, field_type, v_iter->second); @@ -1060,7 +1060,7 @@ void t_javame_generator::generate_java_struct_definition(ostream& out, indent_up(); for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { t_type* t = get_true_type((*m_iter)->get_type()); - if ((*m_iter)->get_value() != NULL) { + if ((*m_iter)->get_value() != nullptr) { print_const_value(out, "this." + (*m_iter)->get_name(), t, @@ -1898,7 +1898,7 @@ void t_javame_generator::generate_primitive_service_interface(t_service* tservic f_iface.open(f_interface_name.c_str()); string extends_iface = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends_iface = " extends " + type_name(tservice->get_extends()) + "Iface"; } @@ -1923,7 +1923,7 @@ void t_javame_generator::generate_primitive_service_interface(t_service* tservic void t_javame_generator::generate_service_interface(t_service* tservice) { string extends = ""; string extends_iface = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); extends_iface = " extends " + extends + ".Iface"; } @@ -1964,7 +1964,7 @@ void t_javame_generator::generate_service_helpers(t_service* tservice) { void t_javame_generator::generate_service_client(t_service* tservice) { string extends = ""; string extends_client = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); extends_client = " extends " + extends + ".Client"; } @@ -2144,7 +2144,7 @@ void t_javame_generator::generate_service_server(t_service* tservice) { // Extends stuff string extends = ""; string extends_processor = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); extends_processor = " extends " + extends + ".Processor"; } @@ -2791,7 +2791,7 @@ string t_javame_generator::type_name(t_type* ttype, // Check for namespacing t_program* program = ttype->get_program(); - if (program != NULL && program != program_) { + if (program != nullptr && program != program_) { string package = program->get_namespace("java"); if (!package.empty()) { return package + "." + ttype->get_name(); @@ -2846,7 +2846,7 @@ string t_javame_generator::declare_field(t_field* tfield, bool init) { string result = type_name(tfield->get_type()) + " " + tfield->get_name(); if (init) { t_type* ttype = get_true_type(tfield->get_type()); - if (ttype->is_base_type() && tfield->get_value() != NULL) { + if (ttype->is_base_type() && tfield->get_value() != nullptr) { std::ofstream dummy; result += " = " + render_const_value(dummy, tfield->get_name(), ttype, tfield->get_value()); } else if (ttype->is_base_type()) { @@ -3208,7 +3208,7 @@ void t_javame_generator::generate_isset_set(ostream& out, t_field* field) { std::string t_javame_generator::get_enum_class_name(t_type* type) { string package = ""; t_program* program = type->get_program(); - if (program != NULL && program != program_) { + if (program != nullptr && program != program_) { package = program->get_namespace("java") + "."; } return package + type->get_name(); @@ -3252,7 +3252,7 @@ void t_javame_generator::generate_java_struct_clear(std::ostream& out, t_struct* indent_up(); for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { t_type* t = get_true_type((*m_iter)->get_type()); - if ((*m_iter)->get_value() != NULL) { + if ((*m_iter)->get_value() != nullptr) { print_const_value(out, "this." + (*m_iter)->get_name(), t, diff --git a/compiler/cpp/src/thrift/generate/t_js_generator.cc b/compiler/cpp/src/thrift/generate/t_js_generator.cc index 976689729..b0bed92b3 100644 --- a/compiler/cpp/src/thrift/generate/t_js_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_js_generator.cc @@ -265,7 +265,7 @@ public: std::string js_type_namespace(t_program* p) { if (gen_node_) { - if (p != NULL && p != program_) { + if (p != nullptr && p != program_) { return make_valid_nodeJs_identifier(p->get_name()) + "_ttypes."; } return "ttypes."; @@ -325,7 +325,7 @@ public: * @param t_field The field to check * @return string */ - string ts_get_req(t_field* field) {return (field->get_req() == t_field::T_OPTIONAL || field->get_value() != NULL ? "?" : ""); } + string ts_get_req(t_field* field) {return (field->get_req() == t_field::T_OPTIONAL || field->get_value() != nullptr ? "?" : ""); } /** * Returns the documentation, if the provided documentable object has one. @@ -738,13 +738,13 @@ string t_js_generator::render_const_value(t_type* type, t_const_value* value) { const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map(); map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw std::runtime_error("type error: " + type->get_name() + " has no field " + v_iter->first->get_string()); } if (v_iter != val.begin()) @@ -901,7 +901,7 @@ void t_js_generator::generate_js_struct_definition(ostream& out, for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { string dval = declare_field(*m_iter, false, true); t_type* t = get_true_type((*m_iter)->get_type()); - if ((*m_iter)->get_value() != NULL && !(t->is_struct() || t->is_xception())) { + if ((*m_iter)->get_value() != nullptr && !(t->is_struct() || t->is_xception())) { dval = render_const_value((*m_iter)->get_type(), (*m_iter)->get_value()); out << indent() << "this." << (*m_iter)->get_name() << " = " << dval << ";" << endl; } else { @@ -923,7 +923,7 @@ void t_js_generator::generate_js_struct_definition(ostream& out, for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { t_type* t = get_true_type((*m_iter)->get_type()); - if ((*m_iter)->get_value() != NULL && (t->is_struct() || t->is_xception())) { + if ((*m_iter)->get_value() != nullptr && (t->is_struct() || t->is_xception())) { indent(out) << "this." << (*m_iter)->get_name() << " = " << render_const_value(t, (*m_iter)->get_value()) << ";" << endl; } @@ -1210,7 +1210,7 @@ void t_js_generator::generate_service(t_service* tservice) { f_service_ << js_includes() << endl << render_includes() << endl; if (gen_ts_) { - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { f_service_ts_ << "/// <reference path=\"" << tservice->get_extends()->get_name() << ".d.ts\" />" << endl; } @@ -1262,7 +1262,7 @@ void t_js_generator::generate_service(t_service* tservice) { } if (gen_node_) { - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { f_service_ << js_const_type_ << tservice->get_extends()->get_name() << " = require('./" << tservice->get_extends()->get_name() << "');" << endl << js_const_type_ << tservice->get_extends()->get_name() @@ -1311,7 +1311,7 @@ void t_js_generator::generate_service_processor(t_service* tservice) { f_service_ << prefix << service_name_ << "Processor = " << "exports.Processor"; if (gen_ts_) { f_service_ts_ << endl << "declare class Processor "; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { f_service_ts_ << "extends " << tservice->get_extends()->get_name() << "Processor "; } f_service_ts_ << "{" << endl; @@ -1326,7 +1326,7 @@ void t_js_generator::generate_service_processor(t_service* tservice) { << "exports.Processor"; } - bool is_subclass_service = tservice->get_extends() != NULL; + bool is_subclass_service = tservice->get_extends() != nullptr; // ES6 Constructor if (gen_es6_) { @@ -1686,7 +1686,7 @@ void t_js_generator::generate_service_rest(t_service* tservice) { */ void t_js_generator::generate_service_client(t_service* tservice) { - bool is_subclass_service = tservice->get_extends() != NULL; + bool is_subclass_service = tservice->get_extends() != nullptr; if (gen_node_) { string prefix = has_js_namespace(tservice->get_program()) ? js_namespace(tservice->get_program()) : js_const_type_; @@ -1694,7 +1694,7 @@ void t_js_generator::generate_service_client(t_service* tservice) { if (gen_ts_) { f_service_ts_ << ts_print_doc(tservice) << ts_indent() << ts_declare() << "class " << "Client "; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { f_service_ts_ << "extends " << tservice->get_extends()->get_name() << "Client "; } f_service_ts_ << "{" << endl; diff --git a/compiler/cpp/src/thrift/generate/t_lua_generator.cc b/compiler/cpp/src/thrift/generate/t_lua_generator.cc index f85856226..b63569d77 100644 --- a/compiler/cpp/src/thrift/generate/t_lua_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_lua_generator.cc @@ -282,13 +282,13 @@ string t_lua_generator::render_const_value(t_type* type, t_const_value* value) { const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map(); map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end();) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } @@ -513,7 +513,7 @@ void t_lua_generator::generate_service(t_service* tservice) { if (gen_requires_) { f_service_ << endl << "require '" << cur_ns << "ttypes'" << endl; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { f_service_ << "require '" << get_namespace(tservice->get_extends()->get_program()) << tservice->get_extends()->get_name() << "'" << endl; } @@ -550,7 +550,7 @@ void t_lua_generator::generate_service_client(ostream& out, t_service* tservice) // Client object definition out << classname << " = __TObject.new("; - if (extends_s != NULL) { + if (extends_s != nullptr) { out << extends_s->get_name() << "Client"; } else { out << "__TClient"; @@ -646,7 +646,7 @@ void t_lua_generator::generate_service_processor(ostream& out, t_service* tservi // Define processor table out << endl << classname << " = __TObject.new("; - if (extends_s != NULL) { + if (extends_s != nullptr) { out << extends_s->get_name() << "Processor" << endl; } else { out << "__TProcessor" << endl; diff --git a/compiler/cpp/src/thrift/generate/t_netstd_generator.cc b/compiler/cpp/src/thrift/generate/t_netstd_generator.cc index 7be323005..0373faf48 100644 --- a/compiler/cpp/src/thrift/generate/t_netstd_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_netstd_generator.cc @@ -128,7 +128,7 @@ static string check_and_correct_struct_name(const string& struct_name) return struct_name; } -static bool field_has_default(t_field* tfield) { return tfield->get_value() != NULL; } +static bool field_has_default(t_field* tfield) { return tfield->get_value() != nullptr; } static bool field_is_required(t_field* tfield) { return tfield->get_req() == t_field::T_REQUIRED; } @@ -502,7 +502,7 @@ void t_netstd_generator::print_const_def_value(ostream& out, string name, t_type for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_field* field = NULL; + t_field* field = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { @@ -512,7 +512,7 @@ void t_netstd_generator::print_const_def_value(ostream& out, string name, t_type } } - if (field == NULL) + if (field == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } @@ -1031,7 +1031,7 @@ void t_netstd_generator::generate_netstd_struct_definition(ostream& out, t_struc t_type* t = (*m_iter)->get_type(); t = resolve_typedef(t); - if ((*m_iter)->get_value() != NULL) + if ((*m_iter)->get_value() != nullptr) { if (field_is_required((*m_iter))) { @@ -1924,7 +1924,7 @@ void t_netstd_generator::generate_service_interface(ostream& out, t_service* tse { string extends = ""; string extends_iface = ""; - if (tservice->get_extends() != NULL) + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); extends_iface = " : " + extends + ".IAsync"; @@ -1986,7 +1986,7 @@ void t_netstd_generator::generate_service_client(ostream& out, t_service* tservi { string extends = ""; string extends_client = ""; - if (tservice->get_extends() != NULL) + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); extends_client = extends + ".Client, "; @@ -2132,7 +2132,7 @@ void t_netstd_generator::generate_service_server(ostream& out, t_service* tservi string extends = ""; string extends_processor = ""; - if (tservice->get_extends() != NULL) + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); extends_processor = extends + ".AsyncProcessor, "; @@ -3120,7 +3120,7 @@ string t_netstd_generator::type_name(t_type* ttype) string the_name = check_and_correct_struct_name(normalize_name(ttype->get_name())); t_program* program = ttype->get_program(); - if (program != NULL && program != program_) + if (program != nullptr && program != program_) { string ns = program->get_namespace("netstd"); if (!ns.empty()) @@ -3434,7 +3434,7 @@ string t_netstd_generator::get_enum_class_name(t_type* type) { string package = ""; t_program* program = type->get_program(); - if (program != NULL && program != program_) + if (program != nullptr && program != program_) { package = program->get_namespace("netstd") + "."; } diff --git a/compiler/cpp/src/thrift/generate/t_ocaml_generator.cc b/compiler/cpp/src/thrift/generate/t_ocaml_generator.cc index a3781e8ee..0a961467e 100644 --- a/compiler/cpp/src/thrift/generate/t_ocaml_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_ocaml_generator.cc @@ -404,13 +404,13 @@ string t_ocaml_generator::render_const_value(t_type* type, t_const_value* value) const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map(); map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } string fname = v_iter->first->get_string(); @@ -898,7 +898,7 @@ void t_ocaml_generator::generate_service(t_service* tservice) { f_service_ << ocaml_autogen_comment() << endl << ocaml_imports() << endl; f_service_i_ << ocaml_autogen_comment() << endl << ocaml_imports() << endl; - /* if (tservice->get_extends() != NULL) { + /* if (tservice->get_extends() != nullptr) { f_service_ << "open " << capitalize(tservice->get_extends()->get_name()) << endl; f_service_i_ << @@ -970,7 +970,7 @@ void t_ocaml_generator::generate_service_interface(t_service* tservice) { indent_up(); - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { string extends = type_name(tservice->get_extends()); indent(f_service_) << "inherit " << extends << ".iface" << endl; indent(f_service_i_) << "inherit " << extends << ".iface" << endl; @@ -1004,7 +1004,7 @@ void t_ocaml_generator::generate_service_client(t_service* tservice) { indent(f_service_i_) << "class client : Protocol.t -> Protocol.t -> " << endl << "object" << endl; indent_up(); - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); indent(f_service_) << "inherit " << extends << ".client iprot oprot as super" << endl; indent(f_service_i_) << "inherit " << extends << ".client" << endl; @@ -1155,7 +1155,7 @@ void t_ocaml_generator::generate_service_server(t_service* tservice) { f_service_i_ << indent() << "inherit Processor.t" << endl << endl; string extends = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); indent(f_service_) << "inherit " + extends + ".processor (handler :> " + extends + ".iface)" << endl; @@ -1377,7 +1377,7 @@ void t_ocaml_generator::generate_deserialize_type(ostream& out, t_type* type) { void t_ocaml_generator::generate_deserialize_struct(ostream& out, t_struct* tstruct) { string prefix = ""; t_program* program = tstruct->get_program(); - if (program != NULL && program != program_) { + if (program != nullptr && program != program_) { prefix = capitalize(program->get_name()) + "_types."; } string name = decapitalize(tstruct->get_name()); @@ -1658,7 +1658,7 @@ string t_ocaml_generator::argument_list(t_struct* tstruct) { string t_ocaml_generator::type_name(t_type* ttype) { string prefix = ""; t_program* program = ttype->get_program(); - if (program != NULL && program != program_) { + if (program != nullptr && program != program_) { if (!ttype->is_service()) { prefix = capitalize(program->get_name()) + "_types."; } diff --git a/compiler/cpp/src/thrift/generate/t_oop_generator.h b/compiler/cpp/src/thrift/generate/t_oop_generator.h index f8da54792..2df1be413 100644 --- a/compiler/cpp/src/thrift/generate/t_oop_generator.h +++ b/compiler/cpp/src/thrift/generate/t_oop_generator.h @@ -59,7 +59,7 @@ public: virtual std::string get_enum_class_name(t_type* type) { std::string package = ""; t_program* program = type->get_program(); - if (program != NULL && program != program_) { + if (program != nullptr && program != program_) { package = program->get_namespace("java") + "."; } return package + type->get_name(); diff --git a/compiler/cpp/src/thrift/generate/t_perl_generator.cc b/compiler/cpp/src/thrift/generate/t_perl_generator.cc index 80729cbfd..2e687dd5e 100644 --- a/compiler/cpp/src/thrift/generate/t_perl_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_perl_generator.cc @@ -362,13 +362,13 @@ string t_perl_generator::render_const_value(t_type* type, t_const_value* value) const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map(); map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } indent(out) << render_const_value(g_type_string, v_iter->first); @@ -489,7 +489,7 @@ void t_perl_generator::generate_perl_struct_definition(ostream& out, for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { string dval = "undef"; t_type* t = get_true_type((*m_iter)->get_type()); - if ((*m_iter)->get_value() != NULL && !(t->is_struct() || t->is_xception())) { + if ((*m_iter)->get_value() != nullptr && !(t->is_struct() || t->is_xception())) { dval = render_const_value((*m_iter)->get_type(), (*m_iter)->get_value()); } out << indent() << "$self->{" << (*m_iter)->get_name() << "} = " << dval << ";" << endl; @@ -500,7 +500,7 @@ void t_perl_generator::generate_perl_struct_definition(ostream& out, for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { t_type* t = get_true_type((*m_iter)->get_type()); - if ((*m_iter)->get_value() != NULL && (t->is_struct() || t->is_xception())) { + if ((*m_iter)->get_value() != nullptr && (t->is_struct() || t->is_xception())) { indent(out) << "$self->{" << (*m_iter)->get_name() << "} = " << render_const_value(t, (*m_iter)->get_value()) << ";" << endl; } @@ -680,7 +680,7 @@ void t_perl_generator::generate_service(t_service* tservice) { generate_use_includes(f_service_, done, tservice, true); t_service* extends_s = tservice->get_extends(); - if (extends_s != NULL) { + if (extends_s != nullptr) { f_service_ << "use " << perl_namespace(extends_s->get_program()) << extends_s->get_name() << ";" << endl; } @@ -712,7 +712,7 @@ void t_perl_generator::generate_service_processor(t_service* tservice) { string extends = ""; string extends_processor = ""; t_service* extends_s = tservice->get_extends(); - if (extends_s != NULL) { + if (extends_s != nullptr) { extends = perl_namespace(extends_s->get_program()) + extends_s->get_name(); extends_processor = "use base qw(" + extends + "Processor);"; } @@ -939,7 +939,7 @@ void t_perl_generator::generate_perl_function_helpers(t_function* tfunction) { void t_perl_generator::generate_service_interface(t_service* tservice) { string extends_if = ""; t_service* extends_s = tservice->get_extends(); - if (extends_s != NULL) { + if (extends_s != nullptr) { extends_if = "use base qw(" + perl_namespace(extends_s->get_program()) + extends_s->get_name() + "If);"; } @@ -964,7 +964,7 @@ void t_perl_generator::generate_service_rest(t_service* tservice) { string extends = ""; string extends_if = ""; t_service* extends_s = tservice->get_extends(); - if (extends_s != NULL) { + if (extends_s != nullptr) { extends = extends_s->get_name(); extends_if = "use base qw(" + perl_namespace(extends_s->get_program()) + extends_s->get_name() + "Rest);"; @@ -1024,7 +1024,7 @@ void t_perl_generator::generate_service_client(t_service* tservice) { string extends = ""; string extends_client = ""; t_service* extends_s = tservice->get_extends(); - if (extends_s != NULL) { + if (extends_s != nullptr) { extends = perl_namespace(extends_s->get_program()) + extends_s->get_name(); extends_client = "use base qw(" + extends + "Client);"; } diff --git a/compiler/cpp/src/thrift/generate/t_php_generator.cc b/compiler/cpp/src/thrift/generate/t_php_generator.cc index e29ad77e7..c3278543e 100644 --- a/compiler/cpp/src/thrift/generate/t_php_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_php_generator.cc @@ -651,13 +651,13 @@ string t_php_generator::render_const_value(t_type* type, t_const_value* value) { const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map(); map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } out << indent(); @@ -846,7 +846,7 @@ void t_php_generator::generate_php_struct_definition(ostream& out, for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { string dval = "null"; t_type* t = get_true_type((*m_iter)->get_type()); - if ((*m_iter)->get_value() != NULL && !(t->is_struct() || t->is_xception())) { + if ((*m_iter)->get_value() != nullptr && !(t->is_struct() || t->is_xception())) { dval = render_const_value((*m_iter)->get_type(), (*m_iter)->get_value()); } generate_php_doc(out, *m_iter); @@ -864,7 +864,7 @@ void t_php_generator::generate_php_struct_definition(ostream& out, if (members.size() > 0) { for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { t_type* t = get_true_type((*m_iter)->get_type()); - if ((*m_iter)->get_value() != NULL && (t->is_struct() || t->is_xception())) { + if ((*m_iter)->get_value() != nullptr && (t->is_struct() || t->is_xception())) { indent(out) << "$this->" << (*m_iter)->get_name() << " = " << render_const_value(t, (*m_iter)->get_value()) << ";" << endl; } @@ -1293,7 +1293,7 @@ void t_php_generator::generate_service_processor(t_service* tservice) { string extends = ""; string extends_processor = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = tservice->get_extends()->get_name(); extends_processor = " extends " + php_namespace(tservice->get_extends()->get_program()) + extends + "Processor"; @@ -1618,7 +1618,7 @@ void t_php_generator::generate_service_interface(t_service* tservice) { string extends = ""; string extends_if = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = " extends " + php_namespace(tservice->get_extends()->get_program()) + tservice->get_extends()->get_name(); extends_if = " extends " + php_namespace(tservice->get_extends()->get_program()) @@ -1657,7 +1657,7 @@ void t_php_generator::generate_service_rest(t_service* tservice) { string extends = ""; string extends_if = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = " extends " + php_namespace(tservice->get_extends()->get_program()) + tservice->get_extends()->get_name(); extends_if = " extends " + php_namespace(tservice->get_extends()->get_program()) @@ -1738,7 +1738,7 @@ void t_php_generator::generate_service_client(t_service* tservice) { string extends = ""; string extends_client = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = tservice->get_extends()->get_name(); extends_client = " extends " + php_namespace(tservice->get_extends()->get_program()) + extends + "Client"; diff --git a/compiler/cpp/src/thrift/generate/t_py_generator.cc b/compiler/cpp/src/thrift/generate/t_py_generator.cc index 4be2fcc04..827c482f5 100644 --- a/compiler/cpp/src/thrift/generate/t_py_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_py_generator.cc @@ -252,8 +252,8 @@ public: std::string type_name(t_type* ttype); std::string function_signature(t_function* tfunction, bool interface = false); std::string argument_list(t_struct* tstruct, - std::vector<std::string>* pre = NULL, - std::vector<std::string>* post = NULL); + std::vector<std::string>* pre = nullptr, + std::vector<std::string>* post = nullptr); std::string type_to_enum(t_type* ttype); std::string type_to_spec_args(t_type* ttype); @@ -590,13 +590,13 @@ string t_py_generator::render_const_value(t_type* type, t_const_value* value) { const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map(); map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } indent(out) << render_const_value(g_type_string, v_iter->first) << ": " @@ -832,7 +832,7 @@ void t_py_generator::generate_py_struct_definition(ostream& out, for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { // Initialize fields t_type* type = (*m_iter)->get_type(); - if (!type->is_base_type() && !type->is_enum() && (*m_iter)->get_value() != NULL) { + if (!type->is_base_type() && !type->is_enum() && (*m_iter)->get_value() != nullptr) { indent(out) << "if " << (*m_iter)->get_name() << " is " << "self.thrift_spec[" << (*m_iter)->get_key() << "][4]:" << endl; indent_up(); @@ -987,7 +987,7 @@ void t_py_generator::generate_py_struct_reader(ostream& out, t_struct* tstruct) t_field* tfield = *f_iter; std::ostringstream result; result << tfield->get_name() << " = "; - if (tfield->get_value() != NULL) { + if (tfield->get_value() != nullptr) { result << render_field_default_value(tfield); } else { result << "None"; @@ -1138,7 +1138,7 @@ void t_py_generator::generate_service(t_service* tservice) { f_service_ << py_autogen_comment() << endl << py_imports() << endl; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { f_service_ << "import " << get_real_py_module(tservice->get_extends()->get_program(), gen_twisted_, package_prefix_) << "." << tservice->get_extends()->get_name() << endl; @@ -1227,7 +1227,7 @@ void t_py_generator::generate_py_function_helpers(t_function* tfunction) { void t_py_generator::generate_service_interface(t_service* tservice) { string extends = ""; string extends_if = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); extends_if = "(" + extends + ".Iface)"; } else { @@ -1272,7 +1272,7 @@ void t_py_generator::generate_service_interface(t_service* tservice) { void t_py_generator::generate_service_client(t_service* tservice) { string extends = ""; string extends_client = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); if (gen_zope_interface_) { extends_client = "(" + extends + ".Client)"; @@ -1609,7 +1609,7 @@ void t_py_generator::generate_service_remote(t_service* tservice) { vector<t_function*> functions = tservice->get_functions(); // Get all function from parents t_service* parent = tservice->get_extends(); - while (parent != NULL) { + while (parent != nullptr) { vector<t_function*> p_functions = parent->get_functions(); functions.insert(functions.end(), p_functions.begin(), p_functions.end()); parent = parent->get_extends(); @@ -1818,7 +1818,7 @@ void t_py_generator::generate_service_server(t_service* tservice) { string extends = ""; string extends_processor = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); extends_processor = extends + ".Processor, "; } @@ -2609,7 +2609,7 @@ void t_py_generator::generate_python_docstring(ostream& out, t_doc* tdoc) { string t_py_generator::declare_argument(t_field* tfield) { std::ostringstream result; result << tfield->get_name() << "="; - if (tfield->get_value() != NULL) { + if (tfield->get_value() != nullptr) { result << render_field_default_value(tfield); } else { result << "None"; @@ -2624,7 +2624,7 @@ string t_py_generator::declare_argument(t_field* tfield) { */ string t_py_generator::render_field_default_value(t_field* tfield) { t_type* type = get_true_type(tfield->get_type()); - if (tfield->get_value() != NULL) { + if (tfield->get_value() != nullptr) { return render_const_value(type, tfield->get_value()); } else { return "None"; @@ -2700,7 +2700,7 @@ string t_py_generator::type_name(t_type* ttype) { if (ttype->is_service()) { return get_real_py_module(program, gen_twisted_, package_prefix_) + "." + ttype->get_name(); } - if (program != NULL && program != program_) { + if (program != nullptr && program != program_) { return get_real_py_module(program, gen_twisted_, package_prefix_) + ".ttypes." + ttype->get_name(); } return ttype->get_name(); diff --git a/compiler/cpp/src/thrift/generate/t_rb_generator.cc b/compiler/cpp/src/thrift/generate/t_rb_generator.cc index 61c34811d..116ccaaa7 100644 --- a/compiler/cpp/src/thrift/generate/t_rb_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_rb_generator.cc @@ -460,13 +460,13 @@ t_rb_ofstream& t_rb_generator::render_const_value(t_rb_ofstream& out, const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map(); map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } out.indent(); @@ -713,7 +713,7 @@ void t_rb_generator::generate_field_defns(t_rb_ofstream& out, t_struct* tstruct) void t_rb_generator::generate_field_data(t_rb_ofstream& out, t_type* field_type, const std::string& field_name = "", - t_const_value* field_value = NULL, + t_const_value* field_value = nullptr, bool optional = false) { field_type = get_true_type(field_type); @@ -724,7 +724,7 @@ void t_rb_generator::generate_field_data(t_rb_ofstream& out, out << ", :name => '" << field_name << "'"; } - if (field_value != NULL) { + if (field_value != nullptr) { out << ", :default => "; render_const_value(out, field_type, field_value); } @@ -788,7 +788,7 @@ void t_rb_generator::generate_service(t_service* tservice) { f_service_ << rb_autogen_comment() << endl << render_require_thrift(); - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { if (namespaced_) { f_service_ << "require '" << rb_namespace_to_path_prefix( tservice->get_extends()->get_program()->get_namespace("rb")) @@ -868,7 +868,7 @@ void t_rb_generator::generate_rb_function_helpers(t_function* tfunction) { void t_rb_generator::generate_service_client(t_service* tservice) { string extends = ""; string extends_client = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = full_type_name(tservice->get_extends()); extends_client = " < " + extends + "::Client "; } @@ -992,7 +992,7 @@ void t_rb_generator::generate_service_server(t_service* tservice) { string extends = ""; string extends_processor = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = full_type_name(tservice->get_extends()); extends_processor = " < " + extends + "::Processor "; } diff --git a/compiler/cpp/src/thrift/generate/t_rs_generator.cc b/compiler/cpp/src/thrift/generate/t_rs_generator.cc index b240d991f..bdadf58b1 100644 --- a/compiler/cpp/src/thrift/generate/t_rs_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_rs_generator.cc @@ -2470,7 +2470,7 @@ void t_rs_generator::render_sync_processor(t_service *tservice) { void t_rs_generator::render_sync_handler_trait(t_service *tservice) { string extension = ""; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { t_service* extends = tservice->get_extends(); extension = " : " + rust_namespace(extends) + rust_sync_handler_trait_name(extends); } @@ -2751,7 +2751,7 @@ void t_rs_generator::render_sync_handler_failed(t_function *tfunc) { indent_up(); // if there are any user-defined exceptions for this service call handle them first - if (tfunc->get_xceptions() != NULL && tfunc->get_xceptions()->get_sorted_members().size() > 0) { + if (tfunc->get_xceptions() != nullptr && tfunc->get_xceptions()->get_sorted_members().size() > 0) { string user_err_var("usr_err"); f_gen_ << indent() << "thrift::Error::User(" << user_err_var << ") => {" << endl; indent_up(); @@ -2780,7 +2780,7 @@ void t_rs_generator::render_sync_handler_failed(t_function *tfunc) { } void t_rs_generator::render_sync_handler_failed_user_exception_branch(t_function *tfunc) { - if (tfunc->get_xceptions() == NULL || tfunc->get_xceptions()->get_sorted_members().empty()) { + if (tfunc->get_xceptions() == nullptr || tfunc->get_xceptions()->get_sorted_members().empty()) { throw "cannot render user exception branches if no user exceptions defined"; } @@ -2918,7 +2918,7 @@ string t_rs_generator::handler_successful_return_struct(t_function* tfunc) { } // any user-defined exceptions - if (tfunc->get_xceptions() != NULL) { + if (tfunc->get_xceptions() != nullptr) { t_struct* txceptions = tfunc->get_xceptions(); const vector<t_field*> members = txceptions->get_sorted_members(); vector<t_field*>::const_iterator members_iter; @@ -3170,7 +3170,7 @@ t_field::e_req t_rs_generator::actual_field_req(t_field* tfield, t_rs_generator: } bool t_rs_generator::has_args(t_function* tfunc) { - return tfunc->get_arglist() != NULL && !tfunc->get_arglist()->get_sorted_members().empty(); + return tfunc->get_arglist() != nullptr && !tfunc->get_arglist()->get_sorted_members().empty(); } bool t_rs_generator::has_non_void_args(t_function* tfunc) { diff --git a/compiler/cpp/src/thrift/generate/t_st_generator.cc b/compiler/cpp/src/thrift/generate/t_st_generator.cc index bc95feb66..109adc705 100644 --- a/compiler/cpp/src/thrift/generate/t_st_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_st_generator.cc @@ -406,13 +406,13 @@ string t_st_generator::render_const_value(t_type* type, t_const_value* value) { map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } @@ -934,7 +934,7 @@ void t_st_generator::generate_service_client(t_service* tservice) { vector<t_function*> functions = tservice->get_functions(); vector<t_function*>::iterator f_iter; - if (tservice->get_extends() != NULL) { + if (tservice->get_extends() != nullptr) { extends = type_name(tservice->get_extends()); extends_client = extends + "Client"; } @@ -1000,7 +1000,7 @@ string t_st_generator::argument_list(t_struct* tstruct) { string t_st_generator::type_name(t_type* ttype) { string prefix = ""; t_program* program = ttype->get_program(); - if (program != NULL && program != program_) { + if (program != nullptr && program != program_) { if (!ttype->is_service()) { prefix = program->get_name() + "_types."; } diff --git a/compiler/cpp/src/thrift/generate/t_swift_generator.cc b/compiler/cpp/src/thrift/generate/t_swift_generator.cc index 91181f681..d8eb73310 100644 --- a/compiler/cpp/src/thrift/generate/t_swift_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_swift_generator.cc @@ -1599,7 +1599,7 @@ void t_swift_generator::generate_swift_service_protocol(ostream& out, t_service* indent(out) << "public protocol " << tservice->get_name(); t_service* parent = tservice->get_extends(); - if (parent != NULL) { + if (parent != nullptr) { out << " : " << parent->get_name(); } block_open(out); @@ -1684,7 +1684,7 @@ void t_swift_generator::generate_swift_service_client(ostream& out, t_service* t // Inherit from ParentClient t_service* parent = tservice->get_extends(); - out << " : " << ((parent == NULL) ? "TClient" : parent->get_name() + "Client"); + out << " : " << ((parent == nullptr) ? "TClient" : parent->get_name() + "Client"); out << " /* , " << tservice->get_name() << " */"; block_open(out); out << endl; @@ -1729,7 +1729,7 @@ void t_swift_generator::generate_swift_service_client_async(ostream& out, t_serv // Inherit from ParentClient t_service* parent = tservice->get_extends(); - out << " : " << ((parent == NULL) ? "T" : parent->get_name()) + "AsyncClient<Protocol, Factory>"; + out << " : " << ((parent == nullptr) ? "T" : parent->get_name()) + "AsyncClient<Protocol, Factory>"; out << " /* , " << tservice->get_name() << " */"; block_open(out); @@ -2646,7 +2646,7 @@ void t_swift_generator::render_const_value(ostream& out, for (f_iter = fields.begin(); f_iter != fields.end();) { t_field* tfield = *f_iter; - t_const_value* value = NULL; + t_const_value* value = nullptr; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { if (tfield->get_name() == v_iter->first->get_string()) { value = v_iter->second; diff --git a/compiler/cpp/src/thrift/generate/t_xsd_generator.cc b/compiler/cpp/src/thrift/generate/t_xsd_generator.cc index 379e5a448..d7fb6cf2a 100644 --- a/compiler/cpp/src/thrift/generate/t_xsd_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_xsd_generator.cc @@ -82,7 +82,7 @@ private: void generate_element(std::ostream& out, std::string name, t_type* ttype, - t_struct* attrs = NULL, + t_struct* attrs = nullptr, bool optional = false, bool nillable = false, bool list_element = false); @@ -199,7 +199,7 @@ void t_xsd_generator::generate_element(ostream& out, if (ttype->is_void() || ttype->is_list()) { indent(out) << "<xsd:element name=\"" << name << "\"" << soptional << snillable << ">" << endl; indent_up(); - if (attrs == NULL && ttype->is_void()) { + if (attrs == nullptr && ttype->is_void()) { indent(out) << "<xsd:complexType />" << endl; } else { indent(out) << "<xsd:complexType>" << endl; @@ -216,12 +216,12 @@ void t_xsd_generator::generate_element(ostream& out, } f_php_ << "$GLOBALS['" << program_->get_name() << "_xsd_elt_" << name << "'] = '" << subname << "';" << endl; - generate_element(out, subname, subtype, NULL, false, false, true); + generate_element(out, subname, subtype, nullptr, false, false, true); indent_down(); indent(out) << "</xsd:sequence>" << endl; indent(out) << "<xsd:attribute name=\"list\" type=\"xsd:boolean\" />" << endl; } - if (attrs != NULL) { + if (attrs != nullptr) { const vector<t_field*>& members = attrs->get_members(); vector<t_field*>::const_iterator a_iter; for (a_iter = members.begin(); a_iter != members.end(); ++a_iter) { @@ -235,7 +235,7 @@ void t_xsd_generator::generate_element(ostream& out, indent_down(); indent(out) << "</xsd:element>" << endl; } else { - if (attrs == NULL) { + if (attrs == nullptr) { indent(out) << "<xsd:element name=\"" << name << "\"" << " type=\"" << type_name(ttype) << "\"" << soptional << snillable << " />" << endl; diff --git a/compiler/cpp/src/thrift/main.cc b/compiler/cpp/src/thrift/main.cc index 4c900f713..50bdcea46 100644 --- a/compiler/cpp/src/thrift/main.cc +++ b/compiler/cpp/src/thrift/main.cc @@ -337,7 +337,7 @@ string include_file(string filename) { // Realpath! char rp[THRIFT_PATH_MAX]; // cppcheck-suppress uninitvar - if (saferealpath(filename.c_str(), rp) == NULL) { + if (saferealpath(filename.c_str(), rp) == nullptr) { pwarning(0, "Cannot open include file %s\n", filename.c_str()); return std::string(); } @@ -360,7 +360,7 @@ string include_file(string filename) { // Realpath! char rp[THRIFT_PATH_MAX]; // cppcheck-suppress uninitvar - if (saferealpath(sfilename.c_str(), rp) == NULL) { + if (saferealpath(sfilename.c_str(), rp) == nullptr) { continue; } @@ -382,20 +382,20 @@ string include_file(string filename) { * Also prints a warning if we are discarding information. */ void clear_doctext() { - if (g_doctext != NULL) { + if (g_doctext != nullptr) { pwarning(2, "Uncaptured doctext at on line %d.", g_doctext_lineno); } free(g_doctext); - g_doctext = NULL; + g_doctext = nullptr; } /** * Reset program doctext information after processing a file */ void reset_program_doctext_info() { - if (g_program_doctext_candidate != NULL) { + if (g_program_doctext_candidate != nullptr) { free(g_program_doctext_candidate); - g_program_doctext_candidate = NULL; + g_program_doctext_candidate = nullptr; } g_program_doctext_lineno = 0; g_program_doctext_status = INVALID; @@ -406,7 +406,7 @@ void reset_program_doctext_info() { * We are sure the program doctext candidate is really the program doctext. */ void declare_valid_program_doctext() { - if ((g_program_doctext_candidate != NULL) && (g_program_doctext_status == STILL_CANDIDATE)) { + if ((g_program_doctext_candidate != nullptr) && (g_program_doctext_status == STILL_CANDIDATE)) { g_program_doctext_status = ABSOLUTELY_SURE; pdebug("%s", "program doctext set to ABSOLUTELY_SURE"); } else { @@ -446,7 +446,7 @@ char* clean_up_doctext(char* doctext) { // A very profound docstring. if (lines.empty()) { - return NULL; + return nullptr; } // Clear leading whitespace from the first line. @@ -616,7 +616,7 @@ void dump_docstrings(t_program* program) { * Emits a warning on list<byte>, binary type is typically a much better choice. */ void check_for_list_of_bytes(t_type* list_elem_type) { - if ((g_parse_mode == PROGRAM) && (list_elem_type != NULL) && list_elem_type->is_base_type()) { + if ((g_parse_mode == PROGRAM) && (list_elem_type != nullptr) && list_elem_type->is_base_type()) { t_base_type* tbase = (t_base_type*)list_elem_type; if (tbase->get_base() == t_base_type::TYPE_I8) { pwarning(1, "Consider using the more efficient \"binary\" type instead of \"list<byte>\"."); @@ -640,12 +640,12 @@ void emit_byte_type_warning() { /** * Prints deprecation notice for old NS declarations that are no longer supported - * If new_form is NULL, old_form is assumed to be a language identifier, such as "cpp" - * If new_form is not NULL, both arguments are used exactly as given + * If new_form is nullptr, old_form is assumed to be a language identifier, such as "cpp" + * If new_form is not nullptr, both arguments are used exactly as given */ void error_unsupported_namespace_decl(const char* old_form, const char* new_form) { const char* remainder = ""; - if( new_form == NULL) { + if( new_form == nullptr) { new_form = old_form; remainder = "_namespace"; } @@ -808,13 +808,13 @@ void validate_const_rec(std::string name, t_type* type, t_const_value* value) { if (v_iter->first->get_type() != t_const_value::CV_STRING) { throw "type error: " + name + " struct key must be string"; } - t_type* field_type = NULL; + t_type* field_type = nullptr; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } - if (field_type == NULL) { + if (field_type == nullptr) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } @@ -951,7 +951,7 @@ void parse(t_program* program, t_program* parent_program) { g_parse_mode = PROGRAM; g_program = program; g_scope = program->scope(); - g_parent_scope = (parent_program != NULL) ? parent_program->scope() : NULL; + g_parent_scope = (parent_program != nullptr) ? parent_program->scope() : nullptr; g_parent_prefix = program->get_name() + "."; g_curpath = path; @@ -1004,7 +1004,7 @@ void generate(t_program* program, const vector<string>& generator_strings) { for (iter = generator_strings.begin(); iter != generator_strings.end(); ++iter) { t_generator* generator = t_generator_registry::get_generator(program, *iter); - if (generator == NULL) { + if (generator == nullptr) { pwarning(1, "Unable to get a generator for \"%s\".\n", iter->c_str()); g_generator_failure = true; } else if (generator) { @@ -1032,14 +1032,14 @@ void audit(t_program* new_program, g_incl_searchpath.push_back(old_thrift_include_path); } - parse(old_program, NULL); + parse(old_program, nullptr); g_incl_searchpath = temp_incl_searchpath; if (!new_thrift_include_path.empty()) { g_incl_searchpath.push_back(new_thrift_include_path); } - parse(new_program, NULL); + parse(new_program, nullptr); compare_namespace(new_program, old_program); compare_services(new_program->get_services(), old_program->get_services()); @@ -1059,7 +1059,7 @@ int main(int argc, char** argv) { bool out_path_is_absolute = false; // Setup time string - time_t now = time(NULL); + time_t now = time(nullptr); g_time_str = ctime(&now); // Check for necessary arguments, you gotta have at least a filename and @@ -1081,7 +1081,7 @@ int main(int argc, char** argv) { char* arg; arg = strtok(argv[i], " "); - while (arg != NULL) { + while (arg != nullptr) { // Treat double dashes as single dashes if (arg[0] == '-' && arg[1] == '-') { ++arg; @@ -1109,7 +1109,7 @@ int main(int argc, char** argv) { g_allow_64bit_consts = true; } else if (strcmp(arg, "-gen") == 0) { arg = argv[++i]; - if (arg == NULL) { + if (arg == nullptr) { fprintf(stderr, "Missing generator specification\n"); usage(); } @@ -1118,7 +1118,7 @@ int main(int argc, char** argv) { // An argument of "-I\ asdf" is invalid and has unknown results arg = argv[++i]; - if (arg == NULL) { + if (arg == nullptr) { fprintf(stderr, "Missing Include directory\n"); usage(); } @@ -1126,7 +1126,7 @@ int main(int argc, char** argv) { } else if ((strcmp(arg, "-o") == 0) || (strcmp(arg, "-out") == 0)) { out_path_is_absolute = (strcmp(arg, "-out") == 0) ? true : false; arg = argv[++i]; - if (arg == NULL) { + if (arg == nullptr) { fprintf(stderr, "-o: missing output directory\n"); usage(); } @@ -1144,14 +1144,14 @@ int main(int argc, char** argv) { } else if (strcmp(arg, "-audit") == 0) { g_audit = true; arg = argv[++i]; - if (arg == NULL) { + if (arg == nullptr) { fprintf(stderr, "Missing old thrift file name for audit operation\n"); usage(); } char old_thrift_file_rp[THRIFT_PATH_MAX]; // cppcheck-suppress uninitvar - if (saferealpath(arg, old_thrift_file_rp) == NULL) { + if (saferealpath(arg, old_thrift_file_rp) == nullptr) { failure("Could not open input file with realpath: %s", arg); } old_input_file = string(old_thrift_file_rp); @@ -1159,14 +1159,14 @@ int main(int argc, char** argv) { g_audit_fatal = false; } else if (strcmp(arg, "-Iold") == 0) { arg = argv[++i]; - if (arg == NULL) { + if (arg == nullptr) { fprintf(stderr, "Missing Include directory for old thrift file\n"); usage(); } old_thrift_include_path = string(arg); } else if (strcmp(arg, "-Inew") == 0) { arg = argv[++i]; - if (arg == NULL) { + if (arg == nullptr) { fprintf(stderr, "Missing Include directory for new thrift file\n"); usage(); } @@ -1177,7 +1177,7 @@ int main(int argc, char** argv) { } // Tokenize more - arg = strtok(NULL, " "); + arg = strtok(nullptr, " "); } } @@ -1204,12 +1204,12 @@ int main(int argc, char** argv) { } char new_thrift_file_rp[THRIFT_PATH_MAX]; - if (argv[i] == NULL) { + if (argv[i] == nullptr) { fprintf(stderr, "Missing file name of new thrift file for audit\n"); usage(); } // cppcheck-suppress uninitvar - if (saferealpath(argv[i], new_thrift_file_rp) == NULL) { + if (saferealpath(argv[i], new_thrift_file_rp) == nullptr) { failure("Could not open input file with realpath: %s", argv[i]); } string new_input_file(new_thrift_file_rp); @@ -1230,12 +1230,12 @@ int main(int argc, char** argv) { // Real-pathify it char rp[THRIFT_PATH_MAX]; - if (argv[i] == NULL) { + if (argv[i] == nullptr) { fprintf(stderr, "Missing file name\n"); usage(); } // cppcheck-suppress uninitvar - if (saferealpath(argv[i], rp) == NULL) { + if (saferealpath(argv[i], rp) == nullptr) { failure("Could not open input file with realpath: %s", argv[i]); } string input_file(rp); @@ -1259,7 +1259,7 @@ int main(int argc, char** argv) { program->set_include_prefix(include_prefix); // Parse it! - parse(program, NULL); + parse(program, nullptr); // The current path is not really relevant when we are doing generation. // Reset the variable to make warning messages clearer. diff --git a/compiler/cpp/src/thrift/main.h b/compiler/cpp/src/thrift/main.h index 163b02e4b..4615ace2b 100644 --- a/compiler/cpp/src/thrift/main.h +++ b/compiler/cpp/src/thrift/main.h @@ -103,8 +103,8 @@ void emit_byte_type_warning(); /** * Prints deprecation notice for old NS declarations that are no longer supported - * If new_form is NULL, old_form is assumed to be a language identifier, such as "cpp" - * If new_form is not NULL, both arguments are used exactly as given + * If new_form is nullptr, old_form is assumed to be a language identifier, such as "cpp" + * If new_form is not nullptr, both arguments are used exactly as given */ void error_unsupported_namespace_decl(const char* old_form, const char* new_form = nullptr); diff --git a/compiler/cpp/src/thrift/parse/t_typedef.cc b/compiler/cpp/src/thrift/parse/t_typedef.cc index c80868560..48e861e8d 100644 --- a/compiler/cpp/src/thrift/parse/t_typedef.cc +++ b/compiler/cpp/src/thrift/parse/t_typedef.cc @@ -26,9 +26,9 @@ t_type* t_typedef::get_type() { } const t_type* t_typedef::get_type() const { - if (type_ == NULL) { + if (type_ == nullptr) { const t_type* type = get_program()->scope()->get_type(symbolic_); - if (type == NULL) { + if (type == nullptr) { printf("Type \"%s\" not defined\n", symbolic_.c_str()); exit(1); } diff --git a/compiler/cpp/src/thrift/thriftl.ll b/compiler/cpp/src/thrift/thriftl.ll index 5f0ebd985..377351649 100644 --- a/compiler/cpp/src/thrift/thriftl.ll +++ b/compiler/cpp/src/thrift/thriftl.ll @@ -159,7 +159,7 @@ literal_begin (['\"]) g_doctext[strlen(g_doctext) - 1] = '\0'; g_doctext = clean_up_doctext(g_doctext); g_doctext_lineno = yylineno; - if( (g_program_doctext_candidate == NULL) && (g_program_doctext_status == INVALID)){ + if( (g_program_doctext_candidate == nullptr) && (g_program_doctext_status == INVALID)){ g_program_doctext_candidate = strdup(g_doctext); g_program_doctext_lineno = g_doctext_lineno; g_program_doctext_status = STILL_CANDIDATE; @@ -264,7 +264,7 @@ literal_begin (['\"]) {intconstant} { errno = 0; - yylval.iconst = strtoll(yytext, NULL, 10); + yylval.iconst = strtoll(yytext, nullptr, 10); if (errno == ERANGE) { integer_overflow(yytext); } @@ -275,7 +275,7 @@ literal_begin (['\"]) errno = 0; char sign = yytext[0]; int shift = sign == '0' ? 2 : 3; - yylval.iconst = strtoll(yytext+shift, NULL, 16); + yylval.iconst = strtoll(yytext+shift, nullptr, 16); if (sign == '-') { yylval.iconst = -yylval.iconst; } diff --git a/compiler/cpp/src/thrift/thrifty.yy b/compiler/cpp/src/thrift/thrifty.yy index df34adf04..dc6838a54 100644 --- a/compiler/cpp/src/thrift/thrifty.yy +++ b/compiler/cpp/src/thrift/thrifty.yy @@ -250,7 +250,7 @@ Program: HeaderList DefinitionList { pdebug("Program -> Headers DefinitionList"); - if((g_program_doctext_candidate != NULL) && (g_program_doctext_status != ALREADY_PROCESSED)) + if((g_program_doctext_candidate != nullptr) && (g_program_doctext_status != ALREADY_PROCESSED)) { g_program->set_doc(g_program_doctext_candidate); g_program_doctext_status = ALREADY_PROCESSED; @@ -262,9 +262,9 @@ CaptureDocText: { if (g_parse_mode == PROGRAM) { $$ = g_doctext; - g_doctext = NULL; + g_doctext = nullptr; } else { - $$ = NULL; + $$ = nullptr; } } @@ -300,7 +300,7 @@ Header: if (g_parse_mode == PROGRAM) { g_program->set_namespace($2, $3); } - if ($4 != NULL) { + if ($4 != nullptr) { g_program->set_namespace_annotations($2, $4->annotations_); delete $4; } @@ -339,7 +339,7 @@ DefinitionList: DefinitionList CaptureDocText Definition { pdebug("DefinitionList -> DefinitionList Definition"); - if ($2 != NULL && $3 != NULL) { + if ($2 != nullptr && $3 != nullptr) { $3->set_doc($2); } } @@ -362,7 +362,7 @@ Definition: pdebug("Definition -> TypeDefinition"); if (g_parse_mode == PROGRAM) { g_scope->add_type($1->get_name(), $1); - if (g_parent_scope != NULL) { + if (g_parent_scope != nullptr) { g_parent_scope->add_type(g_parent_prefix + $1->get_name(), $1); } if (! g_program->is_unique_typename($1)) { @@ -377,7 +377,7 @@ Definition: pdebug("Definition -> Service"); if (g_parse_mode == PROGRAM) { g_scope->add_service($1->get_name(), $1); - if (g_parent_scope != NULL) { + if (g_parent_scope != nullptr) { g_parent_scope->add_service(g_parent_prefix + $1->get_name(), $1); } g_program->add_service($1); @@ -441,7 +441,7 @@ Typedef: validate_simple_identifier( $3); t_typedef *td = new t_typedef(g_program, $2, $3); $$ = td; - if ($4 != NULL) { + if ($4 != nullptr) { $$->annotations_ = $4->annotations_; delete $4; } @@ -454,7 +454,7 @@ Enum: $$ = $4; validate_simple_identifier( $2); $$->set_name($2); - if ($6 != NULL) { + if ($6 != nullptr) { $$->annotations_ = $6->annotations_; delete $6; } @@ -468,7 +468,7 @@ Enum: t_const_value* const_val = new t_const_value((*c_iter)->get_value()); const_val->set_enum($$); g_scope->add_constant(const_name, new t_const(g_type_i32, (*c_iter)->get_name(), const_val)); - if (g_parent_scope != NULL) { + if (g_parent_scope != nullptr) { g_parent_scope->add_constant(g_parent_prefix + const_name, new t_const(g_type_i32, (*c_iter)->get_name(), const_val)); } } @@ -494,10 +494,10 @@ EnumDef: { pdebug("EnumDef -> EnumValue"); $$ = $2; - if ($1 != NULL) { + if ($1 != nullptr) { $$->set_doc($1); } - if ($3 != NULL) { + if ($3 != nullptr) { $$->annotations_ = $3->annotations_; delete $3; } @@ -536,7 +536,7 @@ Senum: pdebug("Senum -> tok_senum tok_identifier { SenumDefList }"); validate_simple_identifier( $2); $$ = new t_typedef(g_program, $4, $2); - if ($6 != NULL) { + if ($6 != nullptr) { $$->annotations_ = $6->annotations_; delete $6; } @@ -574,11 +574,11 @@ Const: validate_const_type($$); g_scope->add_constant($3, $$); - if (g_parent_scope != NULL) { + if (g_parent_scope != nullptr) { g_parent_scope->add_constant(g_parent_prefix + $3, $$); } } else { - $$ = NULL; + $$ = nullptr; } } @@ -681,7 +681,7 @@ Struct: $5->set_union($1 == struct_is_union); $$ = $5; $$->set_name($2); - if ($7 != NULL) { + if ($7 != nullptr) { $$->annotations_ = $7->annotations_; delete $7; } @@ -724,7 +724,7 @@ XsdAttributes: } | { - $$ = NULL; + $$ = nullptr; } Xception: @@ -735,7 +735,7 @@ Xception: $4->set_name($2); $4->set_xception(true); $$ = $4; - if ($6 != NULL) { + if ($6 != nullptr) { $$->annotations_ = $6->annotations_; delete $6; } @@ -749,7 +749,7 @@ Service: $$ = $6; $$->set_name($2); $$->set_extends($3); - if ($9 != NULL) { + if ($9 != nullptr) { $$->annotations_ = $9->annotations_; delete $9; } @@ -769,10 +769,10 @@ Extends: tok_extends tok_identifier { pdebug("Extends -> tok_extends tok_identifier"); - $$ = NULL; + $$ = nullptr; if (g_parse_mode == PROGRAM) { $$ = g_scope->get_service($2); - if ($$ == NULL) { + if ($$ == nullptr) { yyerror("Service \"%s\" has not been defined.", $2); exit(1); } @@ -780,7 +780,7 @@ Extends: } | { - $$ = NULL; + $$ = nullptr; } FunctionList: @@ -802,10 +802,10 @@ Function: validate_simple_identifier( $4); $6->set_name(std::string($4) + "_args"); $$ = new t_function($3, $4, $6, $8, $2); - if ($1 != NULL) { + if ($1 != nullptr) { $$->set_doc($1); } - if ($9 != NULL) { + if ($9 != nullptr) { $$->annotations_ = $9->annotations_; delete $9; } @@ -868,20 +868,20 @@ Field: $$ = new t_field($4, $6, $2.value); $$->set_reference($5); $$->set_req($3); - if ($7 != NULL) { + if ($7 != nullptr) { g_scope->resolve_const_value($7, $4); validate_field_value($$, $7); $$->set_value($7); } $$->set_xsd_optional($8); $$->set_xsd_nillable($9); - if ($1 != NULL) { + if ($1 != nullptr) { $$->set_doc($1); } - if ($10 != NULL) { + if ($10 != nullptr) { $$->set_xsd_attrs($10); } - if ($11 != NULL) { + if ($11 != nullptr) { $$->annotations_ = $11->annotations_; delete $11; } @@ -974,12 +974,12 @@ FieldValue: if (g_parse_mode == PROGRAM) { $$ = $2; } else { - $$ = NULL; + $$ = nullptr; } } | { - $$ = NULL; + $$ = nullptr; } FunctionType: @@ -1000,11 +1000,11 @@ FieldType: pdebug("FieldType -> tok_identifier"); if (g_parse_mode == INCLUDES) { // Ignore identifiers in include mode - $$ = NULL; + $$ = nullptr; } else { // Lookup the identifier in the current scope $$ = g_scope->get_type($1); - if ($$ == NULL) { + if ($$ == nullptr) { /* * Either this type isn't yet declared, or it's never declared. Either way allow it and we'll figure it out @@ -1028,7 +1028,7 @@ FieldType: BaseType: SimpleBaseType TypeAnnotations { pdebug("BaseType -> SimpleBaseType TypeAnnotations"); - if ($2 != NULL) { + if ($2 != nullptr) { $$ = new t_base_type(*static_cast<t_base_type*>($1)); $$->annotations_ = $2->annotations_; delete $2; @@ -1088,7 +1088,7 @@ ContainerType: SimpleContainerType TypeAnnotations { pdebug("ContainerType -> SimpleContainerType TypeAnnotations"); $$ = $1; - if ($2 != NULL) { + if ($2 != nullptr) { $$->annotations_ = $2->annotations_; delete $2; } @@ -1116,7 +1116,7 @@ MapType: { pdebug("MapType -> tok_map <FieldType, FieldType>"); $$ = new t_map($4, $6); - if ($2 != NULL) { + if ($2 != nullptr) { ((t_container*)$$)->set_cpp_name(std::string($2)); } } @@ -1126,7 +1126,7 @@ SetType: { pdebug("SetType -> tok_set<FieldType>"); $$ = new t_set($4); - if ($2 != NULL) { + if ($2 != nullptr) { ((t_container*)$$)->set_cpp_name(std::string($2)); } } @@ -1137,7 +1137,7 @@ ListType: pdebug("ListType -> tok_list<FieldType>"); check_for_list_of_bytes($3); $$ = new t_list($3); - if ($5 != NULL) { + if ($5 != nullptr) { ((t_container*)$$)->set_cpp_name(std::string($5)); } } @@ -1149,7 +1149,7 @@ CppType: } | { - $$ = NULL; + $$ = nullptr; } TypeAnnotations: @@ -1160,7 +1160,7 @@ TypeAnnotations: } | { - $$ = NULL; + $$ = nullptr; } TypeAnnotationList: diff --git a/contrib/async-test/test-server.cpp b/contrib/async-test/test-server.cpp index b304e1bc9..9e696c92c 100644 --- a/contrib/async-test/test-server.cpp +++ b/contrib/async-test/test-server.cpp @@ -28,7 +28,7 @@ class AggrAsyncHandler : public AggrCobSvIf { public: AggrAsyncHandler() - : eb_(NULL) + : eb_(nullptr) , pfact_(new TBinaryProtocolFactory()) { leaf_ports_.push_back(8081); diff --git a/contrib/fb303/TClientInfo.cpp b/contrib/fb303/TClientInfo.cpp index 1fc661251..a4b00cf2d 100644 --- a/contrib/fb303/TClientInfo.cpp +++ b/contrib/fb303/TClientInfo.cpp @@ -34,7 +34,7 @@ void TClientInfoConnection::recordAddr(const sockaddr* addr) { eraseAddr(); initTime(); ncalls_ = 0; - if (addr != NULL) { + if (addr != nullptr) { if (addr->sa_family == AF_INET) { memcpy((void*)&addr_.ipv4, (const void *)addr, sizeof(sockaddr_in)); } @@ -55,7 +55,7 @@ const char* TClientInfoConnection::getAddr(char* buf, int len) const { case AF_INET6: return inet_ntop(AF_INET6, &addr_.ipv6.sin6_addr, buf, len); default: - return NULL; + return nullptr; } } @@ -70,7 +70,7 @@ void TClientInfoConnection::eraseCall() { const char* TClientInfoConnection::getCall() const { if (call_[0] == '\0') { - return NULL; + return nullptr; } return call_; } @@ -90,7 +90,7 @@ void TClientInfoConnection::initTime() { TClientInfoConnection* TClientInfo::getConnection(int fd, bool grow) { if (fd < 0 || (!grow && fd >= info_.size())) { - return NULL; + return nullptr; } return &info_[fd]; } @@ -119,7 +119,7 @@ void TClientInfoServerHandler::deleteContext(void* connectionContext, void TClientInfoServerHandler::processContext(void* connectionContext, shared_ptr<TTransport> transport) { Connect* call = static_cast<Connect*>(connectionContext); - if (call->callInfo_ == NULL) { + if (call->callInfo_ == nullptr) { if (typeid(*(transport.get())) == typeid(TSocket)) { TSocket* tsocket = static_cast<TSocket*>(transport.get()); int fd = tsocket->getSocketFD(); @@ -127,7 +127,7 @@ void TClientInfoServerHandler::processContext(void* connectionContext, return; } call->callInfo_ = call->clientInfo_->getConnection(fd, true); - assert(call->callInfo_ != NULL); + assert(call->callInfo_ != nullptr); socklen_t len; call->callInfo_->recordAddr(tsocket->getCachedAddress(&len)); } @@ -142,13 +142,13 @@ void TClientInfoServerHandler::getStatsStrings(vector<string>& result) { for (int i = 0; i < clientInfo_.size(); ++i) { TClientInfoConnection* info = clientInfo_.getConnection(i, false); const char* callStr = info->getCall(); - if (callStr == NULL) { + if (callStr == nullptr) { continue; } char addrBuf[INET6_ADDRSTRLEN]; const char* addrStr = info->getAddr(addrBuf, sizeof addrBuf); - if (addrStr == NULL) { + if (addrStr == nullptr) { // cerr << "no addr!" << endl; continue; } @@ -168,11 +168,11 @@ void TClientInfoServerHandler::getStatsStrings(vector<string>& result) { void* TClientInfoCallHandler::getContext(const char* fn_name, void* serverContext) { if (serverContext) { TClientInfoConnection* callInfo = static_cast<TClientInfoServerHandler::Connect*>(serverContext)->callInfo_; - if (callInfo != NULL) { + if (callInfo != nullptr) { callInfo->recordCall(fn_name); } } - return NULL; + return nullptr; } } } } // namespace apache::thrift::server diff --git a/contrib/fb303/TClientInfo.h b/contrib/fb303/TClientInfo.h index 6668c1921..e3859a71e 100644 --- a/contrib/fb303/TClientInfo.h +++ b/contrib/fb303/TClientInfo.h @@ -174,7 +174,7 @@ class TClientInfoConnection { void eraseAddr(); /** - * Return a string representing the present address, or NULL if none. + * Return a string representing the present address, or nullptr if none. * Copies the string into the buffer provided. */ const char* getAddr(char* buf, int len) const; @@ -193,7 +193,7 @@ class TClientInfoConnection { /** * Return as string the thrift call either currently being processed or * most recently processed if the connection is still open for additional - * calls. Returns NULL if a call hasn't been made yet or processing + * calls. Returns nullptr if a call hasn't been made yet or processing * has ended. */ const char* getCall() const; @@ -229,7 +229,7 @@ class TClientInfo { * Return the info object for a given file descriptor. If "grow" is true * extend the info vector if required (such as for a file descriptor not seen * before). If "grow" is false and the info vector isn't large enough, - * or if "fd" is negative, return NULL. + * or if "fd" is negative, return nullptr. */ TClientInfoConnection* getConnection(int fd, bool grow); @@ -258,7 +258,7 @@ class TClientInfoServerHandler : public TServerEventHandler { explicit Connect(TClientInfo* clientInfo) : clientInfo_(clientInfo) - , callInfo_(NULL) { + , callInfo_(nullptr) { } }; diff --git a/contrib/fb303/cpp/FacebookBase.cpp b/contrib/fb303/cpp/FacebookBase.cpp index 3c569759c..eb2e63cc5 100644 --- a/contrib/fb303/cpp/FacebookBase.cpp +++ b/contrib/fb303/cpp/FacebookBase.cpp @@ -24,7 +24,7 @@ using apache::thrift::concurrency::Guard; FacebookBase::FacebookBase(std::string name) : name_(name) { - aliveSince_ = (int64_t) time(NULL); + aliveSince_ = (int64_t) time(nullptr); } inline void FacebookBase::getName(std::string& _return) { diff --git a/contrib/fb303/cpp/FacebookBase.h b/contrib/fb303/cpp/FacebookBase.h index daa524644..e0be4bf2e 100644 --- a/contrib/fb303/cpp/FacebookBase.h +++ b/contrib/fb303/cpp/FacebookBase.h @@ -65,7 +65,7 @@ class FacebookBase : virtual public FacebookServiceIf { virtual void reinitialize() {} virtual void shutdown() { - if (server_.get() != NULL) { + if (server_.get() != nullptr) { server_->stop(); } } diff --git a/contrib/fb303/cpp/ServiceTracker.cpp b/contrib/fb303/cpp/ServiceTracker.cpp index 7a61b21a9..a2e670c76 100644 --- a/contrib/fb303/cpp/ServiceTracker.cpp +++ b/contrib/fb303/cpp/ServiceTracker.cpp @@ -46,7 +46,7 @@ ServiceTracker::ServiceTracker(facebook::fb303::FacebookBase *handler, checkpointServices_(0) { if (featureCheckpoint_) { - time_t now = time(NULL); + time_t now = time(nullptr); checkpointTime_ = now; } else { checkpointTime_ = 0; @@ -105,7 +105,7 @@ ServiceTracker::startService(const ServiceMethod &serviceMethod) if (featureThreadCheck_ && !serviceMethod.featureLogOnly_) { // note: Might want to put these messages in reportCheckpoint() if // log is getting spammed. - if (threadManager_ != NULL) { + if (threadManager_ != nullptr) { size_t idle_count = threadManager_->idleWorkerCount(); if (idle_count == 0) { stringstream message; @@ -211,7 +211,7 @@ ServiceTracker::finishService(const ServiceMethod &serviceMethod) // maybe report checkpoint // note: ...if it's been long enough since the last report. - time_t now = time(NULL); + time_t now = time(nullptr); uint64_t check_interval = now - checkpointTime_; if (check_interval >= CHECKPOINT_MINIMUM_INTERVAL_SECONDS) { reportCheckpoint(); @@ -239,7 +239,7 @@ ServiceTracker::finishService(const ServiceMethod &serviceMethod) void ServiceTracker::reportCheckpoint() { - time_t now = time(NULL); + time_t now = time(nullptr); uint64_t check_count = checkpointServices_; uint64_t check_interval = now - checkpointTime_; @@ -282,7 +282,7 @@ ServiceTracker::reportCheckpoint() << " checkpoint_speed_sum:" << check_duration << " lifetime_time:" << life_interval << " lifetime_services:" << life_count; - if (featureThreadCheck_ && threadManager_ != NULL) { + if (featureThreadCheck_ && threadManager_ != nullptr) { size_t worker_count = threadManager_->workerCount(); size_t idle_count = threadManager_->idleWorkerCount(); message << " total_workers:" << worker_count @@ -321,7 +321,7 @@ ServiceTracker::defaultLogMethod(int level, const string &message) { if (level <= LOG_LEVEL) { string level_string; - time_t now = time(NULL); + time_t now = time(nullptr); char now_pretty[26]; ctime_r(&now, now_pretty); now_pretty[24] = '\0'; @@ -356,20 +356,20 @@ ServiceTracker::defaultLogMethod(int level, const string &message) */ Stopwatch::Stopwatch() { - gettimeofday(&startTime_, NULL); + gettimeofday(&startTime_, nullptr); } void Stopwatch::reset() { - gettimeofday(&startTime_, NULL); + gettimeofday(&startTime_, nullptr); } uint64_t Stopwatch::elapsedUnits(Stopwatch::Unit unit, string *label) const { timeval now_time; - gettimeofday(&now_time, NULL); + gettimeofday(&now_time, nullptr); time_t duration_secs = now_time.tv_sec - startTime_.tv_sec; uint64_t duration_units; @@ -377,7 +377,7 @@ Stopwatch::elapsedUnits(Stopwatch::Unit unit, string *label) const case UNIT_SECONDS: duration_units = duration_secs + (now_time.tv_usec - startTime_.tv_usec + 500000) / 1000000; - if (NULL != label) { + if (nullptr != label) { stringstream ss_label; ss_label << duration_units << " secs"; label->assign(ss_label.str()); @@ -386,7 +386,7 @@ Stopwatch::elapsedUnits(Stopwatch::Unit unit, string *label) const case UNIT_MICROSECONDS: duration_units = duration_secs * 1000000 + now_time.tv_usec - startTime_.tv_usec; - if (NULL != label) { + if (nullptr != label) { stringstream ss_label; ss_label << duration_units << " us"; label->assign(ss_label.str()); @@ -396,7 +396,7 @@ Stopwatch::elapsedUnits(Stopwatch::Unit unit, string *label) const default: duration_units = duration_secs * 1000 + (now_time.tv_usec - startTime_.tv_usec + 500) / 1000; - if (NULL != label) { + if (nullptr != label) { stringstream ss_label; ss_label << duration_units << " ms"; label->assign(ss_label.str()); diff --git a/contrib/fb303/cpp/ServiceTracker.h b/contrib/fb303/cpp/ServiceTracker.h index 9a3edd8f1..faaa4a72d 100644 --- a/contrib/fb303/cpp/ServiceTracker.h +++ b/contrib/fb303/cpp/ServiceTracker.h @@ -120,7 +120,7 @@ class Stopwatch public: enum Unit { UNIT_SECONDS, UNIT_MILLISECONDS, UNIT_MICROSECONDS }; Stopwatch(); - uint64_t elapsedUnits(Unit unit, std::string *label = NULL) const; + uint64_t elapsedUnits(Unit unit, std::string *label = nullptr) const; void reset(); private: timeval startTime_; diff --git a/contrib/transport-sample/ThriftCommon.cpp b/contrib/transport-sample/ThriftCommon.cpp index 60ebf7a00..2b676a88e 100644 --- a/contrib/transport-sample/ThriftCommon.cpp +++ b/contrib/transport-sample/ThriftCommon.cpp @@ -23,7 +23,7 @@ namespace thriftcommon (int)boost::shared_dynamic_cast<TPipeServer>(transport)->getClientWrtPipeHandle()); //spawn the child process - if (!CreateProcessA(NULL, handles, NULL,NULL,TRUE,0,NULL,NULL,&si,&pi)) + if (!CreateProcessA(nullptr, handles, nullptr,nullptr,TRUE,0,nullptr,nullptr,&si,&pi)) { GlobalOutput.perror("TPipeServer CreateProcess failed, GLE=", GetLastError()); return false; diff --git a/contrib/zeromq/TZmqServer.cpp b/contrib/zeromq/TZmqServer.cpp index 88660a330..1ad7db804 100644 --- a/contrib/zeromq/TZmqServer.cpp +++ b/contrib/zeromq/TZmqServer.cpp @@ -41,7 +41,7 @@ bool TZmqServer::serveOne(int recv_flags) { outputProtocolFactory_->getProtocol(outputTransport)); shared_ptr<TMemoryBuffer> transport(new TMemoryBuffer); - processor_->process(inputProtocol, outputProtocol, NULL); + processor_->process(inputProtocol, outputProtocol, nullptr); if (zmq_type_ == ZMQ_REP) { uint8_t* buf; diff --git a/lib/c_glib/test/testthrifttestclient.cpp b/lib/c_glib/test/testthrifttestclient.cpp index 20fbcdb03..5732996ef 100644 --- a/lib/c_glib/test/testthrifttestclient.cpp +++ b/lib/c_glib/test/testthrifttestclient.cpp @@ -384,11 +384,11 @@ test_thrift_client (void) // create a C client tsocket = (ThriftSocket *) g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost", - "port", TEST_PORT, NULL); + "port", TEST_PORT, nullptr); protocol = (ThriftBinaryProtocol *) g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport", - tsocket, NULL); - client = (TTestThriftTestClient *) g_object_new (T_TEST_TYPE_THRIFT_TEST_CLIENT, "input_protocol", protocol, "output_protocol", protocol, NULL); + tsocket, nullptr); + client = (TTestThriftTestClient *) g_object_new (T_TEST_TYPE_THRIFT_TEST_CLIENT, "input_protocol", protocol, "output_protocol", protocol, nullptr); iface = T_TEST_THRIFT_TEST_IF (client); // open and send diff --git a/lib/cpp/src/thrift/TOutput.cpp b/lib/cpp/src/thrift/TOutput.cpp index 800ba0751..a30879acd 100644 --- a/lib/cpp/src/thrift/TOutput.cpp +++ b/lib/cpp/src/thrift/TOutput.cpp @@ -122,8 +122,8 @@ std::string TOutput::strerror_s(int errno_copy) { #else // HAVE_STRERROR_R #ifdef _WIN32 const size_t size = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, errno_copy, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - b_errbuf, sizeof(b_errbuf), NULL); + nullptr, errno_copy, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + b_errbuf, sizeof(b_errbuf), nullptr); if (size > 2 && b_errbuf[size-2] == '\r' && b_errbuf[size-1] == '\n') { b_errbuf[size-2] = '\0'; diff --git a/lib/cpp/src/thrift/VirtualProfiling.cpp b/lib/cpp/src/thrift/VirtualProfiling.cpp index 6ce346b82..4d752cf1e 100644 --- a/lib/cpp/src/thrift/VirtualProfiling.cpp +++ b/lib/cpp/src/thrift/VirtualProfiling.cpp @@ -112,7 +112,7 @@ public: void* getFrame(int index) const { int adjusted_index = index + skip_; if (adjusted_index < 0 || adjusted_index >= numCallers_) { - return NULL; + return nullptr; } return callers_[adjusted_index]; } @@ -151,7 +151,7 @@ public: }; Key(const Backtrace* bt, const std::type_info& type_info) - : backtrace_(bt), typeName1_(type_info.name()), typeName2_(NULL) {} + : backtrace_(bt), typeName1_(type_info.name()), typeName2_(nullptr) {} Key(const Backtrace* bt, const std::type_info& type_info1, const std::type_info& type_info2) : backtrace_(bt), typeName1_(type_info1.name()), typeName2_(type_info2.name()) {} @@ -189,7 +189,7 @@ public: */ void cleanup() { delete backtrace_; - backtrace_ = NULL; + backtrace_ = nullptr; } int cmp(const Key& k) const { diff --git a/lib/cpp/src/thrift/server/TNonblockingServer.cpp b/lib/cpp/src/thrift/server/TNonblockingServer.cpp index 26ffa686f..ea394c804 100644 --- a/lib/cpp/src/thrift/server/TNonblockingServer.cpp +++ b/lib/cpp/src/thrift/server/TNonblockingServer.cpp @@ -1341,7 +1341,7 @@ bool TNonblockingIOThread::notify(TNonblockingServer::TConnection* conn) { FD_ZERO(&efds); FD_SET(fd, &wfds); FD_SET(fd, &efds); - ret = select(static_cast<int>(fd + 1), NULL, &wfds, &efds, NULL); + ret = select(static_cast<int>(fd + 1), nullptr, &wfds, &efds, nullptr); if (ret < 0) { return false; } else if (ret == 0) { diff --git a/lib/cpp/src/thrift/server/TNonblockingServer.h b/lib/cpp/src/thrift/server/TNonblockingServer.h index e44c7ee4c..65e569dcf 100644 --- a/lib/cpp/src/thrift/server/TNonblockingServer.h +++ b/lib/cpp/src/thrift/server/TNonblockingServer.h @@ -158,7 +158,7 @@ private: /// The optional user-provided event-base (for single-thread servers) event_base* userEventBase_; - /// For processing via thread pool, may be NULL + /// For processing via thread pool, may be nullptr std::shared_ptr<ThreadManager> threadManager_; /// Is thread pool processing? diff --git a/lib/cpp/src/thrift/transport/TBufferTransports.cpp b/lib/cpp/src/thrift/transport/TBufferTransports.cpp index 329d22023..d8a1b3e28 100644 --- a/lib/cpp/src/thrift/transport/TBufferTransports.cpp +++ b/lib/cpp/src/thrift/transport/TBufferTransports.cpp @@ -112,7 +112,7 @@ void TBufferedTransport::writeSlow(const uint8_t* buf, uint32_t len) { const uint8_t* TBufferedTransport::borrowSlow(uint8_t* buf, uint32_t* len) { (void)buf; (void)len; - // Simply return NULL. We don't know if there is actually data available on + // Simply return nullptr. We don't know if there is actually data available on // the underlying transport, so calling read() might block. return nullptr; } diff --git a/lib/cpp/src/thrift/transport/TBufferTransports.h b/lib/cpp/src/thrift/transport/TBufferTransports.h index df06586bd..86f0c5acc 100644 --- a/lib/cpp/src/thrift/transport/TBufferTransports.h +++ b/lib/cpp/src/thrift/transport/TBufferTransports.h @@ -137,7 +137,7 @@ protected: /** * Slow path borrow. * - * POSTCONDITION: return == NULL || rBound_ - rBase_ >= *len + * POSTCONDITION: return == nullptr || rBound_ - rBase_ >= *len */ virtual const uint8_t* borrowSlow(uint8_t* buf, uint32_t* len) = 0; @@ -245,7 +245,7 @@ public: /** * The following behavior is currently implemented by TBufferedTransport, * but that may change in a future version: - * 1/ If len is at most rBufSize_, borrow will never return NULL. + * 1/ If len is at most rBufSize_, borrow will never return nullptr. * Depending on the underlying transport, it could throw an exception * or hang forever. * 2/ Some borrow requests may copy bytes internally. However, diff --git a/lib/cpp/src/thrift/transport/TNonblockingServerTransport.h b/lib/cpp/src/thrift/transport/TNonblockingServerTransport.h index f81132869..e8997d784 100644 --- a/lib/cpp/src/thrift/transport/TNonblockingServerTransport.h +++ b/lib/cpp/src/thrift/transport/TNonblockingServerTransport.h @@ -49,7 +49,7 @@ public: * Gets a new dynamically allocated transport object and passes it to the * caller. Note that it is the explicit duty of the caller to free the * allocated object. The returned TTransport object must always be in the - * opened state. NULL should never be returned, instead an Exception should + * opened state. nullptr should never be returned, instead an Exception should * always be thrown. * * @return A new TTransport object @@ -58,7 +58,7 @@ public: std::shared_ptr<TSocket> accept() { std::shared_ptr<TSocket> result = acceptImpl(); if (!result) { - throw TTransportException("accept() may not return NULL"); + throw TTransportException("accept() may not return nullptr"); } return result; } diff --git a/lib/cpp/src/thrift/transport/TPipe.cpp b/lib/cpp/src/thrift/transport/TPipe.cpp index 72af4fcd6..4c2fea927 100644 --- a/lib/cpp/src/thrift/transport/TPipe.cpp +++ b/lib/cpp/src/thrift/transport/TPipe.cpp @@ -183,7 +183,7 @@ void pseudo_sync_write(HANDLE pipe, HANDLE event, const uint8_t* buf, uint32_t l uint32_t written = 0; while (written < len) { - BOOL result = ::WriteFile(pipe, buf + written, len - written, NULL, &tempOverlap); + BOOL result = ::WriteFile(pipe, buf + written, len - written, nullptr, &tempOverlap); if (result == FALSE && ::GetLastError() != ERROR_IO_PENDING) { GlobalOutput.perror("TPipe ::WriteFile errored GLE=", ::GetLastError()); @@ -205,7 +205,7 @@ uint32_t pseudo_sync_read(HANDLE pipe, HANDLE event, uint8_t* buf, uint32_t len) memset(&tempOverlap, 0, sizeof(tempOverlap)); tempOverlap.hEvent = event; - BOOL result = ::ReadFile(pipe, buf, len, NULL, &tempOverlap); + BOOL result = ::ReadFile(pipe, buf, len, nullptr, &tempOverlap); if (result == FALSE && ::GetLastError() != ERROR_IO_PENDING) { GlobalOutput.perror("TPipe ::ReadFile errored GLE=", ::GetLastError()); @@ -255,7 +255,7 @@ TPipe::~TPipe() { // Transport callbacks //--------------------------------------------------------- bool TPipe::isOpen() const { - return impl_.get() != NULL; + return impl_.get() != nullptr; } bool TPipe::peek() { @@ -272,10 +272,10 @@ void TPipe::open() { hPipe.reset(CreateFileA(pipename_.c_str(), GENERIC_READ | GENERIC_WRITE, 0, // no sharing - NULL, // default security attributes + nullptr, // default security attributes OPEN_EXISTING, // opens existing pipe flags, - NULL)); // no template file + nullptr)); // no template file if (hPipe.h != INVALID_HANDLE_VALUE) break; // success! @@ -310,7 +310,7 @@ uint32_t pipe_read(HANDLE pipe, uint8_t* buf, uint32_t len) { buf, // buffer to receive reply len, // size of buffer &cbRead, // number of bytes read - NULL); // not overlapped + nullptr); // not overlapped if (!fSuccess && GetLastError() != ERROR_MORE_DATA) return 0; // No more data, possibly because client disconnected. @@ -330,7 +330,7 @@ void pipe_write(HANDLE pipe, const uint8_t* buf, uint32_t len) { buf, // message len, // message length &cbWritten, // bytes written - NULL); // not overlapped + nullptr); // not overlapped if (!fSuccess) throw TTransportException(TTransportException::NOT_OPEN, "Write to pipe failed"); diff --git a/lib/cpp/src/thrift/transport/TPipeServer.cpp b/lib/cpp/src/thrift/transport/TPipeServer.cpp index e1cee80ef..27635513c 100644 --- a/lib/cpp/src/thrift/transport/TPipeServer.cpp +++ b/lib/cpp/src/thrift/transport/TPipeServer.cpp @@ -50,7 +50,7 @@ public: virtual HANDLE getWrtPipeHandle() = 0; virtual HANDLE getClientRdPipeHandle() = 0; virtual HANDLE getClientWrtPipeHandle() = 0; - virtual HANDLE getNativeWaitHandle() { return NULL; } + virtual HANDLE getNativeWaitHandle() { return nullptr; } }; class TAnonPipeServer : public TPipeServerImpl { @@ -155,7 +155,7 @@ private: HANDLE TPipeServer::getNativeWaitHandle() { if (impl_) return impl_->getNativeWaitHandle(); - return NULL; + return nullptr; } //---- Constructors ---- @@ -227,7 +227,7 @@ shared_ptr<TTransport> TAnonPipeServer::acceptImpl() { &buf, // buffer to receive reply 0, // size of buffer &br, // number of bytes read - NULL); // not overlapped + nullptr); // not overlapped if (!fSuccess && GetLastError() != ERROR_MORE_DATA) { GlobalOutput.perror("TPipeServer unable to initiate pipe comms, GLE=", GetLastError()); @@ -248,7 +248,7 @@ void TNamedPipeServer::initiateNamedConnect(const TAutoCrit &lockProof) { // The prior connection has been handled, so close the gate ResetEvent(listen_event_.h); - connectOverlap_.reset(NULL, 0, listen_event_.h); + connectOverlap_.reset(nullptr, 0, listen_event_.h); connectOverlap_.h = Pipe_.h; thread_->addWorkItem(&connectOverlap_); @@ -283,7 +283,7 @@ void TNamedPipeServer::initiateNamedConnect(const TAutoCrit &lockProof) { shared_ptr<TTransport> TNamedPipeServer::acceptImpl() { { TAutoCrit lock(pipe_protect_); - if (cached_client_.get() != NULL) { + if (cached_client_.get() != nullptr) { shared_ptr<TPipe> client; // zero out cached_client, since we are about to return it. client.swap(cached_client_); @@ -350,7 +350,7 @@ void TPipeServer::close() { bool TNamedPipeServer::createNamedPipe(const TAutoCrit& /*lockProof*/) { - PSECURITY_DESCRIPTOR psd = NULL; + PSECURITY_DESCRIPTOR psd = nullptr; ULONG size = 0; if (!ConvertStringSecurityDescriptorToSecurityDescriptorA(securityDescriptor_.c_str(), @@ -404,7 +404,7 @@ bool TAnonPipeServer::createAnonPipe() { GetLastError()); return false; } - if (!SetSecurityDescriptorDacl(&sd, true, NULL, false)) { + if (!SetSecurityDescriptorDacl(&sd, true, nullptr, false)) { GlobalOutput.perror("TPipeServer SetSecurityDescriptorDacl (anon) failed, GLE=", GetLastError()); return false; diff --git a/lib/cpp/src/thrift/transport/TSSLSocket.cpp b/lib/cpp/src/thrift/transport/TSSLSocket.cpp index 64f08ddf1..aa76980aa 100644 --- a/lib/cpp/src/thrift/transport/TSSLSocket.cpp +++ b/lib/cpp/src/thrift/transport/TSSLSocket.cpp @@ -562,7 +562,7 @@ void TSSLSocket::flush() { throw TSSLException("BIO_flush: Handshake is not completed"); BIO* bio = SSL_get_wbio(ssl_); if (bio == nullptr) { - throw TSSLException("SSL_get_wbio returns NULL"); + throw TSSLException("SSL_get_wbio returns nullptr"); } if (BIO_flush(bio) != 1) { int errno_copy = THRIFT_GET_SOCKET_ERROR; @@ -798,7 +798,7 @@ unsigned int TSSLSocket::waitForEvent(bool wantRead) { } if (bio == nullptr) { - throw TSSLException("SSL_get_?bio returned NULL"); + throw TSSLException("SSL_get_?bio returned nullptr"); } if (BIO_get_fd(bio, &fdSocket) <= 0) { @@ -943,7 +943,7 @@ void TSSLSocketFactory::authenticate(bool required) { void TSSLSocketFactory::loadCertificate(const char* path, const char* format) { if (path == nullptr || format == nullptr) { throw TTransportException(TTransportException::BAD_ARGS, - "loadCertificateChain: either <path> or <format> is NULL"); + "loadCertificateChain: either <path> or <format> is nullptr"); } if (strcmp(format, "PEM") == 0) { if (SSL_CTX_use_certificate_chain_file(ctx_->get(), path) == 0) { @@ -960,12 +960,12 @@ void TSSLSocketFactory::loadCertificate(const char* path, const char* format) { void TSSLSocketFactory::loadCertificateFromBuffer(const char* aCertificate, const char* format) { if (aCertificate == nullptr || format == nullptr) { throw TTransportException(TTransportException::BAD_ARGS, - "loadCertificate: either <path> or <format> is NULL"); + "loadCertificate: either <path> or <format> is nullptr"); } if (strcmp(format, "PEM") == 0) { BIO* mem = BIO_new(BIO_s_mem()); BIO_puts(mem, aCertificate); - X509* cert = PEM_read_bio_X509(mem, NULL, 0, NULL); + X509* cert = PEM_read_bio_X509(mem, nullptr, 0, nullptr); BIO_free(mem); if (SSL_CTX_use_certificate(ctx_->get(), cert) == 0) { @@ -982,7 +982,7 @@ void TSSLSocketFactory::loadCertificateFromBuffer(const char* aCertificate, cons void TSSLSocketFactory::loadPrivateKey(const char* path, const char* format) { if (path == nullptr || format == nullptr) { throw TTransportException(TTransportException::BAD_ARGS, - "loadPrivateKey: either <path> or <format> is NULL"); + "loadPrivateKey: either <path> or <format> is nullptr"); } if (strcmp(format, "PEM") == 0) { if (SSL_CTX_use_PrivateKey_file(ctx_->get(), path, SSL_FILETYPE_PEM) == 0) { @@ -997,7 +997,7 @@ void TSSLSocketFactory::loadPrivateKey(const char* path, const char* format) { void TSSLSocketFactory::loadPrivateKeyFromBuffer(const char* aPrivateKey, const char* format) { if (aPrivateKey == nullptr || format == nullptr) { throw TTransportException(TTransportException::BAD_ARGS, - "loadPrivateKey: either <path> or <format> is NULL"); + "loadPrivateKey: either <path> or <format> is nullptr"); } if (strcmp(format, "PEM") == 0) { BIO* mem = BIO_new(BIO_s_mem()); @@ -1019,7 +1019,7 @@ void TSSLSocketFactory::loadPrivateKeyFromBuffer(const char* aPrivateKey, const void TSSLSocketFactory::loadTrustedCertificates(const char* path, const char* capath) { if (path == nullptr) { throw TTransportException(TTransportException::BAD_ARGS, - "loadTrustedCertificates: <path> is NULL"); + "loadTrustedCertificates: <path> is nullptr"); } if (SSL_CTX_load_verify_locations(ctx_->get(), path, capath) == 0) { int errno_copy = THRIFT_GET_SOCKET_ERROR; @@ -1037,7 +1037,7 @@ void TSSLSocketFactory::loadTrustedCertificatesFromBuffer(const char* aCertifica X509_STORE* vX509Store = SSL_CTX_get_cert_store(ctx_->get()); BIO* mem = BIO_new(BIO_s_mem()); BIO_puts(mem, aCertificate); - X509* cert = PEM_read_bio_X509(mem, NULL, 0, NULL); + X509* cert = PEM_read_bio_X509(mem, nullptr, 0, nullptr); BIO_free(mem); if (X509_STORE_add_cert(vX509Store, cert) == 0) { @@ -1050,7 +1050,7 @@ void TSSLSocketFactory::loadTrustedCertificatesFromBuffer(const char* aCertifica if (aChain) { mem = BIO_new(BIO_s_mem()); BIO_puts(mem, aChain); - cert = PEM_read_bio_X509(mem, NULL, 0, NULL); + cert = PEM_read_bio_X509(mem, nullptr, 0, nullptr); BIO_free(mem); if (SSL_CTX_add_extra_chain_cert(ctx_->get(), cert) == 0) { diff --git a/lib/cpp/src/thrift/transport/TServerTransport.h b/lib/cpp/src/thrift/transport/TServerTransport.h index 9e84850aa..0c5660929 100644 --- a/lib/cpp/src/thrift/transport/TServerTransport.h +++ b/lib/cpp/src/thrift/transport/TServerTransport.h @@ -54,7 +54,7 @@ public: * Gets a new dynamically allocated transport object and passes it to the * caller. Note that it is the explicit duty of the caller to free the * allocated object. The returned TTransport object must always be in the - * opened state. NULL should never be returned, instead an Exception should + * opened state. nullptr should never be returned, instead an Exception should * always be thrown. * * @return A new TTransport object @@ -63,7 +63,7 @@ public: std::shared_ptr<TTransport> accept() { std::shared_ptr<TTransport> result = acceptImpl(); if (!result) { - throw TTransportException("accept() may not return NULL"); + throw TTransportException("accept() may not return nullptr"); } return result; } diff --git a/lib/cpp/src/thrift/transport/TSocket.cpp b/lib/cpp/src/thrift/transport/TSocket.cpp index 38112796f..a1a6dfb2f 100644 --- a/lib/cpp/src/thrift/transport/TSocket.cpp +++ b/lib/cpp/src/thrift/transport/TSocket.cpp @@ -432,7 +432,7 @@ void TSocket::open() { void TSocket::unix_open() { if (!path_.empty()) { - // Unix Domain SOcket does not need addrinfo struct, so we pass NULL + // Unix Domain SOcket does not need addrinfo struct, so we pass nullptr openConnection(nullptr); } } diff --git a/lib/cpp/src/thrift/transport/TTransport.h b/lib/cpp/src/thrift/transport/TTransport.h index 891bfe151..63978829f 100644 --- a/lib/cpp/src/thrift/transport/TTransport.h +++ b/lib/cpp/src/thrift/transport/TTransport.h @@ -191,7 +191,7 @@ public: * @oaram buf A buffer where the data can be stored if needed. * If borrow doesn't return buf, then the contents of * buf after the call are undefined. This parameter may be - * NULL to indicate that the caller is not supplying storage, + * nullptr to indicate that the caller is not supplying storage, * but would like a pointer into an internal buffer, if * available. * @param len *len should initially contain the number of bytes to borrow. diff --git a/lib/cpp/src/thrift/windows/GetTimeOfDay.cpp b/lib/cpp/src/thrift/windows/GetTimeOfDay.cpp index 0a0292c7e..ac24124b3 100644 --- a/lib/cpp/src/thrift/windows/GetTimeOfDay.cpp +++ b/lib/cpp/src/thrift/windows/GetTimeOfDay.cpp @@ -51,7 +51,7 @@ int thrift_gettimeofday(struct timeval* tv, struct timezone* tz) { int thrift_gettimeofday(struct timeval * tp, struct timezone * tzp) { // We don't fill it in so prove nobody is looking for the data - assert(tzp == NULL); + assert(tzp == nullptr); // Note: some broken versions only have 8 trailing zero's, the correct epoch has 9 trailing zero's // This magic number is the number of 100 nanosecond intervals since January 1, 1601 (UTC) diff --git a/lib/cpp/src/thrift/windows/SocketPair.cpp b/lib/cpp/src/thrift/windows/SocketPair.cpp index 7228832ee..2650b37d4 100644 --- a/lib/cpp/src/thrift/windows/SocketPair.cpp +++ b/lib/cpp/src/thrift/windows/SocketPair.cpp @@ -77,12 +77,12 @@ int thrift_socketpair(int d, int type, int protocol, THRIFT_SOCKET sv[2]) { break; if (listen(listener, 1) == SOCKET_ERROR) break; - sv[0] = WSASocket(AF_INET, SOCK_STREAM, 0, NULL, 0, flags); + sv[0] = WSASocket(AF_INET, SOCK_STREAM, 0, nullptr, 0, flags); if (sv[0] == INVALID_SOCKET) break; if (connect(sv[0], &a.addr, sizeof(a.inaddr)) == SOCKET_ERROR) break; - sv[1] = accept(listener, NULL, NULL); + sv[1] = accept(listener, nullptr, nullptr); if (sv[1] == INVALID_SOCKET) break; diff --git a/lib/cpp/src/thrift/windows/Sync.h b/lib/cpp/src/thrift/windows/Sync.h index 5d321996b..a296d7ec4 100644 --- a/lib/cpp/src/thrift/windows/Sync.h +++ b/lib/cpp/src/thrift/windows/Sync.h @@ -55,8 +55,8 @@ struct TAutoResetEvent : boost::noncopyable { HANDLE h; TAutoResetEvent() { - h = CreateEvent(NULL, FALSE, FALSE, NULL); - if (h == NULL) { + h = CreateEvent(nullptr, FALSE, FALSE, nullptr); + if (h == nullptr) { GlobalOutput.perror("TAutoResetEvent unable to create event, GLE=", GetLastError()); throw apache::thrift::concurrency::SystemResourceException("CreateEvent failed"); } @@ -68,8 +68,8 @@ struct TManualResetEvent : boost::noncopyable { HANDLE h; TManualResetEvent() { - h = CreateEvent(NULL, TRUE, FALSE, NULL); - if (h == NULL) { + h = CreateEvent(nullptr, TRUE, FALSE, nullptr); + if (h == nullptr) { GlobalOutput.perror("TManualResetEvent unable to create event, GLE=", GetLastError()); throw apache::thrift::concurrency::SystemResourceException("CreateEvent failed"); } diff --git a/lib/cpp/src/thrift/windows/TWinsockSingleton.cpp b/lib/cpp/src/thrift/windows/TWinsockSingleton.cpp index a502cbdc6..c3339f39e 100644 --- a/lib/cpp/src/thrift/windows/TWinsockSingleton.cpp +++ b/lib/cpp/src/thrift/windows/TWinsockSingleton.cpp @@ -26,7 +26,7 @@ namespace apache { namespace thrift { namespace transport { -TWinsockSingleton::instance_ptr TWinsockSingleton::instance_ptr_(NULL); +TWinsockSingleton::instance_ptr TWinsockSingleton::instance_ptr_(nullptr); std::once_flag TWinsockSingleton::flags_; //------------------------------------------------------------------------------ diff --git a/lib/cpp/src/thrift/windows/WinFcntl.cpp b/lib/cpp/src/thrift/windows/WinFcntl.cpp index c907e92f2..292ddfca0 100644 --- a/lib/cpp/src/thrift/windows/WinFcntl.cpp +++ b/lib/cpp/src/thrift/windows/WinFcntl.cpp @@ -45,8 +45,8 @@ int thrift_fcntl(THRIFT_SOCKET fd, int cmd, int flags) { #if WINVER <= 0x0502 // XP, Server2003 int thrift_poll(THRIFT_POLLFD* fdArray, ULONG nfds, INT timeout) { fd_set read_fds, write_fds; - fd_set* read_fds_ptr = NULL; - fd_set* write_fds_ptr = NULL; + fd_set* read_fds_ptr = nullptr; + fd_set* write_fds_ptr = nullptr; FD_ZERO(&read_fds); FD_ZERO(&write_fds); @@ -65,7 +65,7 @@ int thrift_poll(THRIFT_POLLFD* fdArray, ULONG nfds, INT timeout) { } timeval time_out; - timeval* time_out_ptr = NULL; + timeval* time_out_ptr = nullptr; if (timeout >= 0) { time_out.tv_sec = timeout / 1000; time_out.tv_usec = (timeout % 1000) * 1000; @@ -75,7 +75,7 @@ int thrift_poll(THRIFT_POLLFD* fdArray, ULONG nfds, INT timeout) { (void)timeout; } - int sktready = select(1, read_fds_ptr, write_fds_ptr, NULL, time_out_ptr); + int sktready = select(1, read_fds_ptr, write_fds_ptr, nullptr, time_out_ptr); if (sktready > 0) { for (ULONG i = 0; i < nfds; i++) { fdArray[i].revents = 0; diff --git a/lib/cpp/test/OpenSSLManualInitTest.cpp b/lib/cpp/test/OpenSSLManualInitTest.cpp index a7518064e..935a20514 100644 --- a/lib/cpp/test/OpenSSLManualInitTest.cpp +++ b/lib/cpp/test/OpenSSLManualInitTest.cpp @@ -88,6 +88,6 @@ boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { suite->add(BOOST_TEST_CASE(test_openssl_availability)); - return NULL; + return nullptr; } #endif
\ No newline at end of file diff --git a/lib/cpp/test/TFileTransportTest.cpp b/lib/cpp/test/TFileTransportTest.cpp index 21c1f3b33..c116fdc1b 100644 --- a/lib/cpp/test/TFileTransportTest.cpp +++ b/lib/cpp/test/TFileTransportTest.cpp @@ -399,6 +399,6 @@ boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { // Parse arguments parse_args(argc, argv); - return NULL; + return nullptr; } #endif diff --git a/lib/cpp/test/TransportTest.cpp b/lib/cpp/test/TransportTest.cpp index a890aa8ce..085197a08 100644 --- a/lib/cpp/test/TransportTest.cpp +++ b/lib/cpp/test/TransportTest.cpp @@ -230,7 +230,7 @@ public: HANDLE hWrite; CoupledPipeTransports() { - BOOST_REQUIRE(CreatePipe(&hRead, &hWrite, NULL, 1048576 * 2)); + BOOST_REQUIRE(CreatePipe(&hRead, &hWrite, nullptr, 1048576 * 2)); in.reset(new TPipe(hRead, hWrite)); in->open(); out = in; @@ -707,7 +707,7 @@ void test_borrow_part_available() { uint8_t read_buf[16]; memset(write_buf, 'a', sizeof(write_buf)); - // Attemping to borrow 10 bytes when only 9 are available should return NULL + // Attemping to borrow 10 bytes when only 9 are available should return nullptr // immediately. transports.out->write(write_buf, 9); transports.out->flush(); @@ -1075,7 +1075,7 @@ boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { THRIFT_UNUSED_VARIABLE(argc); THRIFT_UNUSED_VARIABLE(argv); struct timeval tv; - THRIFT_GETTIMEOFDAY(&tv, NULL); + THRIFT_GETTIMEOFDAY(&tv, nullptr); int seed = tv.tv_sec ^ tv.tv_usec; initrand(seed); @@ -1084,6 +1084,6 @@ boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { suite->p_name.value = "TransportTest"; TransportTestGen transport_test_generator(suite, 1); transport_test_generator.generate(); - return NULL; + return nullptr; } #endif diff --git a/lib/cpp/test/ZlibTest.cpp b/lib/cpp/test/ZlibTest.cpp index 3e2eb816c..274a24391 100644 --- a/lib/cpp/test/ZlibTest.cpp +++ b/lib/cpp/test/ZlibTest.cpp @@ -454,7 +454,7 @@ int main( int argc, char* argv[] ) { boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { THRIFT_UNUSED_VARIABLE(argc); THRIFT_UNUSED_VARIABLE(argv); - uint32_t seed = static_cast<uint32_t>(time(NULL)); + uint32_t seed = static_cast<uint32_t>(time(nullptr)); #ifdef HAVE_INTTYPES_H printf("seed: %" PRIu32 "\n", seed); #endif @@ -470,6 +470,6 @@ boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { suite->add(BOOST_TEST_CASE(test_no_write)); - return NULL; + return nullptr; } #endif diff --git a/lib/cpp/test/processor/ProcessorTest.cpp b/lib/cpp/test/processor/ProcessorTest.cpp index a36ef3eec..017fa89ea 100644 --- a/lib/cpp/test/processor/ProcessorTest.cpp +++ b/lib/cpp/test/processor/ProcessorTest.cpp @@ -924,6 +924,6 @@ int main( int argc, char* argv[] ) { THRIFT_UNUSED_VARIABLE(argc); THRIFT_UNUSED_VARIABLE(argv); ::boost::unit_test::framework::master_test_suite().p_name.value = "ProcessorTest"; - return NULL; + return nullptr; } #endif diff --git a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp index e152d08a3..c8bc50ecc 100644 --- a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp +++ b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp @@ -414,7 +414,7 @@ void createObject(const char* obj_typename, zval* return_value, int nargs = 0, z object_and_properties_init(return_value, ce, nullptr); zend_function* constructor = zend_std_get_constructor(Z_OBJ_P(return_value)); zval ctor_rv; - zend_call_method(return_value, ce, &constructor, NULL, 0, &ctor_rv, nargs, arg1, arg2); + zend_call_method(return_value, ce, &constructor, nullptr, 0, &ctor_rv, nargs, arg1, arg2); zval_dtor(&ctor_rv); if (EG(exception)) { zend_object *ex = EG(exception); diff --git a/lib/py/src/ext/module.cpp b/lib/py/src/ext/module.cpp index 7158b8fdf..f14ddaeb6 100644 --- a/lib/py/src/ext/module.cpp +++ b/lib/py/src/ext/module.cpp @@ -48,20 +48,20 @@ namespace py { template <typename T> static PyObject* encode_impl(PyObject* args) { if (!args) - return NULL; + return nullptr; - PyObject* enc_obj = NULL; - PyObject* type_args = NULL; + PyObject* enc_obj = nullptr; + PyObject* type_args = nullptr; if (!PyArg_ParseTuple(args, "OO", &enc_obj, &type_args)) { - return NULL; + return nullptr; } if (!enc_obj || !type_args) { - return NULL; + return nullptr; } T protocol; if (!protocol.prepareEncodeBuffer() || !protocol.encodeValue(enc_obj, T_STRUCT, type_args)) { - return NULL; + return nullptr; } return protocol.getEncodedValue(); @@ -79,11 +79,11 @@ static inline long as_long_then_delete(PyObject* value, long default_value) { template <typename T> static PyObject* decode_impl(PyObject* args) { - PyObject* output_obj = NULL; - PyObject* oprot = NULL; - PyObject* typeargs = NULL; + PyObject* output_obj = nullptr; + PyObject* oprot = nullptr; + PyObject* typeargs = nullptr; if (!PyArg_ParseTuple(args, "OOO", &output_obj, &oprot, &typeargs)) { - return NULL; + return nullptr; } T protocol; @@ -96,16 +96,16 @@ static PyObject* decode_impl(PyObject* args) { default_limit)); ScopedPyObject transport(PyObject_GetAttr(oprot, INTERN_STRING(trans))); if (!transport) { - return NULL; + return nullptr; } StructTypeArgs parsedargs; if (!parse_struct_args(&parsedargs, typeargs)) { - return NULL; + return nullptr; } if (!protocol.prepareDecodeBufferFromTransport(transport.get())) { - return NULL; + return nullptr; } return protocol.readStruct(output_obj, parsedargs.klass, parsedargs.spec); @@ -141,22 +141,22 @@ static PyMethodDef ThriftFastBinaryMethods[] = { {"decode_binary", decode_binary, METH_VARARGS, ""}, {"encode_compact", encode_compact, METH_VARARGS, ""}, {"decode_compact", decode_compact, METH_VARARGS, ""}, - {NULL, NULL, 0, NULL} /* Sentinel */ + {nullptr, nullptr, 0, nullptr} /* Sentinel */ }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef ThriftFastBinaryDef = {PyModuleDef_HEAD_INIT, "thrift.protocol.fastbinary", - NULL, + nullptr, 0, ThriftFastBinaryMethods, - NULL, - NULL, - NULL, - NULL}; + nullptr, + nullptr, + nullptr, + nullptr}; -#define INITERROR return NULL; +#define INITERROR return nullptr; PyObject* PyInit_fastbinary() { @@ -167,7 +167,7 @@ PyObject* PyInit_fastbinary() { void initfastbinary() { PycString_IMPORT; - if (PycStringIO == NULL) + if (PycStringIO == nullptr) INITERROR #endif @@ -193,7 +193,7 @@ void initfastbinary() { #else Py_InitModule("thrift.protocol.fastbinary", ThriftFastBinaryMethods); #endif - if (module == NULL) + if (module == nullptr) INITERROR; #if PY_MAJOR_VERSION >= 3 diff --git a/lib/py/src/ext/protocol.h b/lib/py/src/ext/protocol.h index 521b7ee92..c0cd43724 100644 --- a/lib/py/src/ext/protocol.h +++ b/lib/py/src/ext/protocol.h @@ -35,7 +35,7 @@ public: ProtocolBase() : stringLimit_((std::numeric_limits<int32_t>::max)()), containerLimit_((std::numeric_limits<int32_t>::max)()), - output_(NULL) {} + output_(nullptr) {} inline virtual ~ProtocolBase(); bool prepareDecodeBufferFromTransport(PyObject* trans); diff --git a/lib/py/src/ext/protocol.tcc b/lib/py/src/ext/protocol.tcc index ede2bb46a..03cfc9b6f 100644 --- a/lib/py/src/ext/protocol.tcc +++ b/lib/py/src/ext/protocol.tcc @@ -48,7 +48,7 @@ inline EncodeBuffer* new_encode_buffer(size_t size) { PycString_IMPORT; } if (!PycStringIO) { - return NULL; + return nullptr; } return PycStringIO->NewOutput(size); } @@ -83,7 +83,7 @@ PyObject* ProtocolBase<Impl>::getEncodedValue() { PycString_IMPORT; } if (!PycStringIO) { - return NULL; + return nullptr; } return PycStringIO->cgetvalue(output_); } @@ -277,7 +277,7 @@ bool ProtocolBase<Impl>::readBytes(char** output, int len) { } else { // using building functions as this is a rare codepath ScopedPyObject newiobuf(PyObject_CallFunction(input_.refill_callable.get(), refill_signature, - *output, rlen, len, NULL)); + *output, rlen, len, nullptr)); if (!newiobuf) { return false; } @@ -332,7 +332,7 @@ bool ProtocolBase<Impl>::prepareDecodeBufferFromTransport(PyObject* trans) { template <typename Impl> bool ProtocolBase<Impl>::prepareEncodeBuffer() { output_ = detail::new_encode_buffer(INIT_OUTBUF_SIZE); - return output_ != NULL; + return output_ != nullptr; } template <typename Impl> @@ -484,8 +484,8 @@ bool ProtocolBase<Impl>::encodeValue(PyObject* value, TType type, PyObject* type return false; } Py_ssize_t pos = 0; - PyObject* k = NULL; - PyObject* v = NULL; + PyObject* k = nullptr; + PyObject* v = nullptr; // TODO(bmaurer): should support any mapping, not just dicts while (PyDict_Next(value, &pos, &k, &v)) { if (!encodeValue(k, parsedargs.ktag, parsedargs.ktypeargs) @@ -647,7 +647,7 @@ PyObject* ProtocolBase<Impl>::decodeValue(TType type, PyObject* typeargs) { case T_BOOL: { bool v = 0; if (!impl()->readBool(v)) { - return NULL; + return nullptr; } if (v) { Py_RETURN_TRUE; @@ -658,21 +658,21 @@ PyObject* ProtocolBase<Impl>::decodeValue(TType type, PyObject* typeargs) { case T_I08: { int8_t v = 0; if (!impl()->readI8(v)) { - return NULL; + return nullptr; } return PyInt_FromLong(v); } case T_I16: { int16_t v = 0; if (!impl()->readI16(v)) { - return NULL; + return nullptr; } return PyInt_FromLong(v); } case T_I32: { int32_t v = 0; if (!impl()->readI32(v)) { - return NULL; + return nullptr; } return PyInt_FromLong(v); } @@ -680,7 +680,7 @@ PyObject* ProtocolBase<Impl>::decodeValue(TType type, PyObject* typeargs) { case T_I64: { int64_t v = 0; if (!impl()->readI64(v)) { - return NULL; + return nullptr; } // TODO(dreiss): Find out if we can take this fastpath always when // sizeof(long) == sizeof(long long). @@ -693,16 +693,16 @@ PyObject* ProtocolBase<Impl>::decodeValue(TType type, PyObject* typeargs) { case T_DOUBLE: { double v = 0.0; if (!impl()->readDouble(v)) { - return NULL; + return nullptr; } return PyFloat_FromDouble(v); } case T_STRING: { - char* buf = NULL; + char* buf = nullptr; int len = impl()->readString(&buf); if (len < 0) { - return NULL; + return nullptr; } if (isUtf8(typeargs)) { return PyUnicode_DecodeUTF8(buf, len, 0); @@ -715,28 +715,28 @@ PyObject* ProtocolBase<Impl>::decodeValue(TType type, PyObject* typeargs) { case T_SET: { SetListTypeArgs parsedargs; if (!parse_set_list_args(&parsedargs, typeargs)) { - return NULL; + return nullptr; } TType etype = T_STOP; int32_t len = impl()->readListBegin(etype); if (len < 0) { - return NULL; + return nullptr; } if (len > 0 && !checkType(etype, parsedargs.element_type)) { - return NULL; + return nullptr; } bool use_tuple = type == T_LIST && parsedargs.immutable; ScopedPyObject ret(use_tuple ? PyTuple_New(len) : PyList_New(len)); if (!ret) { - return NULL; + return nullptr; } for (int i = 0; i < len; i++) { PyObject* item = decodeValue(etype, parsedargs.typeargs); if (!item) { - return NULL; + return nullptr; } if (use_tuple) { PyTuple_SET_ITEM(ret.get(), i, item); @@ -758,32 +758,32 @@ PyObject* ProtocolBase<Impl>::decodeValue(TType type, PyObject* typeargs) { case T_MAP: { MapTypeArgs parsedargs; if (!parse_map_args(&parsedargs, typeargs)) { - return NULL; + return nullptr; } TType ktype = T_STOP; TType vtype = T_STOP; uint32_t len = impl()->readMapBegin(ktype, vtype); if (len > 0 && (!checkType(ktype, parsedargs.ktag) || !checkType(vtype, parsedargs.vtag))) { - return NULL; + return nullptr; } ScopedPyObject ret(PyDict_New()); if (!ret) { - return NULL; + return nullptr; } for (uint32_t i = 0; i < len; i++) { ScopedPyObject k(decodeValue(ktype, parsedargs.ktypeargs)); if (!k) { - return NULL; + return nullptr; } ScopedPyObject v(decodeValue(vtype, parsedargs.vtypeargs)); if (!v) { - return NULL; + return nullptr; } if (PyDict_SetItem(ret.get(), k.get(), v.get()) == -1) { - return NULL; + return nullptr; } } @@ -792,12 +792,12 @@ PyObject* ProtocolBase<Impl>::decodeValue(TType type, PyObject* typeargs) { ThriftModule = PyImport_ImportModule("thrift.Thrift"); } if (!ThriftModule) { - return NULL; + return nullptr; } ScopedPyObject cls(PyObject_GetAttr(ThriftModule, INTERN_STRING(TFrozenDict))); if (!cls) { - return NULL; + return nullptr; } ScopedPyObject arg(PyTuple_New(1)); @@ -811,7 +811,7 @@ PyObject* ProtocolBase<Impl>::decodeValue(TType type, PyObject* typeargs) { case T_STRUCT: { StructTypeArgs parsedargs; if (!parse_struct_args(&parsedargs, typeargs)) { - return NULL; + return nullptr; } return readStruct(Py_None, parsedargs.klass, parsedargs.spec); } @@ -823,7 +823,7 @@ PyObject* ProtocolBase<Impl>::decodeValue(TType type, PyObject* typeargs) { case T_U64: default: PyErr_Format(PyExc_TypeError, "Unexpected TType for decodeValue: %d", type); - return NULL; + return nullptr; } } @@ -833,26 +833,26 @@ PyObject* ProtocolBase<Impl>::readStruct(PyObject* output, PyObject* klass, PyOb bool immutable = output == Py_None; ScopedPyObject kwargs; if (spec_seq_len == -1) { - return NULL; + return nullptr; } if (immutable) { kwargs.reset(PyDict_New()); if (!kwargs) { PyErr_SetString(PyExc_TypeError, "failed to prepare kwargument storage"); - return NULL; + return nullptr; } } detail::ReadStructScope<Impl> scope = detail::readStructScope(this); if (!scope) { - return NULL; + return nullptr; } while (true) { TType type = T_STOP; int16_t tag; if (!impl()->readFieldBegin(type, tag)) { - return NULL; + return nullptr; } if (type == T_STOP) { break; @@ -860,7 +860,7 @@ PyObject* ProtocolBase<Impl>::readStruct(PyObject* output, PyObject* klass, PyOb if (tag < 0 || tag >= spec_seq_len) { if (!skip(type)) { PyErr_SetString(PyExc_TypeError, "Error while skipping unknown field"); - return NULL; + return nullptr; } continue; } @@ -869,38 +869,38 @@ PyObject* ProtocolBase<Impl>::readStruct(PyObject* output, PyObject* klass, PyOb if (item_spec == Py_None) { if (!skip(type)) { PyErr_SetString(PyExc_TypeError, "Error while skipping unknown field"); - return NULL; + return nullptr; } continue; } StructItemSpec parsedspec; if (!parse_struct_item_spec(&parsedspec, item_spec)) { - return NULL; + return nullptr; } if (parsedspec.type != type) { if (!skip(type)) { PyErr_Format(PyExc_TypeError, "struct field had wrong type: expected %d but got %d", parsedspec.type, type); - return NULL; + return nullptr; } continue; } ScopedPyObject fieldval(decodeValue(parsedspec.type, parsedspec.typeargs)); if (!fieldval) { - return NULL; + return nullptr; } if ((immutable && PyDict_SetItem(kwargs.get(), parsedspec.attrname, fieldval.get()) == -1) || (!immutable && PyObject_SetAttr(output, parsedspec.attrname, fieldval.get()) == -1)) { - return NULL; + return nullptr; } } if (immutable) { ScopedPyObject args(PyTuple_New(0)); if (!args) { PyErr_SetString(PyExc_TypeError, "failed to prepare argument storage"); - return NULL; + return nullptr; } return PyObject_Call(klass, args.get(), kwargs.get()); } diff --git a/lib/py/src/ext/types.cpp b/lib/py/src/ext/types.cpp index 68443fbe8..e8d6939b1 100644 --- a/lib/py/src/ext/types.cpp +++ b/lib/py/src/ext/types.cpp @@ -24,7 +24,7 @@ namespace apache { namespace thrift { namespace py { -PyObject* ThriftModule = NULL; +PyObject* ThriftModule = nullptr; #if PY_MAJOR_VERSION < 3 char refill_signature[] = {'s', '#', 'i'}; diff --git a/lib/py/src/ext/types.h b/lib/py/src/ext/types.h index 5cd8dda9e..9b45dd065 100644 --- a/lib/py/src/ext/types.h +++ b/lib/py/src/ext/types.h @@ -83,7 +83,7 @@ enum TType { // replace with unique_ptr when we're OK with C++11 class ScopedPyObject { public: - ScopedPyObject() : obj_(NULL) {} + ScopedPyObject() : obj_(nullptr) {} explicit ScopedPyObject(PyObject* py_object) : obj_(py_object) {} ~ScopedPyObject() { if (obj_) @@ -98,7 +98,7 @@ public: } PyObject* release() throw() { PyObject* tmp = obj_; - obj_ = NULL; + obj_ = nullptr; return tmp; } void swap(ScopedPyObject& other) throw() { |