coverity fixes (Jens)
authorjthaeder <jthaeder@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 30 Jan 2012 09:29:39 +0000 (09:29 +0000)
committerjthaeder <jthaeder@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 30 Jan 2012 09:29:39 +0000 (09:29 +0000)
TPC/AliTPCMonitorConfig.cxx
TPC/AliTPCMonitorMappingHandler.cxx

index ea1cca9..b1bf892 100755 (executable)
@@ -155,56 +155,54 @@ AliTPCMonitorConfig::AliTPCMonitorConfig(const AliTPCMonitorConfig &config) :
 AliTPCMonitorConfig &AliTPCMonitorConfig::operator =(const AliTPCMonitorConfig& config)
 {
   // assignement operator
-  if(this!=&config){ 
-    ((TNamed *)this)->operator=(config);
-    fFormat=config.fFormat;
-    fSector=config.fSector;
-    fSectorLast=config.fSectorLast;
-    fSectorLastDisplayed=config.fSectorLastDisplayed;
-    fSectorArr= new Int_t[36];
-    fFileLast= config.fFileLast;
-    fFileLastSet=config.fFileLastSet;
-    fFileCurrent=config.fFileCurrent;
-    fEventNext=config.fEventNext;
-    fEventNextID=config.fEventNextID;
-    fEventProcessed=config.fEventProcessed;
-    fRangeMaxAdcMin=config.fRangeMaxAdcMin;
-    fRangeMaxAdcMax=config.fRangeMaxAdcMax;
-    fRangeBaseMin=config.fRangeBaseMin;
-    fRangeBaseMax=config.fRangeBaseMax;
-    fRangeSumMin=config.fRangeSumMin;
-    fRangeSumMax=config.fRangeSumMax;
-    fCanvasXSize=config.fCanvasXSize;
-    fCanvasYSize=config.fCanvasYSize;
-    fCanvasXSpace=config.fCanvasXSpace;
-    fCanvasYSpace=config.fCanvasYSpace;
-    fCanvasXOffset=config.fCanvasXOffset;
-    fCanvasMainSize=config.fCanvasMainSize;
-    fMainXSize=config.fMainXSize;
-    fMainYSize=config.fMainYSize;
-    fBorderXSize=config.fBorderXSize;
-    fBorderYSize=config.fBorderYSize;
-    fButtonXSize=config.fButtonXSize;
-    fButtonYSize=config.fButtonYSize;
-    fButtonFirstX1=config.fButtonFirstX1;
-    fButtonFirstX2=config.fButtonFirstX2;
-    fButtonFirstY=config.fButtonFirstY;
-    fWrite10Bit=config.fWrite10Bit;
-    fComponents= new Float_t[10];
-    fSamplingFreq=config.fSamplingFreq;
-    fPedestals=config.fPedestals;
-    fNumOfChannels=config.fNumOfChannels;
-    fTimeBins=config.fTimeBins;
-    fMaxHwAddr=config.fMaxHwAddr;
-    fFitPulse=config.fFitPulse; 
-    fProcOneSector=config.fProcOneSector;
+  if(this == &config) return *this;
+  
+  TNamed::operator=(config);
+  fFormat=config.fFormat;
+  fSector=config.fSector;
+  fSectorLast=config.fSectorLast;
+  fSectorLastDisplayed=config.fSectorLastDisplayed;
+  if (!fSectorArr) fSectorArr= new Int_t[36];
+  fFileLast= config.fFileLast;
+  fFileLastSet=config.fFileLastSet;
+  fFileCurrent=config.fFileCurrent;
+  fEventNext=config.fEventNext;
+  fEventNextID=config.fEventNextID;
+  fEventProcessed=config.fEventProcessed;
+  fRangeMaxAdcMin=config.fRangeMaxAdcMin;
+  fRangeMaxAdcMax=config.fRangeMaxAdcMax;
+  fRangeBaseMin=config.fRangeBaseMin;
+  fRangeBaseMax=config.fRangeBaseMax;
+  fRangeSumMin=config.fRangeSumMin;
+  fRangeSumMax=config.fRangeSumMax;
+  fCanvasXSize=config.fCanvasXSize;
+  fCanvasYSize=config.fCanvasYSize;
+  fCanvasXSpace=config.fCanvasXSpace;
+  fCanvasYSpace=config.fCanvasYSpace;
+  fCanvasXOffset=config.fCanvasXOffset;
+  fCanvasMainSize=config.fCanvasMainSize;
+  fMainXSize=config.fMainXSize;
+  fMainYSize=config.fMainYSize;
+  fBorderXSize=config.fBorderXSize;
+  fBorderYSize=config.fBorderYSize;
+  fButtonXSize=config.fButtonXSize;
+  fButtonYSize=config.fButtonYSize;
+  fButtonFirstX1=config.fButtonFirstX1;
+  fButtonFirstX2=config.fButtonFirstX2;
+  fButtonFirstY=config.fButtonFirstY;
+  fWrite10Bit=config.fWrite10Bit;
+  if (!fComponents) fComponents= new Float_t[10];
+  fSamplingFreq=config.fSamplingFreq;
+  fPedestals=config.fPedestals;
+  fNumOfChannels=config.fNumOfChannels;
+  fTimeBins=config.fTimeBins;
+  fMaxHwAddr=config.fMaxHwAddr;
+  fFitPulse=config.fFitPulse;
+  fProcOneSector=config.fProcOneSector;
 
+  for(Int_t i =0; i<36; i++) { fSectorArr[i]  = 0;}
+  for(Int_t i =0; i<10;i++)  { fComponents[i] = 0.;}
     
-    for(Int_t i =0; i<36; i++) { fSectorArr[i]  =  0;}
-    for(Int_t i =0; i<10;i++)  { fComponents[i] =0.0;}
-    
-      
-  }
   return *this;
 }
 
index 720c3b8..cff5a7d 100755 (executable)
@@ -279,27 +279,30 @@ void AliTPCMonitorMappingHandler::ReadMapping(char* mapfile)
 
   if (!in->is_open()) return;
 
-//   int numLines = 0;
-//   while ( std::getline(*in, std::string()) )
-//     ++numLines;
-//  in->seekg(0,ios::beg);
+  int numLines = 0;
+  std::string line;
+  while ( std::getline(*in, line) )
+    ++numLines;
+ in->seekg(0,ios::beg);
   
 //   *in >> readcarry;
 //   version = atoi(readcarry);
   *in >> version;
-//   --numLines;
+  --numLines;
 //   *in >> readcarry;
 //   fnumofChannels = atoi(readcarry);
   *in >> fnumofChannels;
-//   --numLines;
+  --numLines;
   
 //   *in >> readcarry;
 //   fmaxHWAdress = atoi(readcarry);
   *in >> fmaxHWAdress;
   fsizeofArray = fmaxHWAdress;
-//   --numLines;
-  
-//   fnumofChannels=TMath::Min(fnumofChannels,numLines);
+  --numLines;
+
+  //consistency check
+  fnumofChannels=TMath::Abs(fnumofChannels);
+  fnumofChannels=TMath::Min(fnumofChannels,numLines);
   
   Short_t *fmappingEmptyRow = new Short_t[11];
   for(Int_t i = 0; i < 11 ; i++) {