]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliDigits.cxx
Using the robust option of AliRelAlignerKalman
[u/mrichter/AliRoot.git] / TPC / AliDigits.cxx
index bcb170a474dfbd9a98ba9ad863240cd9162a4656..710097e7f5b615db2e99531d6783c0cda07192f8 100644 (file)
 ClassImp(AliDigits)
 
 
-AliDigits::AliDigits()
+ AliDigits::AliDigits()
+           :AliSegmentID(),
+            fNrows(0),
+            fNcols(0),
+           fElements(0),
+            fIndex(0),
+            fBufType(0),
+            fThreshold(0),
+            fNelems(0),
+            fCurrentRow(0),
+            fCurrentCol(0),
+            fCurrentIndex(0) 
 {
   // 
   //default constructor
-  fIndex = 0;
-  fElements = 0;
-  fThreshold =0;
+  //
   Invalidate();
 }
 
-AliDigits::AliDigits(const AliDigits& digits):
-  AliSegmentID(digits)
+AliDigits::AliDigits(const AliDigits& digits)
+          :AliSegmentID(digits),
+            fNrows(0),
+            fNcols(0),
+           fElements(0),
+            fIndex(0),
+            fBufType(0),
+            fThreshold(0),
+            fNelems(0),
+            fCurrentRow(0),
+            fCurrentCol(0),
+            fCurrentIndex(0)
 {
   //
   //copy constructor
+  //
   fNrows = digits.fNrows;
   fNcols = digits.fNcols;
   fElements = new TArrayS(*(digits.fElements));
@@ -106,8 +126,8 @@ AliDigits::~AliDigits()
 Bool_t AliDigits::OutOfBoundsError(const char *where, Int_t row, Int_t column) 
 {
    // Generate an out-of-bounds error. Always returns false.
-   ::Error(where, "row %d  col %d out of bounds (size: %d x %d, this: 0x%08x)", 
-          row, column, fNrows, fNcols, this);
+   ::Error(where, "row %d  col %d out of bounds (size: %d x %d, this: 0x%08lx)", 
+          row, column, fNrows, fNcols, (ULong_t) this);
    return kFALSE;
 }
 
@@ -156,9 +176,11 @@ void AliDigits::Allocate(Int_t rows, Int_t columns)
 Int_t AliDigits::GetSize()
 {
   //
-  //return size of object
+  //return size of object as represented in the memory
   //
-  Int_t size = sizeof(this);
+  //  Int_t size = sizeof(this);
+  Int_t size = 0;   // COVERITY consider the previous statment as bug 
+                    // 
   if (fIndex!=0) size+= sizeof(fIndex)+fIndex->GetSize()*sizeof(Int_t);
   if (fElements!=0) size+= sizeof(fElements)+fElements->GetSize()*sizeof(Short_t);
   return size;
@@ -289,7 +311,7 @@ AliH2F *  AliDigits::GenerHisto()
   //
   //make digits histo 
   char ch[30];
-  sprintf(ch,"Segment_%d ",GetID());
+  snprintf(ch,30, "Segment_%d ",GetID());
   if ( (fNrows<1)|| (fNcols<1)) {
     return 0;
   }
@@ -345,6 +367,7 @@ void AliDigits::ExpandBuffer1()
     }else 
       if (row>fNrows){
        Invalidate();
+       delete [] buf;
        return;
       }      
   }
@@ -411,7 +434,7 @@ Bool_t AliDigits::First0()
   fCurrentCol = -1;
   fCurrentIndex = -1;
   Int_t i;
-  for (i=0; (( i<fNelems) && (fElements->At(i)<=fThreshold));i++);  //MI1211
+  for (i=0; (( i<fNelems) && (fElements->At(i)<=fThreshold));i++) {}  //MI1211
   if (i == fNelems) return kFALSE;
   fCurrentCol =i/fNrows;
   fCurrentRow =i%fNrows;
@@ -426,7 +449,7 @@ Bool_t AliDigits::Next0()
   //
   if (fCurrentIndex<0) return kFALSE;  // if we didn't adjust first 
   Int_t i;
-  for (i=fCurrentIndex+1; ( (i<fNelems) && (fElements->At(i)<=fThreshold) ) ;i++);
+  for (i=fCurrentIndex+1; ( (i<fNelems) && (fElements->At(i)<=fThreshold) ) ;i++) {}
   if (i >= fNelems)  {
     fCurrentIndex = -1;
     return kFALSE;