diff options
Diffstat (limited to 'TAO')
43 files changed, 629 insertions, 375 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 657b8288985..4237a710fb2 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -124,7 +124,7 @@ Fri Jul 14 21:15:32 UTC 2006 Ossama Othman <ossama_othman at symantec dot com> Renamed wait_for_non_servant_upcall_to_complete() method call to the name (..._to_complete_no_throw()). - + * tao/PortableServer/Servant_var.cpp: * tao/PortableServer/Servant_var.h: * tao/PortableServer/Servant_var.inl: diff --git a/TAO/TAO_IDL/fe/fe_init.cpp b/TAO/TAO_IDL/fe/fe_init.cpp index f7da20c2f1b..8c42f299187 100644 --- a/TAO/TAO_IDL/fe/fe_init.cpp +++ b/TAO/TAO_IDL/fe/fe_init.cpp @@ -696,14 +696,14 @@ FE_store_env_include_paths (void) separator = ':'; #endif ACE_CString aggr_cstr (aggr_str); - ssize_t pos; + ACE_CString::size_type pos; do { pos = aggr_cstr.find (separator); idl_global->add_include_path (aggr_cstr.substr (0, pos).fast_rep ()); aggr_cstr = aggr_cstr.substr (pos + 1); - } while (pos != ACE_String_Base_Const::npos); + } while (pos != ACE_CString::npos); } } diff --git a/TAO/orbsvcs/Trading_Service/Trading_Service.h b/TAO/orbsvcs/Trading_Service/Trading_Service.h index f793fc7b1d7..951b67e6ecf 100644 --- a/TAO/orbsvcs/Trading_Service/Trading_Service.h +++ b/TAO/orbsvcs/Trading_Service/Trading_Service.h @@ -1,3 +1,5 @@ +// -*- C++ -*- +// // $Id$ // ======================================================================== @@ -17,7 +19,7 @@ #define _TRADING_SERVICE_H #include "ace/Auto_Ptr.h" -#include "ace/Signal.h" +#include "ace/Sig_Handler.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once diff --git a/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.h b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.h index a0c3c3b00a5..a17453cfc07 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.h @@ -23,7 +23,6 @@ #include "orbsvcs/NotifyExtS.h" #include "orbsvcs/Notify/Admin.h" -class TAO_Notify_ProxySupplier; #if defined(_MSC_VER) #pragma warning(push) @@ -32,6 +31,8 @@ class TAO_Notify_ProxySupplier; TAO_BEGIN_VERSIONED_NAMESPACE_DECL +class TAO_Notify_ProxySupplier; + /** * @class TAO_Notify_ConsumerAdmin * diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Accept_Strategy.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Accept_Strategy.cpp index 20845593237..5de9b828787 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Accept_Strategy.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Accept_Strategy.cpp @@ -50,6 +50,10 @@ TAO::SSLIOP::Accept_Strategy::accept_svc_handler (handler_type * svc_handler) reset_new_handle // reset new handler ) == -1) { + // Ensure that errno is preserved in case the svc_handler + // close() method resets it. + ACE_Errno_Guard error (errno); + // Close down handler to avoid memory leaks. svc_handler->close (0); diff --git a/TAO/orbsvcs/orbsvcs/Shutdown_Utilities.h b/TAO/orbsvcs/orbsvcs/Shutdown_Utilities.h index 9d4983ffaaf..2663a13d407 100644 --- a/TAO/orbsvcs/orbsvcs/Shutdown_Utilities.h +++ b/TAO/orbsvcs/orbsvcs/Shutdown_Utilities.h @@ -12,6 +12,8 @@ #include "ace/Event_Handler.h" #include "ace/Signal.h" +#include "ace/Sig_Handler.h" + TAO_BEGIN_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/tests/CosEvent/lib/CosEvent_lib.mpc b/TAO/orbsvcs/tests/CosEvent/lib/CosEvent_lib.mpc index f3c8fe6d235..8ac7b79bce9 100644 --- a/TAO/orbsvcs/tests/CosEvent/lib/CosEvent_lib.mpc +++ b/TAO/orbsvcs/tests/CosEvent/lib/CosEvent_lib.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(CosEvent Test Lib): orbsvcslib, event_skel, naming, svc_utils, iortable, portableserver { +project(CosEvent Test Lib): orbsvcslib, event_skel, svc_utils, iortable, portableserver { sharedname = CECTests dynamicflags = CEC_TEST_BUILD_DLL Header_Files { diff --git a/TAO/tao/AnyTypeCode/Any_Array_Impl_T.cpp b/TAO/tao/AnyTypeCode/Any_Array_Impl_T.cpp index a3d7f0db70a..97cda1e2d59 100644 --- a/TAO/tao/AnyTypeCode/Any_Array_Impl_T.cpp +++ b/TAO/tao/AnyTypeCode/Any_Array_Impl_T.cpp @@ -134,6 +134,20 @@ TAO::Any_Array_Impl_T<T_slice, T_forany>::extract (const CORBA::Any & any, } template<typename T_slice, typename T_forany> +CORBA::Boolean +TAO::Any_Array_Impl_T<T_slice, T_forany>::marshal_value (TAO_OutputCDR &cdr) +{ + return (cdr << T_forany (this->value_)); +} + +template<typename T_slice, typename T_forany> +const void * +TAO::Any_Array_Impl_T<T_slice, T_forany>::value (void) const +{ + return this->value_; +} + +template<typename T_slice, typename T_forany> void TAO::Any_Array_Impl_T<T_slice, T_forany>::free_value (void) { diff --git a/TAO/tao/AnyTypeCode/Any_Array_Impl_T.inl b/TAO/tao/AnyTypeCode/Any_Array_Impl_T.inl index c64d59e022c..939a2e9d3e3 100644 --- a/TAO/tao/AnyTypeCode/Any_Array_Impl_T.inl +++ b/TAO/tao/AnyTypeCode/Any_Array_Impl_T.inl @@ -7,26 +7,10 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL template<typename T_slice, typename T_forany> ACE_INLINE CORBA::Boolean -TAO::Any_Array_Impl_T<T_slice, T_forany>::marshal_value (TAO_OutputCDR &cdr) -{ - return (cdr << T_forany (this->value_)); -} - -template<typename T_slice, typename T_forany> -ACE_INLINE -CORBA::Boolean TAO::Any_Array_Impl_T<T_slice, T_forany>::demarshal_value (TAO_InputCDR &cdr) { T_forany tmp (this->value_); return (cdr >> tmp); } -template<typename T_slice, typename T_forany> -ACE_INLINE -const void * -TAO::Any_Array_Impl_T<T_slice, T_forany>::value (void) const -{ - return this->value_; -} - TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.cpp b/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.cpp index 6adfea2fcd8..7c892b754d3 100644 --- a/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.cpp +++ b/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.cpp @@ -117,6 +117,20 @@ TAO::Any_Basic_Impl_T<T>::extract (const CORBA::Any & any, } template<typename T> +CORBA::Boolean +TAO::Any_Basic_Impl_T<T>::marshal_value (TAO_OutputCDR &cdr) +{ + return (cdr << this->value_); +} + +template<typename T> +const void * +TAO::Any_Basic_Impl_T<T>::value (void) const +{ + return &this->value_; +} + +template<typename T> TAO::Any_Basic_Impl_T<T> * TAO::Any_Basic_Impl_T<T>::create_empty (CORBA::TypeCode_ptr tc) { diff --git a/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.inl b/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.inl index 1cd0d1627dc..3114614a725 100644 --- a/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.inl +++ b/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.inl @@ -7,25 +7,9 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL template<typename T> ACE_INLINE CORBA::Boolean -TAO::Any_Basic_Impl_T<T>::marshal_value (TAO_OutputCDR &cdr) -{ - return (cdr << this->value_); -} - -template<typename T> -ACE_INLINE -CORBA::Boolean TAO::Any_Basic_Impl_T<T>::demarshal_value (TAO_InputCDR &cdr) { return (cdr >> this->value_); } -template<typename T> -ACE_INLINE -const void * -TAO::Any_Basic_Impl_T<T>::value (void) const -{ - return &this->value_; -} - TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.cpp b/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.cpp index 3fbb4cbb650..91dc8bdab29 100644 --- a/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.cpp +++ b/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.cpp @@ -173,6 +173,20 @@ TAO::Any_Dual_Impl_T<T>::extract (const CORBA::Any & any, } template<typename T> +CORBA::Boolean +TAO::Any_Dual_Impl_T<T>::marshal_value (TAO_OutputCDR &cdr) +{ + return (cdr << *this->value_); +} + +template<typename T> +const void * +TAO::Any_Dual_Impl_T<T>::value (void) const +{ + return this->value_; +} + +template<typename T> void TAO::Any_Dual_Impl_T<T>::free_value (void) { diff --git a/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.inl b/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.inl index 8e97656a93a..f1fa29d7a4c 100644 --- a/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.inl +++ b/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.inl @@ -8,25 +8,9 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL template<typename T> ACE_INLINE CORBA::Boolean -TAO::Any_Dual_Impl_T<T>::marshal_value (TAO_OutputCDR &cdr) -{ - return (cdr << *this->value_); -} - -template<typename T> -ACE_INLINE -CORBA::Boolean TAO::Any_Dual_Impl_T<T>::demarshal_value (TAO_InputCDR &cdr) { return (cdr >> *this->value_); } -template<typename T> -ACE_INLINE -const void * -TAO::Any_Dual_Impl_T<T>::value (void) const -{ - return this->value_; -} - TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/AnyTypeCode/Any_Impl_T.cpp b/TAO/tao/AnyTypeCode/Any_Impl_T.cpp index bf03b8280a4..4555bf32e9e 100644 --- a/TAO/tao/AnyTypeCode/Any_Impl_T.cpp +++ b/TAO/tao/AnyTypeCode/Any_Impl_T.cpp @@ -128,6 +128,42 @@ TAO::Any_Impl_T<T>::extract (const CORBA::Any & any, } template<typename T> +CORBA::Boolean +TAO::Any_Impl_T<T>::to_object (CORBA::Object_ptr &) const +{ + return 0; +} + +template<typename T> +CORBA::Boolean +TAO::Any_Impl_T<T>::to_value (CORBA::ValueBase *&) const +{ + return 0; +} + +template<typename T> + +CORBA::Boolean +TAO::Any_Impl_T<T>::to_abstract_base (CORBA::AbstractBase_ptr &) const +{ + return 0; +} + +template<typename T> +CORBA::Boolean +TAO::Any_Impl_T<T>::marshal_value (TAO_OutputCDR &cdr) +{ + return (cdr << this->value_); +} + +template<typename T> +const void * +TAO::Any_Impl_T<T>::value (void) const +{ + return this->value_; +} + +template<typename T> void TAO::Any_Impl_T<T>::free_value (void) { diff --git a/TAO/tao/AnyTypeCode/Any_Impl_T.inl b/TAO/tao/AnyTypeCode/Any_Impl_T.inl index 3b5b36ab5ed..d459bc57e67 100644 --- a/TAO/tao/AnyTypeCode/Any_Impl_T.inl +++ b/TAO/tao/AnyTypeCode/Any_Impl_T.inl @@ -9,49 +9,9 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL template<typename T> ACE_INLINE CORBA::Boolean -TAO::Any_Impl_T<T>::to_object (CORBA::Object_ptr &) const -{ - return 0; -} - -template<typename T> -ACE_INLINE -CORBA::Boolean -TAO::Any_Impl_T<T>::to_value (CORBA::ValueBase *&) const -{ - return 0; -} - -template<typename T> -ACE_INLINE -CORBA::Boolean -TAO::Any_Impl_T<T>::to_abstract_base (CORBA::AbstractBase_ptr &) const -{ - return 0; -} - -template<typename T> -ACE_INLINE -CORBA::Boolean -TAO::Any_Impl_T<T>::marshal_value (TAO_OutputCDR &cdr) -{ - return (cdr << this->value_); -} - -template<typename T> -ACE_INLINE -CORBA::Boolean TAO::Any_Impl_T<T>::demarshal_value (TAO_InputCDR &cdr) { return (cdr >> this->value_); } -template<typename T> -ACE_INLINE -const void * -TAO::Any_Impl_T<T>::value (void) const -{ - return this->value_; -} - TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/AnyTypeCode/Any_Special_Impl_T.cpp b/TAO/tao/AnyTypeCode/Any_Special_Impl_T.cpp index 3c815466717..adc32568b3f 100644 --- a/TAO/tao/AnyTypeCode/Any_Special_Impl_T.cpp +++ b/TAO/tao/AnyTypeCode/Any_Special_Impl_T.cpp @@ -177,6 +177,22 @@ TAO::Any_Special_Impl_T<T, from_T, to_T>::extract (const CORBA::Any & any, } template<typename T, typename from_T, typename to_T> +CORBA::Boolean +TAO::Any_Special_Impl_T<T, from_T, to_T>::marshal_value ( + TAO_OutputCDR &cdr + ) +{ + return (cdr << from_T (this->value_, this->bound_)); +} + +template<typename T, typename from_T, typename to_T> +const void * +TAO::Any_Special_Impl_T<T, from_T, to_T>::value (void) const +{ + return this->value_; +} + +template<typename T, typename from_T, typename to_T> void TAO::Any_Special_Impl_T<T, from_T, to_T>::free_value (void) { diff --git a/TAO/tao/AnyTypeCode/Any_Special_Impl_T.inl b/TAO/tao/AnyTypeCode/Any_Special_Impl_T.inl index cce6dbda782..257a7681bd9 100644 --- a/TAO/tao/AnyTypeCode/Any_Special_Impl_T.inl +++ b/TAO/tao/AnyTypeCode/Any_Special_Impl_T.inl @@ -7,16 +7,6 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL template<typename T, typename from_T, typename to_T> ACE_INLINE CORBA::Boolean -TAO::Any_Special_Impl_T<T, from_T, to_T>::marshal_value ( - TAO_OutputCDR &cdr - ) -{ - return (cdr << from_T (this->value_, this->bound_)); -} - -template<typename T, typename from_T, typename to_T> -ACE_INLINE -CORBA::Boolean TAO::Any_Special_Impl_T<T, from_T, to_T>::demarshal_value ( TAO_InputCDR &cdr ) @@ -24,12 +14,4 @@ TAO::Any_Special_Impl_T<T, from_T, to_T>::demarshal_value ( return (cdr >> to_T (this->value_, this->bound_)); } -template<typename T, typename from_T, typename to_T> -ACE_INLINE -const void * -TAO::Any_Special_Impl_T<T, from_T, to_T>::value (void) const -{ - return this->value_; -} - TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/CORBANAME_Parser.cpp b/TAO/tao/CORBANAME_Parser.cpp index bfc2eca66a7..8924feee395 100644 --- a/TAO/tao/CORBANAME_Parser.cpp +++ b/TAO/tao/CORBANAME_Parser.cpp @@ -80,7 +80,7 @@ TAO_CORBANAME_Parser::parse_string (const char *ior, { // The position of the seperator between the obj_addr and key // string - ssize_t pos_seperator = 0; + ACE_CString::size_type pos_seperator = 0; ACE_CString corbaname_str (corbaname, 0, 1); @@ -92,7 +92,7 @@ TAO_CORBANAME_Parser::parse_string (const char *ior, if (pos_seperator != ACE_CString::npos) { key_string = corbaname_str.substring (pos_seperator + 1, - -1); + ACE_CString::npos); } // Prepare a suitable corbaloc string for the name service. diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy_Factory.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy_Factory.cpp index 9e87aaf73e6..fd03281a261 100644 --- a/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy_Factory.cpp +++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy_Factory.cpp @@ -57,7 +57,7 @@ TAO::CSD::TP_Strategy_Factory::init (int argc, { // Parse the parameter ACE_CString arg ((const char *)argv[curarg]); - ssize_t pos = arg.find (':'); + ACE_CString::size_type pos = arg.find (':'); if (pos == ACE_CString::npos) { diff --git a/TAO/tao/GIOP_Message_Base.cpp b/TAO/tao/GIOP_Message_Base.cpp index bd95055d517..242c13c983f 100644 --- a/TAO/tao/GIOP_Message_Base.cpp +++ b/TAO/tao/GIOP_Message_Base.cpp @@ -930,10 +930,11 @@ TAO_GIOP_Message_Base::write_protocol_header (TAO_GIOP_Message_Type type, } int -TAO_GIOP_Message_Base::process_request (TAO_Transport *transport, - TAO_InputCDR &cdr, - TAO_OutputCDR &output, - TAO_GIOP_Message_Generator_Parser *parser) +TAO_GIOP_Message_Base::process_request ( + TAO_Transport * transport, + TAO_InputCDR & cdr, + TAO_OutputCDR & output, + TAO_GIOP_Message_Generator_Parser * parser) { // This will extract the request header, set <response_required> // and <sync_with_server> as appropriate. @@ -954,11 +955,11 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport, parse_error = parser->parse_request_header (request); - TAO_Codeset_Manager *csm = request.orb_core()->codeset_manager(); + TAO_Codeset_Manager *csm = request.orb_core ()->codeset_manager (); if (csm) { - csm->process_service_context(request); - transport->assign_translators(&cdr,&output); + csm->process_service_context (request); + transport->assign_translators (&cdr, &output); } // Throw an exception if the @@ -971,11 +972,11 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport, CORBA::Object_var forward_to; -/* - * Hook to specialize request processing within TAO - * This hook will be replaced by specialized request - * processing implementation. - */ + /* + * Hook to specialize request processing within TAO + * This hook will be replaced by specialized request + * processing implementation. + */ //@@ TAO_DISPATCH_RESOLUTION_OPT_COMMENT_HOOK_START // Do this before the reply is sent. @@ -1005,7 +1006,8 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport, reply_params.svc_ctx_.length (0); // Send back the reply service context. - reply_params.service_context_notowned (&request.reply_service_info ()); + reply_params.service_context_notowned ( + &request.reply_service_info ()); output.message_attributes (request_id, 0, @@ -1013,8 +1015,7 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport, 0); // Make the GIOP header and Reply header - this->generate_reply_header (output, - reply_params); + this->generate_reply_header (output, reply_params); if (!(output << forward_to.in ())) { diff --git a/TAO/tao/IIOP_Acceptor.cpp b/TAO/tao/IIOP_Acceptor.cpp index 0bdb6b4bb09..7129d0d3b12 100644 --- a/TAO/tao/IIOP_Acceptor.cpp +++ b/TAO/tao/IIOP_Acceptor.cpp @@ -1089,17 +1089,15 @@ TAO_IIOP_Acceptor::parse_options (const char *str) ACE_CString **argv = 0; ACE_NEW_RETURN (argv, ACE_CString*[argc],-1); - ssize_t begin = 0; - ssize_t end = -1; + ACE_CString::size_type begin = 0; + ACE_CString::size_type end = 0; int result = 0; for (int j = 0; j < argc; ++j) { - begin = end + 1; - if (j < argc - 1) end = options.find (option_delimiter, begin); else - end = static_cast<ssize_t> (len); + end = len; if (end == begin) { @@ -1108,10 +1106,15 @@ TAO_IIOP_Acceptor::parse_options (const char *str) result = -1; break; } - else if (end != ACE_CString::npos) + else if (end != options.npos) { argv_base[j] = options.substring (begin, end); argv[j] = &argv_base[j]; + begin = end + 1; + } + else + { + break; // No other options. } } @@ -1142,10 +1145,10 @@ TAO_IIOP_Acceptor::parse_options_i (int &argc, int i = 0; while (i < argc) { - size_t len = argv[i]->length(); - ssize_t slot = argv[i]->find ("="); + ACE_CString::size_type const len = argv[i]->length (); + ACE_CString::size_type const slot = argv[i]->find ('='); - if (slot == static_cast <ssize_t> (len - 1) + if (slot == len - 1 || slot == ACE_CString::npos) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - IIOP option <%s> is ") @@ -1194,7 +1197,7 @@ TAO_IIOP_Acceptor::parse_options_i (int &argc, else { // the name is not known, skip to the next option - i++; + ++i; continue; } // at the end, we've consumed this argument. Shift the list and @@ -1203,7 +1206,7 @@ TAO_IIOP_Acceptor::parse_options_i (int &argc, // these arguments are only whole strings. --argc; ACE_CString *temp = argv[i]; - for (int j = i; j <= argc-1; j++) + for (int j = i; j <= argc-1; ++j) argv[j] = argv[j+1]; argv[argc] = temp; } diff --git a/TAO/tao/IIOP_Endpoint.cpp b/TAO/tao/IIOP_Endpoint.cpp index f72f3999629..4538689ce28 100644 --- a/TAO/tao/IIOP_Endpoint.cpp +++ b/TAO/tao/IIOP_Endpoint.cpp @@ -461,11 +461,11 @@ static void find_preferred_interfaces (const ACE_CString& host, // The outer loop steps through each preferred interface directive // and chains a new endpoint if the remote interface matches the // current endpoint. - size_t index = 0; + ACE_CString::size_type index = 0; while (index < csvPreferred.length()) { - ssize_t comma = csvPreferred.find(',', index); - ssize_t assign = csvPreferred.find('=', index); + ACE_CString::size_type comma = csvPreferred.find(',', index); + ACE_CString::size_type assign = csvPreferred.find('=', index); if (assign == ACE_CString::npos) { @@ -484,7 +484,7 @@ static void find_preferred_interfaces (const ACE_CString& host, wild_local = csvPreferred.substr(assign + 1, comma - assign - 1); ACE_CString wild_remote = csvPreferred.substr(index, assign - index); - index = static_cast<size_t>(comma) + 1; + index = comma + 1; // For now, we just try to match against the host literally. In // the future it might be worthwhile to resolve some aliases for diff --git a/TAO/tao/IIOP_Profile.cpp b/TAO/tao/IIOP_Profile.cpp index ac27fdfe4d0..b8a13f82884 100644 --- a/TAO/tao/IIOP_Profile.cpp +++ b/TAO/tao/IIOP_Profile.cpp @@ -495,7 +495,7 @@ TAO_IIOP_Profile::to_string (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { // Don't publish scopeid if included. ACE_CString tmp(endp->host ()); - ssize_t pos = tmp.find('%'); + ACE_CString::size_type pos = tmp.find('%'); if (pos != ACE_CString::npos) { tmp = tmp.substr(0, pos + 1); @@ -694,7 +694,7 @@ TAO_IIOP_Profile::encode_endpoints (void) { // Don't publish scopeid if included. ACE_CString tmp(endpoint->host ()); - ssize_t pos = tmp.find('%'); + ACE_CString::size_type pos = tmp.find('%'); if (pos != ACE_CString::npos) { tmp = tmp.substr (0, pos + 1); diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index 6aaec7a0870..758ff292d7d 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -1982,7 +1982,7 @@ TAO_ORB_Core::create_object (TAO_Stub *stub) // iterate through the ORBs. ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, - TAO::ORB_Table::instance()->lock_, + TAO::ORB_Table::instance()->lock (), CORBA::Object::_nil ()); TAO::ORB_Table * const table = TAO::ORB_Table::instance (); @@ -2058,7 +2058,7 @@ TAO_ORB_Core::initialize_object_i (TAO_Stub *stub, // iterate through the ORBs. ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, - TAO::ORB_Table::instance()->lock_, + TAO::ORB_Table::instance()->lock (), 0)); TAO::ORB_Table * const table = TAO::ORB_Table::instance (); diff --git a/TAO/tao/ORB_Table.h b/TAO/tao/ORB_Table.h index 4838b0754da..4525c5157d9 100644 --- a/TAO/tao/ORB_Table.h +++ b/TAO/tao/ORB_Table.h @@ -62,7 +62,6 @@ namespace TAO */ class TAO_Export ORB_Table { - friend class ::TAO_ORB_Core; public: /// Constructor @@ -120,6 +119,9 @@ namespace TAO /// Accessor to the underlying table_ Table * table (void); + /// Return reference to underlying lock. + TAO_SYNCH_MUTEX & lock (void); + private: // Prevent copying diff --git a/TAO/tao/ORB_Table.inl b/TAO/tao/ORB_Table.inl index b3145b1f2e0..40cb80e4d70 100644 --- a/TAO/tao/ORB_Table.inl +++ b/TAO/tao/ORB_Table.inl @@ -40,6 +40,12 @@ TAO::ORB_Table::table (void) return &this->table_; } +ACE_INLINE TAO_SYNCH_MUTEX & +TAO::ORB_Table::lock (void) +{ + return this->lock_; +} + // **************************************************************** ACE_INLINE diff --git a/TAO/tao/Policy_Manager.h b/TAO/tao/Policy_Manager.h index 14c00ee8721..39158187253 100644 --- a/TAO/tao/Policy_Manager.h +++ b/TAO/tao/Policy_Manager.h @@ -69,6 +69,12 @@ public: CORBA::InvalidPolicies)); private: + + // Disallow copying. + TAO_Policy_Manager (TAO_Policy_Manager const &); + TAO_Policy_Manager & operator= (TAO_Policy_Manager const &); + +private: /// Protect access TAO_SYNCH_MUTEX mutex_; diff --git a/TAO/tao/PortableServer.mpc b/TAO/tao/PortableServer.mpc index 3a0a21d9f92..d484db6aa62 100644 --- a/TAO/tao/PortableServer.mpc +++ b/TAO/tao/PortableServer.mpc @@ -16,7 +16,8 @@ project : taolib, core, core_anytypecode, tao_versioning_idl_defaults { } Template_Files { - PortableServer + PortableServer/Servant_var.cpp + PortableServer/*_T.cpp } Resource_Files { diff --git a/TAO/tao/PortableServer/Object_Adapter.cpp b/TAO/tao/PortableServer/Object_Adapter.cpp index 9c458226869..2f2305ec233 100644 --- a/TAO/tao/PortableServer/Object_Adapter.cpp +++ b/TAO/tao/PortableServer/Object_Adapter.cpp @@ -759,9 +759,10 @@ TAO_Object_Adapter::dispatch (TAO::ObjectKey &key, CORBA::Object_out forward_to ACE_ENV_ARG_DECL) { - if (ACE_OS::memcmp (key.get_buffer (), - &TAO_Root_POA::objectkey_prefix[0], - TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0) + if (key.length() < TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE + || ACE_OS::memcmp (key.get_buffer (), + &TAO_Root_POA::objectkey_prefix[0], + TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0) { return TAO_Adapter::DS_MISMATCHED_KEY; } @@ -968,9 +969,10 @@ TAO_Object_Adapter::get_collocated_servant (const TAO_MProfile &mp) const TAO_Profile *profile = mp.get_profile (j); TAO::ObjectKey_var objkey = profile->_key (); - if (ACE_OS::memcmp (objkey->get_buffer (), - &TAO_Root_POA::objectkey_prefix[0], - TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0) + if (objkey->length() < TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE + || ACE_OS::memcmp (objkey->get_buffer (), + &TAO_Root_POA::objectkey_prefix[0], + TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0) continue; TAO_ServantBase *servant = 0; @@ -1228,12 +1230,8 @@ TAO_Object_Adapter::iteratable_poa_name::end (void) const } void -TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete (CORBA::Environment &ACE_TRY_ENV) +TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete (ACE_ENV_SINGLE_ARG_DECL) { -#if defined (ACE_HAS_EXCEPTIONS) - ACE_UNUSED_ARG (ACE_TRY_ENV); // FUZZ: ignore check_for_ace_check -#endif - // Check if a non-servant upcall is in progress. If a non-servant // upcall is in progress, wait for it to complete. Unless of // course, the thread making the non-servant upcall is this thread. @@ -1251,12 +1249,12 @@ TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete (CORBA::Environment } void -TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete (void) +TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete_no_throw (void) { // Non-exception throwing version. ACE_TRY_NEW_ENV { - this->wait_for_non_servant_upcalls_to_complete (ACE_TRY_ENV); + this->wait_for_non_servant_upcalls_to_complete (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; } ACE_CATCHANY diff --git a/TAO/tao/PortableServer/Object_Adapter.h b/TAO/tao/PortableServer/Object_Adapter.h index 6d36e4631a4..59f40a596b5 100644 --- a/TAO/tao/PortableServer/Object_Adapter.h +++ b/TAO/tao/PortableServer/Object_Adapter.h @@ -132,10 +132,10 @@ public: TAO_ORB_Core &orb_core (void) const; /// Wait for non-servant upcalls to complete. - void wait_for_non_servant_upcalls_to_complete (CORBA::Environment &ACE_TRY_ENV); + void wait_for_non_servant_upcalls_to_complete (ACE_ENV_SINGLE_ARG_DECL); /// Non-exception throwing version. - void wait_for_non_servant_upcalls_to_complete (void); + void wait_for_non_servant_upcalls_to_complete_no_throw (void); static CORBA::ULong transient_poa_name_size (void); diff --git a/TAO/tao/PortableServer/PS_ForwardC.h b/TAO/tao/PortableServer/PS_ForwardC.h index e05abec2d4c..4d4aa7d4ddc 100644 --- a/TAO/tao/PortableServer/PS_ForwardC.h +++ b/TAO/tao/PortableServer/PS_ForwardC.h @@ -55,7 +55,6 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL class TAO_ServantBase; -class TAO_ServantBase_var; class TAO_Local_ServantBase; class TAO_Root_POA; class TAO_DynamicImplementation; @@ -67,7 +66,8 @@ namespace PortableServer { typedef TAO_ServantBase ServantBase; struct RefCountServantBase {}; - typedef TAO_ServantBase_var ServantBase_var; + template <class T> class Servant_var; + typedef Servant_var<TAO_ServantBase> ServantBase_var; typedef ServantBase *Servant; typedef TAO_Local_ServantBase LocalServantBase; diff --git a/TAO/tao/PortableServer/Servant_Base.cpp b/TAO/tao/PortableServer/Servant_Base.cpp index a91077fe966..0d66b79c7e5 100644 --- a/TAO/tao/PortableServer/Servant_Base.cpp +++ b/TAO/tao/PortableServer/Servant_Base.cpp @@ -358,125 +358,4 @@ TAO_ServantBase::_refcount_value (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const return static_cast<CORBA::ULong> (this->ref_count_.value ()); } -// ------------------------------------------------------------------- - -TAO_ServantBase_var::TAO_ServantBase_var (const TAO_ServantBase_var &b) - : ptr_ (b.ptr_) -{ - if (this->ptr_ != 0) - { - ACE_TRY_NEW_ENV - { - this->ptr_->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHALL - { - ACE_RE_THROW; - } - ACE_ENDTRY; - } -} - -TAO_ServantBase_var::~TAO_ServantBase_var (void) -{ - if (this->ptr_ != 0) - { - // We should not allow exceptions to pass through - ACE_TRY_NEW_ENV - { - this->ptr_->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHALL - { - } - ACE_ENDTRY; - } -} - -TAO_ServantBase_var & -TAO_ServantBase_var::operator= (TAO_ServantBase *p) -{ - if (this->ptr_ == p) - return *this; - - ACE_TRY_NEW_ENV - { - if (this->ptr_ != 0) - { - this->ptr_->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCHALL - { - ACE_RE_THROW; - } - ACE_ENDTRY; - - this->ptr_ = p; - - return *this; -} - -TAO_ServantBase_var & -TAO_ServantBase_var::operator= (const TAO_ServantBase_var &b) -{ - if (this->ptr_ != b.ptr_) - { - ACE_TRY_NEW_ENV - { - if (this->ptr_ != 0) - { - this->ptr_->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - - if ((this->ptr_ = b.ptr_) != 0) - { - this->ptr_->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCHALL - { - ACE_RE_THROW; - } - ACE_ENDTRY; - } - - return *this; -} - -TAO_ServantBase *& -TAO_ServantBase_var::out (void) -{ - ACE_TRY_NEW_ENV - { - if (this->ptr_ != 0) - { - this->ptr_->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCHALL - { - ACE_RE_THROW; - } - ACE_ENDTRY; - - this->ptr_ = 0; - - return this->ptr_; -} - -TAO_ServantBase * -TAO_ServantBase_var::_retn (void) -{ - TAO_ServantBase *retval = this->ptr_; - this->ptr_ = 0; - return retval; -} - TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/PortableServer/Servant_Base.h b/TAO/tao/PortableServer/Servant_Base.h index 486369efbed..63757c06ecf 100644 --- a/TAO/tao/PortableServer/Servant_Base.h +++ b/TAO/tao/PortableServer/Servant_Base.h @@ -22,6 +22,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "tao/PortableServer/PS_ForwardC.h" +#include "tao/PortableServer/Servant_var.h" #include "tao/Abstract_Servant_Base.h" #include "ace/Atomic_Op.h" @@ -179,45 +180,11 @@ public: u_long operator () (PortableServer::Servant servant) const; }; -/** - * @class TAO_ServantBase_var - * - * @brief Auto pointer for reference counting servants. - * - * For the convenience of automatically managing servant - * reference counts, the PortableServer namespace also provides - * the ServantBase_var class. This class behaves similarly to - * _var classes for object references (see Section 20.3.1). - */ -class TAO_PortableServer_Export TAO_ServantBase_var -{ -public: - TAO_ServantBase_var (void); - - TAO_ServantBase_var (TAO_ServantBase *p); - - TAO_ServantBase_var (const TAO_ServantBase_var &b); - - ~TAO_ServantBase_var (void); - - TAO_ServantBase_var &operator= (TAO_ServantBase *p); - TAO_ServantBase_var &operator= (const TAO_ServantBase_var &b); - - TAO_ServantBase *operator-> () const; - - TAO_ServantBase *in (void) const; - - TAO_ServantBase *&inout (void); - - TAO_ServantBase *&out (void); - - TAO_ServantBase *_retn (void); - -private: - - TAO_ServantBase *ptr_; -}; +namespace PortableServer +{ + typedef Servant_var<TAO_ServantBase> ServantBase_var; +} TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/PortableServer/Servant_Base.i b/TAO/tao/PortableServer/Servant_Base.i index a975c809e62..afa16b3fb71 100644 --- a/TAO/tao/PortableServer/Servant_Base.i +++ b/TAO/tao/PortableServer/Servant_Base.i @@ -4,38 +4,6 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL -ACE_INLINE -TAO_ServantBase_var::TAO_ServantBase_var (void) - : ptr_ (0) -{ -} - -ACE_INLINE -TAO_ServantBase_var::TAO_ServantBase_var (TAO_ServantBase *p) - : ptr_ (p) -{ -} - -ACE_INLINE TAO_ServantBase * -TAO_ServantBase_var::operator->() const -{ - return this->ptr_; -} - -ACE_INLINE TAO_ServantBase * -TAO_ServantBase_var::in (void) const -{ - return this->ptr_; -} - -ACE_INLINE TAO_ServantBase *& -TAO_ServantBase_var::inout (void) -{ - return this->ptr_; -} - -// ------------------------------------------------------------------- - ACE_INLINE u_long TAO_Servant_Hash::operator () (PortableServer::Servant servant) const { diff --git a/TAO/tao/PortableServer/Servant_Upcall.cpp b/TAO/tao/PortableServer/Servant_Upcall.cpp index e68f9f42bcb..2842aec5bcb 100644 --- a/TAO/tao/PortableServer/Servant_Upcall.cpp +++ b/TAO/tao/PortableServer/Servant_Upcall.cpp @@ -301,7 +301,7 @@ namespace TAO // non-servant upcall is in progress, wait for it to complete. // Unless of course, the thread making the non-servant upcall is // this thread. - this->object_adapter_->wait_for_non_servant_upcalls_to_complete (); + this->object_adapter_->wait_for_non_servant_upcalls_to_complete_no_throw (); // Cleanup servant related state. this->servant_cleanup (); diff --git a/TAO/tao/PortableServer/Servant_var.cpp b/TAO/tao/PortableServer/Servant_var.cpp new file mode 100755 index 00000000000..e5fca921aaa --- /dev/null +++ b/TAO/tao/PortableServer/Servant_var.cpp @@ -0,0 +1,65 @@ +// $Id$ + +#ifndef TAO_PORTABLESERVER_SERVANT_VAR_CPP +#define TAO_PORTABLESERVER_SERVANT_VAR_CPP + +#include "tao/PortableServer/Servant_var.h" + +#if !defined (__ACE_INLINE__) +# include "tao/PortableServer/Servant_var.inl" +#endif /* __ACE_INLINE__ */ + +#include "tao/Exception.h" +#include "tao/Environment.h" +#include "ace/CORBA_macros.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +template <class T> +T * +PortableServer::Servant_var<T>::_duplicate (T * p) +{ + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + if (p != 0) + { + p->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + } + ACE_CATCHALL + { + ACE_RE_THROW; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (0); + + return p; +} + +template <class T> +PortableServer::Servant_var<T>::~Servant_var (void) /* throw () */ +{ + // Unfortunately, there is no throw spec on _remove_ref, so we + // can't assume that it will not throw. If it does, then we are in + // trouble. In any event, we can't let the exception escape our + // destructor. + ACE_TRY_NEW_ENV + { + if (this->ptr_ != 0) + { + this->ptr_->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + } + ACE_CATCHALL + { + // Forget the exception.. + } + ACE_ENDTRY; +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif /* TAO_PORTABLESERVER_SERVANT_VAR_CPP */ diff --git a/TAO/tao/PortableServer/Servant_var.h b/TAO/tao/PortableServer/Servant_var.h new file mode 100755 index 00000000000..94a7ada7655 --- /dev/null +++ b/TAO/tao/PortableServer/Servant_var.h @@ -0,0 +1,170 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Servant_var.h + * + * $Id$ + * + * @author Jody Hagins <jody@atdesk.com> + * @author Carlos O'Ryan <coryan@atdesk.com> + */ +//============================================================================= + +#ifndef TAO_PORTABLESERVER_SERVANT_VAR_H +#define TAO_PORTABLESERVER_SERVANT_VAR_H +#include /**/ "ace/pre.h" +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/orbconf.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace PortableServer +{ + /** + * @class Servant_var + * + * @brief Provides a type safe counted reference to servants. + * + * @author Jody Hagins + * + * @todo Life would be much easier if _add_ref() and _remove_ref() had + * throw specs of "throw ()", that can be hidden in static + * methods though. + */ + template<class T> + class Servant_var + { + public: + typedef T servant_type; + + /// Constructor. Assumes ownership of @c p. + explicit Servant_var (T * p = 0); + + /// Copy constructor. Adds reference to @c rhs. + Servant_var (Servant_var<T> const & rhs); + + /// Assignment operator. Adds reference to @c rhs. + Servant_var<T> & operator= (Servant_var<T> const & rhs); + + /// Destructor. Removes a reference from the underlying object, + /// possibly destroying it. + /** + * This destructor doesn't throw exceptions. + */ + ~Servant_var (void) /* throw () */; + + /// Assignment operator. Assumes ownership of @c p. + Servant_var<T> & operator= (T * p); + +# if !defined(ACE_LACKS_MEMBER_TEMPLATES) + /// Template member constructor from a pointer that will implicitly + /// cast to type T. Assumes ownership of @c p. + /// This constructor allows constructs such as: + /// Servant_Base<Base> p(new Derived); + template <class Y> + Servant_var (Y * p); + + /// Template member copy constructor from a Servant_var<Y>, where + /// Y can be implicitly cast to type T. + template <class Y> + Servant_var (Servant_var<Y> const & rhs); + + /// Template member assignment operator from a Servant_var<Y>, where + /// Y can be implicitly cast to type T. + template <class Y> + Servant_var<T> & operator= (Servant_var<Y> const & rhs); + + /// Template member assignment operator from a pointer to Y, where Y + /// can be implicitly cast to type T. + template <class Y> + Servant_var<T> & operator= (Y * p); +# endif /* ACE_LACKS_MEMBER_TEMPLATES */ + + /// Smart pointer operator-> provides access to the underlying object. + T const * operator->() const; + + /// Smart pointer operator-> provides access to the underlying object. + T * operator->(); + + /// Dereference the underlying object. + T const & operator*() const; + + /// Dereference the underlying object. + T & operator*(); + + /// Return a void pointer to the underlying object. This allows + /// it to be used in conditional code and tested against 0. + operator void const * () const; + + /// As an IN parameter. + T * in() const; + + /// As an INOUT parameter. + T *& inout(); + + /// As an OUT parameter. + T *& out(); + + /// Return a pointer to the underlying object, and this counted + /// reference will no longer own the object. + T * _retn(); + + /// Increment the reference count and return the servant. + /** + * It is safe to pass in a null pointer, the pointer is simply + * returned in that case. + * + * @todo We might want to add a throw spec and catch all (potential) + * exceptions in _add_ref() + * + * @todo It might be useful to add a _release() method that handles + * any potential exceptions... + */ + static T * _duplicate (T *); + + /// Swap the contents of a Servant_var<T> with another + /// Servant_var<T> + /** + * Non-throwing swap operation. + * Often used to implement strong exception safety. + */ + void swap (Servant_var<T> & rhs) /* throw () */; + + private: + T * ptr_; + }; + + /// Compare two Servant_vars for equivalence. + template <class X, class Y> + bool operator==(Servant_var<X> const & x, + Servant_var<Y> const & y); + + /// Compare two Servant_vars for non-equivalence. + template <class X, class Y> + bool operator!=(Servant_var<X> const & x, + Servant_var<Y> const & y); + +} // namespace PortableServer + +TAO_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +# include "tao/PortableServer/Servant_var.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "tao/PortableServer/Servant_var.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("tao/PortableServer/Servant_var.cpp") +#endif + +#include /**/ "ace/post.h" +#endif /* TAO_PORTABLESERVER_SERVANT_VAR_H */ diff --git a/TAO/tao/PortableServer/Servant_var.inl b/TAO/tao/PortableServer/Servant_var.inl new file mode 100755 index 00000000000..a46be3e50da --- /dev/null +++ b/TAO/tao/PortableServer/Servant_var.inl @@ -0,0 +1,182 @@ +// -*- C++ -*- +// +// $Id$ + +#include <algorithm> + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +template <class T> +ACE_INLINE void +PortableServer::Servant_var<T>::swap (Servant_var<T> & rhs) /* throw () */ +{ + std::swap (this->ptr_, rhs.ptr_); +} + +template <class T> +ACE_INLINE +PortableServer::Servant_var<T>::Servant_var (T * p) + : ptr_ (p) +{ +} + +// If _add_ref throws, this object will not be completely constructed +// so the destructor will not be called. +template <class T> +ACE_INLINE +PortableServer::Servant_var<T>::Servant_var (Servant_var<T> const & rhs) + : ptr_ (Servant_var<T>::_duplicate(rhs.ptr_)) +{ +} + +template <class T> +ACE_INLINE PortableServer::Servant_var<T> & +PortableServer::Servant_var<T>::operator= (Servant_var<T> const & rhs) +{ + PortableServer::Servant_var<T> tmp (rhs); + this->swap (tmp); + return *this; +} + +template <class T> +ACE_INLINE typename PortableServer::Servant_var<T> & +PortableServer::Servant_var<T>::operator= (T * p) +{ + if (this->ptr_ != p) + { + // This constructor doesn't increase the reference count, nor is + // it a copy constructor, so we must check for self-assignment. + // Otherwise the reference count would be prematurely + // decremented upon exiting this scope. + PortableServer::Servant_var<T> tmp (p); + this->swap (tmp); + } + + return *this; +} + +#if !defined(ACE_LACKS_MEMBER_TEMPLATES) +template <class T> template <class Y> +ACE_INLINE +PortableServer::Servant_var<T>::Servant_var (Y * p) + : ptr_ (p) +{ +} + +template <class T> template <class Y> +ACE_INLINE +PortableServer::Servant_var<T>::Servant_var (Servant_var<Y> const & rhs) + : ptr_ (Servant_var<T>::_duplicate (rhs.in ())) +{ +} + +template <class T> template <class Y> +ACE_INLINE typename PortableServer::Servant_var<T> & +PortableServer::Servant_var<T>::operator=(Servant_var<Y> const & rhs) +{ + PortableServer::Servant_var<T> tmp (rhs); + this->swap (tmp); + return *this; +} + +template <class T> template <class Y> +ACE_INLINE typename PortableServer::Servant_var<T> & +PortableServer::Servant_var<T>::operator= (Y * p) +{ + if (this->ptr_ != p) + { + // This constructor doesn't increase the reference count, nor is + // it a copy constructor, so we must check for self-assignment. + // Otherwise the reference count would be prematurely + // decremented upon exiting this scope. + PortableServer::Servant_var<T> tmp (p); + this->swap (tmp); + } + + return *this; +} +#endif /* ACE_LACKS_MEMBER_TEMPLATES */ + +template <class T> +ACE_INLINE T const * +PortableServer::Servant_var<T>::operator->() const +{ + return this->ptr_; +} + +template <class T> +ACE_INLINE T * +PortableServer::Servant_var<T>::operator->() +{ + return this->ptr_; +} + +template <class T> +ACE_INLINE T const & +PortableServer::Servant_var<T>::operator*() const +{ + return *this->ptr_; +} + +template <class T> +ACE_INLINE T & +PortableServer::Servant_var<T>::operator*() +{ + return *this->ptr_; +} + +template <class T> +ACE_INLINE PortableServer::Servant_var<T>::operator void const * () const +{ + return this->ptr_; +} + +template <class T> +ACE_INLINE T * +PortableServer::Servant_var<T>::in (void) const +{ + return this->ptr_; +} + +template <class T> +ACE_INLINE T *& +PortableServer::Servant_var<T>::inout (void) +{ + return this->ptr_; +} + +template <class T> +ACE_INLINE T *& +PortableServer::Servant_var<T>::out (void) +{ + PortableServer::Servant_var<T> tmp; + this->swap (tmp); + return this->ptr_; +} + +template <class T> +ACE_INLINE T * +PortableServer::Servant_var<T>::_retn (void) +{ + T * const rval = ptr_; + this->ptr_ = 0; + return this->rval; +} + +template <class X, class Y> +ACE_INLINE bool +operator== (typename PortableServer::Servant_var<X> const & x, + typename PortableServer::Servant_var<Y> const & y) +{ + return x.in () == y.in (); +} + +template <class X, class Y> +ACE_INLINE bool +operator!= (typename PortableServer::Servant_var<X> const & x, + typename PortableServer::Servant_var<Y> const & y) +{ + return x.in () != y.in (); +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Transport_Connector.cpp b/TAO/tao/Transport_Connector.cpp index 82aebdf3c21..33313169d3c 100644 --- a/TAO/tao/Transport_Connector.cpp +++ b/TAO/tao/Transport_Connector.cpp @@ -116,7 +116,7 @@ TAO_Connector::make_mprofile (const char *string, ior.set (string, ACE_OS::strlen (string), 1); // Find out where the protocol ends - ssize_t ior_index = ior.find ("://"); + ACE_CString::size_type ior_index = ior.find ("://"); if (ior_index == ACE_CString::npos) { @@ -131,7 +131,7 @@ TAO_Connector::make_mprofile (const char *string, } // Find the object key - const ssize_t objkey_index = + const ACE_CString::size_type objkey_index = ior.find (this->object_key_delimiter (), ior_index); if (objkey_index == 0 || objkey_index == ACE_CString::npos) @@ -151,7 +151,7 @@ TAO_Connector::make_mprofile (const char *string, // Only check for endpoints after the protocol specification and // before the object key. - for (ssize_t i = ior_index; i < objkey_index; ++i) + for (ACE_CString::size_type i = ior_index; i < objkey_index; ++i) { if (ior[i] == endpoint_delimiter) ++profile_count; @@ -179,8 +179,8 @@ TAO_Connector::make_mprofile (const char *string, // `shu/arf' // `1.1@chicken/arf' - ssize_t begin = 0; - ssize_t end = ior_index - 1; + ACE_CString::size_type begin = 0; + ACE_CString::size_type end = ior_index - 1; // Initialize the end of the endpoint index for (CORBA::ULong j = 0; j < profile_count; ++j) @@ -196,7 +196,7 @@ TAO_Connector::make_mprofile (const char *string, end = objkey_index; // Handle last endpoint differently } - if (end < static_cast<ssize_t> (ior.length ()) && end != ior.npos) + if (end < ior.length () && end != ior.npos) { ACE_CString endpoint = ior.substring (begin, end - begin); diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp b/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp index d1e918736c7..6183754d39b 100644 --- a/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp +++ b/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp @@ -1662,7 +1662,7 @@ TAO_TypeCodeFactory_i::valid_id (const char *id) 0, 0); - int pos = safety.find (':'); + ACE_CString::size_type const pos = safety.find (':'); if (pos == ACE_CString::npos) { diff --git a/TAO/tao/Utils/Servant_Var.h b/TAO/tao/Utils/Servant_Var.h index 9fc8f6cb920..d4fc65f58c6 100644 --- a/TAO/tao/Utils/Servant_Var.h +++ b/TAO/tao/Utils/Servant_Var.h @@ -1,4 +1,5 @@ // -*- C++ -*- + //============================================================================= /** * @file Servant_Var.h @@ -7,8 +8,11 @@ * * @author Jody Hagins <jody@atdesk.com> * @author Carlos O'Ryan <coryan@atdesk.com> + * + * @deprecated Use PortableServer::Servant_var instead. */ //============================================================================= + #ifndef TAO_UTILS_SERVANT_VAR_H #define TAO_UTILS_SERVANT_VAR_H #include /**/ "ace/pre.h" @@ -21,6 +25,9 @@ #include "ace/CORBA_macros.h" #include "tao/Environment.h" +#warning TAO::Utils::Servant_Var<> is deprecated. +#warning Use PortableServer::Servant_var<> instead. + TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO diff --git a/TAO/tao/params.cpp b/TAO/tao/params.cpp index f4bc363777f..136f8261724 100644 --- a/TAO/tao/params.cpp +++ b/TAO/tao/params.cpp @@ -170,7 +170,7 @@ TAO_ORB_Parameters::parse_and_add_endpoints (const ACE_CString &endpoints, // from the offset `begin' to the end of the string. // Check for a valid URL style endpoint set - ssize_t const check_offset = endpt.find ("://"); + ACE_CString::size_type const check_offset = endpt.find ("://"); if (check_offset > 0 && check_offset != endpt.npos) diff --git a/TAO/utils/catior/catior.cpp b/TAO/utils/catior/catior.cpp index 4a53e5683d3..f8df799c965 100644 --- a/TAO/utils/catior/catior.cpp +++ b/TAO/utils/catior/catior.cpp @@ -153,18 +153,18 @@ CORBA::Boolean cat_profile_helper(TAO_InputCDR& stream, const char *protocol); CORBA::Boolean -catior (char* str +catior (char const * str ACE_ENV_ARG_DECL_NOT_USED) { // Unhex the bytes, and make a CDR deencapsulation stream from the // resulting data. - ACE_Message_Block mb (ACE_OS::strlen ((char *) str) / 2 + 1 + ACE_Message_Block mb (ACE_OS::strlen (str) / 2 + 1 + ACE_CDR::MAX_ALIGNMENT); ACE_CDR::mb_align (&mb); - char *buffer = mb.rd_ptr (); - char *tmp = (char *) str; + char * const buffer = mb.rd_ptr (); + char const * tmp = (char *) str; size_t len = 0; CORBA::Boolean continue_decoding; @@ -182,7 +182,7 @@ catior (char* str byte = (u_char) (ACE::hex2byte (tmp [0]) << 4); byte |= ACE::hex2byte (tmp [1]); - buffer [len++] = byte; + buffer[len++] = byte; tmp += 2; } @@ -192,7 +192,7 @@ catior (char* str int byteOrder = *(mb.rd_ptr ()); mb.rd_ptr (1); - mb.wr_ptr (2 * len - 1); + mb.wr_ptr (len); TAO_InputCDR stream (&mb, static_cast<int> (byteOrder)); if (byteOrder == 1) @@ -576,7 +576,7 @@ ACE_TMAIN (int argcw, ACE_TCHAR *argvw[]) "\nhere is the IOR\n%s\n\n", aString.rep ())); - char* str; + char * str = 0; if (aString.find ("IOR:") == 0) { ACE_DEBUG ((LM_DEBUG, @@ -619,6 +619,8 @@ ACE_TMAIN (int argcw, ACE_TCHAR *argvw[]) else ACE_ERROR ((LM_ERROR, "Don't know how to decode this IOR\n")); + + delete [] str; } ACE_CATCHANY { |