]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDBoolMap.cxx
Fix coverity issues
[u/mrichter/AliRoot.git] / FMD / AliFMDBoolMap.cxx
index aa2c6dc633f5574ddb4c8d0bde2ff924d5ab9548..3a7b86e464906491c36ff225b72064362de89106 100644 (file)
@@ -40,20 +40,33 @@ AliFMDBoolMap::AliFMDBoolMap(const AliFMDBoolMap& other)
               other.fMaxRings,
               other.fMaxSectors,
               other.fMaxStrips),
+    fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips),
     fData(0)
 {
   // Copy constructor
-  fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
+  if (fTotal == 0) fTotal = 51200;
   fData  = new Bool_t[fTotal];
-  for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
+  for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
 }
 
 //__________________________________________________________
-AliFMDBoolMap::AliFMDBoolMap(size_t maxDet,
-                         size_t maxRing,
-                         size_t maxSec,
-                         size_t maxStr)
+AliFMDBoolMap::AliFMDBoolMap()
+  : AliFMDMap(),
+    fTotal(0),
+    fData(0)
+{
+  // Constructor.
+  // Parameters:
+  //   None
+}
+
+//__________________________________________________________
+AliFMDBoolMap::AliFMDBoolMap(UShort_t maxDet,
+                            UShort_t maxRing,
+                            UShort_t maxSec,
+                            UShort_t maxStr)
   : AliFMDMap(maxDet, maxRing, maxSec, maxStr),
+    fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips),
     fData(0)
 {
   // Constructor.
@@ -62,7 +75,7 @@ AliFMDBoolMap::AliFMDBoolMap(size_t maxDet,
   //   maxRing Maximum number of rings per detector
   //   maxSec  Maximum number of sectors per ring
   //   maxStr  Maximum number of strips per sector
-  fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
+  if (fTotal == 0) fTotal = 51200;
   fData  = new Bool_t[fTotal];
   Reset();
 }
@@ -78,8 +91,9 @@ AliFMDBoolMap::operator=(const AliFMDBoolMap& other)
   fMaxStrips    = other.fMaxStrips;
   if (fData) delete [] fData;
   fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
+  if (fTotal == 0) fTotal = 51200;
   fData  = new Bool_t[fTotal];
-  for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
+  for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
   return *this;
 }
 
@@ -88,7 +102,7 @@ void
 AliFMDBoolMap::Reset(const Bool_t& val)
 {
   // Reset map to val
-  for (size_t i = 0; i < fTotal; i++) fData[i] = val;
+  for (Int_t i = 0; i < fTotal; i++) fData[i] = val;
 }
 
 //__________________________________________________________