Fix bug for large files (no test because testing 4 GB files would be
very slow)
This commit is contained in:
parent
388919583b
commit
9a0efc9532
1 changed files with 9 additions and 17 deletions
|
@ -1845,38 +1845,30 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
|
||||||
} /* end Z_BZIP2ED */
|
} /* end Z_BZIP2ED */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZPOS64_T uTotalOutBefore,uTotalOutAfter;
|
uInt uAvailOutBefore,uAvailOutAfter;
|
||||||
const Bytef *bufBefore;
|
const Bytef *bufBefore;
|
||||||
ZPOS64_T uOutThis;
|
uInt uOutThis;
|
||||||
int flush=Z_SYNC_FLUSH;
|
int flush=Z_SYNC_FLUSH;
|
||||||
|
|
||||||
uTotalOutBefore = pfile_in_zip_read_info->stream.total_out;
|
uAvailOutBefore = pfile_in_zip_read_info->stream.avail_out;
|
||||||
bufBefore = pfile_in_zip_read_info->stream.next_out;
|
bufBefore = pfile_in_zip_read_info->stream.next_out;
|
||||||
|
|
||||||
/*
|
|
||||||
if ((pfile_in_zip_read_info->rest_read_uncompressed ==
|
|
||||||
pfile_in_zip_read_info->stream.avail_out) &&
|
|
||||||
(pfile_in_zip_read_info->rest_read_compressed == 0))
|
|
||||||
flush = Z_FINISH;
|
|
||||||
*/
|
|
||||||
err=inflate(&pfile_in_zip_read_info->stream,flush);
|
err=inflate(&pfile_in_zip_read_info->stream,flush);
|
||||||
|
|
||||||
if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL))
|
if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL))
|
||||||
err = Z_DATA_ERROR;
|
err = Z_DATA_ERROR;
|
||||||
|
|
||||||
uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
|
uAvailOutAfter = pfile_in_zip_read_info->stream.avail_out;
|
||||||
uOutThis = uTotalOutAfter-uTotalOutBefore;
|
uOutThis = uAvailOutBefore - uAvailOutAfter;
|
||||||
|
|
||||||
pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis;
|
pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis;
|
||||||
|
|
||||||
pfile_in_zip_read_info->crc32 =
|
pfile_in_zip_read_info->crc32
|
||||||
crc32(pfile_in_zip_read_info->crc32,bufBefore,
|
= crc32(pfile_in_zip_read_info->crc32,bufBefore, uOutThis);
|
||||||
(uInt)(uOutThis));
|
|
||||||
|
|
||||||
pfile_in_zip_read_info->rest_read_uncompressed -=
|
pfile_in_zip_read_info->rest_read_uncompressed -= uOutThis;
|
||||||
uOutThis;
|
|
||||||
|
|
||||||
iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
|
iRead += uAvailOutBefore - uAvailOutAfter;
|
||||||
|
|
||||||
if (err==Z_STREAM_END)
|
if (err==Z_STREAM_END)
|
||||||
return (iRead==0) ? UNZ_EOF : iRead;
|
return (iRead==0) ? UNZ_EOF : iRead;
|
||||||
|
|
Loading…
Reference in a new issue