Anton Fernando
Anton Fernando

Reputation: 31

After reboot, on resumption of uncompression, inflate() is reporting Z_DATA_ERROR

Thanks Mark, on resumption, now I get Z_DATA_ERROR

case STORED:
   strm->msg = (char *)"invalid stored block lengths";  // got here - Anton
   state->mode = BAD;

Just to see I understood your suggestions yesterday:

after inflateInit2()

// go to byte offset
ZSEEK64( , , streamCurrentPos, ZLIB_FILEFUNC_SEEK_SET)

if ( streamBits > 0 ) 
{
   // get that byte
   unz64local_getByte( , , &aByte)
   
   // and shift down by the number of bits. This API doing it? 
   inflatePrime ( , streamBits, 8 - streamBits)
   
} else { no bits to insert }

inflateSetDictionary ()

And state of uncompression is saved like this:

typedef struct state_of_uncompression
{

  ZPOS64_T streamCurrentPos;      // from : unzGetCurrentFileZStreamPos64()
  int      streamBits;            // from : stream.data_type & (~0x1C0), after clearing bits 8,7, and 6
  Byte     dictionary_buf[32768]; // from : inflateGetDictionary()
  uInt     dictLength;            // from : inflateGetDictionary();
  uint64_t output_wrt_offset      // got this already. 

} uncompression_state_info;

Upvotes: 0

Views: 43

Answers (1)

Mark Adler
Mark Adler

Reputation: 112502

What? No.

inflatePrime ( , streamBits, 8 - streamBits) makes no sense. And you did nothing with the aByte you got.

It should be inflatePrime(strm, streamBits, aByte >> (8 - streamBits)).

Upvotes: 0

Related Questions