diff options
author | Bernard Normier <bernard@zeroc.com> | 2012-10-05 16:31:52 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2012-10-05 16:31:52 -0400 |
commit | 0d20d608543547fd2a3abcc08210fb7910773e3d (patch) | |
tree | 33b4acb74e574e4cbced30693448fcd3808c8d9d /cpp | |
parent | Fixed ICE-4741 and minor add-in issues (diff) | |
download | ice-0d20d608543547fd2a3abcc08210fb7910773e3d.tar.bz2 ice-0d20d608543547fd2a3abcc08210fb7910773e3d.tar.xz ice-0d20d608543547fd2a3abcc08210fb7910773e3d.zip |
Port to gcc and clang in c++11 mode:
- for GCC, replaced most std::auto_ptr usage by a new IceUtil::UniquePtr
- for clang, added ICE_NOEXCEPT and ICE_NOEXCEPT_FALSE for a few dtors in Freeze
Diffstat (limited to 'cpp')
43 files changed, 208 insertions, 91 deletions
diff --git a/cpp/include/Freeze/Map.h b/cpp/include/Freeze/Map.h index abd6912306f..c2083948ee9 100644 --- a/cpp/include/Freeze/Map.h +++ b/cpp/include/Freeze/Map.h @@ -383,7 +383,7 @@ private: friend class ConstIterator<key_type, mapped_type, KeyCodec, ValueCodec, Compare>; friend class Map<key_type, mapped_type, KeyCodec, ValueCodec, Compare>; - std::auto_ptr<IteratorHelper> _helper; + IceUtil::UniquePtr<IteratorHelper> _helper; Ice::CommunicatorPtr _communicator; Ice::EncodingVersion _encoding; @@ -604,7 +604,7 @@ private: friend class Map<key_type, mapped_type, KeyCodec, ValueCodec, Compare>; - std::auto_ptr<IteratorHelper> _helper; + IceUtil::UniquePtr<IteratorHelper> _helper; Ice::CommunicatorPtr _communicator; Ice::EncodingVersion _encoding; @@ -1156,7 +1156,7 @@ protected: { } - std::auto_ptr<MapHelper> _helper; + IceUtil::UniquePtr<MapHelper> _helper; Ice::CommunicatorPtr _communicator; Ice::EncodingVersion _encoding; }; diff --git a/cpp/include/Ice/Direct.h b/cpp/include/Ice/Direct.h index 90a8944689f..225e6bd0586 100644 --- a/cpp/include/Ice/Direct.h +++ b/cpp/include/Ice/Direct.h @@ -16,7 +16,7 @@ #include <Ice/LocalObjectF.h> #include <Ice/Current.h> -#include <memory> +#include <IceUtil/UniquePtr.h> namespace IceInternal { @@ -51,7 +51,7 @@ private: Ice::ObjectPtr _servant; Ice::ServantLocatorPtr _locator; Ice::LocalObjectPtr _cookie; - std::auto_ptr<Ice::UserException> _userException; + IceUtil::UniquePtr<Ice::UserException> _userException; }; } diff --git a/cpp/include/Ice/Outgoing.h b/cpp/include/Ice/Outgoing.h index 1bcc5fa9d5b..06d12c9218e 100644 --- a/cpp/include/Ice/Outgoing.h +++ b/cpp/include/Ice/Outgoing.h @@ -12,13 +12,13 @@ #include <IceUtil/Mutex.h> #include <IceUtil/Monitor.h> +#include <IceUtil/UniquePtr.h> #include <Ice/RequestHandlerF.h> #include <Ice/InstanceF.h> #include <Ice/ConnectionIF.h> #include <Ice/ReferenceF.h> #include <Ice/BasicStream.h> #include <Ice/Current.h> -#include <memory> namespace Ice { @@ -58,7 +58,7 @@ private: const LocalExceptionWrapper& operator=(const LocalExceptionWrapper&); - std::auto_ptr<Ice::LocalException> _ex; + IceUtil::UniquePtr<Ice::LocalException> _ex; bool _retry; }; @@ -144,7 +144,7 @@ private: // RequestHandler* _handler; - std::auto_ptr<Ice::LocalException> _exception; + IceUtil::UniquePtr<Ice::LocalException> _exception; enum { @@ -191,7 +191,7 @@ private: RequestHandler* _handler; Ice::ConnectionI* _connection; bool _sent; - std::auto_ptr<Ice::LocalException> _exception; + IceUtil::UniquePtr<Ice::LocalException> _exception; BasicStream _os; }; diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h index 9c27f0f9a6d..c5b90cbacbb 100644 --- a/cpp/include/Ice/OutgoingAsync.h +++ b/cpp/include/Ice/OutgoingAsync.h @@ -14,6 +14,7 @@ #include <IceUtil/Mutex.h> #include <IceUtil/Timer.h> #include <IceUtil/Exception.h> +#include <IceUtil/UniquePtr.h> #include <Ice/OutgoingAsyncF.h> #include <Ice/InstanceF.h> #include <Ice/ReferenceF.h> @@ -22,7 +23,6 @@ #include <Ice/Current.h> #include <Ice/BasicStream.h> -#include <memory> #ifdef ICE_CPP11 # include <functional> // for std::function #endif @@ -152,7 +152,7 @@ protected: unsigned char _state; bool _sentSynchronously; - std::auto_ptr<Exception> _exception; + IceUtil::UniquePtr<Exception> _exception; }; } diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index 1ea2dc144ed..fc2b7dda6f5 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -55,6 +55,16 @@ # define ICE_CPP11 #endif +#if defined(ICE_CPP11) && !defined(_MSC_VER) + +// Visual Studio does not support noexcept yet +# define ICE_NOEXCEPT noexcept +# define ICE_NOEXCEPT_FALSE noexcept(false) +#else +# define ICE_NOEXCEPT throw() +# define ICE_NOEXCEPT_FALSE /**/ +#endif + #if defined(_MSC_VER) && (_MSC_VER >= 1700) // Visual Studio 2012 or later // diff --git a/cpp/include/IceUtil/IceUtil.h b/cpp/include/IceUtil/IceUtil.h index 783bcb6f945..dacdd36b8a5 100644 --- a/cpp/include/IceUtil/IceUtil.h +++ b/cpp/include/IceUtil/IceUtil.h @@ -31,6 +31,7 @@ #include <IceUtil/Mutex.h> #include <IceUtil/MutexPtrLock.h> #include <IceUtil/RecMutex.h> +#include <IceUtil/ScopedArray.h> #include <IceUtil/Shared.h> #include <IceUtil/Thread.h> #include <IceUtil/ThreadException.h> @@ -38,5 +39,6 @@ #include <IceUtil/Timer.h> #include <IceUtil/UUID.h> #include <IceUtil/Unicode.h> +#include <IceUtil/UniquePtr.h> #endif diff --git a/cpp/include/IceUtil/UniquePtr.h b/cpp/include/IceUtil/UniquePtr.h new file mode 100644 index 00000000000..6030d294100 --- /dev/null +++ b/cpp/include/IceUtil/UniquePtr.h @@ -0,0 +1,101 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef ICE_UTIL_UNIQUE_PTR_H +#define ICE_UTIL_UNIQUE_PTR_H + +#include <IceUtil/Config.h> + +namespace IceUtil +{ + +// +// This is temporary and very partial placeholder for std::unique_ptr, +// which is not yet widely available. +// + + +template<typename T> +class UniquePtr +{ +public: + + explicit UniquePtr(T* ptr = 0) : + _ptr(ptr) + { + } + + UniquePtr(UniquePtr& o) : + _ptr(o.release()) + { + } + + UniquePtr& operator=(UniquePtr& o) + { + reset(o.release()); + return *this; + } + + ~UniquePtr() + { + if(_ptr != 0) + { + delete _ptr; + } + } + + T* release() + { + T* r = _ptr; + _ptr = 0; + return r; + } + + void reset(T* ptr = 0) + { + assert(ptr == 0 || ptr != _ptr); + + if(_ptr != 0) + { + delete _ptr; + } + _ptr = ptr; + } + + T& operator*() const + { + return *_ptr; + } + + T* operator->() const + { + return _ptr; + } + + + T* get() const + { + return _ptr; + } + + void swap(UniquePtr& a) + { + T* tmp = a._ptr; + a._ptr = _ptr; + _ptr = tmp; + } + +private: + + T* _ptr; +}; + +} // End of namespace IceUtil + +#endif diff --git a/cpp/src/Freeze/IndexI.h b/cpp/src/Freeze/IndexI.h index ea850a3be02..c38ee83b168 100644 --- a/cpp/src/Freeze/IndexI.h +++ b/cpp/src/Freeze/IndexI.h @@ -44,7 +44,7 @@ private: Index& _index; std::string _dbName; - std::auto_ptr<Db> _db; + IceUtil::UniquePtr<Db> _db; ObjectStoreBase* _store; }; diff --git a/cpp/src/Freeze/MapDb.cpp b/cpp/src/Freeze/MapDb.cpp index f334dfd1423..53a64011b9e 100644 --- a/cpp/src/Freeze/MapDb.cpp +++ b/cpp/src/Freeze/MapDb.cpp @@ -210,7 +210,7 @@ Freeze::MapDb::MapDb(const ConnectionIPtr& connection, indexBase->_communicator = connection->communicator(); indexBase->_encoding = connection->encoding(); - auto_ptr<MapIndexI> indexI; + IceUtil::UniquePtr<MapIndexI> indexI; try { diff --git a/cpp/src/Freeze/MapDb.h b/cpp/src/Freeze/MapDb.h index 5bc9a6f6373..de66abfe1ca 100644 --- a/cpp/src/Freeze/MapDb.h +++ b/cpp/src/Freeze/MapDb.h @@ -57,7 +57,7 @@ public: private: const MapIndexBasePtr _index; - std::auto_ptr<Db> _db; + IceUtil::UniquePtr<Db> _db; std::string _dbName; }; diff --git a/cpp/src/Freeze/MapI.cpp b/cpp/src/Freeze/MapI.cpp index a419f5ad447..bede240647b 100644 --- a/cpp/src/Freeze/MapI.cpp +++ b/cpp/src/Freeze/MapI.cpp @@ -205,7 +205,7 @@ Freeze::MapHelper::recreate(const Freeze::ConnectionPtr& connection, oldDb.open(txn, Ice::nativeToUTF8(connectionI->communicator(), oldDbName).c_str(), 0, DB_BTREE, DB_THREAD, FREEZE_DB_MODE); - auto_ptr<MapDb> newDb(new MapDb(connectionI, dbName, key, value, keyCompare, indices, true)); + IceUtil::UniquePtr<MapDb> newDb(new MapDb(connectionI, dbName, key, value, keyCompare, indices, true)); if(connectionI->trace() >= 2) { @@ -325,7 +325,7 @@ Freeze::IteratorHelper::create(const MapHelper& m, bool readOnly) { const MapHelperI& actualMap = dynamic_cast<const MapHelperI&>(m); - auto_ptr<IteratorHelperI> r(new IteratorHelperI(actualMap, readOnly, + IceUtil::UniquePtr<IteratorHelperI> r(new IteratorHelperI(actualMap, readOnly, 0, false)); if(r->next()) { @@ -1049,7 +1049,7 @@ Freeze::MapHelperI::find(const Key& k, bool readOnly) const { try { - auto_ptr<IteratorHelperI> r(new IteratorHelperI(*this, readOnly, 0, false)); + IceUtil::UniquePtr<IteratorHelperI> r(new IteratorHelperI(*this, readOnly, 0, false)); if(r->find(k)) { return r.release(); @@ -1089,7 +1089,7 @@ Freeze::MapHelperI::lowerBound(const Key& k, bool readOnly) const { try { - auto_ptr<IteratorHelperI> r(new IteratorHelperI(*this, readOnly, 0, false)); + IceUtil::UniquePtr<IteratorHelperI> r(new IteratorHelperI(*this, readOnly, 0, false)); if(r->lowerBound(k)) { return r.release(); @@ -1129,7 +1129,7 @@ Freeze::MapHelperI::upperBound(const Key& k, bool readOnly) const { try { - auto_ptr<IteratorHelperI> r(new IteratorHelperI(*this, readOnly, 0, false)); + IceUtil::UniquePtr<IteratorHelperI> r(new IteratorHelperI(*this, readOnly, 0, false)); if(r->upperBound(k)) { return r.release(); @@ -1709,7 +1709,7 @@ Freeze::MapIndexI::~MapIndexI() IteratorHelper* Freeze::MapIndexI::begin(bool ro, const MapHelperI& m) const { - auto_ptr<IteratorHelperI> r(new IteratorHelperI(m, ro, _index, false)); + IceUtil::UniquePtr<IteratorHelperI> r(new IteratorHelperI(m, ro, _index, false)); if(r->next()) { @@ -1725,7 +1725,7 @@ IteratorHelper* Freeze::MapIndexI::untypedFind(const Key& k, bool ro, const MapHelperI& m, bool onlyDups) const { - auto_ptr<IteratorHelperI> r(new IteratorHelperI(m, ro, _index, onlyDups)); + IceUtil::UniquePtr<IteratorHelperI> r(new IteratorHelperI(m, ro, _index, onlyDups)); if(r->find(k)) { @@ -1740,7 +1740,7 @@ Freeze::MapIndexI::untypedFind(const Key& k, bool ro, const MapHelperI& m, IteratorHelper* Freeze::MapIndexI::untypedLowerBound(const Key& k, bool ro, const MapHelperI& m) const { - auto_ptr<IteratorHelperI> r(new IteratorHelperI(m, ro, _index, false)); + IceUtil::UniquePtr<IteratorHelperI> r(new IteratorHelperI(m, ro, _index, false)); if(r->lowerBound(k)) { @@ -1755,7 +1755,7 @@ Freeze::MapIndexI::untypedLowerBound(const Key& k, bool ro, const MapHelperI& m) IteratorHelper* Freeze::MapIndexI::untypedUpperBound(const Key& k, bool ro, const MapHelperI& m) const { - auto_ptr<IteratorHelperI> r(new IteratorHelperI(m, ro, _index, false)); + IceUtil::UniquePtr<IteratorHelperI> r(new IteratorHelperI(m, ro, _index, false)); if(r->upperBound(k)) { diff --git a/cpp/src/Freeze/ObjectStore.h b/cpp/src/Freeze/ObjectStore.h index cb69c38a1c0..bf6f3d81c8f 100644 --- a/cpp/src/Freeze/ObjectStore.h +++ b/cpp/src/Freeze/ObjectStore.h @@ -73,7 +73,7 @@ protected: private: - std::auto_ptr<Db> _db; + IceUtil::UniquePtr<Db> _db; std::string _facet; std::string _dbName; EvictorIBase* _evictor; diff --git a/cpp/src/Freeze/SharedDbEnv.cpp b/cpp/src/Freeze/SharedDbEnv.cpp index d17e61faf36..42c7ed4baf3 100644 --- a/cpp/src/Freeze/SharedDbEnv.cpp +++ b/cpp/src/Freeze/SharedDbEnv.cpp @@ -23,7 +23,6 @@ #include <Ice/StringConverter.h> #include <cstdlib> -#include <memory> using namespace std; @@ -149,7 +148,7 @@ Freeze::SharedDbEnv::get(const CommunicatorPtr& communicator, const string& envN // // MapKey not found, let's create and open a new DbEnv // - auto_ptr<SharedDbEnv> result(new SharedDbEnv(envName, communicator, env)); + IceUtil::UniquePtr<SharedDbEnv> result(new SharedDbEnv(envName, communicator, env)); // // Insert it into the map @@ -246,7 +245,7 @@ Freeze::SharedDbEnv::getSharedMapDb(const string& dbName, ConnectionIPtr insertConnection = new ConnectionI(this); - auto_ptr<MapDb> result(new MapDb(insertConnection, dbName, key, value, + IceUtil::UniquePtr<MapDb> result(new MapDb(insertConnection, dbName, key, value, keyCompare, indices, createDb)); // diff --git a/cpp/src/Freeze/SharedDbEnv.h b/cpp/src/Freeze/SharedDbEnv.h index 0afd4b9098f..91eeaf77f3a 100644 --- a/cpp/src/Freeze/SharedDbEnv.h +++ b/cpp/src/Freeze/SharedDbEnv.h @@ -80,7 +80,7 @@ private: void cleanup(); DbEnv* _env; - std::auto_ptr<DbEnv> _envHolder; + IceUtil::UniquePtr<DbEnv> _envHolder; const std::string _envName; const Ice::CommunicatorPtr _communicator; Ice::EncodingVersion _encoding; diff --git a/cpp/src/Freeze/TransactionalEvictorContext.cpp b/cpp/src/Freeze/TransactionalEvictorContext.cpp index 298019aed26..b2cbf130b80 100644 --- a/cpp/src/Freeze/TransactionalEvictorContext.cpp +++ b/cpp/src/Freeze/TransactionalEvictorContext.cpp @@ -265,7 +265,7 @@ Freeze::TransactionalEvictorContext::ServantHolder::ServantHolder() : } -Freeze::TransactionalEvictorContext::ServantHolder::~ServantHolder() +Freeze::TransactionalEvictorContext::ServantHolder::~ServantHolder() ICE_NOEXCEPT_FALSE { if(_ownBody && _body.ownServant) { diff --git a/cpp/src/Freeze/TransactionalEvictorContext.h b/cpp/src/Freeze/TransactionalEvictorContext.h index 0278d6f5ad3..d02eb627e88 100644 --- a/cpp/src/Freeze/TransactionalEvictorContext.h +++ b/cpp/src/Freeze/TransactionalEvictorContext.h @@ -34,7 +34,7 @@ public: public: ServantHolder(); - ~ServantHolder(); + ~ServantHolder() ICE_NOEXCEPT_FALSE; void init(const TransactionalEvictorContextPtr&, const Ice::Current&, ObjectStore<TransactionalEvictorElement>*); @@ -147,8 +147,8 @@ private: bool _rollbackOnly; - std::auto_ptr<DeadlockException> _deadlockException; - std::auto_ptr<TransactionalEvictorDeadlockException> _nestedCallDeadlockException; + IceUtil::UniquePtr<DeadlockException> _deadlockException; + IceUtil::UniquePtr<TransactionalEvictorDeadlockException> _nestedCallDeadlockException; // // Protected by this diff --git a/cpp/src/Freeze/TransactionalEvictorI.cpp b/cpp/src/Freeze/TransactionalEvictorI.cpp index dfca69dee6a..d41e0e1f3ec 100644 --- a/cpp/src/Freeze/TransactionalEvictorI.cpp +++ b/cpp/src/Freeze/TransactionalEvictorI.cpp @@ -351,7 +351,7 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) { } - ~CtxHolder() + ~CtxHolder() ICE_NOEXCEPT_FALSE { if(_ownCtx) { diff --git a/cpp/src/Glacier2Lib/SessionHelper.cpp b/cpp/src/Glacier2Lib/SessionHelper.cpp index 31cfc92fbee..3080fe5c47f 100644 --- a/cpp/src/Glacier2Lib/SessionHelper.cpp +++ b/cpp/src/Glacier2Lib/SessionHelper.cpp @@ -10,13 +10,10 @@ #include <IceUtil/DisableWarnings.h> #include <Glacier2/SessionHelper.h> -#include <IceUtil/UUID.h> -#include <IceUtil/CountDownLatch.h> - +#include <IceUtil/IceUtil.h> #include <Ice/Ice.h> #include <algorithm> // required by max -#include <memory> // required by auto_ptr using namespace std; @@ -525,7 +522,7 @@ private: const Glacier2::SessionCallbackPtr _callback; const Glacier2::SessionHelperPtr _session; - std::auto_ptr<Ice::Exception> _ex; + IceUtil::UniquePtr<Ice::Exception> _ex; }; class CreatedCommunicator : public Ice::DispatcherCall diff --git a/cpp/src/Ice/Application.cpp b/cpp/src/Ice/Application.cpp index 2a879eeaaee..027d42b39c8 100644 --- a/cpp/src/Ice/Application.cpp +++ b/cpp/src/Ice/Application.cpp @@ -14,7 +14,7 @@ #include <IceUtil/Cond.h> #include <IceUtil/ArgVector.h> #include <Ice/GC.h> -#include <memory> +#include <IceUtil/UniquePtr.h> using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/ConnectRequestHandler.cpp b/cpp/src/Ice/ConnectRequestHandler.cpp index de6d765137d..797d9a1a79f 100644 --- a/cpp/src/Ice/ConnectRequestHandler.cpp +++ b/cpp/src/Ice/ConnectRequestHandler.cpp @@ -47,7 +47,7 @@ public: private: const ConnectRequestHandlerPtr _handler; - const auto_ptr<Ice::LocalException> _exception; + const IceUtil::UniquePtr<Ice::LocalException> _exception; }; class FlushRequestsWithExceptionWrapper : public DispatchWorkItem diff --git a/cpp/src/Ice/ConnectRequestHandler.h b/cpp/src/Ice/ConnectRequestHandler.h index 491d5b6639a..4126564f122 100644 --- a/cpp/src/Ice/ConnectRequestHandler.h +++ b/cpp/src/Ice/ConnectRequestHandler.h @@ -19,7 +19,7 @@ #include <Ice/ProxyF.h> #include <Ice/BasicStream.h> -#include <memory> +#include <IceUtil/UniquePtr.h> #include <deque> namespace IceInternal @@ -76,7 +76,7 @@ private: Ice::ConnectionIPtr _connection; bool _compress; - std::auto_ptr<Ice::LocalException> _exception; + IceUtil::UniquePtr<Ice::LocalException> _exception; bool _initialized; bool _flushing; diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index 7f7b5e90ea3..c6efdac809b 100755 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -165,7 +165,7 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointIPtr>& endpt return connection; } - auto_ptr<Ice::LocalException> exception; + IceUtil::UniquePtr<Ice::LocalException> exception; // // If we didn't find a connection with the endpoints, we create the connectors diff --git a/cpp/src/Ice/ConnectionI.h b/cpp/src/Ice/ConnectionI.h index c181452d99b..e58bc7b0eb6 100644 --- a/cpp/src/Ice/ConnectionI.h +++ b/cpp/src/Ice/ConnectionI.h @@ -33,7 +33,7 @@ #include <Ice/ConnectionAsync.h> #include <deque> -#include <memory> +#include <IceUtil/UniquePtr.h> namespace IceInternal { @@ -319,7 +319,7 @@ private: std::map<Int, IceInternal::OutgoingAsyncPtr> _asyncRequests; std::map<Int, IceInternal::OutgoingAsyncPtr>::iterator _asyncRequestsHint; - std::auto_ptr<LocalException> _exception; + IceUtil::UniquePtr<LocalException> _exception; const bool _batchAutoFlush; IceInternal::BasicStream _batchStream; diff --git a/cpp/src/Ice/Instance.h b/cpp/src/Ice/Instance.h index b39e88ce838..a1bed6c006d 100644 --- a/cpp/src/Ice/Instance.h +++ b/cpp/src/Ice/Instance.h @@ -38,7 +38,7 @@ #include <Ice/FacetMap.h> #include <Ice/Process.h> #include <list> -#include <memory> +#include <IceUtil/UniquePtr.h> namespace Ice { diff --git a/cpp/src/Ice/LocatorInfo.h b/cpp/src/Ice/LocatorInfo.h index 266756fc0db..b3252e01453 100644 --- a/cpp/src/Ice/LocatorInfo.h +++ b/cpp/src/Ice/LocatorInfo.h @@ -20,7 +20,7 @@ #include <Ice/EndpointIF.h> #include <Ice/PropertiesF.h> -#include <memory> +#include <IceUtil/UniquePtr.h> namespace IceInternal { @@ -130,7 +130,7 @@ public: bool _sent; bool _response; Ice::ObjectPrx _proxy; - std::auto_ptr<Ice::Exception> _exception; + IceUtil::UniquePtr<Ice::Exception> _exception; }; typedef IceUtil::Handle<Request> RequestPtr; diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index e019e9e4949..dad736c7e14 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -68,7 +68,7 @@ public: private: const Ice::AsyncResultPtr _result; - const auto_ptr<Ice::Exception> _exception; + const IceUtil::UniquePtr<Ice::Exception> _exception; }; class AsynchronousSent : public DispatchWorkItem @@ -634,7 +634,7 @@ IceInternal::OutgoingAsync::__finished(BasicStream& is) string operation; _is.read(operation, false); - auto_ptr<RequestFailedException> ex; + IceUtil::UniquePtr<RequestFailedException> ex; switch(replyStatus) { case replyObjectNotExist: @@ -675,7 +675,7 @@ IceInternal::OutgoingAsync::__finished(BasicStream& is) string unknown; _is.read(unknown, false); - auto_ptr<UnknownException> ex; + IceUtil::UniquePtr<UnknownException> ex; switch(replyStatus) { case replyUnknownException: diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index 69df87b2924..3822d8afee6 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -1674,7 +1674,7 @@ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& all // connection for one of the endpoints. // - auto_ptr<LocalException> exception; + IceUtil::UniquePtr<LocalException> exception; vector<EndpointIPtr> endpoint; endpoint.push_back(0); @@ -1832,7 +1832,7 @@ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& all const vector<EndpointIPtr> _endpoints; const GetConnectionCallbackPtr _callback; size_t _i; - std::auto_ptr<Ice::LocalException> _exception; + IceUtil::UniquePtr<Ice::LocalException> _exception; }; // diff --git a/cpp/src/IceGrid/AdapterCache.cpp b/cpp/src/IceGrid/AdapterCache.cpp index 5a1f3d6528c..3e6fa703aeb 100644 --- a/cpp/src/IceGrid/AdapterCache.cpp +++ b/cpp/src/IceGrid/AdapterCache.cpp @@ -169,7 +169,7 @@ private: int _synchronizeCount; int _synchronizedCount; int _nReplicas; - std::auto_ptr<Ice::Exception> _exception; + IceUtil::UniquePtr<Ice::Exception> _exception; }; typedef IceUtil::Handle<ReplicaGroupSyncCallback> ReplicaGroupSyncCallbackPtr; diff --git a/cpp/src/IceGrid/DescriptorParser.cpp b/cpp/src/IceGrid/DescriptorParser.cpp index 25a4b4786e9..22bb1f20111 100644 --- a/cpp/src/IceGrid/DescriptorParser.cpp +++ b/cpp/src/IceGrid/DescriptorParser.cpp @@ -61,15 +61,15 @@ private: int _line; int _column; - auto_ptr<ApplicationDescriptorBuilder> _currentApplication; - auto_ptr<NodeDescriptorBuilder> _currentNode; - auto_ptr<TemplateDescriptorBuilder> _currentTemplate; - auto_ptr<ServerInstanceDescriptorBuilder> _currentServerInstance; - auto_ptr<ServiceInstanceDescriptorBuilder> _currentServiceInstance; - auto_ptr<ServerDescriptorBuilder> _currentServer; - auto_ptr<ServiceDescriptorBuilder> _currentService; + IceUtil::UniquePtr<ApplicationDescriptorBuilder> _currentApplication; + IceUtil::UniquePtr<NodeDescriptorBuilder> _currentNode; + IceUtil::UniquePtr<TemplateDescriptorBuilder> _currentTemplate; + IceUtil::UniquePtr<ServerInstanceDescriptorBuilder> _currentServerInstance; + IceUtil::UniquePtr<ServiceInstanceDescriptorBuilder> _currentServiceInstance; + IceUtil::UniquePtr<ServerDescriptorBuilder> _currentServer; + IceUtil::UniquePtr<ServiceDescriptorBuilder> _currentService; CommunicatorDescriptorBuilder* _currentCommunicator; - auto_ptr<PropertySetDescriptorBuilder> _currentPropertySet; + IceUtil::UniquePtr<PropertySetDescriptorBuilder> _currentPropertySet; bool _isTopLevel; bool _inAdapter; diff --git a/cpp/src/IceGrid/LocatorI.cpp b/cpp/src/IceGrid/LocatorI.cpp index ddcc8601758..6fb5a2bbc9a 100644 --- a/cpp/src/IceGrid/LocatorI.cpp +++ b/cpp/src/IceGrid/LocatorI.cpp @@ -420,7 +420,7 @@ private: unsigned int _count; LocatorAdapterInfoSeq::const_iterator _lastAdapter; std::map<std::string, Ice::ObjectPrx> _proxies; - std::auto_ptr<Ice::Exception> _exception; + IceUtil::UniquePtr<Ice::Exception> _exception; }; class RoundRobinRequest : public LocatorI::Request, SynchronizationCallback, public IceUtil::Mutex @@ -694,7 +694,7 @@ private: bool _waitForActivation; set<string> _failed; set<string> _activatingOrFailed; - std::auto_ptr<Ice::Exception> _exception; + IceUtil::UniquePtr<Ice::Exception> _exception; }; class FindAdapterByIdCallback : public SynchronizationCallback diff --git a/cpp/src/IceGrid/NodeSessionManager.cpp b/cpp/src/IceGrid/NodeSessionManager.cpp index 320255bc086..b3a498ae1fd 100644 --- a/cpp/src/IceGrid/NodeSessionManager.cpp +++ b/cpp/src/IceGrid/NodeSessionManager.cpp @@ -38,7 +38,7 @@ NodeSessionPrx NodeSessionKeepAliveThread::createSession(InternalRegistryPrx& registry, IceUtil::Time& timeout) { NodeSessionPrx session; - auto_ptr<Ice::Exception> exception; + IceUtil::UniquePtr<Ice::Exception> exception; TraceLevelsPtr traceLevels = _node->getTraceLevels(); try { diff --git a/cpp/src/IceGrid/ReplicaSessionManager.cpp b/cpp/src/IceGrid/ReplicaSessionManager.cpp index 8d478fddc8c..60a3dac2039 100644 --- a/cpp/src/IceGrid/ReplicaSessionManager.cpp +++ b/cpp/src/IceGrid/ReplicaSessionManager.cpp @@ -429,7 +429,7 @@ ReplicaSessionPrx ReplicaSessionManager::createSession(InternalRegistryPrx& registry, IceUtil::Time& timeout) { ReplicaSessionPrx session; - auto_ptr<Ice::Exception> exception; + IceUtil::UniquePtr<Ice::Exception> exception; try { if(_traceLevels && _traceLevels->replica > 1) diff --git a/cpp/src/IceGrid/ServerCache.cpp b/cpp/src/IceGrid/ServerCache.cpp index c7b3835eeb0..7d0ceeb69cf 100644 --- a/cpp/src/IceGrid/ServerCache.cpp +++ b/cpp/src/IceGrid/ServerCache.cpp @@ -275,7 +275,7 @@ ServerEntry::update(const ServerInfo& info) { Lock sync(*this); - auto_ptr<ServerInfo> descriptor(new ServerInfo()); + IceUtil::UniquePtr<ServerInfo> descriptor(new ServerInfo()); *descriptor = info; _updated = true; diff --git a/cpp/src/IceGrid/ServerCache.h b/cpp/src/IceGrid/ServerCache.h index c7986a9813e..7795a7358cf 100644 --- a/cpp/src/IceGrid/ServerCache.h +++ b/cpp/src/IceGrid/ServerCache.h @@ -86,9 +86,9 @@ private: ServerCache& _cache; const std::string _id; - std::auto_ptr<ServerInfo> _loaded; - std::auto_ptr<ServerInfo> _load; - std::auto_ptr<ServerInfo> _destroy; + IceUtil::UniquePtr<ServerInfo> _loaded; + IceUtil::UniquePtr<ServerInfo> _load; + IceUtil::UniquePtr<ServerInfo> _destroy; ServerPrx _proxy; AdapterPrxDict _adapters; @@ -97,7 +97,7 @@ private: bool _synchronizing; bool _updated; - std::auto_ptr<Ice::Exception> _exception; + IceUtil::UniquePtr<Ice::Exception> _exception; std::vector<SynchronizationCallbackPtr> _callbacks; SessionIPtr _session; diff --git a/cpp/src/IceGrid/ServerI.h b/cpp/src/IceGrid/ServerI.h index d84542c050d..169d3cb829e 100644 --- a/cpp/src/IceGrid/ServerI.h +++ b/cpp/src/IceGrid/ServerI.h @@ -318,7 +318,7 @@ private: std::vector<AMD_Node_loadServerPtr> _loadCB; bool _clearDir; InternalServerDescriptorPtr _desc; - std::auto_ptr<DeploymentException> _exception; + IceUtil::UniquePtr<DeploymentException> _exception; }; } diff --git a/cpp/test/Freeze/evictor/TestI.cpp b/cpp/test/Freeze/evictor/TestI.cpp index 6d7c552079c..56f18b1190e 100644 --- a/cpp/test/Freeze/evictor/TestI.cpp +++ b/cpp/test/Freeze/evictor/TestI.cpp @@ -134,7 +134,7 @@ private: Test::AMD_Account_transfer3Ptr _cb; bool _response; bool _cancelled; - std::auto_ptr<Ice::UserException> _exception; + IceUtil::UniquePtr<Ice::UserException> _exception; }; typedef IceUtil::Handle<ResponseThread> ResponseThreadPtr; diff --git a/cpp/test/Glacier2/router/Client.cpp b/cpp/test/Glacier2/router/Client.cpp index 48beea250ed..14befd9d3aa 100644 --- a/cpp/test/Glacier2/router/Client.cpp +++ b/cpp/test/Glacier2/router/Client.cpp @@ -65,7 +65,7 @@ public: private: bool _haveResponse; - auto_ptr<Exception> _ex; + IceUtil::UniquePtr<Exception> _ex; Int _response; }; typedef IceUtil::Handle<AsyncCallback> AsyncCallbackPtr; diff --git a/cpp/test/Ice/background/Configuration.h b/cpp/test/Ice/background/Configuration.h index c4a16fd725e..d845107b0ad 100644 --- a/cpp/test/Ice/background/Configuration.h +++ b/cpp/test/Ice/background/Configuration.h @@ -10,12 +10,10 @@ #ifndef TEST_CONFIGURATION_H #define TEST_CONFIGURATION_H -#include <IceUtil/Shared.h> -#include <IceUtil/Handle.h> +#include <IceUtil/IceUtil.h> #include <Ice/LocalException.h> #include <Ice/Selector.h> -#include <memory> class Configuration; typedef IceUtil::Handle<Configuration> ConfigurationPtr; @@ -52,15 +50,15 @@ public: private: - std::auto_ptr<Ice::LocalException> _connectorsException; - std::auto_ptr<Ice::LocalException> _connectException; + IceUtil::UniquePtr<Ice::LocalException> _connectorsException; + IceUtil::UniquePtr<Ice::LocalException> _connectException; IceInternal::SocketOperation _initializeSocketOperation; int _initializeResetCount; - std::auto_ptr<Ice::LocalException> _initializeException; + IceUtil::UniquePtr<Ice::LocalException> _initializeException; int _readReadyCount; - std::auto_ptr<Ice::LocalException> _readException; + IceUtil::UniquePtr<Ice::LocalException> _readException; int _writeReadyCount; - std::auto_ptr<Ice::LocalException> _writeException; + IceUtil::UniquePtr<Ice::LocalException> _writeException; static Configuration* _instance; }; diff --git a/cpp/test/Ice/background/EndpointI.cpp b/cpp/test/Ice/background/EndpointI.cpp index 024446f6b42..2ebcfdb4f8d 100644 --- a/cpp/test/Ice/background/EndpointI.cpp +++ b/cpp/test/Ice/background/EndpointI.cpp @@ -13,6 +13,11 @@ #include <Acceptor.h> #include <Ice/BasicStream.h> +#ifdef _MSC_VER +// For 'Ice::Object::ice_getHash': was declared deprecated +#pragma warning( disable : 4996 ) +#endif + using namespace std; Ice::Short EndpointI::TYPE_BASE = 100; diff --git a/cpp/test/Ice/hash/Client.cpp b/cpp/test/Ice/hash/Client.cpp index 833ce35dc9d..afa8b64cb39 100644 --- a/cpp/test/Ice/hash/Client.cpp +++ b/cpp/test/Ice/hash/Client.cpp @@ -12,6 +12,11 @@ #include <Test.h> #include <TestCommon.h> +#ifdef _MSC_VER +// For 'Ice::Object::ice_getHash': was declared deprecated +#pragma warning( disable : 4996 ) +#endif + using namespace std; using namespace Test; diff --git a/cpp/test/Ice/interceptor/AMDInterceptorI.h b/cpp/test/Ice/interceptor/AMDInterceptorI.h index 872b6004615..e783dcf7f34 100644 --- a/cpp/test/Ice/interceptor/AMDInterceptorI.h +++ b/cpp/test/Ice/interceptor/AMDInterceptorI.h @@ -33,7 +33,7 @@ private: Ice::DispatchInterceptorAsyncCallbackPtr _defaultCb; Ice::DispatchStatus _actualStatus; - std::auto_ptr<IceUtil::Exception> _exception; + IceUtil::UniquePtr<IceUtil::Exception> _exception; IceUtil::Mutex _mutex; }; diff --git a/cpp/test/Ice/optional/AllTests.cpp b/cpp/test/Ice/optional/AllTests.cpp index 2afe094f20b..94ac115bff6 100644 --- a/cpp/test/Ice/optional/AllTests.cpp +++ b/cpp/test/Ice/optional/AllTests.cpp @@ -920,7 +920,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) test(!p2 && !p3); bool bs[100]; - fill(&bs[0], &bs[0] + 100, 56); + fill(&bs[0], &bs[0] + 100, true); vector<bool> bsv(&bs[0], &bs[0] + 100); #if defined(__SUNPRO_CC) && defined(_RWSTD_NO_MEMBER_TEMPLATES) std::pair<const bool*, const bool*> cpair(&bs[0], &bs[0] + 100); diff --git a/cpp/test/IceGrid/activation/AllTests.cpp b/cpp/test/IceGrid/activation/AllTests.cpp index 391cb8a2497..193323ca4f4 100644 --- a/cpp/test/IceGrid/activation/AllTests.cpp +++ b/cpp/test/IceGrid/activation/AllTests.cpp @@ -66,7 +66,7 @@ public: notifyAll(); } - auto_ptr<Ice::LocalException> + Ice::LocalException* waitUntilFinished() { Lock sync(*this); @@ -74,13 +74,13 @@ public: { wait(); } - return _exception; + return _exception.release(); } private: Ice::ObjectPrx _proxy; - auto_ptr<Ice::LocalException> _exception; + IceUtil::UniquePtr<Ice::LocalException> _exception; bool _finished; int _nRepetitions; }; @@ -464,7 +464,7 @@ allTests(const Ice::CommunicatorPtr& communicator) } for(p = threads.begin(); p != threads.end(); ++p) { - auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished()); + IceUtil::UniquePtr<Ice::LocalException> ex((*p)->waitUntilFinished()); test(dynamic_cast<Ice::NoEndpointException*>(ex.get())); } threads.resize(0); @@ -480,7 +480,7 @@ allTests(const Ice::CommunicatorPtr& communicator) } for(p = threads.begin(); p != threads.end(); ++p) { - auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished()); + IceUtil::UniquePtr<Ice::LocalException> ex((*p)->waitUntilFinished()); test(dynamic_cast<Ice::NoEndpointException*>(ex.get())); } threads.resize(0); @@ -496,7 +496,7 @@ allTests(const Ice::CommunicatorPtr& communicator) } for(p = threads.begin(); p != threads.end(); ++p) { - auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished()); + IceUtil::UniquePtr<Ice::LocalException> ex((*p)->waitUntilFinished()); test(dynamic_cast<Ice::NoEndpointException*>(ex.get())); } threads.resize(0); @@ -549,7 +549,7 @@ allTests(const Ice::CommunicatorPtr& communicator) } for(p = threads.begin(); p != threads.end(); ++p) { - auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished()); + IceUtil::UniquePtr<Ice::LocalException> ex((*p)->waitUntilFinished()); test(dynamic_cast<Ice::NoEndpointException*>(ex.get())); } admin->stopServer("server-activation-timeout"); |