diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/include/IceUtil/Config.h | 2 | ||||
-rw-r--r-- | cpp/src/Glacier2Lib/SessionHelper.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Ice/AsyncResult.cpp | 43 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionI.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Ice/LocatorInfo.cpp | 7 | ||||
-rw-r--r-- | cpp/src/Ice/Outgoing.cpp | 31 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.cpp | 13 | ||||
-rw-r--r-- | cpp/test/Ice/interceptor/AMDInterceptorI.cpp | 12 |
8 files changed, 26 insertions, 94 deletions
diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index b4396023e97..74033859774 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -272,6 +272,7 @@ typedef long long Int64; # define ICE_IN(T) T # define ICE_EXCEPTION_GET(T) T # define ICE_RETHROW_EXCEPTION(T) ::std::rethrow_exception(T) +# define ICE_RESET_EXCEPTION(T, V) T = V #else // C++98 mapping # define ICE_HANDLE ::IceUtil::Handle # define ICE_INTERNAL_HANDLE ::IceInternal::Handle @@ -290,6 +291,7 @@ typedef long long Int64; # define ICE_IN(T) const T& # define ICE_EXCEPTION_GET(T) T.get() # define ICE_RETHROW_EXCEPTION(T) T->ice_throw() +# define ICE_RESET_EXCEPTION(T, V) = T.reset(V) #endif #endif diff --git a/cpp/src/Glacier2Lib/SessionHelper.cpp b/cpp/src/Glacier2Lib/SessionHelper.cpp index bc0f625d503..2aebb4cfc30 100644 --- a/cpp/src/Glacier2Lib/SessionHelper.cpp +++ b/cpp/src/Glacier2Lib/SessionHelper.cpp @@ -507,11 +507,7 @@ public: _callback(callback), _session(session) { -#ifdef ICE_CPP11_MAPPING - _ex = ex.ice_clone(); -#else - _ex.reset(ex.ice_clone()); -#endif + ICE_RESET_EXCEPTION(_ex, ex.ice_clone()); } virtual void diff --git a/cpp/src/Ice/AsyncResult.cpp b/cpp/src/Ice/AsyncResult.cpp index 5848747810e..7387366cbed 100644 --- a/cpp/src/Ice/AsyncResult.cpp +++ b/cpp/src/Ice/AsyncResult.cpp @@ -50,7 +50,7 @@ AsyncResult::getCommunicator() const ConnectionPtr AsyncResult::getConnection() const { - return 0; + return ICE_NULLPTR; } ObjectPrxPtr @@ -299,11 +299,7 @@ AsyncResult::finished(const Ice::Exception& ex) { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor); _state |= Done; -#ifdef ICE_CPP11_MAPPING - _exception = ex.ice_clone(); -#else - _exception.reset(ex.ice_clone()); -#endif + ICE_RESET_EXCEPTION(_exception, ex.ice_clone()); _cancellationHandler = 0; _observer.failed(ex.ice_name()); if(!_callback) @@ -438,55 +434,34 @@ AsyncResult::cancel(const Ice::LocalException& ex) CancellationHandlerPtr handler; { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor); -#ifdef ICE_CPP11_MAPPING - _cancellationException = ex.ice_clone(); -#else - _cancellationException.reset(ex.ice_clone()); -#endif + ICE_RESET_EXCEPTION(_cancellationException, ex.ice_clone()); if(!_cancellationHandler) { return; } handler = _cancellationHandler; } -#ifdef ICE_CPP11_MAPPING - handler->asyncRequestCanceled(dynamic_pointer_cast<OutgoingAsyncBase>(shared_from_this()), ex); -#else - handler->asyncRequestCanceled(OutgoingAsyncBasePtr::dynamicCast(this), ex); -#endif + handler->asyncRequestCanceled(ICE_DYNAMIC_CAST(OutgoingAsyncBase, shared_from_this()), ex); } void AsyncResult::cancelable(const CancellationHandlerPtr& handler) { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor); -#ifdef ICE_CPP11_MAPPING - if(_cancellationException) - { - try - { - rethrow_exception(_cancellationException); - } - catch(const Ice::Exception&) - { - _cancellationException = nullptr; - throw; - } - } -#else - if(_cancellationException.get()) + + + if(ICE_EXCEPTION_GET(_cancellationException)) { try { - _cancellationException->ice_throw(); + ICE_RETHROW_EXCEPTION(_cancellationException); } catch(const Ice::Exception&) { - _cancellationException.reset(0); + ICE_RESET_EXCEPTION(_cancellationException, ICE_NULLPTR); throw; } } -#endif _cancellationHandler = handler; } diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index d3b54bfa386..cb7fcfc5d3f 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -2384,11 +2384,7 @@ Ice::ConnectionI::setState(State state, const LocalException& ex) // If we are in closed state, an exception must be set. // assert(_state != StateClosed); -#ifdef ICE_CPP11_MAPPING - _exception = ex.ice_clone(); -#else - _exception.reset(ex.ice_clone()); -#endif + ICE_RESET_EXCEPTION(_exception, ex.ice_clone()); // // We don't warn if we are not validated. // diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp index ae3936fccb2..4bc0c4cc165 100644 --- a/cpp/src/Ice/LocatorInfo.cpp +++ b/cpp/src/Ice/LocatorInfo.cpp @@ -555,11 +555,8 @@ IceInternal::LocatorInfo::Request::exception(const Ice::Exception& ex) { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor); _locatorInfo->finishRequest(_ref, _wellKnownRefs, 0, dynamic_cast<const Ice::UserException*>(&ex)); -#ifdef ICE_CPP11_MAPPING - _exception = ex.ice_clone(); -#else - _exception.reset(ex.ice_clone()); -#endif + + ICE_RESET_EXCEPTION(_exception, ex.ice_clone()); _monitor.notifyAll(); } for(vector<RequestCallbackPtr>::const_iterator p = _callbacks.begin(); p != _callbacks.end(); ++p) diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index d3291ff1ddf..2a12baf84d9 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -86,11 +86,7 @@ ProxyOutgoingBase::completed(const Ice::Exception& ex) _childObserver.detach(); _state = StateFailed; -#ifdef ICE_CPP11_MAPPING - _exception = ex.ice_clone(); -#else - _exception.reset(ex.ice_clone()); -#endif + ICE_RESET_EXCEPTION(_exception, ex.ice_clone()); _monitor.notify(); } @@ -126,11 +122,7 @@ ProxyOutgoingBase::invokeImpl() } _state = StateInProgress; -#ifdef ICE_CPP11_MAPPING - _exception = nullptr; -#else - _exception.reset(0); -#endif + ICE_RESET_EXCEPTION(_exception, ICE_NULLPTR); _sent = false; _handler = _proxy->__getRequestHandler(); @@ -509,12 +501,7 @@ Outgoing::completed(BasicStream& is) ex->id = ident; ex->facet = facet; ex->operation = operation; -#ifdef ICE_CPP11_MAPPING - _exception = ex->ice_clone(); -#else - _exception.reset(ex); -#endif - + ICE_RESET_EXCEPTION(_exception, ex->ice_clone()); _state = StateLocalException; // The state must be set last, in case there is an exception. break; } @@ -561,11 +548,7 @@ Outgoing::completed(BasicStream& is) } ex->unknown = unknown; -#ifdef ICE_CPP11_MAPPING - _exception = ex->ice_clone(); -#else - _exception.reset(ex); -#endif + ICE_RESET_EXCEPTION(_exception, ex->ice_clone()); _state = StateLocalException; // The state must be set last, in case there is an exception. break; } @@ -699,11 +682,7 @@ ConnectionFlushBatch::completed(const Ice::Exception& ex) Monitor<Mutex>::Lock sync(_monitor); _childObserver.failed(ex.ice_name()); _childObserver.detach(); -#ifdef ICE_CPP11_MAPPING - _exception = ex.ice_clone(); -#else - _exception.reset(ex.ice_clone()); -#endif + ICE_RESET_EXCEPTION(_exception, ex.ice_clone()); _monitor.notify(); } diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index 737d4bdbfe6..f002b8356f6 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -1777,12 +1777,12 @@ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& all virtual void setException(const Ice::LocalException& ex) { -#ifdef ICE_CPP11_MAPPING - if(!_exception) + if(!ICE_EXCEPTION_GET(_exception)) { - _exception = ex.ice_clone(); + ICE_RESET_EXCEPTION(_exception, ex.ice_clone()); } - + +#ifdef ICE_CPP11_MAPPING try { rethrow_exception(_exception); @@ -1796,11 +1796,6 @@ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& all } } #else - if(!_exception.get()) - { - _exception.reset(ex.ice_clone()); - } - if(++_i == _endpoints.size()) { _callback->setException(*_exception.get()); diff --git a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp index eb4fec01954..25e98745940 100644 --- a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp +++ b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp @@ -84,11 +84,7 @@ void AMDInterceptorI::setActualStatus(const IceUtil::Exception& e) { IceUtil::Mutex::Lock lock(_mutex); -#ifdef ICE_CPP11_MAPPING - _exception = e.ice_clone(); -#else - _exception.reset(e.ice_clone()); -#endif + ICE_RESET_EXCEPTION(_exception, e.ice_clone()); _actualStatus = Ice::DispatchAsync; } @@ -121,11 +117,7 @@ AMDInterceptorI::clear() InterceptorI::clear(); IceUtil::Mutex::Lock lock(_mutex); _actualStatus = Ice::DispatchAsync; -#ifdef ICE_CPP11_MAPPING - _exception = nullptr; -#else - _exception.reset(); -#endif + ICE_RESET_EXCEPTION(_exception, ICE_NULLPTR); } |