Coverity fixes in TUHKMgen
authoriarsene <iarsene@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 20 Mar 2011 17:10:33 +0000 (17:10 +0000)
committeriarsene <iarsene@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 20 Mar 2011 17:10:33 +0000 (17:10 +0000)
TUHKMgen/AliGenUHKM.cxx
TUHKMgen/AliGenUHKM.h
TUHKMgen/TUHKMgen.cxx
TUHKMgen/TUHKMgen.h
TUHKMgen/UHKM/DatabasePDG.cxx

index 71c1902d221d96f9b4f88664a5f40183aad03ad2..7e659fb39eeb0de04fbe1a2fd216df7557731302 100755 (executable)
@@ -119,10 +119,8 @@ AliGenUHKM::AliGenUHKM()
   fHydjetParams.fIenglu=0;
   fHydjetParams.fIanglu=0;
 */
-  if(strlen(Form("%s/TUHKMgen/UHKM/particles.data", gSystem->Getenv("ALICE_ROOT")))<255)
-    strncpy(fParticleFilename, Form("%s/TUHKMgen/UHKM/particles.data", gSystem->Getenv("ALICE_ROOT")), 256);
-  if(strlen(Form("%s/TUHKMgen/UHKM/tabledecay.txt",gSystem->Getenv("ALICE_ROOT")))<255)
-    strncpy(fDecayFilename, Form("%s/TUHKMgen/UHKM/tabledecay.txt", gSystem->Getenv("ALICE_ROOT")), 256);
+  strncpy(fParticleFilename, Form("%s/TUHKMgen/UHKM/particles.data", gSystem->Getenv("ALICE_ROOT")), 255);
+  strncpy(fDecayFilename, Form("%s/TUHKMgen/UHKM/tabledecay.txt", gSystem->Getenv("ALICE_ROOT")), 255);
   for(Int_t i=0; i<500; i++) {
     fStableFlagPDG[i] = 0;
     fStableFlagStatus[i] = kFALSE;
@@ -211,10 +209,8 @@ AliGenUHKM::AliGenUHKM(Int_t npart)
   fHydjetParams.fIanglu=0;
 */
 
-  if(strlen(Form("%s/TUHKMgen/UHKM/particles.data", gSystem->Getenv("ALICE_ROOT")))<255)
-    strncpy(fParticleFilename, Form("%s/TUHKMgen/UHKM/particles.data", gSystem->Getenv("ALICE_ROOT")), 256);
-  if(strlen(Form("%s/TUHKMgen/UHKM/tabledecay.txt", gSystem->Getenv("ALICE_ROOT")))<255)
-    strncpy(fDecayFilename, Form("%s/TUHKMgen/UHKM/tabledecay.txt", gSystem->Getenv("ALICE_ROOT")), 256);
+  strncpy(fParticleFilename, Form("%s/TUHKMgen/UHKM/particles.data", gSystem->Getenv("ALICE_ROOT")), 255);
+  strncpy(fDecayFilename, Form("%s/TUHKMgen/UHKM/tabledecay.txt", gSystem->Getenv("ALICE_ROOT")), 255);
   for(Int_t i=0; i<500; i++) {
     fStableFlagPDG[i] = 0;
     fStableFlagStatus[i] = kFALSE;
@@ -503,7 +499,7 @@ void AliGenUHKM::Generate()
   fCollisionGeometry = (AliGenHijingEventHeader*)  header;
 
   delete [] idsOnStack;
-
+  delete [] newPos;
 }
 
 void AliGenUHKM::Copy(TObject &) const
index 79b8661ddc41c41b0f730b5a959ec116aeb54367..401f826c02bc42bf576f72ede1fc8867d4788fbf 100755 (executable)
@@ -86,8 +86,8 @@ class AliGenUHKM : public AliGenMC
                                                    //gluons (0: small-angular, 1: wide-angular, 2:collinear) (default: 0).
 
 
-  void SetPDGParticleFile(const Char_t *name) {if(strlen(name)<255) strncpy(fParticleFilename, name, 256);}//Set the filename containing the particle PDG info
-  void SetPDGDecayFile(const Char_t *name) {if(strlen(name)<255) strncpy(fDecayFilename, name, 256);} //Set the filename containing the PDG decay channels info
+  void SetPDGParticleFile(const Char_t *name) {strncpy(fParticleFilename, name, 255);}//Set the filename containing the particle PDG info
+  void SetPDGDecayFile(const Char_t *name) {strncpy(fDecayFilename, name, 255);} //Set the filename containing the PDG decay channels info
   void SetPDGParticleStable(Int_t pdg, Bool_t value) { // Turn on/off the decay flag for a PDG particle
     fStableFlagPDG[fStableFlagged] = pdg;
     fStableFlagStatus[fStableFlagged++] = value;
index 2726f7c745553c47a88975e7193e931ec0252de0..bd8ff34cb7f073870eeb34fb3d8c2c67cf672b07 100755 (executable)
@@ -121,10 +121,8 @@ TUHKMgen::TUHKMgen() :
   fHydjetParams.fIanglu=0;  
 */
 
-  if(strlen(Form("%s/TUHKMgen/UHKM/particles.data", gSystem->Getenv("ALICE_ROOT")))<255)   
-    strncpy(fParticleFilename, Form("%s/TUHKMgen/UHKM/particles.data", gSystem->Getenv("ALICE_ROOT")), 256);
-  if(strlen(Form("%s/TUHKMgen/UHKM/tabledecay.txt",gSystem->Getenv("ALICE_ROOT")))<255)
-    strncpy(fDecayFilename, Form("%s/TUHKMgen/UHKM/tabledecay.txt", gSystem->Getenv("ALICE_ROOT")), 256);
+  strncpy(fParticleFilename, Form("%s/TUHKMgen/UHKM/particles.data", gSystem->Getenv("ALICE_ROOT")), 255);
+  strncpy(fDecayFilename, Form("%s/TUHKMgen/UHKM/tabledecay.txt", gSystem->Getenv("ALICE_ROOT")), 255);
   for(Int_t i=0; i<500; i++) {
     fStableFlagPDG[i] = 0;
     fStableFlagStatus[i] = kFALSE;
index 12c23877cd82297cf2707c4bc24254609c821b26..0d6405f41217b797a31eb2862bb7c231e75efb9a 100755 (executable)
@@ -107,8 +107,8 @@ class TUHKMgen : public TGenerator {
                                   // gluons (0: small-angular, 1: wide-angular, 2:collinear) (default: 0).
   
  
-  void SetPDGParticleFile(const Char_t *name)              {if(strlen(name)<255) strncpy(fParticleFilename, name, 256);}     // Set the filename containing the particle PDG info
-  void SetPDGDecayFile(const Char_t *name)                 {if(strlen(name)<255) strncpy(fDecayFilename, name, 256);}        // Set the filename containing the PDG decay channels info
+  void SetPDGParticleFile(const Char_t *name)   {strncpy(fParticleFilename, name, 255);}     // Set the filename containing the particle PDG info
+  void SetPDGDecayFile(const Char_t *name) {strncpy(fDecayFilename, name, 255);}        // Set the filename containing the PDG decay channels info
   void SetPDGParticleStable(Int_t pdg, Bool_t value) {                                      // Turn on/off the decay flag for a PDG particle
     fStableFlagPDG[fStableFlagged] = pdg;
     fStableFlagStatus[fStableFlagged++] = value;
index 7270477f84ded227c869f646e351bd49fd6b264b..c290c6d5ea155a7d230f74328f5e9f119db174d6 100644 (file)
@@ -56,13 +56,11 @@ DatabasePDG::~DatabasePDG() {
 }
 
 void DatabasePDG::SetParticleFilename(Char_t *filename) {
-  if(strlen(filename)<255)
-    strncpy(fParticleFilename, filename, 256);
+  strncpy(fParticleFilename, filename, 255);
 }
 
 void DatabasePDG::SetDecayFilename(Char_t *filename) {
-  if(strlen(filename)<255)
-    strncpy(fDecayFilename, filename, 256);
+  strncpy(fDecayFilename, filename, 255);
 }
 
 Bool_t DatabasePDG::LoadData() {