Skip to content

Commit

Permalink
Merged miniunz into minizip.
Browse files Browse the repository at this point in the history
Renamed passthru stream to raw stream.
Removed zlib extra compression parameters, so now all streams have the same basic parameter, which is compression level. And so got rid of mz_zip_compress and mz_zip_crypt structures.
Fixed issues using the disk splitting stream when the disk size was 0.
Changed return value of mz_file_exists to be consistent with all other functions.
Updated test harness and added empty zip test.
  • Loading branch information
nmoinvaz committed Oct 18, 2017
1 parent 68fae99 commit a66cc31
Show file tree
Hide file tree
Showing 16 changed files with 747 additions and 934 deletions.
11 changes: 4 additions & 7 deletions CMakeLists.txt
Expand Up @@ -9,7 +9,7 @@ option(USE_CRYPT "Enables building with PKWARE traditional encryption" ON)
option(USE_AES "Enables building with AES library" ON)
option(USE_BZIP2 "Enables building with BZIP2 library" ON)
option(USE_LZMA "Enables building with LZMA library" ON)
option(BUILD_TEST "Enables building of executables minizip and miniunz. Requires ZLIB!" OFF)
option(BUILD_TEST "Enables building of executables. Requires ZLIB!" OFF)

# Set a consistent MACOSX_RPATH default across all CMake versions.
# When CMake 2.8.12 is required, change this default to 1.
Expand Down Expand Up @@ -45,25 +45,25 @@ set(PROJECT_NAME libminizip)

set(MINIZIP_SRC
src/mz_os.c
src/mz_compat.c
src/mz_strm.c
src/mz_strm_buf.c
src/mz_strm_mem.c
src/mz_strm_posix.c
src/mz_strm_split.c
src/mz_strm_zlib.c
src/mz_unzip.c
src/mz_zip.c)

set(MINIZIP_PUBLIC_HEADERS
src/mz.h
src/mz_os.h
src/mz_compat.h
src/mz_strm.h
src/mz_strm_buf.h
src/mz_strm_mem.h
src/mz_strm_posix.h
src/mz_strm_split.h
src/mz_strm_zlib.h
src/mz_unzip.h
src/mz_zip.h)

if(WIN32)
Expand Down Expand Up @@ -379,12 +379,9 @@ install(FILES ${MINIZIP_PUBLIC_HEADERS} DESTINATION "${INSTALL_INC_DIR}")
install(FILES ${MINIZIP_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}")

if(BUILD_TEST)
add_executable(miniunz "src/miniunz.c")
target_link_libraries(miniunz ${PROJECT_NAME})

add_executable(minizip "src/minizip.c")
target_link_libraries(minizip ${PROJECT_NAME})

install(TARGETS miniunz minizip
install(TARGETS minizip
RUNTIME DESTINATION "bin")
endif()
8 changes: 4 additions & 4 deletions Minizip.podspec
Expand Up @@ -7,17 +7,17 @@ Pod::Spec.new do |s|
Minizip zlib contribution that includes:
* AES encryption
* I/O buffering
* PKWARE disk spanning
It also has the latest bug fixes that having been found all over the internet including the minizip forum and zlib developer's mailing list.
* PKWARE disk splitting
It also has the latest bug fixes that having been found all over the internet.
DESC
s.homepage = 'https://github.com/nmoinvaz/minizip'
s.authors = 'Gilles Vollant', 'Nathan Moinvaziri'
s.authors = 'Nathan Moinvaziri', 'Gilles Vollant'

s.source = { :git => 'https://github.com/nmoinvaz/minizip.git' }
s.libraries = 'z'

s.subspec 'Core' do |sp|
sp.source_files = '{mz_strm,mz_strm_mem,mz_strm_buf,mz_unzip,mz_zip,mz_strm_crypt,mz_strm_posix,mz_strm_zlib}.{c,h}'
sp.source_files = 'src/{mz_os,mz_compat,mz_strm,mz_strm_mem,mz_strm_buf,mz_zip,mz_strm_crypt,mz_strm_posix,mz_strm_zlib}.{c,h}'
end

s.subspec 'AES' do |sp|
Expand Down
16 changes: 7 additions & 9 deletions README.md
Expand Up @@ -20,8 +20,7 @@ cmake --build .

| File(s) | Description | Required |
|:- |:-|:-:|
| miniunz.c | Sample unzip application | No |
| minizip.c | Sample zip application | No |
| minizip.c | Sample application | No |
| mz_compat.\* | Minizip 1.0 compatibility layer | No |
| mz.h | Error codes and flags | Yes |
| mz_os\* | OS specific helper functions | Encryption |
Expand All @@ -36,8 +35,7 @@ cmake --build .
| mz_strm_posix.\* | File stream using Posix functions | Non-windows systems |
| mz_strm_win32.\* | File stream using Win32 API functions | Windows systems |
| mz_strm_zlib.\* | Deflate stream using zlib | Yes |
| mz_unzip.\* | Unzip functionality | Unzipping |
| mz_zip.\* | Zip functionality | Zipping |
| mz_zip.\* | Zip functionality | Yes |

## Features

Expand All @@ -58,7 +56,7 @@ mz_stream_mem_create(&mem_stream);
mz_stream_mem_set_buffer(mem_stream, zip_buffer, zip_buffer_size);
mz_stream_open(mem_stream, NULL, MZ_STREAM_MODE_READ);
void *unz_handle = mz_unzip_open(mem_stream);
void *zip_handle = mz_zip_open(mem_stream, MZ_STREAM_MODE_READ);
// do unzip operations
mz_stream_mem_delete(&mem_stream);
Expand All @@ -74,7 +72,7 @@ mz_stream_mem_set_grow(mem_stream, 1);
mz_stream_mem_set_grow_size(mem_stream, (128 * 1024));
mz_stream_open(mem_stream, NULL, MZ_STREAM_MODE_CREATE);
void *zip_handle = mz_zip_open(0, 0, mem_stream);
void *zip_handle = mz_zip_open(mem_stream, MZ_STREAM_MODE_WRITE);
// do unzip operations
mz_stream_mem_delete(&mem_stream);
Expand All @@ -94,7 +92,7 @@ mz_stream_buffered_create(&buf_stream);
mz_stream_buffered_open(buf_stream, NULL, MZ_STREAM_MODE_READ);
mz_stream_buffered_set_base(buf_stream, stream);
void *unz_handle = mz_unzip_open(buf_stream);
void *zip_handle = mz_zip_open(buf_stream, MZ_STREAM_MODE_READ);
```

#### Disk Splitting Stream
Expand All @@ -114,7 +112,7 @@ mz_stream_set_base(split_stream, stream);
mz_stream_open(split_stream, path..
handle = mz_unzip/zip_open(split_stream);
handle = mz_zip_open(split_stream, MZ_STREAM_MODE_WRITE);
```

The central directory is the only data stored in the .zip and doesn't follow disk size restrictions.
Expand All @@ -141,7 +139,7 @@ When unzipping it will automatically determine when in needs to cross disk bound
+ Requires [Brian Gladman's](https://github.com/BrianGladman/aes) AES library

When zipping with a password it will always use AES 256-bit encryption.
When unzipping it will use AES decryption only if necessary.
When unzipping it will use AES decryption only if necessary.

#### Central Directory Encryption

Expand Down

0 comments on commit a66cc31

Please sign in to comment.