]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Go from pointer to ifstream to ifstream.
authorrgrosso <Raffaele.Grosso@cern.ch>
Wed, 26 Mar 2014 08:40:48 +0000 (09:40 +0100)
committerhristov <Peter.Hristov@cern.ch>
Thu, 27 Mar 2014 15:27:26 +0000 (16:27 +0100)
STEER/CDB/AliCDBLocal.cxx
STEER/CDB/AliCDBManager.cxx

index c2d4c406ef8eb3dfd856c719c0515a9cdd7ca935..bedf7a609774bb32b92548800138eb7f986c4eb6 100644 (file)
@@ -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;
 }
 
index 642b2f9a5ab0504ea8a77abd003f581aa941fa64..012f782471d119ebafb5f53fe92346df0e0d6697 100644 (file)
@@ -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<TObjString*> (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