]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCDDLRawData.cxx
Fix for coverity 17562
[u/mrichter/AliRoot.git] / TPC / AliTPCDDLRawData.cxx
index 5bb95a42ee32232a81e45faa5ce232abd90c22ba..5bde07cc15cb16281c573bb15c260fde0dbd2a52 100644 (file)
 #include <Riostream.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include "AliAltroBuffer.h"
+//#include "AliAltroBuffer.h"
+#include "AliAltroBufferV3.h"
 #include "AliTPCAltroMapping.h"
 #include "AliTPCDDLRawData.h"
-#include "AliRawDataHeader.h"
 #include "AliDAQ.h"
 
 ClassImp(AliTPCDDLRawData)
 ////////////////////////////////////////////////////////////////////////////////////////
 
 AliTPCDDLRawData::AliTPCDDLRawData(const AliTPCDDLRawData &source):
-  TObject(source)
+  TObject(source),
+  fVerbose(0)
 {
   // Copy Constructor
   fVerbose=source.fVerbose;
@@ -75,7 +76,7 @@ void AliTPCDDLRawData::RawData(const char* inputFileName){
   DataPad data;
 
   //AliAltroBuffer is used in write mode to generate raw data file
-  char  filename[15];
+  char  filename[101];
   Int_t ddlNumber=0;
   AliAltroBuffer *buffer=NULL;
   Int_t pSecNumber=-1;  //Previous Sector number
@@ -111,10 +112,11 @@ void AliTPCDDLRawData::RawData(const char* inputFileName){
        ddlNumber=data.Sec*2+data.SubSec;
       else
        ddlNumber=72+(data.Sec-36)*4+data.SubSec;
-      strcpy(filename,AliDAQ::DdlFileName("TPC",ddlNumber));
+      strncpy(filename,AliDAQ::DdlFileName("TPC",ddlNumber),100);
       Int_t patchIndex = data.SubSec;
       if(data.Sec>=36) patchIndex += 2;
-      buffer=new AliAltroBuffer(filename,mapping[patchIndex]);
+      //buffer=new AliAltroBuffer(filename,mapping[patchIndex]);
+      buffer=new AliAltroBufferV3(filename,mapping[patchIndex]);
       //size magic word sector number sub-sector number 0 for TPC 0 for uncompressed
       buffer->WriteDataHeader(kTRUE,kFALSE);//Dummy;
       bunchLength=1;
@@ -125,20 +127,21 @@ void AliTPCDDLRawData::RawData(const char* inputFileName){
       if ( (data.Time==(pTimeBin+1)) &&
           (pPadNumber==data.Pad) &&
           (pRowNumber==data.Row) &&
-          (pSecNumber==data.Sec)){
+          (pSecNumber==data.Sec) &&
+          (pSubSector==data.SubSec)){
        bunchLength++;
       }//end if
       else{
        buffer->FillBuffer(pTimeBin);
        buffer->FillBuffer(bunchLength+2);
        nwords+=2;
-       if ((pPadNumber!=data.Pad)||(pRowNumber!=data.Row)||(pSecNumber!=data.Sec)){
+       if ((pPadNumber!=data.Pad)||(pRowNumber!=data.Row)||(pSecNumber!=data.Sec)||(pSubSector!=data.SubSec)){
          //Trailer is formatted and inserted!!
          buffer->WriteTrailer(nwords,pPadNumber,pRowNumber,pSecNumber);
          numPackets++;
          nwords=0;
 
-         if(pSubSector!=data.SubSec){
+         if(pSecNumber!=data.Sec || pSubSector!=data.SubSec){
            //size magic word sector number sub-sector number 0 for TPC 0 for uncompressed
            buffer->Flush();
            buffer->WriteDataHeader(kFALSE,kFALSE);
@@ -149,10 +152,11 @@ void AliTPCDDLRawData::RawData(const char* inputFileName){
              ddlNumber=data.Sec*2+data.SubSec;
            else
              ddlNumber=72+(data.Sec-36)*4+data.SubSec;
-           strcpy(filename,AliDAQ::DdlFileName("TPC",ddlNumber));
+           strncpy(filename,AliDAQ::DdlFileName("TPC",ddlNumber),100);
            Int_t patchIndex = data.SubSec;
            if(data.Sec>=36) patchIndex += 2;
-           buffer=new AliAltroBuffer(filename,mapping[patchIndex]);
+           // buffer=new AliAltroBuffer(filename,mapping[patchIndex]);
+            buffer=new AliAltroBufferV3(filename,mapping[patchIndex]);
            buffer->WriteDataHeader(kTRUE,kFALSE);//Dummy;
            pSubSector=data.SubSec;
          }//end if