]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
fix for bug https://savannah.cern.ch/bugs/?72723
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 24 Jan 2011 19:59:41 +0000 (19:59 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 24 Jan 2011 19:59:41 +0000 (19:59 +0000)
the internal buffer size was not reset to 0 when a component did not produce any output
the following attempt to split failed because the position where to split appeared to
be inside the data buffer

HLT/BASE/AliHLTDataBuffer.cxx

index 1874d07a3b048fddb8353cf9b9f5640311653a75..b4c922e6beb0ed447c926faee2e36d2204b89e45 100644 (file)
@@ -918,10 +918,11 @@ int AliHLTDataBuffer::AliHLTRawBuffer::operator>(const AliHLTRawBuffer& op) cons
 AliHLTUInt8_t* AliHLTDataBuffer::AliHLTRawBuffer::UseBuffer(AliHLTUInt32_t size)
 {
   // mark a portion of the buffer as used
-  if (size>0 && fTotalSize>=size) {
+  if (fTotalSize>=size) {
     fSize=size;
     fLastEventCount=AliHLTDataBuffer::fgEventCount;
-    return fPtr;
+    // only return pointer if there is a portion of the buffer used
+    if (size>0) return fPtr;
   }
   return NULL;
 }
@@ -931,7 +932,7 @@ AliHLTDataBuffer::AliHLTRawBuffer* AliHLTDataBuffer::AliHLTRawBuffer::Split(AliH
   // split a buffer at specified size
   // only possible for buffers with external memory
   if (fTotalSize>size && 
-      (fSize==0 || fSize<=size) &&
+      (fSize==0 || fSize<=size) && // used size must fit into the first part
       fExternalPtr!=NULL) {
     AliHLTRawBuffer* part2=new AliHLTRawBuffer(fTotalSize-size, fPtr+size);
     if (part2) {