mirror of
https://github.com/zlib-ng/minizip-ng
synced 2026-08-25 14:26:08 -04:00
Fixed zipcd not working correctly.
Turn off zipcd for raw in cmake tests.
This commit is contained in:
parent
fd2fb24b4e
commit
4d0897361b
4 changed files with 16 additions and 10 deletions
|
|
@ -636,8 +636,11 @@ if(BUILD_UNIT_TEST)
|
|||
if(DECOMPRESS_ONLY)
|
||||
return()
|
||||
endif()
|
||||
set(COMPRESS_METHOD_NAMES "raw")
|
||||
set(COMPRESS_METHOD_ARGS "-0")
|
||||
list(FIND EXTRA_ARGS "-z" ZIPCD_IDX)
|
||||
if(${ZIPCD_IDX} EQUAL -1)
|
||||
set(COMPRESS_METHOD_NAMES "raw")
|
||||
set(COMPRESS_METHOD_ARGS "-0")
|
||||
endif()
|
||||
if (USE_ZLIB OR USE_LIBCOMP)
|
||||
list(APPEND COMPRESS_METHOD_NAMES "deflate")
|
||||
list(APPEND COMPRESS_METHOD_ARGS "-9")
|
||||
|
|
|
|||
7
mz_zip.c
7
mz_zip.c
|
|
@ -1265,7 +1265,7 @@ static int32_t mz_zip_recover_cd(void *handle)
|
|||
mz_stream_mem_set_buffer_limit(cd_mem_stream, (int32_t)disk_offset);
|
||||
|
||||
// Set new central directory info
|
||||
mz_zip_set_cd_start_pos(handle, 0);
|
||||
mz_zip_set_cd_stream(handle, 0, cd_mem_stream);
|
||||
mz_zip_set_number_entry(handle, number_entry);
|
||||
mz_zip_set_disk_number_with_cd(handle, disk_number_with_cd);
|
||||
|
||||
|
|
@ -1488,11 +1488,12 @@ int32_t mz_zip_get_stream(void *handle, void **stream)
|
|||
return MZ_OK;
|
||||
}
|
||||
|
||||
int32_t mz_zip_set_cd_start_pos(void *handle, int64_t cd_start_pos)
|
||||
int32_t mz_zip_set_cd_stream(void *handle, int64_t cd_start_pos, void *cd_stream)
|
||||
{
|
||||
mz_zip *zip = (mz_zip *)handle;
|
||||
if (zip == NULL)
|
||||
if (zip == NULL || cd_stream == NULL)
|
||||
return MZ_PARAM_ERROR;
|
||||
zip->cd_stream = cd_stream;
|
||||
zip->cd_start_pos = cd_start_pos;
|
||||
return MZ_OK;
|
||||
}
|
||||
|
|
|
|||
4
mz_zip.h
4
mz_zip.h
|
|
@ -90,8 +90,8 @@ int32_t mz_zip_set_recover(void *handle, uint8_t recover);
|
|||
int32_t mz_zip_get_stream(void *handle, void **stream);
|
||||
// Get a pointer to the stream used to open
|
||||
|
||||
int32_t mz_zip_set_cd_start_pos(void *handle, int64_t cd_start_pos);
|
||||
// Sets the start position to use for reading the central dir
|
||||
int32_t mz_zip_set_cd_stream(void *handle, int64_t cd_start_pos, void *cd_stream);
|
||||
// Sets the stream to use for reading the central dir
|
||||
|
||||
int32_t mz_zip_get_cd_mem_stream(void *handle, void **cd_mem_stream);
|
||||
// Get a pointer to the stream used to store the central dir in memory
|
||||
|
|
|
|||
|
|
@ -279,12 +279,14 @@ int32_t mz_zip_reader_unzip_cd(void *handle)
|
|||
if (mz_stream_mem_is_open(cd_mem_stream) != MZ_OK)
|
||||
mz_stream_mem_open(cd_mem_stream, NULL, MZ_OPEN_MODE_CREATE);
|
||||
|
||||
err = mz_stream_copy_stream(cd_mem_stream, NULL, handle, mz_zip_reader_entry_read,
|
||||
(int32_t)cd_info->uncompressed_size);
|
||||
err = mz_stream_seek(cd_mem_stream, 0, MZ_SEEK_SET);
|
||||
if (err == MZ_OK)
|
||||
err = mz_stream_copy_stream(cd_mem_stream, NULL, handle, mz_zip_reader_entry_read,
|
||||
(int32_t)cd_info->uncompressed_size);
|
||||
|
||||
if (err == MZ_OK)
|
||||
{
|
||||
mz_zip_set_cd_start_pos(reader->zip_handle, 0);
|
||||
mz_zip_set_cd_stream(reader->zip_handle, 0, cd_mem_stream);
|
||||
mz_zip_set_number_entry(reader->zip_handle, number_entry);
|
||||
|
||||
err = mz_zip_reader_goto_first_entry(handle);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue