Lines Matching refs:pZip

2229 static MZ_FORCEINLINE void mz_zip_array_clear(mz_zip_archive *pZip, mz_zip_array *pArray)  in mz_zip_array_clear()  argument
2231 pZip->m_pFree(pZip->m_pAlloc_opaque, pArray->m_p); in mz_zip_array_clear()
2235 static mz_bool mz_zip_array_ensure_capacity(mz_zip_archive *pZip, mz_zip_array *pArray, size_t min_… in mz_zip_array_ensure_capacity() argument
2239 …if (NULL == (pNew_p = pZip->m_pRealloc(pZip->m_pAlloc_opaque, pArray->m_p, pArray->m_element_size,… in mz_zip_array_ensure_capacity()
2244 static MZ_FORCEINLINE mz_bool mz_zip_array_reserve(mz_zip_archive *pZip, mz_zip_array *pArray, size… in mz_zip_array_reserve() argument
2246 …if (new_capacity > pArray->m_capacity) { if (!mz_zip_array_ensure_capacity(pZip, pArray, new_capac… in mz_zip_array_reserve()
2250 static MZ_FORCEINLINE mz_bool mz_zip_array_resize(mz_zip_archive *pZip, mz_zip_array *pArray, size_… in mz_zip_array_resize() argument
2252 …if (new_size > pArray->m_capacity) { if (!mz_zip_array_ensure_capacity(pZip, pArray, new_size, gro… in mz_zip_array_resize()
2257 static MZ_FORCEINLINE mz_bool mz_zip_array_ensure_room(mz_zip_archive *pZip, mz_zip_array *pArray, … in mz_zip_array_ensure_room() argument
2259 return mz_zip_array_reserve(pZip, pArray, pArray->m_size + n, MZ_TRUE); in mz_zip_array_ensure_room()
2262 static MZ_FORCEINLINE mz_bool mz_zip_array_push_back(mz_zip_archive *pZip, mz_zip_array *pArray, co… in mz_zip_array_push_back() argument
2264 …size_t orig_size = pArray->m_size; if (!mz_zip_array_resize(pZip, pArray, orig_size + n, MZ_TRUE))… in mz_zip_array_push_back()
2322 static mz_bool mz_zip_reader_init_internal(mz_zip_archive *pZip, mz_uint32 flags) in mz_zip_reader_init_internal() argument
2325 if ((!pZip) || (pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_INVALID)) in mz_zip_reader_init_internal()
2328 if (!pZip->m_pAlloc) pZip->m_pAlloc = def_alloc_func; in mz_zip_reader_init_internal()
2329 if (!pZip->m_pFree) pZip->m_pFree = def_free_func; in mz_zip_reader_init_internal()
2330 if (!pZip->m_pRealloc) pZip->m_pRealloc = def_realloc_func; in mz_zip_reader_init_internal()
2332 pZip->m_zip_mode = MZ_ZIP_MODE_READING; in mz_zip_reader_init_internal()
2333 pZip->m_archive_size = 0; in mz_zip_reader_init_internal()
2334 pZip->m_central_directory_file_ofs = 0; in mz_zip_reader_init_internal()
2335 pZip->m_total_files = 0; in mz_zip_reader_init_internal()
2337 …if (NULL == (pZip->m_pState = (mz_zip_internal_state *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, si… in mz_zip_reader_init_internal()
2339 memset(pZip->m_pState, 0, sizeof(mz_zip_internal_state)); in mz_zip_reader_init_internal()
2340 MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir, sizeof(mz_uint8)); in mz_zip_reader_init_internal()
2341 MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir_offsets, sizeof(mz_uint32)); in mz_zip_reader_init_internal()
2342 MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_sorted_central_dir_offsets, sizeof(mz_uint32)); in mz_zip_reader_init_internal()
2366 static void mz_zip_reader_sort_central_dir_offsets_by_filename(mz_zip_archive *pZip) in mz_zip_reader_sort_central_dir_offsets_by_filename() argument
2368 mz_zip_internal_state *pState = pZip->m_pState; in mz_zip_reader_sort_central_dir_offsets_by_filename()
2372 const int size = pZip->m_total_files; in mz_zip_reader_sort_central_dir_offsets_by_filename()
2407 static mz_bool mz_zip_reader_read_central_dir(mz_zip_archive *pZip, mz_uint32 flags) in mz_zip_reader_read_central_dir() argument
2416 if (pZip->m_archive_size < MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) in mz_zip_reader_read_central_dir()
2419 cur_file_ofs = MZ_MAX((mz_int64)pZip->m_archive_size - (mz_int64)sizeof(buf_u32), 0); in mz_zip_reader_read_central_dir()
2422 int i, n = (int)MZ_MIN(sizeof(buf_u32), pZip->m_archive_size - cur_file_ofs); in mz_zip_reader_read_central_dir()
2423 if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pBuf, n) != (mz_uint)n) in mz_zip_reader_read_central_dir()
2433 …if ((!cur_file_ofs) || ((pZip->m_archive_size - cur_file_ofs) >= (0xFFFF + MZ_ZIP_END_OF_CENTRAL_D… in mz_zip_reader_read_central_dir()
2438 …if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pBuf, MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) !… in mz_zip_reader_read_central_dir()
2441 …((pZip->m_total_files = MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS)) != MZ_READ_LE16(p… in mz_zip_reader_read_central_dir()
2449 …if ((cdir_size = MZ_READ_LE32(pBuf + MZ_ZIP_ECDH_CDIR_SIZE_OFS)) < pZip->m_total_files * MZ_ZIP_CE… in mz_zip_reader_read_central_dir()
2453 if ((cdir_ofs + (mz_uint64)cdir_size) > pZip->m_archive_size) in mz_zip_reader_read_central_dir()
2456 pZip->m_central_directory_file_ofs = cdir_ofs; in mz_zip_reader_read_central_dir()
2458 if (pZip->m_total_files) in mz_zip_reader_read_central_dir()
2463 if ((!mz_zip_array_resize(pZip, &pZip->m_pState->m_central_dir, cdir_size, MZ_FALSE)) || in mz_zip_reader_read_central_dir()
2464 …(!mz_zip_array_resize(pZip, &pZip->m_pState->m_central_dir_offsets, pZip->m_total_files, MZ_FALSE)… in mz_zip_reader_read_central_dir()
2469 …if (!mz_zip_array_resize(pZip, &pZip->m_pState->m_sorted_central_dir_offsets, pZip->m_total_files,… in mz_zip_reader_read_central_dir()
2473 …if (pZip->m_pRead(pZip->m_pIO_opaque, cdir_ofs, pZip->m_pState->m_central_dir.m_p, cdir_size) != c… in mz_zip_reader_read_central_dir()
2477 p = (const mz_uint8 *)pZip->m_pState->m_central_dir.m_p; in mz_zip_reader_read_central_dir()
2478 for (n = cdir_size, i = 0; i < pZip->m_total_files; ++i) in mz_zip_reader_read_central_dir()
2483 …MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, i) = (mz_uint32)(p - (cons… in mz_zip_reader_read_central_dir()
2485 MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_sorted_central_dir_offsets, mz_uint32, i) = i; in mz_zip_reader_read_central_dir()
2493 … + MZ_ZIP_CDH_LOCAL_HEADER_OFS) + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + comp_size) > pZip->m_archive_size) in mz_zip_reader_read_central_dir()
2502 mz_zip_reader_sort_central_dir_offsets_by_filename(pZip); in mz_zip_reader_read_central_dir()
2507 mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, mz_uint32 flags) in mz_zip_reader_init() argument
2509 if ((!pZip) || (!pZip->m_pRead)) in mz_zip_reader_init()
2511 if (!mz_zip_reader_init_internal(pZip, flags)) in mz_zip_reader_init()
2513 pZip->m_archive_size = size; in mz_zip_reader_init()
2514 if (!mz_zip_reader_read_central_dir(pZip, flags)) in mz_zip_reader_init()
2516 mz_zip_reader_end(pZip); in mz_zip_reader_init()
2524 mz_zip_archive *pZip = (mz_zip_archive *)pOpaque; in mz_zip_mem_read_func() local
2525 …size_t s = (file_ofs >= pZip->m_archive_size) ? 0 : (size_t)MZ_MIN(pZip->m_archive_size - file_ofs… in mz_zip_mem_read_func()
2526 memcpy(pBuf, (const mz_uint8 *)pZip->m_pState->m_pMem + file_ofs, s); in mz_zip_mem_read_func()
2530 mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint32 flags) in mz_zip_reader_init_mem() argument
2532 if (!mz_zip_reader_init_internal(pZip, flags)) in mz_zip_reader_init_mem()
2534 pZip->m_archive_size = size; in mz_zip_reader_init_mem()
2535 pZip->m_pRead = mz_zip_mem_read_func; in mz_zip_reader_init_mem()
2536 pZip->m_pIO_opaque = pZip; in mz_zip_reader_init_mem()
2538 pZip->m_pState->m_pMem = const_cast<void *>(pMem); in mz_zip_reader_init_mem()
2540 pZip->m_pState->m_pMem = (void *)pMem; in mz_zip_reader_init_mem()
2542 pZip->m_pState->m_mem_size = size; in mz_zip_reader_init_mem()
2543 if (!mz_zip_reader_read_central_dir(pZip, flags)) in mz_zip_reader_init_mem()
2545 mz_zip_reader_end(pZip); in mz_zip_reader_init_mem()
2554 mz_zip_archive *pZip = (mz_zip_archive *)pOpaque; in mz_zip_file_read_func() local
2555 mz_int64 cur_ofs = MZ_FTELL64(pZip->m_pState->m_pFile); in mz_zip_file_read_func()
2556 …if (((mz_int64)file_ofs < 0) || (((cur_ofs != (mz_int64)file_ofs)) && (MZ_FSEEK64(pZip->m_pState->… in mz_zip_file_read_func()
2558 return MZ_FREAD(pBuf, 1, n, pZip->m_pState->m_pFile); in mz_zip_file_read_func()
2561 mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint32 flags) in mz_zip_reader_init_file() argument
2573 if (!mz_zip_reader_init_internal(pZip, flags)) in mz_zip_reader_init_file()
2578 pZip->m_pRead = mz_zip_file_read_func; in mz_zip_reader_init_file()
2579 pZip->m_pIO_opaque = pZip; in mz_zip_reader_init_file()
2580 pZip->m_pState->m_pFile = pFile; in mz_zip_reader_init_file()
2581 pZip->m_archive_size = file_size; in mz_zip_reader_init_file()
2582 if (!mz_zip_reader_read_central_dir(pZip, flags)) in mz_zip_reader_init_file()
2584 mz_zip_reader_end(pZip); in mz_zip_reader_init_file()
2591 mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip) in mz_zip_reader_get_num_files() argument
2593 return pZip ? pZip->m_total_files : 0; in mz_zip_reader_get_num_files()
2596 static MZ_FORCEINLINE const mz_uint8 *mz_zip_reader_get_cdh(mz_zip_archive *pZip, mz_uint file_inde… in mz_zip_reader_get_cdh() argument
2598 …if ((!pZip) || (!pZip->m_pState) || (file_index >= pZip->m_total_files) || (pZip->m_zip_mode != MZ… in mz_zip_reader_get_cdh()
2600 …return &MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir, mz_uint8, MZ_ZIP_ARRAY_ELEMENT(&pZip-… in mz_zip_reader_get_cdh()
2603 mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, mz_uint file_index) in mz_zip_reader_is_file_encrypted() argument
2606 const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); in mz_zip_reader_is_file_encrypted()
2613 mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, mz_uint file_index) in mz_zip_reader_is_file_a_directory() argument
2616 const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); in mz_zip_reader_is_file_a_directory()
2638 mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat … in mz_zip_reader_file_stat() argument
2641 const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); in mz_zip_reader_file_stat()
2647 …pStat->m_central_dir_ofs = MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32,… in mz_zip_reader_file_stat()
2673 mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_ui… in mz_zip_reader_get_filename() argument
2676 const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); in mz_zip_reader_get_filename()
2715 static int mz_zip_reader_locate_file_binary_search(mz_zip_archive *pZip, const char *pFilename) in mz_zip_reader_locate_file_binary_search() argument
2717 mz_zip_internal_state *pState = pZip->m_pState; in mz_zip_reader_locate_file_binary_search()
2721 const int size = pZip->m_total_files; in mz_zip_reader_locate_file_binary_search()
2737 int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uin… in mz_zip_reader_locate_file() argument
2740 if ((!pZip) || (!pZip->m_pState) || (!pName) || (pZip->m_zip_mode != MZ_ZIP_MODE_READING)) in mz_zip_reader_locate_file()
2742 …_FLAG_IGNORE_PATH | MZ_ZIP_FLAG_CASE_SENSITIVE)) == 0) && (!pComment) && (pZip->m_pState->m_sorted… in mz_zip_reader_locate_file()
2743 return mz_zip_reader_locate_file_binary_search(pZip, pName); in mz_zip_reader_locate_file()
2746 for (file_index = 0; file_index < pZip->m_total_files; file_index++) in mz_zip_reader_locate_file()
2748 …mz_uint8 *pHeader = &MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir, mz_uint8, MZ_ZIP_ARRAY_E… in mz_zip_reader_locate_file()
2777 mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip, mz_uint file_index, void *pBuf,… in mz_zip_reader_extract_to_mem_no_alloc() argument
2789 if (!mz_zip_reader_file_stat(pZip, file_index, &file_stat)) in mz_zip_reader_extract_to_mem_no_alloc()
2798 if (mz_zip_reader_is_file_a_directory(pZip, file_index)) in mz_zip_reader_extract_to_mem_no_alloc()
2816 …if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) !… in mz_zip_reader_extract_to_mem_no_alloc()
2822 if ((cur_file_ofs + file_stat.m_comp_size) > pZip->m_archive_size) in mz_zip_reader_extract_to_mem_no_alloc()
2828 if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pBuf, (size_t)needed_size) != needed_size) in mz_zip_reader_extract_to_mem_no_alloc()
2836 if (pZip->m_pState->m_pMem) in mz_zip_reader_extract_to_mem_no_alloc()
2839 pRead_buf = (mz_uint8 *)pZip->m_pState->m_pMem + cur_file_ofs; in mz_zip_reader_extract_to_mem_no_alloc()
2863 if (NULL == (pRead_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)read_buf_size))) in mz_zip_reader_extract_to_mem_no_alloc()
2872 if ((!read_buf_avail) && (!pZip->m_pState->m_pMem)) in mz_zip_reader_extract_to_mem_no_alloc()
2875 …if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pRead_buf, (size_t)read_buf_avail) != read_buf… in mz_zip_reader_extract_to_mem_no_alloc()
2898 if ((!pZip->m_pState->m_pMem) && (!pUser_read_buf)) in mz_zip_reader_extract_to_mem_no_alloc()
2899 pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); in mz_zip_reader_extract_to_mem_no_alloc()
2904 mz_bool mz_zip_reader_extract_file_to_mem_no_alloc(mz_zip_archive *pZip, const char *pFilename, voi… in mz_zip_reader_extract_file_to_mem_no_alloc() argument
2906 int file_index = mz_zip_reader_locate_file(pZip, pFilename, NULL, flags); in mz_zip_reader_extract_file_to_mem_no_alloc()
2909 …return mz_zip_reader_extract_to_mem_no_alloc(pZip, file_index, pBuf, buf_size, flags, pUser_read_b… in mz_zip_reader_extract_file_to_mem_no_alloc()
2912 mz_bool mz_zip_reader_extract_to_mem(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t b… in mz_zip_reader_extract_to_mem() argument
2914 return mz_zip_reader_extract_to_mem_no_alloc(pZip, file_index, pBuf, buf_size, flags, NULL, 0); in mz_zip_reader_extract_to_mem()
2917 mz_bool mz_zip_reader_extract_file_to_mem(mz_zip_archive *pZip, const char *pFilename, void *pBuf, … in mz_zip_reader_extract_file_to_mem() argument
2919 …return mz_zip_reader_extract_file_to_mem_no_alloc(pZip, pFilename, pBuf, buf_size, flags, NULL, 0); in mz_zip_reader_extract_file_to_mem()
2922 void *mz_zip_reader_extract_to_heap(mz_zip_archive *pZip, mz_uint file_index, size_t *pSize, mz_uin… in mz_zip_reader_extract_to_heap() argument
2925 const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); in mz_zip_reader_extract_to_heap()
2943 if (NULL == (pBuf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)alloc_size))) in mz_zip_reader_extract_to_heap()
2946 if (!mz_zip_reader_extract_to_mem(pZip, file_index, pBuf, (size_t)alloc_size, flags)) in mz_zip_reader_extract_to_heap()
2948 pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); in mz_zip_reader_extract_to_heap()
2956 void *mz_zip_reader_extract_file_to_heap(mz_zip_archive *pZip, const char *pFilename, size_t *pSize… in mz_zip_reader_extract_file_to_heap() argument
2958 int file_index = mz_zip_reader_locate_file(pZip, pFilename, NULL, flags); in mz_zip_reader_extract_file_to_heap()
2964 return mz_zip_reader_extract_to_heap(pZip, file_index, pSize, flags); in mz_zip_reader_extract_file_to_heap()
2967 mz_bool mz_zip_reader_extract_to_callback(mz_zip_archive *pZip, mz_uint file_index, mz_file_write_f… in mz_zip_reader_extract_to_callback() argument
2975 if (!mz_zip_reader_file_stat(pZip, file_index, &file_stat)) in mz_zip_reader_extract_to_callback()
2984 if (mz_zip_reader_is_file_a_directory(pZip, file_index)) in mz_zip_reader_extract_to_callback()
2997 …if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) !… in mz_zip_reader_extract_to_callback()
3003 if ((cur_file_ofs + file_stat.m_comp_size) > pZip->m_archive_size) in mz_zip_reader_extract_to_callback()
3007 if (pZip->m_pState->m_pMem) in mz_zip_reader_extract_to_callback()
3009 pRead_buf = (mz_uint8 *)pZip->m_pState->m_pMem + cur_file_ofs; in mz_zip_reader_extract_to_callback()
3016 if (NULL == (pRead_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)read_buf_size))) in mz_zip_reader_extract_to_callback()
3025 if (pZip->m_pState->m_pMem) in mz_zip_reader_extract_to_callback()
3046 …if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pRead_buf, (size_t)read_buf_avail) != read_buf… in mz_zip_reader_extract_to_callback()
3071 if (NULL == (pWrite_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, TINFL_LZ_DICT_SIZE))) in mz_zip_reader_extract_to_callback()
3079 if ((!read_buf_avail) && (!pZip->m_pState->m_pMem)) in mz_zip_reader_extract_to_callback()
3082 …if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pRead_buf, (size_t)read_buf_avail) != read_buf… in mz_zip_reader_extract_to_callback()
3122 if (!pZip->m_pState->m_pMem) in mz_zip_reader_extract_to_callback()
3123 pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); in mz_zip_reader_extract_to_callback()
3125 pZip->m_pFree(pZip->m_pAlloc_opaque, pWrite_buf); in mz_zip_reader_extract_to_callback()
3130 mz_bool mz_zip_reader_extract_file_to_callback(mz_zip_archive *pZip, const char *pFilename, mz_file… in mz_zip_reader_extract_file_to_callback() argument
3132 int file_index = mz_zip_reader_locate_file(pZip, pFilename, NULL, flags); in mz_zip_reader_extract_file_to_callback()
3135 return mz_zip_reader_extract_to_callback(pZip, file_index, pCallback, pOpaque, flags); in mz_zip_reader_extract_file_to_callback()
3144 mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index, const char *pDst_fi… in mz_zip_reader_extract_to_file() argument
3149 if (!mz_zip_reader_file_stat(pZip, file_index, &file_stat)) in mz_zip_reader_extract_to_file()
3154 …status = mz_zip_reader_extract_to_callback(pZip, file_index, mz_zip_file_write_callback, pFile, fl… in mz_zip_reader_extract_to_file()
3165 mz_bool mz_zip_reader_end(mz_zip_archive *pZip) in mz_zip_reader_end() argument
3167 …if ((!pZip) || (!pZip->m_pState) || (!pZip->m_pAlloc) || (!pZip->m_pFree) || (pZip->m_zip_mode != … in mz_zip_reader_end()
3170 if (pZip->m_pState) in mz_zip_reader_end()
3172 mz_zip_internal_state *pState = pZip->m_pState; pZip->m_pState = NULL; in mz_zip_reader_end()
3173 mz_zip_array_clear(pZip, &pState->m_central_dir); in mz_zip_reader_end()
3174 mz_zip_array_clear(pZip, &pState->m_central_dir_offsets); in mz_zip_reader_end()
3175 mz_zip_array_clear(pZip, &pState->m_sorted_central_dir_offsets); in mz_zip_reader_end()
3185 pZip->m_pFree(pZip->m_pAlloc_opaque, pState); in mz_zip_reader_end()
3187 pZip->m_zip_mode = MZ_ZIP_MODE_INVALID; in mz_zip_reader_end()
3193 mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, const char *pArchive_filename, con… in mz_zip_reader_extract_file_to_file() argument
3195 int file_index = mz_zip_reader_locate_file(pZip, pArchive_filename, NULL, flags); in mz_zip_reader_extract_file_to_file()
3198 return mz_zip_reader_extract_to_file(pZip, file_index, pDst_filename, flags); in mz_zip_reader_extract_file_to_file()
3211 mz_bool mz_zip_writer_init(mz_zip_archive *pZip, mz_uint64 existing_size) in mz_zip_writer_init() argument
3213 if ((!pZip) || (pZip->m_pState) || (!pZip->m_pWrite) || (pZip->m_zip_mode != MZ_ZIP_MODE_INVALID)) in mz_zip_writer_init()
3216 if (pZip->m_file_offset_alignment) in mz_zip_writer_init()
3219 if (pZip->m_file_offset_alignment & (pZip->m_file_offset_alignment - 1)) in mz_zip_writer_init()
3223 if (!pZip->m_pAlloc) pZip->m_pAlloc = def_alloc_func; in mz_zip_writer_init()
3224 if (!pZip->m_pFree) pZip->m_pFree = def_free_func; in mz_zip_writer_init()
3225 if (!pZip->m_pRealloc) pZip->m_pRealloc = def_realloc_func; in mz_zip_writer_init()
3227 pZip->m_zip_mode = MZ_ZIP_MODE_WRITING; in mz_zip_writer_init()
3228 pZip->m_archive_size = existing_size; in mz_zip_writer_init()
3229 pZip->m_central_directory_file_ofs = 0; in mz_zip_writer_init()
3230 pZip->m_total_files = 0; in mz_zip_writer_init()
3232 …if (NULL == (pZip->m_pState = (mz_zip_internal_state *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, si… in mz_zip_writer_init()
3234 memset(pZip->m_pState, 0, sizeof(mz_zip_internal_state)); in mz_zip_writer_init()
3235 MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir, sizeof(mz_uint8)); in mz_zip_writer_init()
3236 MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir_offsets, sizeof(mz_uint32)); in mz_zip_writer_init()
3237 MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_sorted_central_dir_offsets, sizeof(mz_uint32)); in mz_zip_writer_init()
3243 mz_zip_archive *pZip = (mz_zip_archive *)pOpaque; in mz_zip_heap_write_func() local
3244 mz_zip_internal_state *pState = pZip->m_pState; in mz_zip_heap_write_func()
3256 …if (NULL == (pNew_block = pZip->m_pRealloc(pZip->m_pAlloc_opaque, pState->m_pMem, 1, new_capacity)… in mz_zip_heap_write_func()
3265 mz_bool mz_zip_writer_init_heap(mz_zip_archive *pZip, size_t size_to_reserve_at_beginning, size_t i… in mz_zip_writer_init_heap() argument
3267 pZip->m_pWrite = mz_zip_heap_write_func; in mz_zip_writer_init_heap()
3268 pZip->m_pIO_opaque = pZip; in mz_zip_writer_init_heap()
3269 if (!mz_zip_writer_init(pZip, size_to_reserve_at_beginning)) in mz_zip_writer_init_heap()
3273 …if (NULL == (pZip->m_pState->m_pMem = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, initial_allocation_… in mz_zip_writer_init_heap()
3275 mz_zip_writer_end(pZip); in mz_zip_writer_init_heap()
3278 pZip->m_pState->m_mem_capacity = initial_allocation_size; in mz_zip_writer_init_heap()
3286 mz_zip_archive *pZip = (mz_zip_archive *)pOpaque; in mz_zip_file_write_func() local
3287 mz_int64 cur_ofs = MZ_FTELL64(pZip->m_pState->m_pFile); in mz_zip_file_write_func()
3288 …if (((mz_int64)file_ofs < 0) || (((cur_ofs != (mz_int64)file_ofs)) && (MZ_FSEEK64(pZip->m_pState->… in mz_zip_file_write_func()
3290 return MZ_FWRITE(pBuf, 1, n, pZip->m_pState->m_pFile); in mz_zip_file_write_func()
3293 mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_rese… in mz_zip_writer_init_file() argument
3296 pZip->m_pWrite = mz_zip_file_write_func; in mz_zip_writer_init_file()
3297 pZip->m_pIO_opaque = pZip; in mz_zip_writer_init_file()
3298 if (!mz_zip_writer_init(pZip, size_to_reserve_at_beginning)) in mz_zip_writer_init_file()
3302 mz_zip_writer_end(pZip); in mz_zip_writer_init_file()
3305 pZip->m_pState->m_pFile = pFile; in mz_zip_writer_init_file()
3312 if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_ofs, buf, n) != n) in mz_zip_writer_init_file()
3314 mz_zip_writer_end(pZip); in mz_zip_writer_init_file()
3324 mz_bool mz_zip_writer_init_from_reader(mz_zip_archive *pZip, const char *pFilename) in mz_zip_writer_init_from_reader() argument
3327 if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_READING)) in mz_zip_writer_init_from_reader()
3330 …if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + M… in mz_zip_writer_init_from_reader()
3333 pState = pZip->m_pState; in mz_zip_writer_init_from_reader()
3341 if (pZip->m_pIO_opaque != pZip) in mz_zip_writer_init_from_reader()
3345 pZip->m_pWrite = mz_zip_file_write_func; in mz_zip_writer_init_from_reader()
3349 mz_zip_reader_end(pZip); in mz_zip_writer_init_from_reader()
3357 if (pZip->m_pIO_opaque != pZip) in mz_zip_writer_init_from_reader()
3360 pZip->m_pWrite = mz_zip_heap_write_func; in mz_zip_writer_init_from_reader()
3363 else if (!pZip->m_pWrite) in mz_zip_writer_init_from_reader()
3367 pZip->m_archive_size = pZip->m_central_directory_file_ofs; in mz_zip_writer_init_from_reader()
3368 pZip->m_zip_mode = MZ_ZIP_MODE_WRITING; in mz_zip_writer_init_from_reader()
3369 pZip->m_central_directory_file_ofs = 0; in mz_zip_writer_init_from_reader()
3374 mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, si… in mz_zip_writer_add_mem() argument
3376 …return mz_zip_writer_add_mem_ex(pZip, pArchive_name, pBuf, buf_size, NULL, 0, level_and_flags, 0, … in mz_zip_writer_add_mem()
3396 static mz_bool mz_zip_writer_create_local_dir_header(mz_zip_archive *pZip, mz_uint8 *pDst, mz_uint1… in mz_zip_writer_create_local_dir_header() argument
3398 (void)pZip; in mz_zip_writer_create_local_dir_header()
3414 static mz_bool mz_zip_writer_create_central_dir_header(mz_zip_archive *pZip, mz_uint8 *pDst, mz_uin… in mz_zip_writer_create_central_dir_header() argument
3416 (void)pZip; in mz_zip_writer_create_central_dir_header()
3435 static mz_bool mz_zip_writer_add_to_central_dir(mz_zip_archive *pZip, const char *pFilename, mz_uin… in mz_zip_writer_add_to_central_dir() argument
3437 mz_zip_internal_state *pState = pZip->m_pState; in mz_zip_writer_add_to_central_dir()
3446 …if (!mz_zip_writer_create_central_dir_header(pZip, central_dir_header, filename_size, extra_size, … in mz_zip_writer_add_to_central_dir()
3449 …if ((!mz_zip_array_push_back(pZip, &pState->m_central_dir, central_dir_header, MZ_ZIP_CENTRAL_DIR_… in mz_zip_writer_add_to_central_dir()
3450 (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pFilename, filename_size)) || in mz_zip_writer_add_to_central_dir()
3451 (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pExtra, extra_size)) || in mz_zip_writer_add_to_central_dir()
3452 (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pComment, comment_size)) || in mz_zip_writer_add_to_central_dir()
3453 (!mz_zip_array_push_back(pZip, &pState->m_central_dir_offsets, &central_dir_ofs, 1))) in mz_zip_writer_add_to_central_dir()
3456 mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE); in mz_zip_writer_add_to_central_dir()
3477 static mz_uint mz_zip_writer_compute_padding_needed_for_file_alignment(mz_zip_archive *pZip) in mz_zip_writer_compute_padding_needed_for_file_alignment() argument
3480 if (!pZip->m_file_offset_alignment) in mz_zip_writer_compute_padding_needed_for_file_alignment()
3482 n = (mz_uint32)(pZip->m_archive_size & (pZip->m_file_offset_alignment - 1)); in mz_zip_writer_compute_padding_needed_for_file_alignment()
3483 return (pZip->m_file_offset_alignment - n) & (pZip->m_file_offset_alignment - 1); in mz_zip_writer_compute_padding_needed_for_file_alignment()
3486 static mz_bool mz_zip_writer_write_zeros(mz_zip_archive *pZip, mz_uint64 cur_file_ofs, mz_uint32 n) in mz_zip_writer_write_zeros() argument
3493 if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_file_ofs, buf, s) != s) in mz_zip_writer_write_zeros()
3500 mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf,… in mz_zip_writer_add_mem_ex() argument
3504 …mz_uint64 local_dir_header_ofs = pZip->m_archive_size, cur_archive_file_ofs = pZip->m_archive_size… in mz_zip_writer_add_mem_ex()
3516pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) || ((buf_size) && (!pBuf))… in mz_zip_writer_add_mem_ex()
3519 pState = pZip->m_pState; in mz_zip_writer_add_mem_ex()
3540 num_alignment_padding_bytes = mz_zip_writer_compute_padding_needed_for_file_alignment(pZip); in mz_zip_writer_add_mem_ex()
3543 …if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + num_alignment_padding_bytes + MZ_Z… in mz_zip_writer_add_mem_ex()
3556 …sure_room(pZip, &pState->m_central_dir, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + archive_name_size + comme… in mz_zip_writer_add_mem_ex()
3561 …if (NULL == (pComp = (tdefl_compressor *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, sizeof(tdefl_com… in mz_zip_writer_add_mem_ex()
3565 …if (!mz_zip_writer_write_zeros(pZip, cur_archive_file_ofs, num_alignment_padding_bytes + sizeof(lo… in mz_zip_writer_add_mem_ex()
3567 pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); in mz_zip_writer_add_mem_ex()
3571 …if (pZip->m_file_offset_alignment) { MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignm… in mz_zip_writer_add_mem_ex()
3575 …if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pArchive_name, archive_name_size) != … in mz_zip_writer_add_mem_ex()
3577 pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); in mz_zip_writer_add_mem_ex()
3595 if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pBuf, buf_size) != buf_size) in mz_zip_writer_add_mem_ex()
3597 pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); in mz_zip_writer_add_mem_ex()
3611 state.m_pZip = pZip; in mz_zip_writer_add_mem_ex()
3618 pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); in mz_zip_writer_add_mem_ex()
3628 pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); in mz_zip_writer_add_mem_ex()
3635 …if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, 0… in mz_zip_writer_add_mem_ex()
3638 …if (pZip->m_pWrite(pZip->m_pIO_opaque, local_dir_header_ofs, local_dir_header, sizeof(local_dir_he… in mz_zip_writer_add_mem_ex()
3641 …if (!mz_zip_writer_add_to_central_dir(pZip, pArchive_name, (mz_uint16)archive_name_size, NULL, 0, … in mz_zip_writer_add_mem_ex()
3644 pZip->m_total_files++; in mz_zip_writer_add_mem_ex()
3645 pZip->m_archive_size = cur_archive_file_ofs; in mz_zip_writer_add_mem_ex()
3651 mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, const char *pSrc_fi… in mz_zip_writer_add_file() argument
3655 …mz_uint64 local_dir_header_ofs = pZip->m_archive_size, cur_archive_file_ofs = pZip->m_archive_size… in mz_zip_writer_add_file()
3664 …if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) || (!pArchive_name) … in mz_zip_writer_add_file()
3675 num_alignment_padding_bytes = mz_zip_writer_compute_padding_needed_for_file_alignment(pZip); in mz_zip_writer_add_file()
3678 …if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + num_alignment_padding_bytes + MZ_Z… in mz_zip_writer_add_file()
3700 …if (!mz_zip_writer_write_zeros(pZip, cur_archive_file_ofs, num_alignment_padding_bytes + sizeof(lo… in mz_zip_writer_add_file()
3706 …if (pZip->m_file_offset_alignment) { MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignm… in mz_zip_writer_add_file()
3710 …if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pArchive_name, archive_name_size) != … in mz_zip_writer_add_file()
3720 void *pRead_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, MZ_ZIP_MAX_IO_BUF_SIZE); in mz_zip_writer_add_file()
3732 …if ((MZ_FREAD(pRead_buf, 1, n, pSrc_file) != n) || (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive… in mz_zip_writer_add_file()
3734 pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); in mz_zip_writer_add_file()
3748 …tdefl_compressor *pComp = (tdefl_compressor *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, sizeof(tdef… in mz_zip_writer_add_file()
3751 pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); in mz_zip_writer_add_file()
3756 state.m_pZip = pZip; in mz_zip_writer_add_file()
3762 pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); in mz_zip_writer_add_file()
3763 pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); in mz_zip_writer_add_file()
3789 pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); in mz_zip_writer_add_file()
3793 pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); in mz_zip_writer_add_file()
3804 pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); in mz_zip_writer_add_file()
3813 …if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, 0… in mz_zip_writer_add_file()
3816 …if (pZip->m_pWrite(pZip->m_pIO_opaque, local_dir_header_ofs, local_dir_header, sizeof(local_dir_he… in mz_zip_writer_add_file()
3819 …if (!mz_zip_writer_add_to_central_dir(pZip, pArchive_name, (mz_uint16)archive_name_size, NULL, 0, … in mz_zip_writer_add_file()
3822 pZip->m_total_files++; in mz_zip_writer_add_file()
3823 pZip->m_archive_size = cur_archive_file_ofs; in mz_zip_writer_add_file()
3829 mz_bool mz_zip_writer_add_from_zip_reader(mz_zip_archive *pZip, mz_zip_archive *pSource_zip, mz_uin… in mz_zip_writer_add_from_zip_reader() argument
3840 if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING)) in mz_zip_writer_add_from_zip_reader()
3844 pState = pZip->m_pState; in mz_zip_writer_add_from_zip_reader()
3846 num_alignment_padding_bytes = mz_zip_writer_compute_padding_needed_for_file_alignment(pZip); in mz_zip_writer_add_from_zip_reader()
3849 …if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + num_alignment_padding_bytes + MZ_Z… in mz_zip_writer_add_from_zip_reader()
3853 cur_dst_file_ofs = pZip->m_archive_size; in mz_zip_writer_add_from_zip_reader()
3861 if (!mz_zip_writer_write_zeros(pZip, cur_dst_file_ofs, num_alignment_padding_bytes)) in mz_zip_writer_add_from_zip_reader()
3865 …if (pZip->m_file_offset_alignment) { MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignm… in mz_zip_writer_add_from_zip_reader()
3867 …if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SI… in mz_zip_writer_add_from_zip_reader()
3874 …if (NULL == (pBuf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)MZ_MAX(sizeof(mz_uint32) * 4,… in mz_zip_writer_add_from_zip_reader()
3882 pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); in mz_zip_writer_add_from_zip_reader()
3887 if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pBuf, n) != n) in mz_zip_writer_add_from_zip_reader()
3889 pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); in mz_zip_writer_add_from_zip_reader()
3903 pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); in mz_zip_writer_add_from_zip_reader()
3908 if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pBuf, n) != n) in mz_zip_writer_add_from_zip_reader()
3910 pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); in mz_zip_writer_add_from_zip_reader()
3917 pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); in mz_zip_writer_add_from_zip_reader()
3927 …if (!mz_zip_array_push_back(pZip, &pState->m_central_dir, central_header, MZ_ZIP_CENTRAL_DIR_HEADE… in mz_zip_writer_add_from_zip_reader()
3931 …if (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pSrc_central_header + MZ_ZIP_CENTRAL_DIR… in mz_zip_writer_add_from_zip_reader()
3933 mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE); in mz_zip_writer_add_from_zip_reader()
3940 if (!mz_zip_array_push_back(pZip, &pState->m_central_dir_offsets, &n, 1)) in mz_zip_writer_add_from_zip_reader()
3942 mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE); in mz_zip_writer_add_from_zip_reader()
3946 pZip->m_total_files++; in mz_zip_writer_add_from_zip_reader()
3947 pZip->m_archive_size = cur_dst_file_ofs; in mz_zip_writer_add_from_zip_reader()
3952 mz_bool mz_zip_writer_finalize_archive(mz_zip_archive *pZip) in mz_zip_writer_finalize_archive() argument
3958 if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING)) in mz_zip_writer_finalize_archive()
3961 pState = pZip->m_pState; in mz_zip_writer_finalize_archive()
3964 …if ((pZip->m_total_files > 0xFFFF) || ((pZip->m_archive_size + pState->m_central_dir.m_size + MZ_Z… in mz_zip_writer_finalize_archive()
3969 if (pZip->m_total_files) in mz_zip_writer_finalize_archive()
3972 central_dir_ofs = pZip->m_archive_size; in mz_zip_writer_finalize_archive()
3974 pZip->m_central_directory_file_ofs = central_dir_ofs; in mz_zip_writer_finalize_archive()
3975 …if (pZip->m_pWrite(pZip->m_pIO_opaque, central_dir_ofs, pState->m_central_dir.m_p, (size_t)central… in mz_zip_writer_finalize_archive()
3977 pZip->m_archive_size += central_dir_size; in mz_zip_writer_finalize_archive()
3983 MZ_WRITE_LE16(hdr + MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS, pZip->m_total_files); in mz_zip_writer_finalize_archive()
3984 MZ_WRITE_LE16(hdr + MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS, pZip->m_total_files); in mz_zip_writer_finalize_archive()
3988 if (pZip->m_pWrite(pZip->m_pIO_opaque, pZip->m_archive_size, hdr, sizeof(hdr)) != sizeof(hdr)) in mz_zip_writer_finalize_archive()
3995 pZip->m_archive_size += sizeof(hdr); in mz_zip_writer_finalize_archive()
3997 pZip->m_zip_mode = MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED; in mz_zip_writer_finalize_archive()
4001 mz_bool mz_zip_writer_finalize_heap_archive(mz_zip_archive *pZip, void **pBuf, size_t *pSize) in mz_zip_writer_finalize_heap_archive() argument
4003 if ((!pZip) || (!pZip->m_pState) || (!pBuf) || (!pSize)) in mz_zip_writer_finalize_heap_archive()
4005 if (pZip->m_pWrite != mz_zip_heap_write_func) in mz_zip_writer_finalize_heap_archive()
4007 if (!mz_zip_writer_finalize_archive(pZip)) in mz_zip_writer_finalize_heap_archive()
4010 *pBuf = pZip->m_pState->m_pMem; in mz_zip_writer_finalize_heap_archive()
4011 *pSize = pZip->m_pState->m_mem_size; in mz_zip_writer_finalize_heap_archive()
4012 pZip->m_pState->m_pMem = NULL; in mz_zip_writer_finalize_heap_archive()
4013 pZip->m_pState->m_mem_size = pZip->m_pState->m_mem_capacity = 0; in mz_zip_writer_finalize_heap_archive()
4017 mz_bool mz_zip_writer_end(mz_zip_archive *pZip) in mz_zip_writer_end() argument
4021 …if ((!pZip) || (!pZip->m_pState) || (!pZip->m_pAlloc) || (!pZip->m_pFree) || ((pZip->m_zip_mode !=… in mz_zip_writer_end()
4024 pState = pZip->m_pState; in mz_zip_writer_end()
4025 pZip->m_pState = NULL; in mz_zip_writer_end()
4026 mz_zip_array_clear(pZip, &pState->m_central_dir); in mz_zip_writer_end()
4027 mz_zip_array_clear(pZip, &pState->m_central_dir_offsets); in mz_zip_writer_end()
4028 mz_zip_array_clear(pZip, &pState->m_sorted_central_dir_offsets); in mz_zip_writer_end()
4038 if ((pZip->m_pWrite == mz_zip_heap_write_func) && (pState->m_pMem)) in mz_zip_writer_end()
4040 pZip->m_pFree(pZip->m_pAlloc_opaque, pState->m_pMem); in mz_zip_writer_end()
4044 pZip->m_pFree(pZip->m_pAlloc_opaque, pState); in mz_zip_writer_end()
4045 pZip->m_zip_mode = MZ_ZIP_MODE_INVALID; in mz_zip_writer_end()