diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2004-06-04 07:17:12 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2004-06-04 07:17:12 +0000 |
commit | 382182a15e6e24a08eb2c7b80137b5a2d1d60e7d (patch) | |
tree | d6153e63f8834b0865ad71993b4e0babd5775d29 | |
parent | 2b98e3e91262ed143705559959faa9c0b052b4d7 (diff) | |
download | ATCD-382182a15e6e24a08eb2c7b80137b5a2d1d60e7d.tar.gz |
ChangeLogTag:Fri Jun 4 00:16:19 2004 Ossama Othman <ossama@dre.vanderbilt.edu>
-rw-r--r-- | TAO/ChangeLog | 196 | ||||
-rw-r--r-- | TAO/tao/CORBA_String.cpp | 2 | ||||
-rw-r--r-- | TAO/tao/Exception.cpp | 14 | ||||
-rw-r--r-- | TAO/tao/Exception.h | 4 | ||||
-rw-r--r-- | TAO/tao/IIOP_Acceptor.cpp | 95 | ||||
-rw-r--r-- | TAO/tao/IIOP_Acceptor.h | 12 | ||||
-rw-r--r-- | TAO/tao/IIOP_Connection_Handler.cpp | 16 | ||||
-rw-r--r-- | TAO/tao/IIOP_Connector.cpp | 43 | ||||
-rw-r--r-- | TAO/tao/IIOP_Connector.h | 3 | ||||
-rw-r--r-- | TAO/tao/IIOP_Transport.cpp | 10 | ||||
-rw-r--r-- | TAO/tao/ORB.cpp | 30 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 46 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.i | 6 | ||||
-rw-r--r-- | TAO/tao/Strategies/UIOP_Acceptor.cpp | 79 | ||||
-rw-r--r-- | TAO/tao/Strategies/UIOP_Acceptor.h | 49 | ||||
-rw-r--r-- | TAO/tao/Strategies/UIOP_Connection_Handler.cpp | 20 | ||||
-rw-r--r-- | TAO/tao/Strategies/UIOP_Connector.cpp | 47 | ||||
-rw-r--r-- | TAO/tao/Strategies/UIOP_Connector.h | 2 | ||||
-rw-r--r-- | TAO/tao/Strategies/UIOP_Endpoint.cpp | 9 | ||||
-rw-r--r-- | TAO/tao/Strategies/UIOP_Transport.cpp | 26 |
20 files changed, 374 insertions, 335 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index df096788f9a..f9b1a1048e3 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,71 +1,129 @@ +Fri Jun 4 00:16:19 2004 Ossama Othman <ossama@dre.vanderbilt.edu> + + * tao/CORBA_String.cpp (string_dup): + * tao/IIOP_Connection_Handler.cpp: + * tao/IIOP_Transport.cpp: + * tao/Strategies/UIOP_Connection_Handler.cpp: + * tao/Strategies/UIOP_Transport.cpp: + + Minor "const correctness" improvements. + + * tao/Exception.h (initialized_): + + This member is now a "bool" instead of an "int." The former is + the more appropriate type in this case. + + * tao/Exception.cpp (init): + + Made array containing exception names static since its contents + are fixed. + + * tao/IIOP_Acceptor.cpp: + * tao/IIOP_Connector.cpp: + * tao/ORB.cpp: + * tao/ORB_Core.cpp: + * tao/ORB_Core.i: + * tao/Strategies/UIOP_Acceptor.cpp: + * tao/Strategies/UIOP_Connector.cpp: + + Made arrays with fixed content static. Reduces footprint + slightly. + + Converted all ACE cast macro calls to their ANSI C++ cast + counterparts. + + Minor "const correctness" improvements. + + Use prefix {in,dec}rement operators where applicable instead of + postfix operators. The former are more efficient. + + * tao/IIOP_Acceptor.h (TAO_IIOP_Acceptor): + + Reordered some class members/attributes to prevent the compiler + from necessarily adding alignment padding. Reduces the size of + this class. + + * tao/IIOP_Connector.h (lite_flag_): + * tao/Strategies/UIOP_Acceptor.h: + * tao/Strategies/UIOP_Connector.h: + + No need to declare this member as a "CORBA::Boolean". The + standard C++ "bool" is fine, particularly since this flag is + used internally. + + * tao/Strategies/UIOP_Endpoint.cpp: + + Converted all ACE cast macro calls to their ANSI C++ cast + counterparts. + Wed Jun 2 00:37:17 2004 Ossama Othman <ossama@dre.vanderbilt.edu> - * TAO/tao/Acceptor_Registry.cpp: - * TAO/tao/Any.cpp: - * TAO/tao/Any_Array_Impl_T.cpp: - * TAO/tao/Any_Basic_Impl_T.cpp: - * TAO/tao/Any_Dual_Impl_T.cpp: - * TAO/tao/Any_Impl.cpp: - * TAO/tao/Any_Impl_T.cpp: - * TAO/tao/Any_Special_Impl_T.cpp: - * TAO/tao/Any_SystemException.cpp: - * TAO/tao/Array_VarOut_T.cpp: - * TAO/tao/Array_VarOut_T.inl: - * TAO/tao/Base_Transport_Property.cpp: - * TAO/tao/CDR.i: - * TAO/tao/CDR_Encaps_Codec.cpp: - * TAO/tao/CORBALOC_Parser.cpp: - * TAO/tao/CORBA_String.cpp: - * TAO/tao/ClientRequestInfo_i.cpp: - * TAO/tao/Fixed_Array_Argument_T.inl: - * TAO/tao/GIOP_Message_Generator_Parser_10.cpp: - * TAO/tao/GIOP_Message_Generator_Parser_12.cpp: - * TAO/tao/GIOP_Message_State.cpp: - * TAO/tao/IIOP_Connection_Handler.cpp: - * TAO/tao/IIOP_Connector.cpp: - * TAO/tao/IIOP_Endpoint.cpp: - * TAO/tao/IIOP_Profile.cpp: - * TAO/tao/Invocation_Base.cpp: - * TAO/tao/LocalObject.cpp: - * TAO/tao/MCAST_Parser.cpp: - * TAO/tao/NVList.i: - * TAO/tao/ORB_Core.cpp: - * TAO/tao/ORB_Table.cpp: - * TAO/tao/Object.cpp: - * TAO/tao/Object_Ref_Table.cpp: - * TAO/tao/ParameterMode.cpp: - * TAO/tao/Sequence.i: - * TAO/tao/Sequence_T.i: - * TAO/tao/Service_Context.cpp: - * TAO/tao/Sync_Strategies.cpp: - * TAO/tao/Tagged_Components.cpp: - * TAO/tao/Tagged_Profile.i: - * TAO/tao/TimeBaseC.cpp: - * TAO/tao/Transport.cpp: - * TAO/tao/Transport_Connector.cpp: - * TAO/tao/Var_Array_Argument_T.inl: - * TAO/tao/orbconf.h: - * TAO/tao/target_specification.i: + * tao/Acceptor_Registry.cpp: + * tao/Any.cpp: + * tao/Any_Array_Impl_T.cpp: + * tao/Any_Basic_Impl_T.cpp: + * tao/Any_Dual_Impl_T.cpp: + * tao/Any_Impl.cpp: + * tao/Any_Impl_T.cpp: + * tao/Any_Special_Impl_T.cpp: + * tao/Any_SystemException.cpp: + * tao/Array_VarOut_T.cpp: + * tao/Array_VarOut_T.inl: + * tao/Base_Transport_Property.cpp: + * tao/CDR.i: + * tao/CDR_Encaps_Codec.cpp: + * tao/CORBALOC_Parser.cpp: + * tao/CORBA_String.cpp: + * tao/ClientRequestInfo_i.cpp: + * tao/Fixed_Array_Argument_T.inl: + * tao/GIOP_Message_Generator_Parser_10.cpp: + * tao/GIOP_Message_Generator_Parser_12.cpp: + * tao/GIOP_Message_State.cpp: + * tao/IIOP_Connection_Handler.cpp: + * tao/IIOP_Connector.cpp: + * tao/IIOP_Endpoint.cpp: + * tao/IIOP_Profile.cpp: + * tao/Invocation_Base.cpp: + * tao/LocalObject.cpp: + * tao/MCAST_Parser.cpp: + * tao/NVList.i: + * tao/ORB_Core.cpp: + * tao/ORB_Table.cpp: + * tao/Object.cpp: + * tao/Object_Ref_Table.cpp: + * tao/ParameterMode.cpp: + * tao/Sequence.i: + * tao/Sequence_T.i: + * tao/Service_Context.cpp: + * tao/Sync_Strategies.cpp: + * tao/Tagged_Components.cpp: + * tao/Tagged_Profile.i: + * tao/TimeBaseC.cpp: + * tao/Transport.cpp: + * tao/Transport_Connector.cpp: + * tao/Var_Array_Argument_T.inl: + * tao/orbconf.h: + * tao/target_specification.i: Converted all ACE cast macro calls to their ANSI C++ cast counterparts. - * TAO/tao/Array_VarOut_T.h (nocopy_): + * tao/Array_VarOut_T.h (nocopy_): Made this attribute "const." Its value never changes. - * TAO/tao/Asynch_Queued_Message.cpp: - * TAO/tao/Codeset_Manager.cpp: - * TAO/tao/Exception.cpp: - * TAO/tao/IIOP_Transport.cpp: - * TAO/tao/Incoming_Message_Queue.cpp: - * TAO/tao/ORB.cpp: - * TAO/tao/Object_KeyC.cpp: - * TAO/tao/Synch_Queued_Message.cpp: - * TAO/tao/Transport_Cache_Manager.cpp: - * TAO/tao/UTF16_BOM_Translator.cpp: - * TAO/tao/append.cpp: - * TAO/tao/skip.cpp: + * tao/Asynch_Queued_Message.cpp: + * tao/Codeset_Manager.cpp: + * tao/Exception.cpp: + * tao/IIOP_Transport.cpp: + * tao/Incoming_Message_Queue.cpp: + * tao/ORB.cpp: + * tao/Object_KeyC.cpp: + * tao/Synch_Queued_Message.cpp: + * tao/Transport_Cache_Manager.cpp: + * tao/UTF16_BOM_Translator.cpp: + * tao/append.cpp: + * tao/skip.cpp: Converted all ACE cast macro calls to their ANSI C++ cast counterparts. @@ -73,34 +131,34 @@ Wed Jun 2 00:37:17 2004 Ossama Othman <ossama@dre.vanderbilt.edu> Use prefix {in,dec}rement operators where applicable instead of postfix operators. The former are more efficient. - * TAO/tao/CORBA_String.h (operator CORBA::WChar *): - * TAO/tao/CORBA_String.inl (operator CORBA::WChar *): + * tao/CORBA_String.h (operator CORBA::WChar *): + * tao/CORBA_String.inl (operator CORBA::WChar *): Corrected this conversion operator. The latest C++ mapping requires that the conversion return "CORBA::WChar *&" instead. - * TAO/tao/GIOPC.h: + * tao/GIOPC.h: No need to include "tao/Any.h". - * TAO/tao/PortableInterceptorC.h: + * tao/PortableInterceptorC.h: No need to include "tao/Any.h", nor "tao/PolicyC.h". Include the much lighterweight "tao/Policy_ForwardC.h" instead. - * TAO/tao/Var_Array_Argument_T.cpp: + * tao/Var_Array_Argument_T.cpp: Nuked trailing whitespace. - * TAO/tao/default_resource.cpp: - * TAO/tao/default_server.cpp: + * tao/default_resource.cpp: + * tao/default_server.cpp: Use prefix {in,dec}rement operators where applicable instead of postfix operators. The former are more efficient. - * TAO/tao/Messaging/Asynch_Invocation.cpp: - * TAO/tao/Messaging/Asynch_Timeout_Handler.cpp: - * TAO/tao/Messaging/Messaging_PolicyFactory.cpp: + * tao/Messaging/Asynch_Invocation.cpp: + * tao/Messaging/Asynch_Timeout_Handler.cpp: + * tao/Messaging/Messaging_PolicyFactory.cpp: Corrected ACE_RCSID macro arguments. "tao" -> "Messaging". diff --git a/TAO/tao/CORBA_String.cpp b/TAO/tao/CORBA_String.cpp index 4e1858ca54a..870c61bf2ca 100644 --- a/TAO/tao/CORBA_String.cpp +++ b/TAO/tao/CORBA_String.cpp @@ -25,7 +25,7 @@ CORBA::string_dup (const char *str) return 0; } - size_t len = ACE_OS::strlen (str); + const size_t len = ACE_OS::strlen (str); // This allocates an extra byte for the '\0'; char * copy = CORBA::string_alloc (static_cast<CORBA::ULong> (len)); diff --git a/TAO/tao/Exception.cpp b/TAO/tao/Exception.cpp index 9d30ac66064..8b8338d3a3b 100644 --- a/TAO/tao/Exception.cpp +++ b/TAO/tao/Exception.cpp @@ -41,7 +41,7 @@ ACE_Allocator *TAO_Exceptions::global_allocator_; // Flag that denotes that the TAO TypeCode constants have been // initialized. -int TAO_Exceptions::initialized_ = 0; +bool TAO_Exceptions::initialized_ = false; // TAO specific typecode. extern CORBA::TypeCode_ptr TC_completion_status; @@ -658,7 +658,7 @@ CORBA::SystemException::_info (void) const } else if (VMCID == CORBA::OMGVMCID) { - CORBA::ULong minor_code = this->minor () & 0xFFFU; + const CORBA::ULong minor_code = this->minor () & 0xFFFU; const char *minor_description = 0; @@ -1169,7 +1169,7 @@ static CORBA::Long tc_buf_CORBA[TAO_TC_BUF_LEN / sizeof (CORBA::Long)]; static const CORBA::ULong array_sz = (sizeof (type_code_array) / sizeof (CORBA::TypeCode_ptr)) - 1; -static const char *repo_id_array [] = { +static const char *repo_id_array[] = { #define TAO_SYSTEM_EXCEPTION(name) \ (char *) "IDL:omg.org/CORBA/" #name ":1.0", STANDARD_EXCEPTION_LIST @@ -1193,7 +1193,7 @@ TAO_Exceptions::init (ACE_ENV_SINGLE_ARG_DECL) // Not thread safe. Caller must provide synchronization. - if (TAO_Exceptions::initialized_ != 0) + if (TAO_Exceptions::initialized_) { return; } @@ -1202,9 +1202,9 @@ TAO_Exceptions::init (ACE_ENV_SINGLE_ARG_DECL) ACE_NEW (TAO_Exceptions::global_allocator_, ACE_New_Allocator); - char *name_array [] = { + static const char *name_array[] = { #define TAO_SYSTEM_EXCEPTION(name) \ - (char *) # name, + # name, STANDARD_EXCEPTION_LIST #undef TAO_SYSTEM_EXCEPTION 0 @@ -1223,7 +1223,7 @@ TAO_Exceptions::init (ACE_ENV_SINGLE_ARG_DECL) TAO_Exceptions::make_unknown_user_typecode (CORBA::_tc_UnknownUserException ACE_ENV_ARG_PARAMETER); - TAO_Exceptions::initialized_ = 1; + TAO_Exceptions::initialized_ = true; } #undef TAO_TC_BUF_LEN diff --git a/TAO/tao/Exception.h b/TAO/tao/Exception.h index 36f87f74124..76759a0e755 100644 --- a/TAO/tao/Exception.h +++ b/TAO/tao/Exception.h @@ -421,7 +421,7 @@ namespace CORBA TAO_SYSTEM_EXCEPTION(ACTIVITY_REQUIRED); TAO_SYSTEM_EXCEPTION(THREAD_CANCELLED); - #undef TAO_SYSTEM_EXCEPTION +#undef TAO_SYSTEM_EXCEPTION #if !defined (ACE_LACKS_IOSTREAM_TOTALLY) @@ -484,7 +484,7 @@ public: private: /// Flag that denotes that the TAO's CORBA exceptions have been /// initialized. - static int initialized_; + static bool initialized_; }; #if defined (TAO_DONT_CATCH_DOT_DOT_DOT) diff --git a/TAO/tao/IIOP_Acceptor.cpp b/TAO/tao/IIOP_Acceptor.cpp index d857085d9de..1d9a9e6437a 100644 --- a/TAO/tao/IIOP_Acceptor.cpp +++ b/TAO/tao/IIOP_Acceptor.cpp @@ -17,9 +17,9 @@ #include "ace/os_include/os_netdb.h" -ACE_RCSID(tao, - IIOP_Acceptor, - "$Id$") +ACE_RCSID (tao, + IIOP_Acceptor, + "$Id$") #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) @@ -55,8 +55,8 @@ TAO_IIOP_Acceptor::TAO_IIOP_Acceptor (CORBA::Boolean flag) addrs_ (0), port_span_ (1), hosts_ (0), - endpoint_count_ (0), hostname_in_ior_ (0), + endpoint_count_ (0), version_ (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR), orb_core_ (0), lite_flag_ (flag), @@ -114,7 +114,7 @@ TAO_IIOP_Acceptor::create_new_profile (const TAO::ObjectKey &object_key, CORBA::Short priority) { // Adding this->endpoint_count_ to the TAO_MProfile. - int count = mprofile.profile_count (); + const int count = mprofile.profile_count (); if ((mprofile.size () - count) < this->endpoint_count_ && mprofile.grow (count + this->endpoint_count_) == -1) return -1; @@ -171,8 +171,7 @@ TAO_IIOP_Acceptor::create_shared_profile (const TAO::ObjectKey &object_key, pfile = mprofile.get_profile (i); if (pfile->tag () == IOP::TAG_INTERNET_IOP) { - iiop_profile = ACE_dynamic_cast (TAO_IIOP_Profile *, - pfile); + iiop_profile = dynamic_cast<TAO_IIOP_Profile *> (pfile); break; } } @@ -189,6 +188,7 @@ TAO_IIOP_Acceptor::create_shared_profile (const TAO::ObjectKey &object_key, this->version_, this->orb_core_), -1); + iiop_profile->endpoint ()->priority (priority); if (mprofile.give_profile (iiop_profile) == -1) @@ -234,7 +234,7 @@ int TAO_IIOP_Acceptor::is_collocated (const TAO_Endpoint *endpoint) { const TAO_IIOP_Endpoint *endp = - ACE_dynamic_cast (const TAO_IIOP_Endpoint *, endpoint); + dynamic_cast<const TAO_IIOP_Endpoint *> (endpoint); // Make sure the dynamically cast pointer is valid. if (endp == 0) @@ -290,10 +290,8 @@ TAO_IIOP_Acceptor::open (TAO_ORB_Core *orb_core, return -1; if (major >=0 && minor >= 0) - this->version_.set_version (ACE_static_cast (CORBA::Octet, - major), - ACE_static_cast (CORBA::Octet, - minor)); + this->version_.set_version (static_cast<CORBA::Octet> (major), + static_cast<CORBA::Octet> (minor)); // Parse options if (this->parse_options (options) == -1) return -1; @@ -320,7 +318,7 @@ TAO_IIOP_Acceptor::open (TAO_ORB_Core *orb_core, // Now reset the port and set the host. if (addr.set (addr.get_port_number (), - ACE_static_cast (ACE_UINT32, INADDR_ANY), + static_cast<ACE_UINT32> (INADDR_ANY), 1) != 0) return -1; else @@ -343,7 +341,7 @@ TAO_IIOP_Acceptor::open (TAO_ORB_Core *orb_core, return -1; // Extract out just the host part of the address. - size_t len = port_separator_loc - address; + const size_t len = port_separator_loc - address; ACE_OS::memcpy (tmp_host, address, len); tmp_host[len] = '\0'; @@ -417,11 +415,9 @@ TAO_IIOP_Acceptor::open_default (TAO_ORB_Core *orb_core, -1); } - if (major >=0 && minor >= 0) - this->version_.set_version (ACE_static_cast (CORBA::Octet, - major), - ACE_static_cast (CORBA::Octet, - minor)); + if (major >= 0 && minor >= 0) + this->version_.set_version (static_cast<CORBA::Octet> (major), + static_cast<CORBA::Octet> (minor)); // Parse options if (this->parse_options (options) == -1) @@ -436,8 +432,8 @@ TAO_IIOP_Acceptor::open_default (TAO_ORB_Core *orb_core, // address. ACE_INET_Addr addr; - if (addr.set (ACE_static_cast(u_short, 0), - ACE_static_cast(ACE_UINT32, INADDR_ANY), + if (addr.set (static_cast<unsigned short> (0), + static_cast<ACE_UINT32> (INADDR_ANY), 1) != 0) return -1; @@ -463,7 +459,7 @@ TAO_IIOP_Acceptor::open_i (const ACE_INET_Addr& addr, TAO_IIOP_ACCEPT_STRATEGY (this->orb_core_), -1); - u_short requested_port = addr.get_port_number (); + unsigned short requested_port = addr.get_port_number (); if (requested_port == 0) { // don't care, i.e., let the OS choose an ephemeral port @@ -485,7 +481,7 @@ TAO_IIOP_Acceptor::open_i (const ACE_INET_Addr& addr, { ACE_INET_Addr a(addr); - int found_a_port = 0; + bool found_a_port = false; ACE_UINT32 last_port = requested_port + this->port_span_ - 1; if (last_port > ACE_MAX_DEFAULT_PORT) { @@ -507,7 +503,7 @@ TAO_IIOP_Acceptor::open_i (const ACE_INET_Addr& addr, this->accept_strategy_, this->concurrency_strategy_) != -1) { - found_a_port = 1; + found_a_port = true; break; } } @@ -544,7 +540,7 @@ TAO_IIOP_Acceptor::open_i (const ACE_INET_Addr& addr, // interface then the endpoint created on each interface will be on // the same port. This is how a wildcard socket bind() is supposed // to work. - u_short port = address.get_port_number (); + unsigned short port = address.get_port_number (); for (CORBA::ULong j = 0; j < this->endpoint_count_; ++j) this->addrs_[j].set_port_number (port, 1); @@ -652,8 +648,7 @@ TAO_IIOP_Acceptor::probe_interfaces (TAO_ORB_Core *orb_core) ACE_INET_Addr *if_addrs = 0; size_t if_cnt = 0; - if (ACE::get_ip_interfaces (if_cnt, - if_addrs) != 0 + if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0 && errno != ENOTSUP) { // In the case where errno == ENOTSUP, if_cnt and if_addrs will @@ -683,7 +678,7 @@ TAO_IIOP_Acceptor::probe_interfaces (TAO_ORB_Core *orb_core) size_t lo_cnt = 0; // Loopback interface count for (size_t j = 0; j < if_cnt; ++j) if (if_addrs[j].get_ip_address () == INADDR_LOOPBACK) - lo_cnt++; + ++lo_cnt; // The instantiation for this template is in // tao/IIOP_Connector.cpp. @@ -693,9 +688,9 @@ TAO_IIOP_Acceptor::probe_interfaces (TAO_ORB_Core *orb_core) // in the list of interfaces to query for a hostname, otherwise // exclude it from the list. if (if_cnt == lo_cnt) - this->endpoint_count_ = ACE_static_cast (CORBA::ULong, if_cnt); + this->endpoint_count_ = static_cast<CORBA::ULong> (if_cnt); else - this->endpoint_count_ = ACE_static_cast (CORBA::ULong, if_cnt - lo_cnt); + this->endpoint_count_ = static_cast<CORBA::ULong> (if_cnt - lo_cnt); ACE_NEW_RETURN (this->addrs_, ACE_INET_Addr[this->endpoint_count_], @@ -717,7 +712,7 @@ TAO_IIOP_Acceptor::probe_interfaces (TAO_ORB_Core *orb_core) // Ignore any loopback interface if there are other // non-loopback interfaces. if (if_cnt != lo_cnt && - if_addrs[i].get_ip_address() == INADDR_LOOPBACK) + if_addrs[i].get_ip_address () == INADDR_LOOPBACK) continue; if (this->hostname_in_ior_ != 0) @@ -747,7 +742,7 @@ TAO_IIOP_Acceptor::probe_interfaces (TAO_ORB_Core *orb_core) if (this->addrs_[host_cnt].set (if_addrs[i]) != 0) return -1; - host_cnt++; + ++host_cnt; } return 0; @@ -767,7 +762,7 @@ TAO_IIOP_Acceptor::object_key (IOP::TaggedProfile &profile, #if (TAO_NO_COPY_OCTET_SEQUENCES == 1) TAO_InputCDR cdr (profile.profile_data.mb ()); #else - TAO_InputCDR cdr (ACE_reinterpret_cast(char*,profile.profile_data.get_buffer ()), + TAO_InputCDR cdr (reinterpret_cast<char*> (profile.profile_data.get_buffer ()), profile.profile_data.length ()); #endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ @@ -824,11 +819,11 @@ TAO_IIOP_Acceptor::parse_options (const char *str) // HTTP URLs. // e.g.: option1=foo&option2=bar - ACE_CString options (str); + const ACE_CString options (str); - size_t len = options.length (); + const size_t len = options.length (); - const char option_delimiter = '&'; + static const char option_delimiter = '&'; // Count the number of options. @@ -839,7 +834,7 @@ TAO_IIOP_Acceptor::parse_options (const char *str) // before the object key. for (size_t i = 0; i < len; ++i) if (options[i] == option_delimiter) - option_count++; + ++option_count; // The idea behind the following loop is to split the options into // (option, name) pairs. @@ -859,8 +854,9 @@ TAO_IIOP_Acceptor::parse_options (const char *str) if (j < option_count - 1) end = options.find (option_delimiter, begin); else - end = ACE_static_cast (CORBA::ULong, len) - - begin; // Handle last endpoint differently + end = static_cast<CORBA::ULong> (len) - begin; // Handle last + // endpoint + // differently. if (end == begin) ACE_ERROR_RETURN ((LM_ERROR, @@ -868,20 +864,20 @@ TAO_IIOP_Acceptor::parse_options (const char *str) -1); else if (end != ACE_CString::npos) { - ACE_CString opt = options.substring (begin, end); + const ACE_CString opt = options.substring (begin, end); - int slot = opt.find ("="); + const int slot = opt.find ("="); - if (slot == ACE_static_cast (int, len - 1) + if (slot == static_cast<int> (len - 1) || slot == ACE_CString::npos) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) IIOP option <%s> is ") ACE_TEXT ("missing a value.\n"), - ACE_TEXT_CHAR_TO_TCHAR ( opt.c_str ())), + ACE_TEXT_CHAR_TO_TCHAR (opt.c_str ())), -1); - ACE_CString name = opt.substring (0, slot); - ACE_CString value = opt.substring (slot + 1); + const ACE_CString name = opt.substring (0, slot); + const ACE_CString value = opt.substring (slot + 1); if (name.length () == 0) ACE_ERROR_RETURN ((LM_ERROR, @@ -898,7 +894,7 @@ TAO_IIOP_Acceptor::parse_options (const char *str) } else if (name == "portspan") { - int range = ACE_static_cast (int, ACE_OS::atoi (value.c_str ())); + int range = static_cast<int> (ACE_OS::atoi (value.c_str ())); // @@ What's the lower bound on the range? zero, or one? if (range < 1 || range > ACE_MAX_DEFAULT_PORT) ACE_ERROR_RETURN ((LM_ERROR, @@ -908,7 +904,7 @@ TAO_IIOP_Acceptor::parse_options (const char *str) ACE_TEXT_CHAR_TO_TCHAR (value.c_str ()), ACE_MAX_DEFAULT_PORT), -1); - this->port_span_ = ACE_static_cast (u_short, range); + this->port_span_ = static_cast<unsigned short> (range); } else if (name == "hostname_in_ior") { @@ -921,6 +917,7 @@ TAO_IIOP_Acceptor::parse_options (const char *str) -1); } } + return 0; } @@ -957,10 +954,10 @@ TAO_IIOP_Acceptor::init_tcp_properties (void) if (tph != 0) { - const char protocol [] = "iiop"; + static const char protocol[] = "iiop"; const char *protocol_type = protocol; - int hook_return = + const int hook_return = tph->call_server_protocols_hook (send_buffer_size, recv_buffer_size, no_delay, diff --git a/TAO/tao/IIOP_Acceptor.h b/TAO/tao/IIOP_Acceptor.h index 2a994deb4c1..182f7aba724 100644 --- a/TAO/tao/IIOP_Acceptor.h +++ b/TAO/tao/IIOP_Acceptor.h @@ -162,7 +162,7 @@ protected: * at the port specified in each element of addrs_) for an available * port. This is specified via the "portspan=" option to the endpoint. */ - u_short port_span_; + unsigned short port_span_; /** * Cache the information about the endpoints serviced by this @@ -173,15 +173,15 @@ protected: */ char **hosts_; - /// The number of host names cached in the hosts_ array (equivalent - /// to the number of endpoints opened by this Acceptor). - CORBA::ULong endpoint_count_; - /** * Override the hostname used in the ORBEndPoint. */ char *hostname_in_ior_; + /// The number of host names cached in the hosts_ array (equivalent + /// to the number of endpoints opened by this Acceptor). + CORBA::ULong endpoint_count_; + /** * The GIOP version for this endpoint * @@ Theoretically they shouldn't be here!! We need to look at a @@ -197,7 +197,7 @@ protected: TAO_IIOP_Properties tcp_properties_; /// Should we use GIOP lite?? - CORBA::Boolean lite_flag_; + const bool lite_flag_; private: diff --git a/TAO/tao/IIOP_Connection_Handler.cpp b/TAO/tao/IIOP_Connection_Handler.cpp index 6857c682c54..77db069c7c8 100644 --- a/TAO/tao/IIOP_Connection_Handler.cpp +++ b/TAO/tao/IIOP_Connection_Handler.cpp @@ -165,7 +165,7 @@ TAO_IIOP_Connection_Handler::close_connection (void) int TAO_IIOP_Connection_Handler::handle_input (ACE_HANDLE h) { - int result = + const int result = this->handle_input_eh (h, this); if (result == -1) @@ -180,7 +180,7 @@ TAO_IIOP_Connection_Handler::handle_input (ACE_HANDLE h) int TAO_IIOP_Connection_Handler::handle_output (ACE_HANDLE handle) { - int result = + const int result = this->handle_output_eh (handle, this); if (result == -1) @@ -254,9 +254,9 @@ TAO_IIOP_Connection_Handler::process_listen_point_list ( IIOP::ListenPointList &listen_list) { // Get the size of the list - CORBA::ULong len = listen_list.length (); + const CORBA::ULong len = listen_list.length (); - for (CORBA::ULong i = 0; i < len; ++ i) + for (CORBA::ULong i = 0; i < len; ++i) { IIOP::ListenPoint listen_point = listen_list[i]; ACE_INET_Addr addr (listen_point.port, @@ -366,10 +366,10 @@ TAO_IIOP_Connection_Handler::set_dscp_codepoint (void) if (tos != this->dscp_codepoint_) { - int ret = this->peer ().set_option (IPPROTO_IP, - IP_TOS, - (int *) &tos , - (int) sizeof (tos)); + const int ret = this->peer ().set_option (IPPROTO_IP, + IP_TOS, + (int *) &tos , + (int) sizeof (tos)); if (TAO_debug_level) { diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index fc231811317..f75ef5dddfd 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -12,7 +12,7 @@ #include "ace/OS_NS_string.h" -ACE_RCSID (TAO, +ACE_RCSID (tao, IIOP_Connector, "$Id$") @@ -136,21 +136,20 @@ TAO_IIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *, TAO_Transport_Descriptor_Interface &desc, ACE_Time_Value *max_wait_time) { - TAO_IIOP_Endpoint *iiop_endpoint = - this->remote_endpoint (desc.endpoint ()); + TAO_IIOP_Endpoint *iiop_endpoint = this->remote_endpoint (desc.endpoint ()); if (iiop_endpoint == 0) return 0; - const ACE_INET_Addr &remote_address = - iiop_endpoint->object_addr (); + const ACE_INET_Addr &remote_address = iiop_endpoint->object_addr (); if (TAO_debug_level > 2) { ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - IIOP_Connector::make_connection, " "to <%s:%d>\n", - ACE_TEXT_CHAR_TO_TCHAR(iiop_endpoint->host()), iiop_endpoint->port())); + ACE_TEXT_CHAR_TO_TCHAR(iiop_endpoint->host()), + iiop_endpoint->port())); } // Get the right synch options @@ -226,8 +225,7 @@ TAO_IIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *, svc_handler->is_closed (); // In case of failures and close() has not be called. - if (result == -1 && - !closed) + if (result == -1 && !closed) { // First, cancel from connector. this->base_connector_.cancel (svc_handler); @@ -239,16 +237,14 @@ TAO_IIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *, // Once connector.cancel() has been processed, we are // assured that the connector will no longer open/close this // handler. - closed = - svc_handler->is_closed (); + closed = svc_handler->is_closed (); // If closed, there is nothing to do here. If not closed, // it was either opened or is still pending. if (!closed) { // Check if the handler has been opened. - int open = - svc_handler->is_open (); + const int open = svc_handler->is_open (); // Some other thread was able to open the handler even // though wait failed for this thread. @@ -293,12 +289,12 @@ TAO_IIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *, ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - IIOP_Connector::make_connection, " "new connection to <%s:%d> on Transport[%d]\n", - ACE_TEXT_CHAR_TO_TCHAR(iiop_endpoint->host ()), iiop_endpoint->port (), + ACE_TEXT_CHAR_TO_TCHAR(iiop_endpoint->host ()), + iiop_endpoint->port (), svc_handler->peer ().get_handle ())); } - TAO_Transport *transport = - svc_handler->transport (); + TAO_Transport *transport = svc_handler->transport (); // Add the handler to Cache int retval = @@ -356,7 +352,7 @@ TAO_IIOP_Connector::create_profile (TAO_InputCDR& cdr) TAO_IIOP_Profile (this->orb_core ()), 0); - int r = pfile->decode (cdr); + const int r = pfile->decode (cdr); if (r == -1) { pfile->_decr_refcnt (); @@ -394,12 +390,12 @@ TAO_IIOP_Connector::check_prefix (const char *endpoint) if (!endpoint || !*endpoint) return -1; // Failure - const char *protocol[] = { "iiop", "iioploc" }; + static const char *protocol[] = { "iiop", "iioploc" }; - size_t slot = ACE_OS::strchr (endpoint, ':') - endpoint; + const size_t slot = ACE_OS::strchr (endpoint, ':') - endpoint; - size_t len0 = ACE_OS::strlen (protocol[0]); - size_t len1 = ACE_OS::strlen (protocol[1]); + const size_t len0 = ACE_OS::strlen (protocol[0]); + const size_t len1 = ACE_OS::strlen (protocol[1]); // Check for the proper prefix in the IOR. If the proper prefix // isn't in the IOR then it is not an IOR we can use. @@ -448,17 +444,17 @@ TAO_IIOP_Connector::init_tcp_properties (void) if (tph != 0) { - const char protocol [] = "iiop"; + static const char protocol[] = "iiop"; const char *protocol_type = protocol; - int hook_result = + const int hook_result = tph->call_client_protocols_hook (send_buffer_size, recv_buffer_size, no_delay, enable_network_priority, protocol_type); - if(hook_result == -1) + if (hook_result == -1) return -1; } @@ -484,6 +480,7 @@ TAO_IIOP_Connector::remote_endpoint (TAO_Endpoint *endpoint) TAO_IIOP_Endpoint *iiop_endpoint = dynamic_cast<TAO_IIOP_Endpoint *> (endpoint ); + if (iiop_endpoint == 0) return 0; diff --git a/TAO/tao/IIOP_Connector.h b/TAO/tao/IIOP_Connector.h index 0fcb91e3259..d8dac4ba098 100644 --- a/TAO/tao/IIOP_Connector.h +++ b/TAO/tao/IIOP_Connector.h @@ -106,8 +106,7 @@ protected: TAO_IIOP_Properties tcp_properties_; /// Do we need to use a GIOP_Lite for sending messages? - CORBA::Boolean lite_flag_; - + const bool lite_flag_; private: diff --git a/TAO/tao/IIOP_Transport.cpp b/TAO/tao/IIOP_Transport.cpp index 16ee8dd018a..3151824b184 100644 --- a/TAO/tao/IIOP_Transport.cpp +++ b/TAO/tao/IIOP_Transport.cpp @@ -138,7 +138,7 @@ TAO_IIOP_Transport::send_request (TAO_Stub *stub, if (tph != 0) { - int result = + const int result = tph->update_client_protocol_properties (stub, this, "iiop"); @@ -186,10 +186,10 @@ TAO_IIOP_Transport::send_message (TAO_OutputCDR &stream, return -1; // This guarantees to send all data (bytes) or return an error. - ssize_t n = this->send_message_shared (stub, - message_semantics, - stream.begin (), - max_wait_time); + const ssize_t n = this->send_message_shared (stub, + message_semantics, + stream.begin (), + max_wait_time); if (n == -1) { diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp index eff8071dda2..c3b934f1e41 100644 --- a/TAO/tao/ORB.cpp +++ b/TAO/tao/ORB.cpp @@ -249,7 +249,7 @@ CORBA::ORB::work_pending (ACE_Time_Value &tv ACE_ENV_ARG_DECL) this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); - int result = this->orb_core_->reactor ()->work_pending (tv); + const int result = this->orb_core_->reactor ()->work_pending (tv); if (result == 0 || (result == -1 && errno == ETIME)) return 0; @@ -266,7 +266,7 @@ CORBA::ORB::work_pending (ACE_ENV_SINGLE_ARG_DECL) this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); - int result = this->orb_core_->reactor ()->work_pending (); + const int result = this->orb_core_->reactor ()->work_pending (); if (result == 0) return 0; @@ -280,8 +280,8 @@ CORBA::ORB::work_pending (ACE_ENV_SINGLE_ARG_DECL) void CORBA::ORB::create_list (CORBA::Long count, - CORBA::NVList_ptr &new_list - ACE_ENV_ARG_DECL) + CORBA::NVList_ptr &new_list + ACE_ENV_ARG_DECL) { ACE_ASSERT (CORBA::ULong (count) <= UINT_MAX); @@ -319,7 +319,7 @@ CORBA::ORB::create_list (CORBA::Long count, void CORBA::ORB::create_exception_list (CORBA::ExceptionList_ptr &list - ACE_ENV_ARG_DECL) + ACE_ENV_ARG_DECL) { TAO_Dynamic_Adapter *dynamic_adapter = ACE_Dynamic_Service<TAO_Dynamic_Adapter>::instance ( @@ -1021,7 +1021,7 @@ CORBA::Object_ptr CORBA::ORB::resolve_service (TAO_MCAST_SERVICEID mcast_service_id ACE_ENV_ARG_DECL_NOT_USED) { - const char * env_service_port [] = + static const char * env_service_port[] = { "NameServicePort", "TradingServicePort", @@ -1029,7 +1029,7 @@ CORBA::ORB::resolve_service (TAO_MCAST_SERVICEID mcast_service_id "InterfaceRepoServicePort" }; - u_short default_service_port [] = + static const unsigned short default_service_port[] = { TAO_DEFAULT_NAME_SERVER_REQUEST_PORT, TAO_DEFAULT_TRADING_SERVER_REQUEST_PORT, @@ -1037,14 +1037,14 @@ CORBA::ORB::resolve_service (TAO_MCAST_SERVICEID mcast_service_id TAO_DEFAULT_INTERFACEREPO_SERVER_REQUEST_PORT }; - CORBA::Object_var return_value = CORBA::Object::_nil (); + CORBA::Object_var return_value; // By now, the table filled in with -ORBInitRef arguments has been // checked. We only get here if the table didn't contain an initial // reference for the requested Service. // First, determine if the port was supplied on the command line - u_short port = + unsigned short port = this->orb_core_->orb_params ()->service_port (mcast_service_id); if (port == 0) @@ -1054,14 +1054,14 @@ CORBA::ORB::resolve_service (TAO_MCAST_SERVICEID mcast_service_id ACE_OS::getenv (env_service_port[mcast_service_id]); if (port_number != 0) - port = (u_short) ACE_OS::atoi (port_number); + port = static_cast<unsigned short> (ACE_OS::atoi (port_number)); else port = default_service_port[mcast_service_id]; } // Set the port value in ORB_Params: modify the default mcast // value. - const char prefix[] = "mcast://:"; + static const char prefix[] = "mcast://:"; char port_char[256]; @@ -1500,7 +1500,7 @@ CORBA::ORB_init (int &argc, // It doesn't make sense for argc to be zero and argv to be // non-empty/zero, or for argc to be greater than zero and argv be // zero. - size_t argv0_len = + const size_t argv0_len = (command_line.get_TCHAR_argv () ? (*command_line.get_TCHAR_argv () ? ACE_OS::strlen (*command_line.get_TCHAR_argv ()) @@ -1529,7 +1529,7 @@ CORBA::ORB_init (int &argc, { const ACE_TCHAR *current_arg = arg_shifter.get_current (); - const ACE_TCHAR orbid_opt[] = ACE_TEXT ("-ORBid"); + static const ACE_TCHAR orbid_opt[] = ACE_TEXT ("-ORBid"); size_t orbid_len = ACE_OS::strlen (orbid_opt); if (ACE_OS::strcasecmp (current_arg, orbid_opt) == 0) @@ -1756,7 +1756,7 @@ CORBA::ORB::object_to_string (CORBA::Object_ptr obj // Now hexify the encapsulated CDR data into a string, and // return that string. - size_t total_len = cdr.total_length (); + const size_t total_len = cdr.total_length (); char *cp; ACE_ALLOCATOR_RETURN (cp, @@ -1946,7 +1946,7 @@ CORBA::ORB::ior_string_to_object (const char *str // Some platforms define 'byte' as a macro, solve the problem // here. #undef byte - u_char byte; + unsigned char byte; if (!(isxdigit (tmp [0]) && isxdigit (tmp [1]))) break; diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index c6aaa0d3604..6d073091420 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -282,20 +282,20 @@ TAO_ORB_Core::init (int &argc, char *argv[] ACE_ENV_ARG_DECL) // @@ GIOPLite should be an alternative ORB Messaging protocols, fredk // int giop_lite = 0; - CORBA::Boolean use_ior = 1; + bool use_ior = true; int cdr_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF; // The following things should be changed to use the ACE_Env_Value<> // template sometime. // Name Service port use for Multicast - u_short ns_port = 0; + unsigned short ns_port = 0; // Trading Service port used for Multicast - u_short ts_port = 0; + unsigned short ts_port = 0; // Implementation Repository Service port #. - u_short ir_port = 0; + unsigned short ir_port = 0; // Buffer sizes for kernel socket buffers // @@ should be a default defined for each protocol implementation? @@ -473,7 +473,7 @@ TAO_ORB_Core::init (int &argc, char *argv[] ACE_ENV_ARG_DECL) const ACE_TCHAR *opt = current_arg; if (ACE_OS::strcasecmp (opt, ACE_LIB_TEXT("URL")) == 0) - use_ior = 0; + use_ior = false; arg_shifter.consume_arg (); } @@ -690,7 +690,7 @@ TAO_ORB_Core::init (int &argc, char *argv[] ACE_ENV_ARG_DECL) #if defined (ACE_LACKS_IOSTREAM_TOTALLY) - FILE* output_stream = ACE_OS::fopen (file_name, ACE_LIB_TEXT("a")); + FILE* output_stream = ACE_OS::fopen (file_name, ACE_LIB_TEXT ("a")); ACE_LOG_MSG->msg_ostream (output_stream, 1); @@ -728,9 +728,7 @@ TAO_ORB_Core::init (int &argc, char *argv[] ACE_ENV_ARG_DECL) else if ((current_arg = arg_shifter.get_the_parameter (ACE_LIB_TEXT("-ORBVerboseLogging")))) { - // Use dotted decimal addresses - // @@ this should be renamed. See above comment. fredk - u_long verbose_logging = ACE_OS::atoi (current_arg); + unsigned long verbose_logging = ACE_OS::atoi (current_arg); arg_shifter.consume_arg (); @@ -1659,7 +1657,8 @@ TAO_ORB_Core::create_stub_object (TAO_MProfile &mprofile, { TAO_Profile * profile; - for (CORBA::ULong i = 0; i < mprofile.profile_count (); ++i) + const CORBA::ULong count = mprofile.profile_count (); + for (CORBA::ULong i = 0; i < count; ++i) { // Get the ith profile profile = mprofile.get_profile (i); @@ -1705,10 +1704,8 @@ TAO_ORB_Core::create_object (TAO_Stub *stub) 0)); TAO_ORB_Table *table = TAO_ORB_Table::instance (); - TAO_ORB_Table::Iterator end = table->end (); - for (TAO_ORB_Table::Iterator i = table->begin (); - i != end; - ++i) + const TAO_ORB_Table::Iterator end = table->end (); + for (TAO_ORB_Table::Iterator i = table->begin (); i != end; ++i) { TAO_ORB_Core *other_core = (*i).int_id_; @@ -1750,9 +1747,7 @@ TAO_ORB_Core::initialize_object (TAO_Stub *stub, TAO_ORB_Table *table = TAO_ORB_Table::instance (); TAO_ORB_Table::Iterator end = table->end (); - for (TAO_ORB_Table::Iterator i = table->begin (); - i != end; - ++i) + for (TAO_ORB_Table::Iterator i = table->begin (); i != end; ++i) { TAO_ORB_Core *other_core = (*i).int_id_; @@ -2291,11 +2286,11 @@ CORBA::ORB::ObjectIdList * TAO_ORB_Core::list_initial_references (ACE_ENV_SINGLE_ARG_DECL) { // Unsupported initial services should NOT be included in the below list! - const char *initial_services[] = { TAO_LIST_OF_INITIAL_SERVICES }; + static const char *initial_services[] = { TAO_LIST_OF_INITIAL_SERVICES }; // Make sure the "terminating" zero is the last array element so // that there is a stop condition when iterating through the list. - const size_t initial_services_size = + static const size_t initial_services_size = sizeof (initial_services) / sizeof (initial_services[0]); const size_t total_size = @@ -2311,7 +2306,7 @@ TAO_ORB_Core::list_initial_references (ACE_ENV_SINGLE_ARG_DECL) CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (0); - CORBA::ORB::ObjectIdList_var list = tmp; + CORBA::ORB::ObjectIdList_var list (tmp); list->length (static_cast<CORBA::ULong> (total_size)); CORBA::ULong index = 0; @@ -2335,7 +2330,7 @@ TAO_ORB_Core::list_initial_references (ACE_ENV_SINGLE_ARG_DECL) list[index] = CORBA::string_dup ((*i).ext_id_); // References registered via INS. - InitRefMap::iterator end = this->init_ref_map_.end (); + const InitRefMap::iterator end = this->init_ref_map_.end (); for (InitRefMap::iterator j = this-> init_ref_map_.begin (); j != end; @@ -2878,13 +2873,12 @@ TAO_ORB_Core_instance (void) // exist in the ORB table after the ORB reference is // destroyed. - CORBA::ORB_var orb; - - int argc = 0; ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - orb = CORBA::ORB_init (argc, 0, 0 ACE_ENV_ARG_PARAMETER); + int argc = 0; + CORBA::ORB_var orb = + CORBA::ORB_init (argc, 0, 0 ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; } ACE_CATCHANY @@ -2910,7 +2904,7 @@ TAO_ORB_Core::collocation_strategy (CORBA::Object_ptr object TAO_ORB_Core *orb_core = stub->servant_orb_var ()->orb_core (); - int collocated = + const int collocated = orb_core->collocation_resolver ().is_collocated (object ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (TAO::TAO_CS_REMOTE_STRATEGY); diff --git a/TAO/tao/ORB_Core.i b/TAO/tao/ORB_Core.i index a9958019f3c..7f9170af8dd 100644 --- a/TAO/tao/ORB_Core.i +++ b/TAO/tao/ORB_Core.i @@ -14,7 +14,7 @@ TAO_ORB_Core::_decr_refcnt (void) { { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, 0); - this->refcount_--; + --this->refcount_; if (this->refcount_ != 0) return this->refcount_; } @@ -296,8 +296,8 @@ TAO_ORB_Core::set_tss_resource (size_t slot_id, void *ts_object) // If the TSS array isn't large enough, then increase its size. // We're guaranteed not to exceed the number of allocated slots by // the above check. - size_t old_size = tss_resources->ts_objects_.size (); - size_t new_size = slot_id + 1; + const size_t old_size = tss_resources->ts_objects_.size (); + const size_t new_size = slot_id + 1; if (slot_id >= old_size && tss_resources->ts_objects_.size (new_size) != 0) return -1; diff --git a/TAO/tao/Strategies/UIOP_Acceptor.cpp b/TAO/tao/Strategies/UIOP_Acceptor.cpp index c5f565366b0..973809ce5d5 100644 --- a/TAO/tao/Strategies/UIOP_Acceptor.cpp +++ b/TAO/tao/Strategies/UIOP_Acceptor.cpp @@ -55,7 +55,7 @@ TAO_UIOP_Acceptor::TAO_UIOP_Acceptor (CORBA::Boolean flag) accept_strategy_ (0), version_ (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR), orb_core_ (0), - unlink_on_close_ (1), + unlink_on_close_ (true), lite_flag_ (flag) { } @@ -148,8 +148,7 @@ TAO_UIOP_Acceptor::create_shared_profile (const TAO::ObjectKey &object_key, pfile = mprofile.get_profile (i); if (pfile->tag () == TAO_TAG_UIOP_PROFILE) { - uiop_profile = ACE_dynamic_cast (TAO_UIOP_Profile *, - pfile); + uiop_profile = dynamic_cast<TAO_UIOP_Profile *> (pfile); break; } } @@ -185,7 +184,7 @@ int TAO_UIOP_Acceptor::is_collocated (const TAO_Endpoint *endpoint) { const TAO_UIOP_Endpoint *endp = - ACE_dynamic_cast (const TAO_UIOP_Endpoint *, endpoint); + dynamic_cast<const TAO_UIOP_Endpoint *> (endpoint); // Make sure the dynamically cast pointer is valid. if (endp == 0) @@ -209,7 +208,7 @@ TAO_UIOP_Acceptor::close (void) if (this->base_acceptor_.acceptor ().get_local_addr (addr) == 0) (void) ACE_OS::unlink (addr.get_path_name ()); - this->unlink_on_close_ = 0; + this->unlink_on_close_ = false; } return this->base_acceptor_.close (); @@ -232,10 +231,8 @@ TAO_UIOP_Acceptor::open (TAO_ORB_Core *orb_core, return -1; if (major >= 0 && minor >= 0) - this->version_.set_version (ACE_static_cast (CORBA::Octet, - major), - ACE_static_cast (CORBA::Octet, - minor)); + this->version_.set_version (static_cast<CORBA::Octet> (major), + static_cast<CORBA::Octet> (minor)); // Parse options if (this->parse_options (options) == -1) return -1; @@ -256,18 +253,15 @@ TAO_UIOP_Acceptor::open_default (TAO_ORB_Core *orb_core, if (this->init_uiop_properties () != 0) return -1; - if (major >=0 && minor >= 0) - this->version_.set_version (ACE_static_cast (CORBA::Octet, - major), - ACE_static_cast (CORBA::Octet, - minor)); + if (major >= 0 && minor >= 0) + this->version_.set_version (static_cast<CORBA::Octet> (major), + static_cast<CORBA::Octet> (minor)); // Parse options if (this->parse_options (options) == -1) return -1; - ACE_Auto_String_Free tempname (ACE_OS::tempnam (0, - "TAO")); + ACE_Auto_String_Free tempname (ACE_OS::tempnam (0, "TAO")); if (tempname.get () == 0) return -1; @@ -307,7 +301,7 @@ TAO_UIOP_Acceptor::open_i (const char *rendezvous, // Don't unlink an existing rendezvous point since it may be in // use by another UIOP server/client. if (errno == EADDRINUSE) - this->unlink_on_close_ = 0; + this->unlink_on_close_ = false; return -1; } @@ -357,7 +351,7 @@ TAO_UIOP_Acceptor::rendezvous_point (ACE_UNIX_Addr &addr, addr.set (rendezvous); - size_t length = ACE_OS::strlen (addr.get_path_name ()); + const size_t length = ACE_OS::strlen (addr.get_path_name ()); // Check if rendezvous point was truncated by ACE_UNIX_Addr since // most UNIX domain socket rendezvous points can only be less than @@ -384,33 +378,34 @@ TAO_UIOP_Acceptor::object_key (IOP::TaggedProfile &profile, #if (TAO_NO_COPY_OCTET_SEQUENCES == 1) TAO_InputCDR cdr (profile.profile_data.mb ()); #else - TAO_InputCDR cdr (ACE_reinterpret_cast(char*,profile.profile_data.get_buffer ()), + TAO_InputCDR cdr (reinterpret_cast<char*> (profile.profile_data.get_buffer ()), profile.profile_data.length ()); #endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ - CORBA::Octet major, minor; + CORBA::Octet major, minor; - // Read the version. We just read it here. We don't*do any* + // Read the version. We just read it here. We don't *do any* // processing. - if (!(cdr.read_octet (major) - && cdr.read_octet (minor))) - { - if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) IIOP_Profile::decode - v%d.%d\n"), - major, - minor)); - } - return -1; - } + if (!(cdr.read_octet (major) && cdr.read_octet (minor))) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) IIOP_Profile::decode - v%d.%d\n"), + major, + minor)); + } - char *rendezvous = 0; + return -1; + } + + char * rendezvous = 0; // Get rendezvous_point if (cdr.read_string (rendezvous) == 0) { - ACE_DEBUG ((LM_DEBUG, "error decoding UIOP rendezvous_point")); + ACE_ERROR ((LM_ERROR, "error decoding UIOP rendezvous_point")); + return -1; } @@ -436,9 +431,9 @@ TAO_UIOP_Acceptor::parse_options (const char *str) ACE_CString options (str); - size_t len = options.length (); + const size_t len = options.length (); - const char option_delimiter = '&'; + static const char option_delimiter = '&'; // Count the number of options. @@ -449,7 +444,7 @@ TAO_UIOP_Acceptor::parse_options (const char *str) // before the object key. for (size_t i = 0; i < len; ++i) if (options[i] == option_delimiter) - option_count++; + ++option_count; // The idea behind the following loop is to split the options into // (option, name) pairs. @@ -480,9 +475,9 @@ TAO_UIOP_Acceptor::parse_options (const char *str) ACE_CString opt = options.substring (begin, end); - int slot = opt.find ("="); + const int slot = opt.find ("="); - if (slot == ACE_static_cast (int, len - 1) + if (slot == static_cast<int> (len - 1) || slot == ACE_CString::npos) ACE_ERROR_RETURN ((LM_ERROR, "TAO (%P|%t) UIOP option <%s> is " @@ -490,7 +485,7 @@ TAO_UIOP_Acceptor::parse_options (const char *str) opt.c_str ()), -1); - ACE_CString name = opt.substring (0, slot); + const ACE_CString name (opt.substring (0, slot)); ACE_CString value = opt.substring (slot + 1); if (name.length () == 0) @@ -543,7 +538,7 @@ TAO_UIOP_Acceptor::init_uiop_properties (void) if (tph != 0) { - const char protocol [] = "uiop"; + static const char protocol[] = "uiop"; const char *protocol_type = protocol; int hook_result = diff --git a/TAO/tao/Strategies/UIOP_Acceptor.h b/TAO/tao/Strategies/UIOP_Acceptor.h index ea588056f09..d6feeb9c678 100644 --- a/TAO/tao/Strategies/UIOP_Acceptor.h +++ b/TAO/tao/Strategies/UIOP_Acceptor.h @@ -1,26 +1,22 @@ -// This may look like C, but it's really -*- C++ -*- -// $Id$ - - -// ============================================================================ -// -// = LIBRARY -// TAO -// -// = FILENAME -// UIOP_Acceptor.h -// -// = DESCRIPTION -// Unix Domain Socket (UIOP) specific acceptor processing -// -// = AUTHOR -// Fred Kuhns <fredk@cs.wustl.edu> -// Ossama Othman <othman@cs.wustl.edu> -// -// ============================================================================ +// -*- C++ -*- + +//============================================================================= +/** + * @file UIOP_Acceptor.h + * + * $Id$ + * + * Unix Domain Socket (UIOP) specific acceptor processing + * + * @author Fred Kuhns <fredk@cs.wustl.edu> + * @author Ossama Othman <ossama@dre.vanderbilt.edu> + */ +//============================================================================= + #ifndef TAO_UIOP_ACCEPTOR_H #define TAO_UIOP_ACCEPTOR_H + #include /**/ "ace/pre.h" #include "tao/orbconf.h" @@ -29,13 +25,15 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ # if TAO_HAS_UIOP == 1 -#include "tao/Transport_Acceptor.h" -#include "ace/Acceptor.h" -#include "ace/LSOCK_Acceptor.h" #include "UIOP_Connection_Handler.h" + +#include "tao/Transport_Acceptor.h" #include "tao/Acceptor_Impl.h" #include "tao/GIOP_Message_Version.h" +#include "ace/Acceptor.h" +#include "ace/LSOCK_Acceptor.h" + /** * @class TAO_UIOP_Acceptor * @@ -131,10 +129,10 @@ private: /// Flag that determines whether or not the rendezvous point should /// be unlinked on close. This is really only used when an error /// occurs. - int unlink_on_close_; + bool unlink_on_close_; /// Should we use GIOP lite?? - CORBA::Boolean lite_flag_; + const bool lite_flag_; /// Properties for all connections accepted by this acceptor. TAO_UIOP_Properties uiop_properties_; @@ -143,4 +141,5 @@ private: # endif /* TAO_HAS_UIOP == 1 */ #include /**/ "ace/post.h" + #endif /* TAO_UIOP_ACCEPTOR_H */ diff --git a/TAO/tao/Strategies/UIOP_Connection_Handler.cpp b/TAO/tao/Strategies/UIOP_Connection_Handler.cpp index 3ca211a4c57..7aa645abde1 100644 --- a/TAO/tao/Strategies/UIOP_Connection_Handler.cpp +++ b/TAO/tao/Strategies/UIOP_Connection_Handler.cpp @@ -22,7 +22,11 @@ # include "UIOP_Connection_Handler.inl" #endif /* ! __ACE_INLINE__ */ -ACE_RCSID(Strategies, UIOP_Connection_Handler, "$Id$") + +ACE_RCSID (Strategies, + UIOP_Connection_Handler, + "$Id$") + TAO_UIOP_Connection_Handler::TAO_UIOP_Connection_Handler (ACE_Thread_Manager *t) : TAO_UIOP_SVC_HANDLER (t, 0 , 0), @@ -38,13 +42,13 @@ TAO_UIOP_Connection_Handler::TAO_UIOP_Connection_Handler (ACE_Thread_Manager *t) } -TAO_UIOP_Connection_Handler::TAO_UIOP_Connection_Handler (TAO_ORB_Core *orb_core, - CORBA::Boolean flag, - void *arg) +TAO_UIOP_Connection_Handler::TAO_UIOP_Connection_Handler ( + TAO_ORB_Core *orb_core, + CORBA::Boolean flag, + void *arg) : TAO_UIOP_SVC_HANDLER (orb_core->thr_mgr (), 0, 0), TAO_Connection_Handler (orb_core), - uiop_properties_ (ACE_static_cast - (TAO_UIOP_Properties *, arg)) + uiop_properties_ (static_cast<TAO_UIOP_Properties *> (arg)) { TAO_UIOP_Transport* specific_transport = 0; ACE_NEW (specific_transport, @@ -116,7 +120,7 @@ TAO_UIOP_Connection_Handler::close_connection (void) int TAO_UIOP_Connection_Handler::handle_input (ACE_HANDLE h) { - int result = + const int result = this->handle_input_eh (h, this); if (result == -1) @@ -131,7 +135,7 @@ TAO_UIOP_Connection_Handler::handle_input (ACE_HANDLE h) int TAO_UIOP_Connection_Handler::handle_output (ACE_HANDLE handle) { - int result = + const int result = this->handle_output_eh (handle, this); if (result == -1) diff --git a/TAO/tao/Strategies/UIOP_Connector.cpp b/TAO/tao/Strategies/UIOP_Connector.cpp index 8b736607ac2..78b2a9b02f8 100644 --- a/TAO/tao/Strategies/UIOP_Connector.cpp +++ b/TAO/tao/Strategies/UIOP_Connector.cpp @@ -108,14 +108,12 @@ TAO_UIOP_Connector::close (void) int TAO_UIOP_Connector::set_validate_endpoint (TAO_Endpoint *endpoint) { - TAO_UIOP_Endpoint *uiop_endpoint = - this->remote_endpoint (endpoint); + TAO_UIOP_Endpoint *uiop_endpoint = this->remote_endpoint (endpoint); if (uiop_endpoint == 0) return -1; - const ACE_UNIX_Addr &remote_address = - uiop_endpoint->object_addr (); + const ACE_UNIX_Addr &remote_address = uiop_endpoint->object_addr (); // @@ Note, POSIX.1g renames AF_UNIX to AF_LOCAL. // Verify that the remote ACE_UNIX_Addr was initialized properly. @@ -209,15 +207,15 @@ TAO_UIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *, // of timeouts, so the event will complete (either success or // failure) within timeout. result = - this->active_connect_strategy_->wait (svc_handler, - 0); + this->active_connect_strategy_->wait (svc_handler, 0); if (TAO_debug_level > 2) { ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - UIOP_Connector::make_connection" "wait done for handle[%d], result = %d\n", - svc_handler->get_handle (), result)); + svc_handler->get_handle (), + result)); } // There are three possibilities when wait() returns: (a) @@ -228,12 +226,10 @@ TAO_UIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *, // following code deals with (c). // Check if the handler has been closed. - int closed = - svc_handler->is_closed (); + int closed = svc_handler->is_closed (); // In case of failures and close() has not be called. - if (result == -1 && - !closed) + if (result == -1 && !closed) { // First, cancel from connector. this->base_connector_.cancel (svc_handler); @@ -245,15 +241,14 @@ TAO_UIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *, // connector. Once connector.cancel() has been processed, // we are assured that the connector will no longer // open/close this handler. - closed = - svc_handler->is_closed (); + closed = svc_handler->is_closed (); // If closed, there is nothing to do here. If not closed, // it was either opened or is still pending. if (!closed) { // Check if the handler has been opened. - int open = + const int open = svc_handler->is_open (); // Some other thread was able to open the handler even @@ -354,7 +349,7 @@ TAO_UIOP_Connector::create_profile (TAO_InputCDR& cdr) TAO_UIOP_Profile (this->orb_core ()), 0); - int r = pfile->decode (cdr); + const int r = pfile->decode (cdr); if (r == -1) { pfile->_decr_refcnt (); @@ -388,12 +383,12 @@ TAO_UIOP_Connector::check_prefix (const char *endpoint) if (!endpoint || !*endpoint) return -1; // Failure - const char *protocol[] = { "uiop", "uioploc" }; + static const char *protocol[] = { "uiop", "uioploc" }; - size_t slot = ACE_OS::strchr (endpoint, ':') - endpoint; + const size_t slot = ACE_OS::strchr (endpoint, ':') - endpoint; - size_t len0 = ACE_OS::strlen (protocol[0]); - size_t len1 = ACE_OS::strlen (protocol[1]); + const size_t len0 = ACE_OS::strlen (protocol[0]); + const size_t len1 = ACE_OS::strlen (protocol[1]); // Check for the proper prefix in the IOR. If the proper prefix // isn't in the IOR then it is not an IOR we can use. @@ -443,9 +438,9 @@ TAO_UIOP_Connector::init_uiop_properties (void) if (tph != 0) { - const char protocol [] = "uiop"; + static const char protocol[] = "uiop"; const char *protocol_type = protocol; - int hook_result = + const int hook_result = tph->call_client_protocols_hook (send_buffer_size, recv_buffer_size, no_delay, @@ -457,10 +452,8 @@ TAO_UIOP_Connector::init_uiop_properties (void) } // Extract and locally store properties of interest. - this->uiop_properties_.send_buffer_size = - send_buffer_size; - this->uiop_properties_.recv_buffer_size = - recv_buffer_size; + this->uiop_properties_.send_buffer_size = send_buffer_size; + this->uiop_properties_.recv_buffer_size = recv_buffer_size; return 0; } @@ -472,8 +465,8 @@ TAO_UIOP_Connector::remote_endpoint (TAO_Endpoint *endpoint) return 0; TAO_UIOP_Endpoint *uiop_endpoint = - ACE_dynamic_cast (TAO_UIOP_Endpoint *, - endpoint ); + dynamic_cast<TAO_UIOP_Endpoint *> (endpoint); + if (uiop_endpoint == 0) return 0; diff --git a/TAO/tao/Strategies/UIOP_Connector.h b/TAO/tao/Strategies/UIOP_Connector.h index 6215ee94392..d3297c8b3a8 100644 --- a/TAO/tao/Strategies/UIOP_Connector.h +++ b/TAO/tao/Strategies/UIOP_Connector.h @@ -126,7 +126,7 @@ private: TAO_UIOP_BASE_CONNECTOR base_connector_; /// Do we need to use a GIOP_Lite for sending messages? - CORBA::Boolean lite_flag_; + const bool lite_flag_; /// UIOP configuration properties for all connections established by /// this connector. diff --git a/TAO/tao/Strategies/UIOP_Endpoint.cpp b/TAO/tao/Strategies/UIOP_Endpoint.cpp index edd38446f90..581563cf34e 100644 --- a/TAO/tao/Strategies/UIOP_Endpoint.cpp +++ b/TAO/tao/Strategies/UIOP_Endpoint.cpp @@ -73,14 +73,13 @@ TAO_UIOP_Endpoint::is_equivalent (const TAO_Endpoint *other_endpoint) TAO_Endpoint *endpt = ACE_const_cast (TAO_Endpoint *, other_endpoint); - TAO_UIOP_Endpoint *endpoint = ACE_dynamic_cast (TAO_UIOP_Endpoint *, - endpt); + TAO_UIOP_Endpoint *endpoint = dynamic_cast<TAO_UIOP_Endpoint *> (endpt); + if (endpoint == 0) return 0; - return - ACE_OS::strcmp (this->rendezvous_point (), - endpoint->rendezvous_point ()) == 0; + return ACE_OS::strcmp (this->rendezvous_point (), + endpoint->rendezvous_point ()) == 0; } CORBA::ULong diff --git a/TAO/tao/Strategies/UIOP_Transport.cpp b/TAO/tao/Strategies/UIOP_Transport.cpp index acf4b400bd8..9170a538447 100644 --- a/TAO/tao/Strategies/UIOP_Transport.cpp +++ b/TAO/tao/Strategies/UIOP_Transport.cpp @@ -1,4 +1,3 @@ -// This may look like C, but it's really -*- C++ -*- // $Id$ #include "UIOP_Transport.h" @@ -22,7 +21,9 @@ # include "UIOP_Transport.i" #endif /* ! __ACE_INLINE__ */ -ACE_RCSID (Strategies, UIOP_Transport, "$Id$") +ACE_RCSID (Strategies, + UIOP_Transport, + "$Id$") TAO_UIOP_Transport::TAO_UIOP_Transport (TAO_UIOP_Connection_Handler *handler, @@ -75,8 +76,11 @@ TAO_UIOP_Transport::send (iovec *iov, int iovcnt, size_t &bytes_transferred, const ACE_Time_Value *max_wait_time) { - ssize_t retval = this->connection_handler_->peer ().sendv (iov, iovcnt, - max_wait_time); + const ssize_t retval = + this->connection_handler_->peer ().sendv (iov, + iovcnt, + max_wait_time); + if (retval > 0) bytes_transferred = retval; @@ -88,9 +92,9 @@ TAO_UIOP_Transport::recv (char *buf, size_t len, const ACE_Time_Value *max_wait_time) { - ssize_t n = this->connection_handler_->peer ().recv (buf, - len, - max_wait_time); + const ssize_t n = this->connection_handler_->peer ().recv (buf, + len, + max_wait_time); // Most of the errors handling is common for // Now the message has been read @@ -159,10 +163,10 @@ TAO_UIOP_Transport::send_message (TAO_OutputCDR &stream, // versions seem to need it though. Leaving it costs little. // This guarantees to send all data (bytes) or return an error. - ssize_t n = this->send_message_shared (stub, - message_semantics, - stream.begin (), - max_wait_time); + const ssize_t n = this->send_message_shared (stub, + message_semantics, + stream.begin (), + max_wait_time); if (n == -1) { |