]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSGridFile.cxx
Fixing coverity bugs
[u/mrichter/AliRoot.git] / PHOS / AliPHOSGridFile.cxx
index 3408191074926024890b3f749f4a4d65032cc50b..f1d1177b344f0b3e6a94244baeeea71ebefc2d31 100644 (file)
@@ -17,6 +17,9 @@
 /* History of cvs commits:
  *
  * $Log$
+ * Revision 1.5  2005/05/28 14:19:04  schutz
+ * Compilation warnings fixed by T.P.
+ *
  */
 
 //_________________________________________________________________________
 ClassImp(AliPHOSGridFile)
 
 //____________________________________________________________________________
-AliPHOSGridFile::AliPHOSGridFile(TString grid)
+AliPHOSGridFile::AliPHOSGridFile(TString grid):
+  fGrid(0),
+  fRoot("/alice/production/aliprod"),
+  fYear(""),
+  fProd(""),
+  fVers(""),
+  fType(""),
+  fRun(""),
+  fEvt(""),
+  fPath("")
 {
   // default ctor; Doing initialisation ;
-  fGrid = 0 ;
   if (grid == "alien")
     fGrid = TGrid::Connect("alien://aliendb1.cern.ch:15000/?direct") ;
   else
@@ -49,22 +60,31 @@ AliPHOSGridFile::AliPHOSGridFile(TString grid)
   if ( !fGrid )
     Error("ctor", "Cannot connect to alien://aliendb1.cern.ch:15000/?direct") ;
 
-  fRoot = "/alice/production/aliprod" ;
 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
   if ( !fGrid->OpenDir(fRoot) )
     Error("ctor", "Cannot find directory %s ", fRoot.Data() ) ;
 #else
   Error("AliPHOSGridFile", "needs to be ported to new TGrid");
 #endif
-  fYear = "" ;
-  fProd = "" ;
-  fVers = "" ;
-  fType = "" ;
-  fRun  = "" ;
-  fEvt  = "" ;
 
   fPath += fRoot ;
+}
 
+//____________________________________________________________________________
+AliPHOSGridFile::AliPHOSGridFile(const AliPHOSGridFile &rhs) :
+  TObject(rhs),
+  fGrid(0),
+  fRoot(""),
+  fYear(""),
+  fProd(""),
+  fVers(""),
+  fType(""),
+  fRun(""),
+  fEvt(""),
+  fPath("")
+{
+  //copy ctor
+  rhs.Copy(*this);
 }
 
 //____________________________________________________________________________
@@ -120,7 +140,7 @@ void AliPHOSGridFile::Help()
 {
   // Prints information on available lfn's
 
-  AliInfo(Form("")) ;
+  AliInfo(Form(" ")) ;
 
 }
 
@@ -130,7 +150,7 @@ void AliPHOSGridFile::ListEvents() const
   // list the available events for the current path and run selected
 
   char path[80] ;
-  sprintf(path, "%s/%s-%s/%s/%s/%s", fRoot.Data(), fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), fRun.Data()) ;
+  snprintf(path,80,"%s/%s-%s/%s/%s/%s", fRoot.Data(), fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), fRun.Data()) ;
   AliInfo(Form("Searching %s", path)) ;
 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
   Grid_ResultHandle_t gr = fGrid->Find(path, "galice.root") ;
@@ -147,7 +167,7 @@ void AliPHOSGridFile::ListRuns() const
   // list the available runs for the current path selected
 
   char path[80] ;
-  sprintf(path, "%s/%s-%s/%s/%s", fRoot.Data(), fYear.Data(), fProd.Data(), fVers.Data(), fType.Data()) ;
+  snprintf(path,80,"%s/%s-%s/%s/%s", fRoot.Data(), fYear.Data(), fProd.Data(), fVers.Data(), fType.Data()) ;
   AliInfo(Form("Searching %s", path)) ;
 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
   Grid_ResultHandle_t gr = fGrid->OpenDir(path) ;
@@ -164,7 +184,7 @@ Bool_t AliPHOSGridFile::SetYearProd(TString year, TString prod)
   // set the year and verifies if the directory exists
   Bool_t rv = kFALSE ;
   char tempo[80] ;
-  sprintf(tempo, "/%s-%s", year.Data(), prod.Data()) ;
+  snprintf(tempo,80,"/%s-%s", year.Data(), prod.Data()) ;
 
   TString path(fRoot) ;
   path += tempo ;
@@ -189,7 +209,7 @@ Bool_t AliPHOSGridFile::SetVers(TString vers)
   // set the year and verifies if the directory exists
   Bool_t rv = kFALSE ;
   char tempo[80] ;
-  sprintf(tempo, "/%s-%s/%s", fYear.Data(), fProd.Data(), vers.Data()) ;
+  snprintf(tempo,80,"/%s-%s/%s", fYear.Data(), fProd.Data(), vers.Data()) ;
   fVers = tempo ;
 
   TString path(fRoot) ;
@@ -214,7 +234,7 @@ Bool_t AliPHOSGridFile::SetType(TString type)
   // set the year and verifies if the directory exists
   Bool_t rv = kFALSE ;
   char tempo[80] ;
-  sprintf(tempo, "/%s-%s/%s/%s", fYear.Data(), fProd.Data(), fVers.Data(), type.Data()) ;
+  snprintf(tempo,80,"/%s-%s/%s/%s", fYear.Data(), fProd.Data(), fVers.Data(), type.Data()) ;
 
   TString path(fRoot) ;
   path += tempo ;
@@ -238,7 +258,7 @@ Bool_t AliPHOSGridFile::SetPath(TString year, TString prod, TString vers, TStrin
   // set the year and verifies if the directory exists
   Bool_t rv = kFALSE ;
   char tempo[80] ;
-  sprintf(tempo, "/%s-%s/%s/%s", year.Data(), prod.Data(), vers.Data(), type.Data()) ;
+  snprintf(tempo,80,"/%s-%s/%s/%s", year.Data(), prod.Data(), vers.Data(), type.Data()) ;
 
   TString path(fRoot) ;
   path += tempo ;
@@ -274,7 +294,7 @@ Bool_t AliPHOSGridFile::SetRun(Int_t run)
     srun.Prepend("0") ;
 
   char tempo[80] ;
-  sprintf(tempo, "/%s-%s/%s/%s/%s", fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), srun.Data()) ;
+  snprintf(tempo,80,"/%s-%s/%s/%s/%s", fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), srun.Data()) ;
 
   TString path(fRoot) ;
   path += tempo ;
@@ -307,7 +327,7 @@ Bool_t AliPHOSGridFile::SetEvt(Int_t evt)
     sevt.Prepend("0") ;
 
   char tempo[80] ;
-  sprintf(tempo, "/%s-%s/%s/%s/%s/%s/", fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), fRun.Data(), sevt.Data()) ;
+  snprintf(tempo,80,"/%s-%s/%s/%s/%s/%s/", fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), fRun.Data(), sevt.Data()) ;
   TString path(fRoot) ;
   path += tempo ;
 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)