From 7de677a920483435700ec4e84ebe8dff95b1bcb4 Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Thu, 29 Sep 2016 20:32:11 +0200 Subject: [PATCH] More auto_ptr => unique_ptr replacements. --- graf3d/gl/inc/TGLContext.h | 2 +- graf3d/gl/src/TGLContext.cxx | 15 ++++++--------- graf3d/gl/src/TGLPadPainter.cxx | 2 +- math/mathmore/src/GSLNLSMinimizer.cxx | 2 +- proof/proofx/src/TXProofMgr.cxx | 2 +- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/graf3d/gl/inc/TGLContext.h b/graf3d/gl/inc/TGLContext.h index e7396acdf6fbb..7d833724121b0 100644 --- a/graf3d/gl/inc/TGLContext.h +++ b/graf3d/gl/inc/TGLContext.h @@ -38,7 +38,7 @@ class TGLContext private: TGLPaintDevice *fDevice; - TGLContextPrivate *fPimpl; + std::unique_ptr fPimpl; Bool_t fFromCtor;//To prohibit user's calls of SetContext. Bool_t fValid; diff --git a/graf3d/gl/src/TGLContext.cxx b/graf3d/gl/src/TGLContext.cxx index ebba3e10e1a20..62b5e7e99afd5 100644 --- a/graf3d/gl/src/TGLContext.cxx +++ b/graf3d/gl/src/TGLContext.cxx @@ -51,7 +51,6 @@ Bool_t TGLContext::fgGlewInitDone = kFALSE; TGLContext::TGLContext(TGLWidget *wid, Bool_t shareDefault, const TGLContext *shareList) : fDevice(wid), - fPimpl(0), fFromCtor(kTRUE), fValid(kFALSE), fIdentity(0) @@ -128,7 +127,7 @@ void TGLContext::SetContext(TGLWidget *widget, const TGLContext *shareList) return; } - std::auto_ptr safe_ptr(fPimpl = new TGLContextPrivate); + fPimpl.reset(new TGLContextPrivate); LayoutCompatible_t *trick = reinterpret_cast(widget->GetId()); HWND hWND = *trick->fPHwnd; @@ -160,7 +159,7 @@ void TGLContext::SetContext(TGLWidget *widget, const TGLContext *shareList) TGLContextPrivate::RegisterContext(this); dcGuard.Stop(); - safe_ptr.release(); + fPimpl.reset(); } //////////////////////////////////////////////////////////////////////////////// @@ -255,7 +254,7 @@ void TGLContext::SetContext(TGLWidget *widget, const TGLContext *shareList) return; } - std::auto_ptr safe_ptr(fPimpl = new TGLContextPrivate); + fPimpl.reset(new TGLContextPrivate); fPimpl->fGLContext = gVirtualX->CreateOpenGLContext(widget->GetId(), shareList ? shareList->fPimpl->fGLContext : 0); fPimpl->fWindowID = widget->GetId(); @@ -264,7 +263,7 @@ void TGLContext::SetContext(TGLWidget *widget, const TGLContext *shareList) fDevice->AddContext(this); TGLContextPrivate::RegisterContext(this); - safe_ptr.release(); + fPimpl.reset(); } //////////////////////////////////////////////////////////////////////////////// @@ -337,7 +336,7 @@ void TGLContext::SetContext(TGLWidget *widget, const TGLContext *shareList) return; } - std::auto_ptr safe_ptr(fPimpl = new TGLContextPrivate); + fPimpl.reset(new TGLContextPrivate); Display *dpy = static_cast(widget->GetInnerData().first); XVisualInfo *visInfo = static_cast(widget->GetInnerData().second); @@ -358,7 +357,7 @@ void TGLContext::SetContext(TGLWidget *widget, const TGLContext *shareList) fDevice->AddContext(this); TGLContextPrivate::RegisterContext(this); - safe_ptr.release(); + fPimpl.reset(); } //////////////////////////////////////////////////////////////////////////////// @@ -439,8 +438,6 @@ TGLContext::~TGLContext() } fIdentity->Release(this); - - delete fPimpl; } //////////////////////////////////////////////////////////////////////////////// diff --git a/graf3d/gl/src/TGLPadPainter.cxx b/graf3d/gl/src/TGLPadPainter.cxx index 187efef5f5862..04e4804351c8a 100644 --- a/graf3d/gl/src/TGLPadPainter.cxx +++ b/graf3d/gl/src/TGLPadPainter.cxx @@ -929,7 +929,7 @@ void TGLPadPainter::SaveImage(TVirtualPad *pad, const char *fileName, Int_t type //glReadPixels(0, 0, canvas->GetWw(), canvas->GetWh(), GL_BGRA, GL_UNSIGNED_BYTE, (char *)&buff[0]); glReadPixels(0, 0, canvas->GetWw(), canvas->GetWh(), GL_RGBA, GL_UNSIGNED_BYTE, (char *)&buff[0]); - std::auto_ptr image(TImage::Create()); + std::unique_ptr image(TImage::Create()); if (!image.get()) { ::Error("TGLPadPainter::SaveImage", "TImage creation failed"); return; diff --git a/math/mathmore/src/GSLNLSMinimizer.cxx b/math/mathmore/src/GSLNLSMinimizer.cxx index 70bbedc6bd57d..c3a035c408e68 100644 --- a/math/mathmore/src/GSLNLSMinimizer.cxx +++ b/math/mathmore/src/GSLNLSMinimizer.cxx @@ -223,7 +223,7 @@ bool GSLNLSMinimizer::Minimize() { MultiNumGradFunction * gradFunction = new MultiNumGradFunction(*fChi2Func); MinimTransformFunction * trFuncRaw = CreateTransformation(startValues, gradFunction); // need to transform in a FitTransformFunction which is set in the residual functions - std::auto_ptr trFunc; + std::unique_ptr trFunc; if (trFuncRaw) { trFunc.reset(new FitTransformFunction(*fChi2Func, trFuncRaw) ); //FitTransformationFunction *trFunc = new FitTransformFunction(*fChi2Func, trFuncRaw); diff --git a/proof/proofx/src/TXProofMgr.cxx b/proof/proofx/src/TXProofMgr.cxx index d50f3feecef7c..6fa35faa7e470 100644 --- a/proof/proofx/src/TXProofMgr.cxx +++ b/proof/proofx/src/TXProofMgr.cxx @@ -1492,7 +1492,7 @@ Int_t TXProofMgr::GetFile(const char *remote, const char *local, const char *opt if (rc == 0) { // Check if everything went fine - std::auto_ptr md5loc(TMD5::FileChecksum(fileloc)); + std::unique_ptr md5loc(TMD5::FileChecksum(fileloc)); if (!(md5loc.get())) { Error("GetFile", "cannot get MD5 checksum of the new local file '%s'", fileloc.Data()); rc = -1;