From bbeac21e82605ef52764a993020d0746d5fb7542 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 10 Dec 2016 12:05:29 +0100 Subject: [PATCH] Changed: Use a CUniquePtr macro since std::unique_ptr doesn't exist on all (yet) supported platforms --- code/nel/include/nel/3d/animation_set_user.h | 4 +- code/nel/include/nel/3d/material.h | 2 +- .../nel/3d/ps_attrib_maker_bin_op_inline.h | 2 +- .../include/nel/3d/ps_attrib_maker_helper.h | 2 +- code/nel/include/nel/3d/ps_mesh.h | 2 +- code/nel/include/nel/misc/types_nl.h | 24 ++++++++---- code/nel/src/3d/animation.cpp | 2 +- code/nel/src/3d/animation_set.cpp | 2 +- code/nel/src/3d/cube_map_builder.cpp | 4 +- code/nel/src/3d/material.cpp | 8 ++-- code/nel/src/3d/ps_mesh.cpp | 4 +- code/nel/src/3d/ps_ribbon.cpp | 2 +- code/nel/src/3d/ps_tail_dot.cpp | 2 +- code/nel/src/3d/texture_cube.cpp | 2 +- code/nel/src/misc/inter_window_msg_queue.cpp | 6 +-- code/nel/src/net/module_gateway_transport.cpp | 8 ++-- code/nel/src/net/module_manager.cpp | 6 +-- code/nel/src/pacs/primitive_block_pacs.cpp | 2 +- code/nel/tools/3d/object_viewer/dup_ps.cpp | 6 +-- .../tools/3d/object_viewer/object_viewer.cpp | 2 +- .../tools/3d/object_viewer/particle_dlg.cpp | 2 +- .../3d/object_viewer/particle_tree_ctrl.cpp | 2 +- .../3d/object_viewer/particle_tree_ctrl.h | 4 +- .../3d/object_viewer/particle_workspace.cpp | 4 +- .../3d/object_viewer/snapshot_tool_dlg.cpp | 4 +- .../plugin_max/nel_mesh_lib/export_mesh.cpp | 2 +- .../nel_mesh_lib/export_remanence.cpp | 2 +- .../3d/zone_check_bind/zone_check_bind.cpp | 4 +- .../tools/3d/zone_lighter/zone_lighter.cpp | 2 +- .../nel/tools/nel_unit_test/nel_unit_test.cpp | 12 +++--- code/nel/tools/nel_unit_test/ut_ligo.h | 2 +- code/nel/tools/nel_unit_test/ut_misc.h | 28 +++++++------- code/nel/tools/nel_unit_test/ut_net.h | 6 +-- code/ryzom/client/src/door_manager.cpp | 2 +- code/ryzom/client/src/pacs_client.cpp | 2 +- code/ryzom/client/src/r2/auto_group.cpp | 2 +- .../src/r2/dmc/client_edition_module.cpp | 14 +++---- .../client/src/r2/dmc/client_edition_module.h | 2 +- .../client/src/r2/tool_create_entity.cpp | 2 +- code/ryzom/client/src/r2/tool_select_move.cpp | 2 +- code/ryzom/client/src/seven_zip/seven_zip.cpp | 12 +++--- code/ryzom/client/src/sky.cpp | 2 +- .../src/game_share/ring_session_manager_itf.h | 12 +++--- .../game_share/server_animation_module.cpp | 2 +- .../src/game_share/server_edition_module.cpp | 4 +- .../src/game_share/server_edition_module.h | 4 +- .../src/admin_modules/admin_modules_itf.h | 12 +++--- .../server/src/logger_service/log_query.cpp | 2 +- .../server/src/logger_service/log_query.h | 2 +- .../src/server_share/continent_container.cpp | 2 +- .../src/server_share/login_service_itf.h | 12 +++--- .../server/src/server_share/mail_forum_itf.h | 12 +++--- .../server/src/server_share/mysql_wrapper.cpp | 8 ++-- .../server/src/server_share/mysql_wrapper.h | 4 +- .../session_browser_server.cpp | 26 ++++++------- .../shard_unifier_service/character_sync.cpp | 4 +- .../database_mapping.cpp | 38 +++++++++---------- .../shard_unifier_service/login_service.cpp | 2 +- .../mail_forum_notfier_fwd.cpp | 4 +- .../shard_unifier_service/name_manager.cpp | 4 +- .../ring_session_manager.cpp | 22 +++++------ .../simulated_ring_session_manager.cpp | 4 +- .../mission_compiler_lib/steps.cpp | 2 +- .../object_viewer/particle_system/dup_ps.cpp | 6 +-- .../particle_system/particle_editor.cpp | 2 +- .../particle_system/particle_node.cpp | 4 +- .../particle_workspace_dialog.h | 4 +- 67 files changed, 207 insertions(+), 197 deletions(-) diff --git a/code/nel/include/nel/3d/animation_set_user.h b/code/nel/include/nel/3d/animation_set_user.h index d5376f6df..39477891e 100644 --- a/code/nel/include/nel/3d/animation_set_user.h +++ b/code/nel/include/nel/3d/animation_set_user.h @@ -93,7 +93,7 @@ public: uint addAnimation (const char* fileName, const char* animName, bool displayMissingFileWarning = true) { // Allocate an animation - std::unique_ptr anim (new CAnimation); + CUniquePtr anim (new CAnimation); // Read it NLMISC::CIFile file; @@ -130,7 +130,7 @@ public: virtual uint addSkeletonWeight (const char* fileName, const char* skelName) { // Allocate an animation - std::unique_ptr skeletonWeight (new CSkeletonWeight); + CUniquePtr skeletonWeight (new CSkeletonWeight); // Read it NLMISC::CIFile file; diff --git a/code/nel/include/nel/3d/material.h b/code/nel/include/nel/3d/material.h index f8736b08b..7a300da45 100644 --- a/code/nel/include/nel/3d/material.h +++ b/code/nel/include/nel/3d/material.h @@ -692,7 +692,7 @@ private: { NLMISC::CMatrix TexMat[IDRV_MAT_MAXTEXTURES]; }; - std::unique_ptr _TexUserMat; // user texture matrix + CUniquePtr _TexUserMat; // user texture matrix public: // Private. For Driver only. diff --git a/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h b/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h index 2814d8dc0..339a52e7f 100644 --- a/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h +++ b/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h @@ -282,7 +282,7 @@ inline float CPSAttribMakerBinOp::getMaxValue(void) const template inline CPSAttribMakerBinOp::CPSAttribMakerBinOp(const CPSAttribMakerBinOp &other) : CPSAttribMaker(other) // parent copy ctor { - std::unique_ptr > a0(NLMISC::safe_cast *>(other._Arg[0]->clone())) + CUniquePtr > a0(NLMISC::safe_cast *>(other._Arg[0]->clone())) , a1(NLMISC::safe_cast *>(other._Arg[1]->clone())); this->_Op = other._Op; this->_Size = other._Size; diff --git a/code/nel/include/nel/3d/ps_attrib_maker_helper.h b/code/nel/include/nel/3d/ps_attrib_maker_helper.h index 2bd309f55..73ab32a31 100644 --- a/code/nel/include/nel/3d/ps_attrib_maker_helper.h +++ b/code/nel/include/nel/3d/ps_attrib_maker_helper.h @@ -1463,7 +1463,7 @@ public: CPSAttribMakerMemoryBase(const CPSAttribMakerMemoryBase &src) : CPSAttribMaker(src) // parent copy ctor { nlassert(src._Scheme); - std::unique_ptr > s(NLMISC::safe_cast *>(src._Scheme->clone())); + CUniquePtr > s(NLMISC::safe_cast *>(src._Scheme->clone())); this->_T = src._T; this->_DefaultValue = src._DefaultValue; this->_Scheme = s.release(); diff --git a/code/nel/include/nel/3d/ps_mesh.h b/code/nel/include/nel/3d/ps_mesh.h index bd9b9e504..6863903f9 100644 --- a/code/nel/include/nel/3d/ps_mesh.h +++ b/code/nel/include/nel/3d/ps_mesh.h @@ -590,7 +590,7 @@ protected: void serial(NLMISC::IStream &f) throw(NLMISC::EStream); }; - typedef std::unique_ptr PGlobalTexAnims; + typedef CUniquePtr PGlobalTexAnims; PGlobalTexAnims _GlobalTexAnims; float _GlobalAnimDate; diff --git a/code/nel/include/nel/misc/types_nl.h b/code/nel/include/nel/misc/types_nl.h index 4f9302260..a532a47fb 100644 --- a/code/nel/include/nel/misc/types_nl.h +++ b/code/nel/include/nel/misc/types_nl.h @@ -162,7 +162,7 @@ # define NL_COMP_GCC #endif -#if defined(_HAS_CPP0X) || defined(__GXX_EXPERIMENTAL_CXX0X__) +#if defined(_HAS_CPP0X) || defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(NL_COMP_VC_VERSION) && NL_COMP_VC_VERSION >= 110) # define NL_ISO_CPP0X_AVAILABLE #endif @@ -430,30 +430,40 @@ extern void operator delete[](void *p) throw(); # define CHashSet ::std::hash_set # define CHashMultiMap ::std::hash_multimap # endif // _STLP_HASH_MAP +# define CUniquePtr ::std::auto_ptr +# define CUniquePtrMove +#elif defined(NL_ISO_CPP0X_AVAILABLE) || (defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 100)) +# include +# include +# define CHashMap ::std::unordered_map +# define CHashSet ::std::unordered_set +# define CHashMultiMap ::std::unordered_multimap +# define CUniquePtr ::std::unique_ptr +# define CUniquePtrMove ::std::move #elif defined(NL_ISO_STDTR1_AVAILABLE) // use std::tr1 for CHash* classes, if available (gcc 4.1+ and VC9 with TR1 feature pack) # include NL_ISO_STDTR1_HEADER(unordered_map) # include NL_ISO_STDTR1_HEADER(unordered_set) # define CHashMap NL_ISO_STDTR1_NAMESPACE::unordered_map # define CHashSet NL_ISO_STDTR1_NAMESPACE::unordered_set # define CHashMultiMap NL_ISO_STDTR1_NAMESPACE::unordered_multimap +# define CUniquePtr ::std::auto_ptr +# define CUniquePtrMove #elif defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 70 && NL_COMP_VC_VERSION <= 90) // VC7 through 9 # include # include # define CHashMap stdext::hash_map # define CHashSet stdext::hash_set # define CHashMultiMap stdext::hash_multimap -#elif defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 100) -# include -# include -# define CHashMap ::std::unordered_map -# define CHashSet ::std::unordered_set -# define CHashMultiMap ::std::unordered_multimap +# define CUniquePtr ::std::auto_ptr +# define CUniquePtrMove #elif defined(NL_COMP_GCC) // GCC4 # include # include # define CHashMap ::__gnu_cxx::hash_map # define CHashSet ::__gnu_cxx::hash_set # define CHashMultiMap ::__gnu_cxx::hash_multimap +# define CUniquePtr ::std::auto_ptr +# define CUniquePtrMove namespace __gnu_cxx { diff --git a/code/nel/src/3d/animation.cpp b/code/nel/src/3d/animation.cpp index 5434c783d..157ca5427 100644 --- a/code/nel/src/3d/animation.cpp +++ b/code/nel/src/3d/animation.cpp @@ -318,7 +318,7 @@ UAnimation* UAnimation::createAnimation (const char* sPath) NL3D_HAUTO_UI_ANIMATION; // Allocate an animation - std::unique_ptr anim (new CAnimation); + CUniquePtr anim (new CAnimation); // Read it NLMISC::CIFile file; diff --git a/code/nel/src/3d/animation_set.cpp b/code/nel/src/3d/animation_set.cpp index 5f4f351f6..0b4c096c0 100644 --- a/code/nel/src/3d/animation_set.cpp +++ b/code/nel/src/3d/animation_set.cpp @@ -225,7 +225,7 @@ bool CAnimationSet::loadFromFiles(const std::string &path, bool recurse /* = tru { NLMISC::CIFile iFile; iFile.open(anims[k]); - std::unique_ptr anim(new CAnimation); + CUniquePtr anim(new CAnimation); anim->serial(iFile); addAnimation(NLMISC::CFile::getFilenameWithoutExtension(anims[k]).c_str(), anim.release()); iFile.close(); diff --git a/code/nel/src/3d/cube_map_builder.cpp b/code/nel/src/3d/cube_map_builder.cpp index ec28cc258..6e319b59e 100644 --- a/code/nel/src/3d/cube_map_builder.cpp +++ b/code/nel/src/3d/cube_map_builder.cpp @@ -89,8 +89,8 @@ static uint8 *BuildCubeMapTexLuminance(const NLMISC::CVector &start, CTextureCube *BuildCubeMap(sint mapSize, ICubeMapFunctor &f, bool luminanceOnly /* = false*/, const std::string &shareName /* = "" */) { - std::unique_ptr cubeMap(new CTextureCube); - std::unique_ptr faces[6]; + CUniquePtr cubeMap(new CTextureCube); + CUniquePtr faces[6]; /// this gives the start (unormalized normal for each face for u,v = 0, 0) static const NLMISC::CVector start[] = diff --git a/code/nel/src/3d/material.cpp b/code/nel/src/3d/material.cpp index f3a0c6e75..3204a620d 100644 --- a/code/nel/src/3d/material.cpp +++ b/code/nel/src/3d/material.cpp @@ -105,9 +105,9 @@ CMaterial &CMaterial::operator=(const CMaterial &mat) // copy texture matrix if there. if (mat._TexUserMat.get()) { - std::unique_ptr texMatClone( new CUserTexMat(*(mat._TexUserMat))); // make cpy + CUniquePtr texMatClone(new CUserTexMat(*(mat._TexUserMat))); // make cpy //std::swap(texMatClone, _TexUserMat); // swap with old - _TexUserMat = std::move(texMatClone); + _TexUserMat = CUniquePtrMove(texMatClone); } else { @@ -265,9 +265,9 @@ void CMaterial::serial(NLMISC::IStream &f) if ((_Flags & IDRV_MAT_USER_TEX_MAT_ALL)) // are there user textrue coordinates matrix ? { - std::unique_ptr newPtr(new CUserTexMat); // create new + CUniquePtr newPtr(new CUserTexMat); // create new //std::swap(_TexUserMat, newPtr); // replace old - _TexUserMat = std::move(newPtr); + _TexUserMat = CUniquePtrMove(newPtr); } } diff --git a/code/nel/src/3d/ps_mesh.cpp b/code/nel/src/3d/ps_mesh.cpp index 02c859d76..655534c6c 100644 --- a/code/nel/src/3d/ps_mesh.cpp +++ b/code/nel/src/3d/ps_mesh.cpp @@ -1533,7 +1533,7 @@ void CPSConstraintMesh::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { PGlobalTexAnims newPtr(new CGlobalTexAnims); // create new //std::swap(_GlobalTexAnims, newPtr); // replace old - _GlobalTexAnims = std::move(newPtr); + _GlobalTexAnims = CUniquePtrMove(newPtr); f.serial(*_GlobalTexAnims); } @@ -2352,7 +2352,7 @@ void CPSConstraintMesh::setTexAnimType(TTexAnimType type) { PGlobalTexAnims newPtr(new CGlobalTexAnims); //std::swap(_GlobalTexAnims, newPtr); - _GlobalTexAnims = std::move(newPtr); + _GlobalTexAnims = CUniquePtrMove(newPtr); _GlobalAnimationEnabled = 1; } break; diff --git a/code/nel/src/3d/ps_ribbon.cpp b/code/nel/src/3d/ps_ribbon.cpp index 87ba44669..00a3d1310 100644 --- a/code/nel/src/3d/ps_ribbon.cpp +++ b/code/nel/src/3d/ps_ribbon.cpp @@ -36,7 +36,7 @@ CPSRibbon::TVBMap CPSRibbon::_VBMaps[16]; static ITexture *CreateGradientTexture() { NL_PS_FUNC(CreateGradientTexture) - std::unique_ptr tex(new CTextureMem((uint8 *) &GradientB2W, + CUniquePtr tex(new CTextureMem((uint8 *) &GradientB2W, sizeof(GradientB2W), false, /* dont delete */ false, /* not a file */ diff --git a/code/nel/src/3d/ps_tail_dot.cpp b/code/nel/src/3d/ps_tail_dot.cpp index 5e1e25043..cf9baa016 100644 --- a/code/nel/src/3d/ps_tail_dot.cpp +++ b/code/nel/src/3d/ps_tail_dot.cpp @@ -33,7 +33,7 @@ static NLMISC::CRGBA GradientB2W[] = {NLMISC::CRGBA(0, 0, 0, 0), NLMISC::CRGBA(2 static ITexture *CreateGradientTexture() { NL_PS_FUNC(CreateGradientTexture) - std::unique_ptr tex(new CTextureMem((uint8 *) &GradientB2W, + CUniquePtr tex(new CTextureMem((uint8 *) &GradientB2W, sizeof(GradientB2W), false, /* dont delete */ false, /* not a file */ diff --git a/code/nel/src/3d/texture_cube.cpp b/code/nel/src/3d/texture_cube.cpp index 47038df78..809bff5fa 100644 --- a/code/nel/src/3d/texture_cube.cpp +++ b/code/nel/src/3d/texture_cube.cpp @@ -193,7 +193,7 @@ bool CTextureCube::isSelectable() const ITexture *CTextureCube::buildNonSelectableVersion(uint index) { if (!isSelectable()) return this; - std::unique_ptr tc(new CTextureCube); + CUniquePtr tc(new CTextureCube); // copy basic texture parameters (ITexture &) *tc.get() = (ITexture &) *this; // invoke ITexture = op for basics parameters diff --git a/code/nel/src/misc/inter_window_msg_queue.cpp b/code/nel/src/misc/inter_window_msg_queue.cpp index d63ae1128..f27fa55da 100644 --- a/code/nel/src/misc/inter_window_msg_queue.cpp +++ b/code/nel/src/misc/inter_window_msg_queue.cpp @@ -268,7 +268,7 @@ namespace NLMISC typedef CSynchronized::CAccessor TAccessor; // NB : use a 'new' instead of an automatic object here, because I got an 'INTERNAL COMPILER ERROR' compiler file 'msc1.cpp', line 1794 // else, this is one of the way recommended by microsoft to solve the problem. - std::unique_ptr messageQueueMap(new TAccessor(&_MessageQueueMap)); + CUniquePtr messageQueueMap(new TAccessor(&_MessageQueueMap)); CMsgQueueIdent msgQueueIdent(ownerWindow, localId, foreignId); if (messageQueueMap->value().count(msgQueueIdent)) { @@ -368,7 +368,7 @@ namespace NLMISC typedef CSynchronized::CAccessor TAccessor; // NB : use a 'new' instead of an automatic object here, because I got an 'INTERNAL COMPILER ERROR' compiler file 'msc1.cpp', line 1794 // else, this is one of the way recommended by microsoft to solve the problem. - std::unique_ptr messageQueueMap(new TAccessor(&_MessageQueueMap)); + CUniquePtr messageQueueMap(new TAccessor(&_MessageQueueMap)); TMessageQueueMap::iterator it = messageQueueMap->value().find(CMsgQueueIdent(_LocalWindow.getWnd(), _LocalWindow.getId(), _ForeignWindow.getId())); nlassert(it != messageQueueMap->value().end()); messageQueueMap->value().erase(it); @@ -408,7 +408,7 @@ namespace NLMISC typedef CSynchronized::CAccessor TAccessor; // NB : use a 'new' instead of an automatic object here, because I got an 'INTERNAL COMPILER ERROR' compiler file 'msc1.cpp', line 1794 // else, this is one of the way recommended by microsoft to solve the problem. - std::unique_ptr messageQueueMap(new TAccessor(&_MessageQueueMap)); + CUniquePtr messageQueueMap(new TAccessor(&_MessageQueueMap)); TMessageQueueMap::iterator it = messageQueueMap->value().find(CMsgQueueIdent(hwnd, toId, fromId)); if (it != messageQueueMap->value().end()) { diff --git a/code/nel/src/net/module_gateway_transport.cpp b/code/nel/src/net/module_gateway_transport.cpp index 57ba9eeb4..d9029285f 100644 --- a/code/nel/src/net/module_gateway_transport.cpp +++ b/code/nel/src/net/module_gateway_transport.cpp @@ -72,7 +72,7 @@ namespace NLNET friend class CL3ServerRoute; public: /// The callback server that receive connection and dispatch message - unique_ptr _CallbackServer; + CUniquePtr _CallbackServer; /// A static mapper to retrieve transport from the CCallbackServer pointer typedef map TDispatcherIndex; @@ -224,7 +224,7 @@ namespace NLNET throw ETransportError("openServer : The server is already open"); // create a new callback server - unique_ptr cbs(new CCallbackServer()); + CUniquePtr cbs(new CCallbackServer()); // register the callbacks cbs->setConnectionCallback(cbConnection, static_cast(this)); @@ -234,7 +234,7 @@ namespace NLNET // open the server cbs->init(port); - _CallbackServer = std::move(cbs); + _CallbackServer = CUniquePtrMove(cbs); // register it in the dispatcher _DispatcherIndex.insert(make_pair(_CallbackServer.get(), this)); @@ -673,7 +673,7 @@ namespace NLNET _FreeRoutesIds.pop_back(); } - unique_ptr route(new CL3ClientRoute(this, addr, connId)); + CUniquePtr route(new CL3ClientRoute(this, addr, connId)); // set the callbacks route->CallbackClient.setDisconnectionCallback(cbDisconnection, static_cast(this)); diff --git a/code/nel/src/net/module_manager.cpp b/code/nel/src/net/module_manager.cpp index 2c32c13a7..20c947d03 100644 --- a/code/nel/src/net/module_manager.cpp +++ b/code/nel/src/net/module_manager.cpp @@ -250,7 +250,7 @@ namespace NLNET // now, load the library string fullName = NLMISC::CPath::standardizePath(path)+CLibrary::makeLibName(shortName); - std::unique_ptr mli(new TModuleLibraryInfo); + CUniquePtr mli(new TModuleLibraryInfo); if (!mli->LibraryHandler.loadLibrary(fullName, false, true, true)) { nlwarning("CModuleManager : failed to load the library '%s' in '%s'", @@ -399,7 +399,7 @@ namespace NLNET IModuleFactory *mf = it->second; // sanity check nlassert(mf->getModuleClassName() == className); - std::unique_ptr module(mf->createModule()); + CUniquePtr module(mf->createModule()); if (module.get() == NULL) { nlwarning("createModule : factory failed to create a module instance for class '%s'", className.c_str()); @@ -623,7 +623,7 @@ namespace NLNET const std::string &moduleManifest, TModuleId foreignModuleId) { - std::unique_ptr modProx(new CModuleProxy(localModule, ++_LastGeneratedId, moduleClassName, moduleFullyQualifiedName, moduleManifest)); + CUniquePtr modProx(new CModuleProxy(localModule, ++_LastGeneratedId, moduleClassName, moduleFullyQualifiedName, moduleManifest)); modProx->_Gateway = gateway; modProx->_Route = route; modProx->_Distance = distance; diff --git a/code/nel/src/pacs/primitive_block_pacs.cpp b/code/nel/src/pacs/primitive_block_pacs.cpp index 39a91a214..c2f40c40c 100644 --- a/code/nel/src/pacs/primitive_block_pacs.cpp +++ b/code/nel/src/pacs/primitive_block_pacs.cpp @@ -103,7 +103,7 @@ UPrimitiveBlock *UPrimitiveBlock::createPrimitiveBlock(NLMISC::IStream &src) { nlassert(src.isReading()); - std::unique_ptr pb(new CPrimitiveBlock); + CUniquePtr pb(new CPrimitiveBlock); pb->serial(src); return pb.release(); } diff --git a/code/nel/tools/3d/object_viewer/dup_ps.cpp b/code/nel/tools/3d/object_viewer/dup_ps.cpp index 537de77af..d942a3d6e 100644 --- a/code/nel/tools/3d/object_viewer/dup_ps.cpp +++ b/code/nel/tools/3d/object_viewer/dup_ps.cpp @@ -67,7 +67,7 @@ struct CDupObjPolicy dest.serialPtr(obj); /*if (dest.isReading()) { - std::unique_ptr newObj(new T); + CUniquePtr newObj(new T); newObj->serialPtr(dest); delete obj; obj = newObj.release(); @@ -112,7 +112,7 @@ NL3D::CParticleSystemProcess *DupPSLocated(const CParticleSystemProcess *in) /** Duplicate the system, and detach. * We can't duplicate the object direclty (it may be referencing other objects in the system, so these objects will be copied too...) */ - std::unique_ptr newPS(DupSerializable(in->getOwner())); + CUniquePtr newPS(DupSerializable(in->getOwner())); // scene pointer is not serialised, but 'detach' may need the scene to be specified newPS->setScene(in->getOwner()->getScene()); return newPS->detach(index); @@ -142,7 +142,7 @@ NL3D::CPSLocatedBindable *DupPSLocatedBindable(CPSLocatedBindable *in) else { CParticleSystem *srcPS = in->getOwner()->getOwner(); - std::unique_ptr newPS(DupSerializable(srcPS)); + CUniquePtr newPS(DupSerializable(srcPS)); // scene pointer is not serialised, but 'detach' may need the scene to be specified newPS->setScene(in->getOwner()->getOwner()->getScene()); // diff --git a/code/nel/tools/3d/object_viewer/object_viewer.cpp b/code/nel/tools/3d/object_viewer/object_viewer.cpp index b5d5f7109..207404635 100644 --- a/code/nel/tools/3d/object_viewer/object_viewer.cpp +++ b/code/nel/tools/3d/object_viewer/object_viewer.cpp @@ -469,7 +469,7 @@ void CObjectViewer::loadConfigFile() try { CConfigFile::CVar &var = cf.getVar("automatic_animation_path"); - std::unique_ptr as(new CAnimationSet); + CUniquePtr as(new CAnimationSet); // bool loadingOk = as->loadFromFiles(var.asString(),true ,"anim",true); // diff --git a/code/nel/tools/3d/object_viewer/particle_dlg.cpp b/code/nel/tools/3d/object_viewer/particle_dlg.cpp index 4fd9f359d..f50fe53a2 100644 --- a/code/nel/tools/3d/object_viewer/particle_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/particle_dlg.cpp @@ -574,7 +574,7 @@ void CParticleDlg::OnLoadPSWorkspace() void CParticleDlg::loadWorkspace(const std::string &fullPath) { // Add to the path - std::unique_ptr newPW(new CParticleWorkspace); + CUniquePtr newPW(new CParticleWorkspace); newPW->init(_ObjView, fullPath, _ObjView->getFontManager(), _ObjView->getFontGenerator()); newPW->setModificationCallback(ParticleTreeCtrl); // save empty workspace diff --git a/code/nel/tools/3d/object_viewer/particle_tree_ctrl.cpp b/code/nel/tools/3d/object_viewer/particle_tree_ctrl.cpp index 973278a89..49eede1c9 100644 --- a/code/nel/tools/3d/object_viewer/particle_tree_ctrl.cpp +++ b/code/nel/tools/3d/object_viewer/particle_tree_ctrl.cpp @@ -1006,7 +1006,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA // Add search path for the texture NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); - std::unique_ptr sb(new NL3D::CShapeBank); + CUniquePtr sb(new NL3D::CShapeBank); CParticleSystemModel *psm = NULL; try { diff --git a/code/nel/tools/3d/object_viewer/particle_tree_ctrl.h b/code/nel/tools/3d/object_viewer/particle_tree_ctrl.h index 9f699938c..4f92adc34 100644 --- a/code/nel/tools/3d/object_viewer/particle_tree_ctrl.h +++ b/code/nel/tools/3d/object_viewer/particle_tree_ctrl.h @@ -182,8 +182,8 @@ private: // Matching infos for each nodes in the CTreeCtrl std::vector _NodeTypes; // - std::unique_ptr _LocatedCopy; - std::unique_ptr _LocatedBindableCopy; + CUniquePtr _LocatedCopy; + CUniquePtr _LocatedBindableCopy; // DECLARE_MESSAGE_MAP() // from CParticleWorkspace::IModificationCallback diff --git a/code/nel/tools/3d/object_viewer/particle_workspace.cpp b/code/nel/tools/3d/object_viewer/particle_workspace.cpp index 89fb31991..66efb5783 100644 --- a/code/nel/tools/3d/object_viewer/particle_workspace.cpp +++ b/code/nel/tools/3d/object_viewer/particle_workspace.cpp @@ -202,7 +202,7 @@ void CParticleWorkspace::CNode::createEmptyPS() NL3D::CParticleSystem emptyPS; NL3D::CParticleSystemShape *pss = new NL3D::CParticleSystemShape; pss->buildFromPS(emptyPS); - std::unique_ptr sb(new NL3D::CShapeBank); + CUniquePtr sb(new NL3D::CShapeBank); std::string shapeName = NLMISC::CFile::getFilename(_RelativePath); sb->add(shapeName, pss); NL3D::CShapeBank *oldSB = NL3D::CNELU::Scene->getShapeBank(); @@ -298,7 +298,7 @@ bool CParticleWorkspace::CNode::loadPS() // collapse name inputFile.open(getFullPath()); ss.serial(inputFile); - std::unique_ptr sb(new NL3D::CShapeBank); + CUniquePtr sb(new NL3D::CShapeBank); std::string shapeName = NLMISC::CFile::getFilename(_RelativePath); sb->add(shapeName, ss.getShapePointer()); NL3D::CShapeBank *oldSB = NL3D::CNELU::Scene->getShapeBank(); diff --git a/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp b/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp index f02eef04d..b4874ff29 100644 --- a/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp @@ -121,7 +121,7 @@ void CSnapshotToolDlg::stringFromRegistry(HKEY hKey, const TCHAR *name, CString return; } - std::unique_ptr tmpDest(new TCHAR[size]); + CUniquePtr tmpDest(new TCHAR[size]); result = RegQueryValueEx(hKey, name, NULL, &type, (BYTE*)tmpDest.get(), &size); if (result != ERROR_SUCCESS) @@ -130,7 +130,7 @@ void CSnapshotToolDlg::stringFromRegistry(HKEY hKey, const TCHAR *name, CString return; } - dest = *tmpDest; + dest = tmpDest.get(); } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp index 0b5f14a36..d39020a64 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp @@ -1180,7 +1180,7 @@ void CExportNel::getBSMeshBuild (std::vector &bsList, INode convertMatrix(finalSpace, node.GetNodeTM(time)); CMeshBase::CMeshBaseBuild *dummyMBB = NULL; - std::unique_ptr baseMB(createMeshBuild (node, time, dummyMBB, finalSpace)); + CUniquePtr baseMB(createMeshBuild (node, time, dummyMBB, finalSpace)); delete dummyMBB; dummyMBB = NULL; if (baseMB.get() == NULL) return; diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_remanence.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_remanence.cpp index 9a629a987..8ca48893b 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_remanence.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_remanence.cpp @@ -39,7 +39,7 @@ static void buildRemanenceError(CExportNel *en, INode &node, const char *mess) //============================================================================================= NL3D::IShape *CExportNel::buildRemanence(INode& node, TimeValue time) { - std::unique_ptr srs(new CSegRemanenceShape); + CUniquePtr srs(new CSegRemanenceShape); uint numSlices = getScriptAppData (&node, NEL3D_APPDATA_REMANENCE_SLICE_NUMBER, 2); float samplingPeriod = getScriptAppData (&node, NEL3D_APPDATA_REMANENCE_SAMPLING_PERIOD, 0.02f); float rollupRatio = getScriptAppData (&node, NEL3D_APPDATA_REMANENCE_ROLLUP_RATIO, 1.f); diff --git a/code/nel/tools/3d/zone_check_bind/zone_check_bind.cpp b/code/nel/tools/3d/zone_check_bind/zone_check_bind.cpp index 8d529936f..45808e479 100644 --- a/code/nel/tools/3d/zone_check_bind/zone_check_bind.cpp +++ b/code/nel/tools/3d/zone_check_bind/zone_check_bind.cpp @@ -95,7 +95,7 @@ static CZone *LoadZone(uint16 xPos, uint16 yPos, std::string zoneExt) { std::string zoneName; ::getZoneNameByCoord(xPos, yPos, zoneName); - std::unique_ptr zone(new CZone); + CUniquePtr zone(new CZone); std::string lookedUpZoneName = CPath::lookup(zoneName + zoneExt, false, false, false); if (lookedUpZoneName.empty()) return NULL; CIFile iF; @@ -174,7 +174,7 @@ static uint CheckZone(std::string middleZoneFile, float weldThreshold, float mid // Load the zones around // //////////////////////////// - std::unique_ptr zones[9]; + CUniquePtr zones[9]; std::string zoneNames[9]; CZoneInfo zoneInfos[9]; uint16 xPos, yPos; diff --git a/code/nel/tools/3d/zone_lighter/zone_lighter.cpp b/code/nel/tools/3d/zone_lighter/zone_lighter.cpp index e45f01f5f..04c165a01 100644 --- a/code/nel/tools/3d/zone_lighter/zone_lighter.cpp +++ b/code/nel/tools/3d/zone_lighter/zone_lighter.cpp @@ -153,7 +153,7 @@ static void loadIGFromVillage(const NLGEORGES::UFormElm *villageItem, const std: if (inputFile.open (nameLookup)) { // New ig - std::unique_ptr group(new CInstanceGroup); + CUniquePtr group(new CInstanceGroup); try { group->serial (inputFile); diff --git a/code/nel/tools/nel_unit_test/nel_unit_test.cpp b/code/nel/tools/nel_unit_test/nel_unit_test.cpp index 17c161afd..ede52b006 100644 --- a/code/nel/tools/nel_unit_test/nel_unit_test.cpp +++ b/code/nel/tools/nel_unit_test/nel_unit_test.cpp @@ -67,7 +67,7 @@ static void usage() exit(0); } -static unique_ptr cmdline(int argc, char* argv[]) +static CUniquePtr cmdline(int argc, char* argv[]) { if (argc > 2) usage(); // will not return @@ -102,7 +102,7 @@ static unique_ptr cmdline(int argc, char* argv[]) } } - return unique_ptr(output); + return CUniquePtr(output); } // Main test program @@ -134,12 +134,12 @@ int main(int argc, char *argv[]) { Test::Suite ts; - ts.add(unique_ptr(new CUTMisc)); - ts.add(unique_ptr(new CUTNet)); - ts.add(unique_ptr(new CUTLigo)); + ts.add(CUniquePtr(new CUTMisc)); + ts.add(CUniquePtr(new CUTNet)); + ts.add(CUniquePtr(new CUTLigo)); // Add a line here when adding a new test MODULE - unique_ptr output(cmdline(argc, argv)); + CUniquePtr output(cmdline(argc, argv)); noerrors = ts.run(*output); Test::HtmlOutput* const html = dynamic_cast(output.get()); diff --git a/code/nel/tools/nel_unit_test/ut_ligo.h b/code/nel/tools/nel_unit_test/ut_ligo.h index 87eadde35..338ffada0 100644 --- a/code/nel/tools/nel_unit_test/ut_ligo.h +++ b/code/nel/tools/nel_unit_test/ut_ligo.h @@ -26,7 +26,7 @@ struct CUTLigo : public Test::Suite { CUTLigo() { - add(unique_ptr(new CUTLigoPrimitive)); + add(CUniquePtr(new CUTLigoPrimitive)); // Add a line here when adding a new test CLASS } }; diff --git a/code/nel/tools/nel_unit_test/ut_misc.h b/code/nel/tools/nel_unit_test/ut_misc.h index 410f1304e..900273260 100644 --- a/code/nel/tools/nel_unit_test/ut_misc.h +++ b/code/nel/tools/nel_unit_test/ut_misc.h @@ -37,20 +37,20 @@ struct CUTMisc : public Test::Suite { CUTMisc() { - add(unique_ptr(new CUTMiscCoTask)); - add(unique_ptr(new CUTMiscCommand)); - add(unique_ptr(new CUTMiscCommon)); - add(unique_ptr(new CUTMiscConfigFile)); - add(unique_ptr(new CUTMiscDebug)); - add(unique_ptr(new CUTMiscDynLibLoad)); - add(unique_ptr(new CUTMiscFile)); - add(unique_ptr(new CUTMiscPackFile)); - add(unique_ptr(new CUTMiscSingleton)); - add(unique_ptr(new CUTMiscSString)); - add(unique_ptr(new CUTMiscStream)); - add(unique_ptr(new CUTMiscVariable)); - add(unique_ptr(new CUTMiscTypes)); - add(unique_ptr(new CUTMiscStringCommon)); + add(CUniquePtr(new CUTMiscCoTask)); + add(CUniquePtr(new CUTMiscCommand)); + add(CUniquePtr(new CUTMiscCommon)); + add(CUniquePtr(new CUTMiscConfigFile)); + add(CUniquePtr(new CUTMiscDebug)); + add(CUniquePtr(new CUTMiscDynLibLoad)); + add(CUniquePtr(new CUTMiscFile)); + add(CUniquePtr(new CUTMiscPackFile)); + add(CUniquePtr(new CUTMiscSingleton)); + add(CUniquePtr(new CUTMiscSString)); + add(CUniquePtr(new CUTMiscStream)); + add(CUniquePtr(new CUTMiscVariable)); + add(CUniquePtr(new CUTMiscTypes)); + add(CUniquePtr(new CUTMiscStringCommon)); // Add a line here when adding a new test CLASS } }; diff --git a/code/nel/tools/nel_unit_test/ut_net.h b/code/nel/tools/nel_unit_test/ut_net.h index 396285700..64678f828 100644 --- a/code/nel/tools/nel_unit_test/ut_net.h +++ b/code/nel/tools/nel_unit_test/ut_net.h @@ -28,9 +28,9 @@ struct CUTNet : public Test::Suite { CUTNet() { - add(unique_ptr(new CUTNetLayer3)); - add(unique_ptr(new CUTNetMessage)); - add(unique_ptr(new CUTNetModule)); + add(CUniquePtr(new CUTNetLayer3)); + add(CUniquePtr(new CUTNetMessage)); + add(CUniquePtr(new CUTNetModule)); // Add a line here when adding a new test CLASS } }; diff --git a/code/ryzom/client/src/door_manager.cpp b/code/ryzom/client/src/door_manager.cpp index ba0678dc0..14c4e889e 100644 --- a/code/ryzom/client/src/door_manager.cpp +++ b/code/ryzom/client/src/door_manager.cpp @@ -273,7 +273,7 @@ void CDoorManager::loadedCallback (NL3D::UInstanceGroup *ig) sShapeName = CPath::lookup(sShapeName,false); if (!sShapeName.empty()) { - std::unique_ptr pb(NLPACS::UPrimitiveBlock::createPrimitiveBlockFromFile(sShapeName)); + CUniquePtr pb(NLPACS::UPrimitiveBlock::createPrimitiveBlockFromFile(sShapeName)); NLPACS::UPrimitiveBlock *pPB = pb.release(); bool bDoorDetectPresent = false; diff --git a/code/ryzom/client/src/pacs_client.cpp b/code/ryzom/client/src/pacs_client.cpp index f50531bb7..8e622d410 100644 --- a/code/ryzom/client/src/pacs_client.cpp +++ b/code/ryzom/client/src/pacs_client.cpp @@ -194,7 +194,7 @@ void addPacsPrim(const std::string &fileName) nlwarning(("Pacs primitive " + ppName + " already has been inserted").c_str()); return; } - std::unique_ptr pb(NLPACS::UPrimitiveBlock::createPrimitiveBlockFromFile(fileName)); + CUniquePtr pb(NLPACS::UPrimitiveBlock::createPrimitiveBlockFromFile(fileName)); PacsPrims[ppName] = pb.release(); } diff --git a/code/ryzom/client/src/r2/auto_group.cpp b/code/ryzom/client/src/r2/auto_group.cpp index 0da724d4b..eeefbd7de 100644 --- a/code/ryzom/client/src/r2/auto_group.cpp +++ b/code/ryzom/client/src/r2/auto_group.cpp @@ -264,7 +264,7 @@ void CAutoGroup::group(CObject *newEntityDesc, const NLMISC::CVectorD &createPos else { // other is a standalone entity -> create a new group - std::unique_ptr newGroup(getEditor().getDMC().newComponent("NpcGrpFeature")); + CUniquePtr newGroup(getEditor().getDMC().newComponent("NpcGrpFeature")); if (!newGroup.get()) { nlwarning("Syntax error in r2_features_npc_group.lua."); diff --git a/code/ryzom/client/src/r2/dmc/client_edition_module.cpp b/code/ryzom/client/src/r2/dmc/client_edition_module.cpp index 98c10afb6..37caebc3e 100644 --- a/code/ryzom/client/src/r2/dmc/client_edition_module.cpp +++ b/code/ryzom/client/src/r2/dmc/client_edition_module.cpp @@ -132,7 +132,7 @@ namespace R2 { client->onScenarioUploaded(server, _Value.get()); } private: - std::unique_ptr _Value; + CUniquePtr _Value; }; class CServerAnswerMsgSet: public IServerAnswerMsg @@ -148,7 +148,7 @@ namespace R2 { private: std::string _InstanceId; std::string _AttrName; - std::unique_ptr _Value; + CUniquePtr _Value; }; class CServerAnswerMsgInserted: public IServerAnswerMsg @@ -166,7 +166,7 @@ namespace R2 { std::string _AttrName; sint32 _Position; std::string _Key; - std::unique_ptr _Value; + CUniquePtr _Value; }; class CServerAnswerMsgErased: public IServerAnswerMsg @@ -1140,7 +1140,7 @@ void CClientEditionModule::startingScenario(class NLNET::IModuleProxy * /* serve _Factory->setMaxId("RtEntryText", 0); _Factory->setMaxId("RtPlotItem", 0); - std::unique_ptr rtDataPtr( _Client->getComLuaModule().translateFeatures(hlScenario , errorMsg) ); + CUniquePtr rtDataPtr( _Client->getComLuaModule().translateFeatures(hlScenario , errorMsg) ); rtData.setData(rtDataPtr.get()); if (rtDataPtr.get()) @@ -2351,7 +2351,7 @@ void CClientEditionModule::loadUserComponentFileAccepted(NLNET::IModuleProxy * / return; } - unique_ptr userComponentToLoad(found->second); + CUniquePtr userComponentToLoad(found->second); _UserComponentToLoad.erase(found); if (!ok) @@ -2383,7 +2383,7 @@ void CClientEditionModule::saveScenarioFileAccepted(NLNET::IModuleProxy *senderM return; } - unique_ptr scenarioToSave(found->second); + CUniquePtr scenarioToSave(found->second); _ScenarioToSave.erase(found); if (ok) @@ -2498,7 +2498,7 @@ void CClientEditionModule::loadScenarioFileAccepted(NLNET::IModuleProxy * /* sen return; } - unique_ptr scenarioToLoad(found->second); + CUniquePtr scenarioToLoad(found->second); _ScenarioToLoad.erase(found); if (!ok) diff --git a/code/ryzom/client/src/r2/dmc/client_edition_module.h b/code/ryzom/client/src/r2/dmc/client_edition_module.h index 3668f6ae6..662dddeb6 100644 --- a/code/ryzom/client/src/r2/dmc/client_edition_module.h +++ b/code/ryzom/client/src/r2/dmc/client_edition_module.h @@ -1169,7 +1169,7 @@ private: uint32 _MaxNpcs; uint32 _MaxStaticObjects; - std::unique_ptr _Emotes; + CUniquePtr _Emotes; CEditorConfig* _ClientEditorConfig; diff --git a/code/ryzom/client/src/r2/tool_create_entity.cpp b/code/ryzom/client/src/r2/tool_create_entity.cpp index 479e9b495..c29209b43 100644 --- a/code/ryzom/client/src/r2/tool_create_entity.cpp +++ b/code/ryzom/client/src/r2/tool_create_entity.cpp @@ -227,7 +227,7 @@ std::string CToolCreateEntity::cloneEntityIntoScenario(CEntityCL *clonee, getDMC().newAction(NLMISC::CI18N::get("uiR2EDCreateAction") + readableName); } // send network commands to create entity on server - std::unique_ptr desc(getDMC().newComponent(className)); + CUniquePtr desc(getDMC().newComponent(className)); if (desc.get()) { diff --git a/code/ryzom/client/src/r2/tool_select_move.cpp b/code/ryzom/client/src/r2/tool_select_move.cpp index c2433a1a3..261e8b49a 100644 --- a/code/ryzom/client/src/r2/tool_select_move.cpp +++ b/code/ryzom/client/src/r2/tool_select_move.cpp @@ -377,7 +377,7 @@ void CToolSelectMove::commitAction(CInstance &instance) if (_AutoGroup.getGroupingCandidate()) { newCopy.push(); - std::unique_ptr desc(CComLuaModule::getObjectFromLua(ls.getStatePointer())); + CUniquePtr desc(CComLuaModule::getObjectFromLua(ls.getStatePointer())); _AutoGroup.group(desc.get(), _FinalPos); } else diff --git a/code/ryzom/client/src/seven_zip/seven_zip.cpp b/code/ryzom/client/src/seven_zip/seven_zip.cpp index f9022b59d..7899e7380 100644 --- a/code/ryzom/client/src/seven_zip/seven_zip.cpp +++ b/code/ryzom/client/src/seven_zip/seven_zip.cpp @@ -196,13 +196,13 @@ bool unpackLZMA(const std::string &lzmaFile, const std::string &destFileName) } // allocate input buffer for props - unique_ptr propsBuffer(new uint8[LZMA_PROPS_SIZE]); + CUniquePtr propsBuffer(new uint8[LZMA_PROPS_SIZE]); // size of LZMA content inSize -= LZMA_PROPS_SIZE + 8; // allocate input buffer for lzma data - unique_ptr inBuffer(new uint8[inSize]); + CUniquePtr inBuffer(new uint8[inSize]); uint64 fileSize = 0; @@ -224,7 +224,7 @@ bool unpackLZMA(const std::string &lzmaFile, const std::string &destFileName) } // allocate the output buffer - unique_ptr outBuffer(new uint8[fileSize]); + CUniquePtr outBuffer(new uint8[fileSize]); // in and out file sizes SizeT outProcessed = (SizeT)fileSize; @@ -273,7 +273,7 @@ bool packLZMA(const std::string &srcFileName, const std::string &lzmaFileName) } // allocate input buffer - unique_ptr inBuffer(new uint8[inSize]); + CUniquePtr inBuffer(new uint8[inSize]); try { @@ -288,11 +288,11 @@ bool packLZMA(const std::string &srcFileName, const std::string &lzmaFileName) // allocate output buffer size_t outSize = (11 * inSize / 10) + 65536; // worst case = 1.1 * size + 64K - unique_ptr outBuffer(new uint8[outSize]); + CUniquePtr outBuffer(new uint8[outSize]); // allocate buffer for props size_t outPropsSize = LZMA_PROPS_SIZE; - unique_ptr outProps(new uint8[outPropsSize]); + CUniquePtr outProps(new uint8[outPropsSize]); // compress with best compression and other default settings sint res = LzmaCompress(outBuffer.get(), &outSize, inBuffer.get(), inSize, outProps.get(), &outPropsSize, 9, 1 << 27, -1, -1, -1, -1, 1); diff --git a/code/ryzom/client/src/sky.cpp b/code/ryzom/client/src/sky.cpp index 696d67251..9b3474ada 100644 --- a/code/ryzom/client/src/sky.cpp +++ b/code/ryzom/client/src/sky.cpp @@ -294,7 +294,7 @@ CBitmap *buildSharedBitmap(const std::string &filename, // load the bitmap std::string path = CPath::lookup(filename, false); if (path.empty()) return NULL; - std::unique_ptr bm(new CBitmap); + CUniquePtr bm(new CBitmap); try { CIFile f; diff --git a/code/ryzom/common/src/game_share/ring_session_manager_itf.h b/code/ryzom/common/src/game_share/ring_session_manager_itf.h index 832903ad1..0921a228c 100644 --- a/code/ryzom/common/src/game_share/ring_session_manager_itf.h +++ b/code/ryzom/common/src/game_share/ring_session_manager_itf.h @@ -2393,7 +2393,7 @@ namespace RSMGR protected: /// the callback server adaptor - std::unique_ptr _CallbackServer; + CUniquePtr _CallbackServer; void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) { @@ -2464,12 +2464,12 @@ namespace RSMGR if (replacementAdaptor == NULL) { // use default callback server - _CallbackServer = std::unique_ptr(new CNelCallbackServerAdaptor(this)); + _CallbackServer = CUniquePtr(new CNelCallbackServerAdaptor(this)); } else { // use the replacement one - _CallbackServer = std::unique_ptr(replacementAdaptor); + _CallbackServer = CUniquePtr(replacementAdaptor); } } @@ -3858,7 +3858,7 @@ namespace RSMGR protected: /// the callback client adaptor - std::unique_ptr < ICallbackClientAdaptor > _CallbackClient; + CUniquePtr < ICallbackClientAdaptor > _CallbackClient; void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) @@ -3922,12 +3922,12 @@ namespace RSMGR if (adaptorReplacement == NULL) { // use the default Nel adaptor - _CallbackClient = std::unique_ptr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this)); + _CallbackClient = CUniquePtr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this)); } else { // use the replacement one - _CallbackClient = std::unique_ptr < ICallbackClientAdaptor >(adaptorReplacement); + _CallbackClient = CUniquePtr < ICallbackClientAdaptor >(adaptorReplacement); } } diff --git a/code/ryzom/common/src/game_share/server_animation_module.cpp b/code/ryzom/common/src/game_share/server_animation_module.cpp index 19446abc1..0f0c90bb0 100644 --- a/code/ryzom/common/src/game_share/server_animation_module.cpp +++ b/code/ryzom/common/src/game_share/server_animation_module.cpp @@ -362,7 +362,7 @@ public: typedef std::map TCharacterInfos; public: - std::unique_ptr RtData; + CUniquePtr RtData; TScenarioHeaderSerializer ScenarioHeader; TSessionId SessionId; //vector diff --git a/code/ryzom/common/src/game_share/server_edition_module.cpp b/code/ryzom/common/src/game_share/server_edition_module.cpp index 6ddbe8931..8670716b0 100644 --- a/code/ryzom/common/src/game_share/server_edition_module.cpp +++ b/code/ryzom/common/src/game_share/server_edition_module.cpp @@ -2215,7 +2215,7 @@ void CServerEditionModule::onNodeSetAsked(NLNET::IModuleProxy *senderModuleProxy value2.uncompress(); CObject* value = value2.getData(); - std::unique_ptr autoDelete(value); + CUniquePtr autoDelete(value); bool ok = checkSecurityInfo(senderModuleProxy, charId, clientEid, userPriv, extendedPriv); @@ -5116,7 +5116,7 @@ bool CServerEditionModule::wakeUpSession(TSessionId sessionId, TCharId ownerChar void CServerEditionModule::wakeUpSessionImpl(CEditionSession* session) { - std::unique_ptr sessionPtr(session); + CUniquePtr sessionPtr(session); TSessionId sessionId = sessionPtr->SessionId; TSessions::iterator found = _Sessions.find(sessionId); diff --git a/code/ryzom/common/src/game_share/server_edition_module.h b/code/ryzom/common/src/game_share/server_edition_module.h index d5f565dc7..9a5b90b88 100644 --- a/code/ryzom/common/src/game_share/server_edition_module.h +++ b/code/ryzom/common/src/game_share/server_edition_module.h @@ -541,7 +541,7 @@ namespace R2 private: std::set _Sessions; - std::unique_ptr _Component; + CUniquePtr _Component; }; struct CHashKeyMD5Less : public std::binary_function @@ -637,7 +637,7 @@ namespace R2 CTaskList _RingAccessTasks; // Remove people that do not belong here TOverrideRingAccess _OverrideRingAccess; //Ring access for dev bool _MustUpdateOverrideRingAcess; - std::unique_ptr _IdRecycle; + CUniquePtr _IdRecycle; TKicked _Kicked; // diff --git a/code/ryzom/server/src/admin_modules/admin_modules_itf.h b/code/ryzom/server/src/admin_modules/admin_modules_itf.h index a77d52935..8c25790e7 100644 --- a/code/ryzom/server/src/admin_modules/admin_modules_itf.h +++ b/code/ryzom/server/src/admin_modules/admin_modules_itf.h @@ -55,7 +55,7 @@ namespace ADMIN protected: /// the callback server adaptor - std::unique_ptr _CallbackServer; + CUniquePtr _CallbackServer; void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) { @@ -102,12 +102,12 @@ namespace ADMIN if (replacementAdaptor == NULL) { // use default callback server - _CallbackServer = std::unique_ptr(new CNelCallbackServerAdaptor(this)); + _CallbackServer = CUniquePtr(new CNelCallbackServerAdaptor(this)); } else { // use the replacement one - _CallbackServer = std::unique_ptr(replacementAdaptor); + _CallbackServer = CUniquePtr(replacementAdaptor); } } @@ -439,7 +439,7 @@ namespace ADMIN protected: /// the callback client adaptor - std::unique_ptr < ICallbackClientAdaptor > _CallbackClient; + CUniquePtr < ICallbackClientAdaptor > _CallbackClient; void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) @@ -493,12 +493,12 @@ namespace ADMIN if (adaptorReplacement == NULL) { // use the default Nel adaptor - _CallbackClient = std::unique_ptr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this)); + _CallbackClient = CUniquePtr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this)); } else { // use the replacement one - _CallbackClient = std::unique_ptr < ICallbackClientAdaptor >(adaptorReplacement); + _CallbackClient = CUniquePtr < ICallbackClientAdaptor >(adaptorReplacement); } } diff --git a/code/ryzom/server/src/logger_service/log_query.cpp b/code/ryzom/server/src/logger_service/log_query.cpp index 9c3d093c0..9a53856a6 100644 --- a/code/ryzom/server/src/logger_service/log_query.cpp +++ b/code/ryzom/server/src/logger_service/log_query.cpp @@ -145,7 +145,7 @@ CQueryParser::TParserResult CQueryParser::parseQuery(const std::string &queryStr return pr; } - unique_ptr rootNode(parseExpr(first, queryStr.end())); + CUniquePtr rootNode(parseExpr(first, queryStr.end())); // make sure we have consumed all the stream iterator rew = first; diff --git a/code/ryzom/server/src/logger_service/log_query.h b/code/ryzom/server/src/logger_service/log_query.h index 0e046fdfb..ba10d7602 100644 --- a/code/ryzom/server/src/logger_service/log_query.h +++ b/code/ryzom/server/src/logger_service/log_query.h @@ -1190,7 +1190,7 @@ public: struct TParserResult { /// The query tree - mutable std::unique_ptr QueryTree; + mutable CUniquePtr QueryTree; /// Option to extract full context with selected logs bool FullContext; diff --git a/code/ryzom/server/src/server_share/continent_container.cpp b/code/ryzom/server/src/server_share/continent_container.cpp index d44604052..9babc998b 100644 --- a/code/ryzom/server/src/server_share/continent_container.cpp +++ b/code/ryzom/server/src/server_share/continent_container.cpp @@ -293,7 +293,7 @@ void CContinentContainer::initPacsPrim(const string &path) if (_PacsPrimMap.find(ppName) != _PacsPrimMap.end()) continue; - std::unique_ptr pb(UPrimitiveBlock::createPrimitiveBlockFromFile(CPath::lookup(fileNames[k], false))); + CUniquePtr pb(UPrimitiveBlock::createPrimitiveBlockFromFile(CPath::lookup(fileNames[k], false))); UPrimitiveBlock* ptr = pb.release(); if (ptr != NULL) { diff --git a/code/ryzom/server/src/server_share/login_service_itf.h b/code/ryzom/server/src/server_share/login_service_itf.h index a032cb5b6..ef7eba0a8 100644 --- a/code/ryzom/server/src/server_share/login_service_itf.h +++ b/code/ryzom/server/src/server_share/login_service_itf.h @@ -43,7 +43,7 @@ namespace LS protected: /// the callback server adaptor - std::unique_ptr _CallbackServer; + CUniquePtr _CallbackServer; void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) { @@ -85,12 +85,12 @@ namespace LS if (replacementAdaptor == NULL) { // use default callback server - _CallbackServer = std::unique_ptr(new CNelCallbackServerAdaptor(this)); + _CallbackServer = CUniquePtr(new CNelCallbackServerAdaptor(this)); } else { // use the replacement one - _CallbackServer = std::unique_ptr(replacementAdaptor); + _CallbackServer = CUniquePtr(replacementAdaptor); } } @@ -259,7 +259,7 @@ namespace LS protected: /// the callback client adaptor - std::unique_ptr < ICallbackClientAdaptor > _CallbackClient; + CUniquePtr < ICallbackClientAdaptor > _CallbackClient; void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) @@ -315,12 +315,12 @@ namespace LS if (adaptorReplacement == NULL) { // use the default Nel adaptor - _CallbackClient = std::unique_ptr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this)); + _CallbackClient = CUniquePtr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this)); } else { // use the replacement one - _CallbackClient = std::unique_ptr < ICallbackClientAdaptor >(adaptorReplacement); + _CallbackClient = CUniquePtr < ICallbackClientAdaptor >(adaptorReplacement); } } diff --git a/code/ryzom/server/src/server_share/mail_forum_itf.h b/code/ryzom/server/src/server_share/mail_forum_itf.h index 6d85e4606..ff23eb210 100644 --- a/code/ryzom/server/src/server_share/mail_forum_itf.h +++ b/code/ryzom/server/src/server_share/mail_forum_itf.h @@ -168,7 +168,7 @@ namespace MFS protected: /// the callback server adaptor - std::unique_ptr _CallbackServer; + CUniquePtr _CallbackServer; void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) { @@ -210,12 +210,12 @@ namespace MFS if (replacementAdaptor == NULL) { // use default callback server - _CallbackServer = std::unique_ptr(new CNelCallbackServerAdaptor(this)); + _CallbackServer = CUniquePtr(new CNelCallbackServerAdaptor(this)); } else { // use the replacement one - _CallbackServer = std::unique_ptr(replacementAdaptor); + _CallbackServer = CUniquePtr(replacementAdaptor); } } @@ -351,7 +351,7 @@ namespace MFS protected: /// the callback client adaptor - std::unique_ptr < ICallbackClientAdaptor > _CallbackClient; + CUniquePtr < ICallbackClientAdaptor > _CallbackClient; void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) @@ -405,12 +405,12 @@ namespace MFS if (adaptorReplacement == NULL) { // use the default Nel adaptor - _CallbackClient = std::unique_ptr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this)); + _CallbackClient = CUniquePtr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this)); } else { // use the replacement one - _CallbackClient = std::unique_ptr < ICallbackClientAdaptor >(adaptorReplacement); + _CallbackClient = CUniquePtr < ICallbackClientAdaptor >(adaptorReplacement); } } diff --git a/code/ryzom/server/src/server_share/mysql_wrapper.cpp b/code/ryzom/server/src/server_share/mysql_wrapper.cpp index 285b88429..5f289aceb 100644 --- a/code/ryzom/server/src/server_share/mysql_wrapper.cpp +++ b/code/ryzom/server/src/server_share/mysql_wrapper.cpp @@ -237,22 +237,22 @@ namespace MSW } - std::unique_ptr CConnection::storeResult() + CUniquePtr CConnection::storeResult() { H_AUTO(CConnection_storeResult); MYSQL_RES *res = mysql_store_result(_MysqlContext); - std::unique_ptr sr(new CStoreResult(res)); + CUniquePtr sr(new CStoreResult(res)); return sr; } - std::unique_ptr CConnection::useResult() + CUniquePtr CConnection::useResult() { H_AUTO(CConnection_useResult); MYSQL_RES *res = mysql_use_result(_MysqlContext); - std::unique_ptr sr(new CUseResult(res)); + CUniquePtr sr(new CUseResult(res)); return sr; } diff --git a/code/ryzom/server/src/server_share/mysql_wrapper.h b/code/ryzom/server/src/server_share/mysql_wrapper.h index 2af472f3a..14e7b58b1 100644 --- a/code/ryzom/server/src/server_share/mysql_wrapper.h +++ b/code/ryzom/server/src/server_share/mysql_wrapper.h @@ -108,8 +108,8 @@ namespace MSW return uint32(mysql_affected_rows(_MysqlContext)); } - std::unique_ptr storeResult(); - std::unique_ptr useResult(); + CUniquePtr storeResult(); + CUniquePtr useResult(); }; diff --git a/code/ryzom/server/src/session_browser_server/session_browser_server.cpp b/code/ryzom/server/src/session_browser_server/session_browser_server.cpp index a8ae1d9be..8c05ee95a 100644 --- a/code/ryzom/server/src/session_browser_server/session_browser_server.cpp +++ b/code/ryzom/server/src/session_browser_server/session_browser_server.cpp @@ -642,7 +642,7 @@ public: return; } - unique_ptr result(_RingDB.storeResult()); + CUniquePtr result(_RingDB.storeResult()); if (result->getNumRows() != 1) { nlinfo("Client from '%s' submited auth cookie '%s' for user %u, but DB return %u row instead of 1", @@ -726,7 +726,7 @@ public: query << "SELECT session_id, kicked"; query << " FROM session_participant WHERE char_id = "<< charId; BOMB_IF(!_RingDB.query(query), "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return); - unique_ptr result(_RingDB.storeResult()); + CUniquePtr result(_RingDB.storeResult()); uint32 row = result->getNumRows(); uint32 index = 0; @@ -757,7 +757,7 @@ public: query << " FROM characters WHERE char_id = "<disconnect(from); return); - unique_ptr result(_RingDB.storeResult()); + CUniquePtr result(_RingDB.storeResult()); BOMB_IF(result->getNumRows() != 1, "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return); result->fetchRow(); uint32 guildId; @@ -831,7 +831,7 @@ public: BOMB_IF(!_RingDB.query(query), "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return); - unique_ptr result2(_RingDB.storeResult()); + CUniquePtr result2(_RingDB.storeResult()); // BOMB_IF(result->getNumFields() != 1, "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return); // parse the result set and build the return vector @@ -917,7 +917,7 @@ public: query << " WHERE current_status='cs_online'"; query << " AND current_session="<< sd.getSessionId(); BOMB_IF(!_RingDB.query(query), "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return); - unique_ptr result3(_RingDB.storeResult()); + CUniquePtr result3(_RingDB.storeResult()); BOMB_IF(result2->getNumRows()<1,"Expected 1 result from SQL nbPlayers request but retrieved none",return); uint32 nbPlayers; result3->fetchRow(); @@ -960,7 +960,7 @@ public: query << " AND ring_users.user_id = characters.user_id"; BOMB_IF(!_RingDB.query(query), "getCharList : error executing request in database", charList(from, charId, sessionId, vector ()); return); - unique_ptr result(_RingDB.storeResult()); + CUniquePtr result(_RingDB.storeResult()); vector charDescs; charDescs.resize(result->getNumRows()); @@ -1044,7 +1044,7 @@ public: CSString query; query << "SELECT home_mainland_session_id, current_session FROM characters WHERE char_id = "<> 4, 103, "Database request failed"); return); - unique_ptr result(_RingDB.storeResult()); + CUniquePtr result(_RingDB.storeResult()); BOMB_IF (result->getNumRows() == 0, "invitedCharacterByName : can't find char "<> 4, 100, "Owner requester character"); return); result->fetchRow(); @@ -1064,7 +1064,7 @@ public: query << "SELECT char_id FROM characters WHERE char_name = '"<> 4, 103, "Database request failed"); return); - result = unique_ptr(_RingDB.storeResult()); + result = CUniquePtr(_RingDB.storeResult()); BOMB_IF (result->getNumRows() == 0, "invitedCharacterByName : can't find invited char '"<> 4, 104, "Invited char not found"); return); result->fetchRow(); @@ -1097,7 +1097,7 @@ public: query << " WHERE char_id = "< result(_RingDB.storeResult()); + CUniquePtr result(_RingDB.storeResult()); if (result->getNumRows() == 0) { @@ -1133,7 +1133,7 @@ public: query << " GROUP BY session_log.id"; BOMB_IF(!_RingDB.query(query), "getScessionAverageScores : failed request in database", sessionAverageScores(from, false, 0,0,0,0,0, 0); return); - unique_ptr result(_RingDB.storeResult()); + CUniquePtr result(_RingDB.storeResult()); if (result->getNumRows() == 0) { @@ -1178,7 +1178,7 @@ public: query << " GROUP BY scenario.id"; BOMB_IF(!_RingDB.query(query), "getScenarioAverageScores : failed request in database", scenarioAverageScores(from, false, 0,0,0,0,0,0); return); - unique_ptr result(_RingDB.storeResult()); + CUniquePtr result(_RingDB.storeResult()); if (result->getNumRows() == 0) { @@ -1219,7 +1219,7 @@ public: CSString query; query << "SELECT rrp_am, rrp_masterless, rrp_author FROM characters WHERE char_id = "< result(_RingDB.storeResult()); + CUniquePtr result(_RingDB.storeResult()); BOMB_IF (result->getNumRows() == 0, "getRingRatings : can't find char "<fetchRow(); @@ -1240,7 +1240,7 @@ public: CSString query; query << "SELECT ring_access FROM characters WHERE char_id = "< result(_RingDB.storeResult()); + CUniquePtr result(_RingDB.storeResult()); BOMB_IF (result->getNumRows() == 0, "on_getRingPoints : can't find char "<fetchRow(); diff --git a/code/ryzom/server/src/shard_unifier_service/character_sync.cpp b/code/ryzom/server/src/shard_unifier_service/character_sync.cpp index dccfd236b..5be9c7fe5 100644 --- a/code/ryzom/server/src/shard_unifier_service/character_sync.cpp +++ b/code/ryzom/server/src/shard_unifier_service/character_sync.cpp @@ -1307,7 +1307,7 @@ namespace CHARSYNC query << " AND session_type = 'st_edit'"; if (_RingDB.query(query) ) { - std::unique_ptr result(_RingDB.storeResult()); + CUniquePtr result(_RingDB.storeResult()); bool sessionClosed = false; if (!result->getNumRows() == 0) @@ -1389,7 +1389,7 @@ namespace CHARSYNC // return true; // } // -// std::unique_ptr result(_RingDB.storeResult()); +// CUniquePtr result(_RingDB.storeResult()); // // result->fetchRow(); // result->getField(0, dstUserId); diff --git a/code/ryzom/server/src/shard_unifier_service/database_mapping.cpp b/code/ryzom/server/src/shard_unifier_service/database_mapping.cpp index 93ac5eda1..5433f44eb 100644 --- a/code/ryzom/server/src/shard_unifier_service/database_mapping.cpp +++ b/code/ryzom/server/src/shard_unifier_service/database_mapping.cpp @@ -578,7 +578,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -638,7 +638,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -1230,7 +1230,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -1288,7 +1288,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -1992,7 +1992,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -2082,7 +2082,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -3940,7 +3940,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -4092,7 +4092,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -5435,7 +5435,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -6105,7 +6105,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -6155,7 +6155,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -6748,7 +6748,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -6808,7 +6808,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -7378,7 +7378,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -7965,7 +7965,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -8637,7 +8637,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -8687,7 +8687,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -9909,7 +9909,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); for (uint i=0; igetNumRows(); ++i) { @@ -10453,7 +10453,7 @@ namespace RSMGR return false; } - std::unique_ptr result(connection.storeResult()); + CUniquePtr result(connection.storeResult()); // check that the data description is consistent with database content nlassert(result->getNumRows() <= 1); diff --git a/code/ryzom/server/src/shard_unifier_service/login_service.cpp b/code/ryzom/server/src/shard_unifier_service/login_service.cpp index 75c547ec7..6344fbb66 100644 --- a/code/ryzom/server/src/shard_unifier_service/login_service.cpp +++ b/code/ryzom/server/src/shard_unifier_service/login_service.cpp @@ -382,7 +382,7 @@ namespace LS CSString query; query << "SELECT UId FROM user WHERE GMId = "< result(_NelDb.storeResult()); + CUniquePtr result(_NelDb.storeResult()); for (uint32 i=0; i!=result->getNumRows(); ++i) { result->fetchRow(); diff --git a/code/ryzom/server/src/shard_unifier_service/mail_forum_notfier_fwd.cpp b/code/ryzom/server/src/shard_unifier_service/mail_forum_notfier_fwd.cpp index f794c6d84..f308e59ff 100644 --- a/code/ryzom/server/src/shard_unifier_service/mail_forum_notfier_fwd.cpp +++ b/code/ryzom/server/src/shard_unifier_service/mail_forum_notfier_fwd.cpp @@ -207,7 +207,7 @@ namespace MFS BOMB_IF(!_RingDb.query(query), ("Database error, no guild forum notification"), break;); - unique_ptr result(_RingDb.storeResult()); + CUniquePtr result(_RingDb.storeResult()); BOMB_IF(result->getNumRows() != 1, ("Database error, no guild forum notification"), break;); @@ -229,7 +229,7 @@ namespace MFS string query = "SELECT COUNT(*) FROM mfs_mail WHERE date > '"+MSW::encodeDate(lastDisconnectionDate)+"' AND status = 'ms_new' AND erase_series = 0"; BOMB_IF(!_RingDb.query(query), ("Database error, no mail notification"), return;); - unique_ptr result(_RingDb.storeResult()); + CUniquePtr result(_RingDb.storeResult()); BOMB_IF(result->getNumRows() != 1, ("Database error, no mail notification"), return;); diff --git a/code/ryzom/server/src/shard_unifier_service/name_manager.cpp b/code/ryzom/server/src/shard_unifier_service/name_manager.cpp index 4087ef9d0..c1dd19dd6 100644 --- a/code/ryzom/server/src/shard_unifier_service/name_manager.cpp +++ b/code/ryzom/server/src/shard_unifier_service/name_manager.cpp @@ -789,7 +789,7 @@ bool CNameManager::loadAccountNamesFromDatabase() query << "SELECT user_id, user_name FROM ring_users"; BOMB_IF(!_Database->query(query), "Failed to load account names from the database", return false); - unique_ptr result(_Database->useResult()); + CUniquePtr result(_Database->useResult()); while (result->fetchRow()) { @@ -986,7 +986,7 @@ bool CNameManager::loadCharacterNamesFromDatabase() query << "SELECT char_id, char_name, home_mainland_session_id FROM characters"; BOMB_IF(!_Database->query(query), "Failed to load character names from the database", return false); - unique_ptr result(_Database->useResult()); + CUniquePtr result(_Database->useResult()); while (result->fetchRow()) { diff --git a/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp b/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp index 685700e71..7393aec96 100644 --- a/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp +++ b/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp @@ -299,7 +299,7 @@ namespace RSMGR list sessionIds; { // scope the result to make it destroyed at scope end - unique_ptr result(_RingDb.useResult()); + CUniquePtr result(_RingDb.useResult()); // for each open session, put it in the locked state while (result->fetchRow()) @@ -627,7 +627,7 @@ namespace RSMGR // query << " AND ShardId = " << shardId; // // BOMB_IF(!_NelDb.query(query), "registerWS : Failed to request into the NeL database", return CNelShardPtr()); -// unique_ptr result(_NelDb.storeResult()); +// CUniquePtr result(_NelDb.storeResult()); // BOMB_IF(result.get() == NULL, "registerWS : Failed to retrieve request result", return CNelShardPtr()); // // if (result->getNumRows() == 0) @@ -656,7 +656,7 @@ namespace RSMGR // joinSessionResult(from, charId>>4, 0, 12, "failed to request for access permission", TSessionPartStatus::invalid_val); return false; } - unique_ptr result(_NelDb.storeResult()); + CUniquePtr result(_NelDb.storeResult()); if (result->getNumRows() == 0) { return false; @@ -1008,7 +1008,7 @@ restartLoop: CSString query; query << "SELECT id FROM scenario WHERE md5 = '"< result(_RingDb.storeResult()); + CUniquePtr result(_RingDb.storeResult()); if (result->getNumRows() != 0) { result->fetchRow(); @@ -1139,7 +1139,7 @@ restartLoop: CSString query; query << "SELECT id FROM scenario WHERE md5 = '"< result(_RingDb.storeResult()); + CUniquePtr result(_RingDb.storeResult()); if (result->getNumRows() != 0) { result->fetchRow(); @@ -1918,7 +1918,7 @@ endOfWelcomeUserResult: CSString query; query << "SELECT COUNT(*) FROM sessions WHERE owner = "<>4, 5, "Database failure"); return); - unique_ptr result(_RingDb.storeResult()); + CUniquePtr result(_RingDb.storeResult()); result->fetchRow(); uint32 nbSession; @@ -2114,7 +2114,7 @@ endOfWelcomeUserResult: query << " AND session_type = 'st_edit'"; BOMB_IF(!_RingDb.query(query), "Error in database request", invokeResult(from, userId, 2, "Error in database request"); return); - unique_ptr result(_RingDb.storeResult()); + CUniquePtr result(_RingDb.storeResult()); bool sessionClosed = false; if (result->getNumRows() == 0) @@ -2196,7 +2196,7 @@ endOfWelcomeUserResult: query << "SELECT session_id FROM sessions"; query << " WHERE owner = "<>4, 1, "Database error"); return); - unique_ptr result(_RingDb.storeResult()); + CUniquePtr result(_RingDb.storeResult()); // 1.1 : if no session so no need to hibernate (not an error) if (result->getNumRows() != 0) @@ -2243,7 +2243,7 @@ endOfWelcomeUserResult: query << "SELECT session_id FROM sessions"; query << " WHERE owner = "<>4, 1, "Database error"); return); - unique_ptr result(_RingDb.storeResult()); + CUniquePtr result(_RingDb.storeResult()); // 1.1 : if no session so no need to hibernate (not an error) if (result->getNumRows() > 1) @@ -3546,7 +3546,7 @@ endOfWelcomeUserResult: query << "SELECT session_id FROM sessions"; query << " WHERE owner = "<>4, TSessionId(0), 11, "Database error", TSessionPartStatus::invalid_val); return); - unique_ptr result(_RingDb.storeResult()); + CUniquePtr result(_RingDb.storeResult()); // 1.1 : if no session found, return an error to the client if (result->getNumRows() == 0) @@ -4387,7 +4387,7 @@ endOfWelcomeUserResult: set sessionToClose; - unique_ptr result = _RingDb.useResult(); + CUniquePtr result = _RingDb.useResult(); while (result->fetchRow()) { diff --git a/code/ryzom/server/src/simulation_service/simulated_ring_session_manager.cpp b/code/ryzom/server/src/simulation_service/simulated_ring_session_manager.cpp index eaaa549a5..e64cbbf57 100644 --- a/code/ryzom/server/src/simulation_service/simulated_ring_session_manager.cpp +++ b/code/ryzom/server/src/simulation_service/simulated_ring_session_manager.cpp @@ -114,7 +114,7 @@ namespace RSMGR list sessionIds; { // scope the result to make it destroyed at scope end - unique_ptr result(_RingDb.useResult()); + CUniquePtr result(_RingDb.useResult()); // for each open session, put it in the locked state while (result->fetchRow()) @@ -1313,7 +1313,7 @@ namespace RSMGR set sessionToClose; - unique_ptr result(_RingDb.useResult()); + CUniquePtr result(_RingDb.useResult()); while (result->fetchRow()) { diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/steps.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/steps.cpp index 9e9e03559..7ada1d1a8 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/steps.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/steps.cpp @@ -741,7 +741,7 @@ public: // _TalkToMenu.initPhrase(md, prim, temp); _TalkToObjective = NULL; - std::unique_ptr talkToObjective; // next calls could throw exceptions, so take care... + CUniquePtr talkToObjective; // next calls could throw exceptions, so take care... if (!temp.empty()) { talkToObjective.reset(new CStepDynChatTalkTo(md, prim, "talk_to_")); diff --git a/code/studio/src/plugins/object_viewer/particle_system/dup_ps.cpp b/code/studio/src/plugins/object_viewer/particle_system/dup_ps.cpp index 3b2e6d69f..086607fac 100644 --- a/code/studio/src/plugins/object_viewer/particle_system/dup_ps.cpp +++ b/code/studio/src/plugins/object_viewer/particle_system/dup_ps.cpp @@ -66,7 +66,7 @@ struct CDupObjPolicy dest.serialPtr(obj); /*if (dest.isReading()) { - std::unique_ptr newObj(new T); + CUniquePtr newObj(new T); newObj->serialPtr(dest); delete obj; obj = newObj.release(); @@ -111,7 +111,7 @@ NL3D::CParticleSystemProcess *DupPSLocated(const CParticleSystemProcess *in) /** Duplicate the system, and detach. * We can't duplicate the object direclty (it may be referencing other objects in the system, so these objects will be copied too...) */ - std::unique_ptr newPS(DupSerializable(in->getOwner())); + CUniquePtr newPS(DupSerializable(in->getOwner())); // scene pointer is not serialised, but 'detach' may need the scene to be specified newPS->setScene(in->getOwner()->getScene()); return newPS->detach(index); @@ -141,7 +141,7 @@ NL3D::CPSLocatedBindable *DupPSLocatedBindable(CPSLocatedBindable *in) else { CParticleSystem *srcPS = in->getOwner()->getOwner(); - std::unique_ptr newPS(DupSerializable(srcPS)); + CUniquePtr newPS(DupSerializable(srcPS)); // scene pointer is not serialised, but 'detach' may need the scene to be specified newPS->setScene(in->getOwner()->getOwner()->getScene()); // diff --git a/code/studio/src/plugins/object_viewer/particle_system/particle_editor.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_editor.cpp index 38b46d439..9940dc350 100644 --- a/code/studio/src/plugins/object_viewer/particle_system/particle_editor.cpp +++ b/code/studio/src/plugins/object_viewer/particle_system/particle_editor.cpp @@ -105,7 +105,7 @@ NL3D::CParticleSystemModel *CParticleEditor::getModelFromPS(NL3D::CParticleSyste void CParticleEditor::loadWorkspace(const std::string &fullPath) { // Add to the path - std::unique_ptr newPW(new CParticleWorkspace); + CUniquePtr newPW(new CParticleWorkspace); newPW->init(fullPath); // save empty workspace diff --git a/code/studio/src/plugins/object_viewer/particle_system/particle_node.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_node.cpp index c85e2e4b6..084358f52 100644 --- a/code/studio/src/plugins/object_viewer/particle_system/particle_node.cpp +++ b/code/studio/src/plugins/object_viewer/particle_system/particle_node.cpp @@ -193,7 +193,7 @@ void CWorkspaceNode::createEmptyPS() NL3D::CParticleSystem emptyPS; NL3D::CParticleSystemShape *pss = new NL3D::CParticleSystemShape; pss->buildFromPS(emptyPS); - std::unique_ptr sb(new NL3D::CShapeBank); + CUniquePtr sb(new NL3D::CShapeBank); std::string shapeName = NLMISC::CFile::getFilename(_RelativePath); sb->add(shapeName, pss); NL3D::CShapeBank *oldSB = Modules::psEdit().getScene()->getShapeBank(); @@ -272,7 +272,7 @@ bool CWorkspaceNode::loadPS() throw(NLMISC::EStream) // collapse name inputFile.open(getFullPath()); ss.serial(inputFile); - std::unique_ptr sb(new NL3D::CShapeBank); + CUniquePtr sb(new NL3D::CShapeBank); std::string shapeName = NLMISC::CFile::getFilename(_RelativePath); sb->add(shapeName, ss.getShapePointer()); NL3D::CShapeBank *oldSB = Modules::psEdit().getScene()->getShapeBank(); diff --git a/code/studio/src/plugins/object_viewer/particle_system/particle_workspace_dialog.h b/code/studio/src/plugins/object_viewer/particle_system/particle_workspace_dialog.h index 7dfc4e781..92afb02e3 100644 --- a/code/studio/src/plugins/object_viewer/particle_system/particle_workspace_dialog.h +++ b/code/studio/src/plugins/object_viewer/particle_system/particle_workspace_dialog.h @@ -123,8 +123,8 @@ private: QAction *_lod2Action; QAction *_externIDAction; - std::unique_ptr _LocatedCopy; - std::unique_ptr _LocatedBindableCopy; + CUniquePtr _LocatedCopy; + CUniquePtr _LocatedBindableCopy; CParticleTreeItem *_currentItem;