From e915b48fcd7eee34bf661673b532bfa0b6e9cccb Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Tue, 15 May 2018 12:28:55 +0200 Subject: Make use of std::unique_ptr when we have C++11 * TAO/tao/DynamicInterface/AMH_DSI_Response_Handler.cpp: * TAO/tao/Load_Protocol_Factory_T.h: --- TAO/tao/DynamicInterface/AMH_DSI_Response_Handler.cpp | 17 ++++++++++------- TAO/tao/Load_Protocol_Factory_T.h | 4 ++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/TAO/tao/DynamicInterface/AMH_DSI_Response_Handler.cpp b/TAO/tao/DynamicInterface/AMH_DSI_Response_Handler.cpp index 830f379f67c..4e373dc8f01 100644 --- a/TAO/tao/DynamicInterface/AMH_DSI_Response_Handler.cpp +++ b/TAO/tao/DynamicInterface/AMH_DSI_Response_Handler.cpp @@ -267,8 +267,8 @@ TAO_AMH_DSI_Exception_Holder::_tao_unmarshal ( TAO_AMH_DSI_Exception_Holder *&new_object) { ::CORBA::ValueBase *base = 0; - ::CORBA::Boolean is_indirected = 0; - ::CORBA::Boolean is_null_object = 0; + ::CORBA::Boolean is_indirected = false; + ::CORBA::Boolean is_null_object = false; ::CORBA::Boolean const retval = ::CORBA::ValueBase::_tao_unmarshal_pre ( strm, @@ -281,14 +281,13 @@ TAO_AMH_DSI_Exception_Holder::_tao_unmarshal ( ::CORBA::ValueBase_var owner (base); if (!retval) - return 0; + return false; if (is_null_object) - return 1; + return true; if (!is_indirected && base != 0 && ! base->_tao_unmarshal_v (strm)) - return 0; - + return false; // Now base must be null or point to the unmarshaled object. // Align the pointer to the right subobject. @@ -297,13 +296,17 @@ TAO_AMH_DSI_Exception_Holder::_tao_unmarshal ( new_object->_add_ref (); owner._retn (); - return 1; + return true; } void TAO_AMH_DSI_Exception_Holder::raise_invoke () { +#if defined (ACE_HAS_CPP11) + std::unique_ptr< ::CORBA::Exception> safety (this->exception_); +#else auto_ptr< ::CORBA::Exception> safety (this->exception_); +#endif this->exception_->_raise (); } diff --git a/TAO/tao/Load_Protocol_Factory_T.h b/TAO/tao/Load_Protocol_Factory_T.h index 45b246d3188..713ad8e6efd 100644 --- a/TAO/tao/Load_Protocol_Factory_T.h +++ b/TAO/tao/Load_Protocol_Factory_T.h @@ -33,7 +33,11 @@ namespace TAO const char *name) { TAO_Protocol_Factory *protocol_factory = 0; +#if defined (ACE_HAS_CPP11) + std::unique_ptr safe_protocol_factory; +#else auto_ptr safe_protocol_factory; +#endif TAO_Protocol_Item *item = 0; -- cgit v1.2.1