| 4730 | } |
| 4731 | |
| 4732 | mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, |
| 4733 | mz_uint32 flags) { |
| 4734 | mz_uint64 file_size; |
| 4735 | MZ_FILE *pFile = MZ_FOPEN(pFilename, "rb"); |
| 4736 | if (!pFile) |
| 4737 | return MZ_FALSE; |
| 4738 | if (MZ_FSEEK64(pFile, 0, SEEK_END)) { |
| 4739 | MZ_FCLOSE(pFile); |
| 4740 | return MZ_FALSE; |
| 4741 | } |
| 4742 | file_size = MZ_FTELL64(pFile); |
| 4743 | if (!mz_zip_reader_init_internal(pZip, flags)) { |
| 4744 | MZ_FCLOSE(pFile); |
| 4745 | return MZ_FALSE; |
| 4746 | } |
| 4747 | pZip->m_pRead = mz_zip_file_read_func; |
| 4748 | pZip->m_pIO_opaque = pZip; |
| 4749 | pZip->m_pState->m_pFile = pFile; |
| 4750 | pZip->m_archive_size = file_size; |
| 4751 | if (!mz_zip_reader_read_central_dir(pZip, flags)) { |
| 4752 | mz_zip_reader_end(pZip); |
| 4753 | return MZ_FALSE; |
| 4754 | } |
| 4755 | return MZ_TRUE; |
| 4756 | } |
| 4757 | #endif // #ifndef MINIZ_NO_STDIO |
| 4758 | |
| 4759 | mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip) { |
no test coverage detected