diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2018-05-15 11:07:52 +0200 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2018-05-15 11:07:52 +0200 |
commit | c3953feb3a48473bc0b78691e7fe18d08f477df8 (patch) | |
tree | aba0e73fce6293d995ed81412513100dc1a7a735 | |
parent | c560110d8f3206a7866866cff325489eb2ea88db (diff) | |
download | ATCD-c3953feb3a48473bc0b78691e7fe18d08f477df8.tar.gz |
When we have C++11 make use of std::unique_ptr
* TAO/tao/AnyTypeCode/Any_Impl_T.cpp:
* TAO/tao/Connector_Registry.cpp:
* TAO/tao/ORB_Core.cpp:
* TAO/tao/Stub.cpp:
* TAO/tao/Synch_Invocation.cpp:
-rw-r--r-- | TAO/tao/AnyTypeCode/Any_Impl_T.cpp | 4 | ||||
-rw-r--r-- | TAO/tao/Connector_Registry.cpp | 10 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 5 | ||||
-rw-r--r-- | TAO/tao/Stub.cpp | 7 | ||||
-rw-r--r-- | TAO/tao/Synch_Invocation.cpp | 8 |
5 files changed, 27 insertions, 7 deletions
diff --git a/TAO/tao/AnyTypeCode/Any_Impl_T.cpp b/TAO/tao/AnyTypeCode/Any_Impl_T.cpp index c1872c61e3f..7152fb2a3f0 100644 --- a/TAO/tao/AnyTypeCode/Any_Impl_T.cpp +++ b/TAO/tao/AnyTypeCode/Any_Impl_T.cpp @@ -91,7 +91,11 @@ TAO::Any_Impl_T<T>::extract (const CORBA::Any & any, 0), false); +#if defined (ACE_HAS_CPP11) + std::unique_ptr<TAO::Any_Impl_T<T> > replacement_safety (replacement); +#else auto_ptr<TAO::Any_Impl_T<T> > replacement_safety (replacement); +#endif // We know this will work since the unencoded case is covered above. TAO::Unknown_IDL_Type * const unk = diff --git a/TAO/tao/Connector_Registry.cpp b/TAO/tao/Connector_Registry.cpp index 8d3d2eece02..3c3ccada1e4 100644 --- a/TAO/tao/Connector_Registry.cpp +++ b/TAO/tao/Connector_Registry.cpp @@ -64,8 +64,11 @@ TAO_Connector_Registry::open (TAO_ORB_Core *orb_core) factory != end; ++factory) { - auto_ptr <TAO_Connector> connector ( - (*factory)->factory ()->make_connector ()); +#if defined (ACE_HAS_CPP11) + std::unique_ptr <TAO_Connector> connector ((*factory)->factory ()->make_connector ()); +#else + auto_ptr <TAO_Connector> connector ((*factory)->factory ()->make_connector ()); +#endif if (connector.get ()) { @@ -79,8 +82,7 @@ TAO_Connector_Registry::open (TAO_ORB_Core *orb_core) -1); } - this->connectors_[this->size_++] = - connector.release (); + this->connectors_[this->size_++] = connector.release (); } else return -1; diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index 99397801b3f..a21405d3798 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -1966,8 +1966,11 @@ TAO_ORB_Core::root_poa (void) if (CORBA::is_nil (this->root_poa_.in ())) { +#if defined (ACE_HAS_CPP11) + std::unique_ptr<TAO_Adapter> poa_adapter (factory->create (this)); +#else auto_ptr<TAO_Adapter> poa_adapter (factory->create (this)); - +#endif poa_adapter->open (); // @@ Not exception safe diff --git a/TAO/tao/Stub.cpp b/TAO/tao/Stub.cpp index 7f2351595aa..9a6787b19d0 100644 --- a/TAO/tao/Stub.cpp +++ b/TAO/tao/Stub.cpp @@ -456,8 +456,11 @@ TAO_Stub::set_policy_overrides (const CORBA::PolicyList & policies, CORBA::SetOverrideType set_add) { // Notice the use of an explicit constructor.... - auto_ptr<TAO_Policy_Set> policy_manager ( - new TAO_Policy_Set (TAO_POLICY_OBJECT_SCOPE)); +#if defined (ACE_HAS_CPP11) + std::unique_ptr<TAO_Policy_Set> policy_manager (new TAO_Policy_Set (TAO_POLICY_OBJECT_SCOPE)); +#else + auto_ptr<TAO_Policy_Set> policy_manager (new TAO_Policy_Set (TAO_POLICY_OBJECT_SCOPE)); +#endif if (set_add == CORBA::SET_OVERRIDE) { diff --git a/TAO/tao/Synch_Invocation.cpp b/TAO/tao/Synch_Invocation.cpp index 5cc60f9ad17..df61a2e8e2c 100644 --- a/TAO/tao/Synch_Invocation.cpp +++ b/TAO/tao/Synch_Invocation.cpp @@ -585,7 +585,11 @@ namespace TAO // We must manage the memory allocated // by the call above to alloc(). +#if defined (ACE_HAS_CPP11) + std::unique_ptr<CORBA::Exception> safety (exception); +#else auto_ptr<CORBA::Exception> safety (exception); +#endif exception->_raise (); @@ -732,7 +736,11 @@ namespace TAO // Without this, the call to create_system_exception() above // causes a memory leak. On platforms without native exceptions, // the CORBA::Environment class manages the memory. +#if defined (ACE_HAS_CPP11) + std::unique_ptr<CORBA::SystemException> safety (ex); +#else auto_ptr<CORBA::SystemException> safety (ex); +#endif ex->minor (minor); ex->completed (CORBA::CompletionStatus (completion)); |