File indexing completed on 2025-08-03 08:20:34
0001 #include "gzbuffer.h"
0002 #include <zlib.h>
0003
0004
0005 gzbuffer::gzbuffer (PHDWORD *array , const int length )
0006
0007 {
0008 is_good =1;
0009 bufferarray=0;
0010 theBuffer=0;
0011
0012 uLong bytes;
0013 uLongf outputlength_in_bytes;
0014 if (array[1] == GZBUFFERMARKER )
0015 {
0016 bytes = array[0]-4*BUFFERHEADERLENGTH;
0017 outputlength_in_bytes = array[3];
0018 }
0019 else if ( u4swap(array[1]) == GZBUFFERMARKER)
0020 {
0021 bytes = i4swap(array[0])-16;
0022 outputlength_in_bytes = i4swap(array[3]);
0023 }
0024
0025 else
0026 {
0027 COUT << " wrong buffer" << std::endl;
0028 is_good = 0;
0029 return;
0030 }
0031
0032
0033 int outputlength = (outputlength_in_bytes+3)/4;
0034 bufferarray = new PHDWORD[outputlength];
0035 uLongf i = outputlength_in_bytes;
0036
0037 uncompress ( (Bytef*) bufferarray, &i, (Bytef*) &array[4], bytes);
0038
0039 theBuffer = new prdfBuffer(bufferarray, outputlength);
0040
0041 }
0042
0043 int gzbuffer::getBufferSequence() const
0044 {
0045 if ( !theBuffer) return 0;
0046 return theBuffer->getBufferSequence();
0047 }
0048
0049
0050
0051 Event * gzbuffer::getEvent()
0052 {
0053 return theBuffer->getEvent();
0054 }
0055
0056
0057
0058 gzbuffer::~gzbuffer()
0059 {
0060 if ( bufferarray) delete [] bufferarray;
0061 if ( theBuffer) delete theBuffer;
0062 }
0063
0064