简体   繁体   English

重启后,恢复解压缩时,inflate() 报告 Z_DATA_ERROR

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

Thanks Mark, on resumption, now I get Z_DATA_ERROR谢谢马克,恢复时,现在我得到 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()在 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:而解压的state是这样保存的:

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;

What?什么? No.不。

inflatePrime (, streamBits, 8 - streamBits) makes no sense. inflatePrime (, streamBits, 8 - streamBits)没有意义。 And you did nothing with the aByte you got.你对你得到的aByte什么也没做。

It should be inflatePrime(strm, streamBits, aByte >> (8 - streamBits)) .它应该是inflatePrime(strm, streamBits, aByte >> (8 - streamBits))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM