Close the file in zip opened with unzOpenCurrentFile Return UNZ_CRCERROR if all the file was read but the CRC is not good */
| 2002 | Return UNZ_CRCERROR if all the file was read but the CRC is not good |
| 2003 | */ |
| 2004 | extern int ZEXPORT unzCloseCurrentFile (unzFile file) |
| 2005 | { |
| 2006 | int err=UNZ_OK; |
| 2007 | |
| 2008 | unz64_s* s; |
| 2009 | file_in_zip64_read_info_s* pfile_in_zip_read_info; |
| 2010 | if (file==NULL) |
| 2011 | return UNZ_PARAMERROR; |
| 2012 | s=(unz64_s*)file; |
| 2013 | pfile_in_zip_read_info=s->pfile_in_zip_read; |
| 2014 | |
| 2015 | if (pfile_in_zip_read_info==NULL) |
| 2016 | return UNZ_PARAMERROR; |
| 2017 | |
| 2018 | |
| 2019 | if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) && |
| 2020 | (!pfile_in_zip_read_info->raw)) |
| 2021 | { |
| 2022 | if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait) |
| 2023 | err=UNZ_CRCERROR; |
| 2024 | } |
| 2025 | |
| 2026 | |
| 2027 | TRYFREE(pfile_in_zip_read_info->read_buffer); |
| 2028 | pfile_in_zip_read_info->read_buffer = NULL; |
| 2029 | if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED) |
| 2030 | inflateEnd(&pfile_in_zip_read_info->stream); |
| 2031 | #ifdef HAVE_BZIP2 |
| 2032 | else if (pfile_in_zip_read_info->stream_initialised == Z_BZIP2ED) |
| 2033 | BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream); |
| 2034 | #endif |
| 2035 | |
| 2036 | |
| 2037 | pfile_in_zip_read_info->stream_initialised = 0; |
| 2038 | TRYFREE(pfile_in_zip_read_info); |
| 2039 | |
| 2040 | s->pfile_in_zip_read=NULL; |
| 2041 | |
| 2042 | return err; |
| 2043 | } |
| 2044 | |
| 2045 | |
| 2046 | /* |
no outgoing calls
no test coverage detected