Close the file in zip opened with unzOpenCurrentFile Return UNZ_CRCERROR if all the file was read but the CRC is not good */
| 1868 | Return UNZ_CRCERROR if all the file was read but the CRC is not good |
| 1869 | */ |
| 1870 | extern int ZEXPORT unzCloseCurrentFile(unzFile file) { |
| 1871 | int err=UNZ_OK; |
| 1872 | |
| 1873 | unz64_s* s; |
| 1874 | file_in_zip64_read_info_s* pfile_in_zip_read_info; |
| 1875 | if (file==NULL) |
| 1876 | return UNZ_PARAMERROR; |
| 1877 | s=(unz64_s*)file; |
| 1878 | pfile_in_zip_read_info=s->pfile_in_zip_read; |
| 1879 | |
| 1880 | if (pfile_in_zip_read_info==NULL) |
| 1881 | return UNZ_PARAMERROR; |
| 1882 | |
| 1883 | |
| 1884 | if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) && |
| 1885 | (!pfile_in_zip_read_info->raw)) |
| 1886 | { |
| 1887 | if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait) |
| 1888 | err=UNZ_CRCERROR; |
| 1889 | } |
| 1890 | |
| 1891 | |
| 1892 | free(pfile_in_zip_read_info->read_buffer); |
| 1893 | pfile_in_zip_read_info->read_buffer = NULL; |
| 1894 | if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED) |
| 1895 | inflateEnd(&pfile_in_zip_read_info->stream); |
| 1896 | #ifdef HAVE_BZIP2 |
| 1897 | else if (pfile_in_zip_read_info->stream_initialised == Z_BZIP2ED) |
| 1898 | BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream); |
| 1899 | #endif |
| 1900 | |
| 1901 | |
| 1902 | pfile_in_zip_read_info->stream_initialised = 0; |
| 1903 | free(pfile_in_zip_read_info); |
| 1904 | |
| 1905 | s->pfile_in_zip_read=NULL; |
| 1906 | |
| 1907 | return err; |
| 1908 | } |
| 1909 | |
| 1910 | |
| 1911 | /* |
no outgoing calls
no test coverage detected