replaced sprintf -> snprintf throughout.

This commit is contained in:
2022-11-05 20:16:44 +01:00
parent 44aacfca50
commit f3414f687c
27 changed files with 120 additions and 120 deletions

View File

@ -317,7 +317,7 @@ void TPofBCalc::Calculate(const TBofZCalc *BofZ, const TTrimSPData *dataTrimSP,
seconds = time (NULL);
char debugfile[50];
int n = sprintf (debugfile, "test_Bz_%ld_%f.dat", seconds, fBmin);
int n = snprintf (debugfile, sizeof(debugfile), "test_Bz_%ld_%f.dat", seconds, fBmin);
if (n > 0) {
ofstream of(debugfile);
@ -330,10 +330,10 @@ void TPofBCalc::Calculate(const TBofZCalc *BofZ, const TTrimSPData *dataTrimSP,
}
char debugfile1[50];
int n1 = sprintf (debugfile1, "test_NZ_%ld_%f.dat", seconds, para[2]);
int n1 = snprintf (debugfile1, sizeof(debugfile1), "test_NZ_%ld_%f.dat", seconds, para[2]);
char debugfile2[50];
int n2 = sprintf (debugfile2, "test_NZgss_%ld_%f.dat", seconds, para[2]);
int n2 = snprintf (debugfile2, sizeof(debugfile2), "test_NZgss_%ld_%f.dat", seconds, para[2]);
if (n1 > 0) {
ofstream of1(debugfile1);

View File

@ -357,7 +357,7 @@ void TPofTCalc::FakeData(const string &rootOutputFileName, const std::vector<dou
// create run info folder and content
TFolder *runInfoFolder = new TFolder("RunInfo", "Run Info");
TLemRunHeader *runHeader = new TLemRunHeader();
//sprintf(str, "Fake Data generated from %s", pBFileName.Data());
//snprintf(str, sizeof(str), "Fake Data generated from %s", pBFileName.Data());
runHeader->SetRunTitle("Fake Data");
if (optPar && (optPar->size() > 1)) { // set energy and field if they were specified
runHeader->SetImpEnergy((*optPar)[1]);