diff options
| author | Markus Mittendrein <git@maxmitti.tk> | 2019-04-07 14:16:53 +0200 |
|---|---|---|
| committer | Markus Mittendrein <git@maxmitti.tk> | 2019-04-07 14:24:50 +0200 |
| commit | 0be23b38b118d9a36ab8ac57462c9566277cc215 (patch) | |
| tree | 2dae5c0681bb4ebbc06e4645b4b9d64127840f43 /src | |
| parent | ca5357a65a86b8823bdbf0d6a1c7530cf5cb8aa0 (diff) | |
| download | cc4group-0be23b38b118d9a36ab8ac57462c9566277cc215.tar.gz cc4group-0be23b38b118d9a36ab8ac57462c9566277cc215.zip | |
Fix accidential if condition on eof instead of *eof
Diffstat (limited to 'src')
| -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) |
