Is this a bug in this gzip inflate method?

后端 未结 2 1331
广开言路
广开言路 2020-12-18 01:13

When searching on how to inflate gzip compressed data on iOS, the following method appears in number of results:

- (NSData *)gzipInflate
{
    if ([self leng         


        
2条回答
  •  抹茶落季
    2020-12-18 01:26

    Yes, looks like a bug. According to this annotated example from the zlib site, Z_BUF_ERROR is just an indication that there is no more output unless inflate() is provided with more input, not in itself a reason to abort the inflate loop abnormally.

    In fact, the linked sample seems to handle Z_BUF_ERROR exactly like Z_OK.

提交回复
热议问题