]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Removal of the last sprintf. Using TString instead
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Apr 2008 10:38:18 +0000 (10:38 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Apr 2008 10:38:18 +0000 (10:38 +0000)
RAW/AliTagDB.cxx

index 4aa2a29948621228308416fe4bf7da710fd7a71b..2edfe5e393f4a03f935deb91f030b17d13aeb883 100644 (file)
@@ -154,7 +154,7 @@ const char *AliTagDB::GetFileName() const
    // Return filename based on hostname and date and time. This will make
    // each file unique. The tags will be stored in the /data1/tags directory.
 
-   static char fname[1024];
+   static TString fname;
    const char *fs = fFS;
 
    // check that fs exists (crude check fails if fs is a file)
@@ -167,17 +167,14 @@ const char *AliTagDB::GetFileName() const
      if (header) runNumber = header->Get("RunNb");
    }
 
-   char hostname[1024];
-   strcpy(hostname, gSystem->HostName());
-
-   char *s;
-   if ((s = strchr(hostname, '.')))
-     *s = 0;
+   TString hostname;
+   hostname.Form("%s",gSystem->HostName());
+   hostname.Resize(hostname.First('.'));
 
    TTimeStamp ts;
 
-   sprintf(fname, "%s/Run%d.%s_%d_%d_%d.RAW.tag.root", fs, runNumber, hostname,
-          ts.GetDate(), ts.GetTime(), ts.GetNanoSec());
+   fname.Form("%s/Run%d.%s_%d_%d_%d.RAW.tag.root", fs, runNumber, hostname.Data(),
+             ts.GetDate(), ts.GetTime(), ts.GetNanoSec());
 
-   return fname;
+   return fname.Data();
 }