From a2b7484b58ac3044e5358ed81973255bc96f067d Mon Sep 17 00:00:00 2001 From: rgrosso Date: Wed, 26 Mar 2014 09:40:48 +0100 Subject: [PATCH] Go from pointer to ifstream to ifstream. --- STEER/CDB/AliCDBLocal.cxx | 9 ++++----- STEER/CDB/AliCDBManager.cxx | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/STEER/CDB/AliCDBLocal.cxx b/STEER/CDB/AliCDBLocal.cxx index c2d4c406ef8..bedf7a60977 100644 --- a/STEER/CDB/AliCDBLocal.cxx +++ b/STEER/CDB/AliCDBLocal.cxx @@ -978,12 +978,12 @@ void AliCDBLocal::QueryValidCVMFSFiles(TString& cvmfsOcdbTag) { // We expect the file with valid paths for this run to be generated in the current directory // and to be named as the CVMFS OCDB tag, without .gz, with '_runnumber' appended // Fill fValidFileIds from file - ifstream *file = new ifstream(runValidFile.Data()); - if (!*file) { + std::ifstream file (runValidFile.Data()); + if (!file.is_open()) { AliFatal(Form("Error opening file \"%s\"!", runValidFile.Data())); } TString filepath; - while (filepath.ReadLine(*file)) { + while (filepath.ReadLine(file)) { // skip line in case it is not a root file path if(! filepath.EndsWith(".root")) { continue; @@ -1018,8 +1018,7 @@ void AliCDBLocal::QueryValidCVMFSFiles(TString& cvmfsOcdbTag) { fValidFileIds.AddLast(validId); } - file->close(); - delete file; + file.close(); return; } diff --git a/STEER/CDB/AliCDBManager.cxx b/STEER/CDB/AliCDBManager.cxx index 642b2f9a5ab..012f782471d 100644 --- a/STEER/CDB/AliCDBManager.cxx +++ b/STEER/CDB/AliCDBManager.cxx @@ -742,13 +742,13 @@ void AliCDBManager::SetDefaultStorageFromRun(Int_t run) { } // now read the file with the uri and first and last run - ifstream *file = new ifstream(inoutFile.Data()); - if (!*file) { + std::ifstream file(inoutFile.Data()); + if (!file.is_open()) { AliFatal(Form("Error opening file \"%s\"!", inoutFile.Data())); } TString lhcPeriod; TObjArray* oStringsArray = 0; - while (lhcPeriod.ReadLine(*file)){ + while (lhcPeriod.ReadLine(file)){ oStringsArray = lhcPeriod.Tokenize(' '); } TObjString *oStrUri = dynamic_cast (oStringsArray->At(0)); @@ -761,8 +761,7 @@ void AliCDBManager::SetDefaultStorageFromRun(Int_t run) { fStartRunLHCPeriod = firstRun.Atoi(); fEndRunLHCPeriod = lastRun.Atoi(); - file->close(); - delete file; + file.close(); } else { // if not cvmfs case, "plain" AliEn case // retrieve XML file from alien -- 2.39.3