Skip to content

Commit

Permalink
More auto_ptr => unique_ptr replacements.
Browse files Browse the repository at this point in the history
  • Loading branch information
Axel-Naumann committed Sep 29, 2016
1 parent d0d8975 commit 7de677a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion graf3d/gl/inc/TGLContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TGLContext

private:
TGLPaintDevice *fDevice;
TGLContextPrivate *fPimpl;
std::unique_ptr<TGLContextPrivate> fPimpl;

Bool_t fFromCtor;//To prohibit user's calls of SetContext.
Bool_t fValid;
Expand Down
15 changes: 6 additions & 9 deletions graf3d/gl/src/TGLContext.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -128,7 +127,7 @@ void TGLContext::SetContext(TGLWidget *widget, const TGLContext *shareList)
return;
}

std::auto_ptr<TGLContextPrivate> safe_ptr(fPimpl = new TGLContextPrivate);
fPimpl.reset(new TGLContextPrivate);
LayoutCompatible_t *trick =
reinterpret_cast<LayoutCompatible_t *>(widget->GetId());
HWND hWND = *trick->fPHwnd;
Expand Down Expand Up @@ -160,7 +159,7 @@ void TGLContext::SetContext(TGLWidget *widget, const TGLContext *shareList)
TGLContextPrivate::RegisterContext(this);

dcGuard.Stop();
safe_ptr.release();
fPimpl.reset();
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -255,7 +254,7 @@ void TGLContext::SetContext(TGLWidget *widget, const TGLContext *shareList)
return;
}

std::auto_ptr<TGLContextPrivate> safe_ptr(fPimpl = new TGLContextPrivate);
fPimpl.reset(new TGLContextPrivate);

fPimpl->fGLContext = gVirtualX->CreateOpenGLContext(widget->GetId(), shareList ? shareList->fPimpl->fGLContext : 0);
fPimpl->fWindowID = widget->GetId();
Expand All @@ -264,7 +263,7 @@ void TGLContext::SetContext(TGLWidget *widget, const TGLContext *shareList)
fDevice->AddContext(this);
TGLContextPrivate::RegisterContext(this);

safe_ptr.release();
fPimpl.reset();
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -337,7 +336,7 @@ void TGLContext::SetContext(TGLWidget *widget, const TGLContext *shareList)
return;
}

std::auto_ptr<TGLContextPrivate> safe_ptr(fPimpl = new TGLContextPrivate);
fPimpl.reset(new TGLContextPrivate);
Display *dpy = static_cast<Display *>(widget->GetInnerData().first);
XVisualInfo *visInfo = static_cast<XVisualInfo *>(widget->GetInnerData().second);

Expand All @@ -358,7 +357,7 @@ void TGLContext::SetContext(TGLWidget *widget, const TGLContext *shareList)
fDevice->AddContext(this);
TGLContextPrivate::RegisterContext(this);

safe_ptr.release();
fPimpl.reset();
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -439,8 +438,6 @@ TGLContext::~TGLContext()
}

fIdentity->Release(this);

delete fPimpl;
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion graf3d/gl/src/TGLPadPainter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<TImage> image(TImage::Create());
std::unique_ptr<TImage> image(TImage::Create());
if (!image.get()) {
::Error("TGLPadPainter::SaveImage", "TImage creation failed");
return;
Expand Down
2 changes: 1 addition & 1 deletion math/mathmore/src/GSLNLSMinimizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<FitTransformFunction> trFunc;
std::unique_ptr<FitTransformFunction> trFunc;
if (trFuncRaw) {
trFunc.reset(new FitTransformFunction(*fChi2Func, trFuncRaw) );
//FitTransformationFunction *trFunc = new FitTransformFunction(*fChi2Func, trFuncRaw);
Expand Down
2 changes: 1 addition & 1 deletion proof/proofx/src/TXProofMgr.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<TMD5> md5loc(TMD5::FileChecksum(fileloc));
std::unique_ptr<TMD5> md5loc(TMD5::FileChecksum(fileloc));
if (!(md5loc.get())) {
Error("GetFile", "cannot get MD5 checksum of the new local file '%s'", fileloc.Data());
rc = -1;
Expand Down

0 comments on commit 7de677a

Please sign in to comment.