diff options
Diffstat (limited to 'src/cc4group.c')
| -rw-r--r-- | src/cc4group.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/cc4group.c b/src/cc4group.c index f257d6b..a664fe3 100644 --- a/src/cc4group.c +++ b/src/cc4group.c @@ -483,7 +483,24 @@ static bool cc4group_inflateFillOutput(z_stream* const strm, CC4Group_ReadCallba } *inflateRet = ret; - return ret == Z_OK || (ret == Z_STREAM_END && strm->avail_in == 0 && eof); + if(ret == Z_OK) + { + return true; + } + + + if(ret == Z_STREAM_END && strm->avail_in == 0) + { + // the input should have really ended now + // but some callbacks may need to be called again to return EOF + if(!*eof) + { + size_t readSize = 0; + *eof = callback((const void**)lastData, &readSize, callbackArg); + } + return *eof; + } + return false; } static bool cc4group_uncompressGroup(CC4Group* const this, CC4Group_ReadCallback const readCallback, void* const callbackArg, int const memoryManagement, CC4Group_ReadSetupCallback const initCallback, CC4Group_ReadSetupCallback const deinitCallback) |
