MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / unzCloseCurrentFile

Function unzCloseCurrentFile

lib/QuaZip/quazip/unzip.c:2010–2049  ·  view source on GitHub ↗

Close the file in zip opened with unzipOpenCurrentFile Return UNZ_CRCERROR if all the file was read but the CRC is not good */

Source from the content-addressed store, hash-verified

2008 Return UNZ_CRCERROR if all the file was read but the CRC is not good
2009*/
2010extern int ZEXPORT unzCloseCurrentFile (unzFile file)
2011{
2012 int err=UNZ_OK;
2013
2014 unz64_s* s;
2015 file_in_zip64_read_info_s* pfile_in_zip_read_info;
2016 if (file==NULL)
2017 return UNZ_PARAMERROR;
2018 s=(unz64_s*)file;
2019 pfile_in_zip_read_info=s->pfile_in_zip_read;
2020
2021 if (pfile_in_zip_read_info==NULL)
2022 return UNZ_PARAMERROR;
2023
2024
2025 if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) &&
2026 (!pfile_in_zip_read_info->raw))
2027 {
2028 if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
2029 err=UNZ_CRCERROR;
2030 }
2031
2032
2033 TRYFREE(pfile_in_zip_read_info->read_buffer);
2034 pfile_in_zip_read_info->read_buffer = NULL;
2035 if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED)
2036 inflateEnd(&pfile_in_zip_read_info->stream);
2037#ifdef HAVE_BZIP2
2038 else if (pfile_in_zip_read_info->stream_initialised == Z_BZIP2ED)
2039 BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream);
2040#endif
2041
2042
2043 pfile_in_zip_read_info->stream_initialised = 0;
2044 TRYFREE(pfile_in_zip_read_info);
2045
2046 s->pfile_in_zip_read=NULL;
2047
2048 return err;
2049}
2050
2051
2052/*

Callers 3

unzCloseFunction · 0.85
unzOpenCurrentFile3Function · 0.85
closeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected