diff --git a/CMakeLists.txt b/CMakeLists.txt index 9598e40..11796ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -672,22 +672,22 @@ if(BUILD_UNIT_TEST) list(GET COMPRESS_METHOD_ARGS ${INDEX} COMPRESS_METHOD_ARG) add_test(NAME ${COMPRESS_METHOD_NAME}-zip-${EXTRA_NAME} COMMAND minizip ${COMPRESS_METHOD_ARG} -o ${EXTRA_ARGS} - test.zip test.c test.h empty.txt fuzz + result.zip test.c test.h empty.txt random.bin uniform.bin fuzz WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test) add_test(NAME ${COMPRESS_METHOD_NAME}-list-${EXTRA_NAME} - COMMAND minizip -l ${EXTRA_ARGS} test.zip + COMMAND minizip -l ${EXTRA_ARGS} result.zip WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test) if(NOT COMPRESS_ONLY) add_test(NAME ${COMPRESS_METHOD_NAME}-unzip-${EXTRA_NAME} - COMMAND minizip -x -o ${EXTRA_ARGS} -d out test.zip + COMMAND minizip -x -o ${EXTRA_ARGS} -d out result.zip WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test) endif() endforeach() endfunction() if(NOT COMPRESS_ONLY) - add_test(NAME empty-unzip - COMMAND minizip -x -o ${EXTRA_ARGS} -d out empty.zip + add_test(NAME tiny-unzip + COMMAND minizip -x -o ${EXTRA_ARGS} -d out tiny.zip WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test) endif() create_compress_tests("generic" "") diff --git a/mz_strm_pkcrypt.c b/mz_strm_pkcrypt.c index f0b060d..ee60e74 100644 --- a/mz_strm_pkcrypt.c +++ b/mz_strm_pkcrypt.c @@ -245,7 +245,7 @@ int32_t mz_stream_pkcrypt_write(void *stream, const void *buf, int32_t size) do { - if (bytes_to_write > (size - total_written)); + if (bytes_to_write > (size - total_written)) bytes_to_write = (size - total_written); for (i = 0; i < bytes_to_write; i += 1) diff --git a/mz_strm_wzaes.c b/mz_strm_wzaes.c index 3c6e586..31874d2 100644 --- a/mz_strm_wzaes.c +++ b/mz_strm_wzaes.c @@ -238,15 +238,13 @@ int32_t mz_stream_wzaes_write(void *stream, const void *buf, int32_t size) int32_t bytes_to_write = sizeof(wzaes->buffer); int32_t total_written = 0; int32_t written = 0; - int32_t i = 0; - uint16_t t = 0; if (size < 0) return MZ_PARAM_ERROR; do { - if (bytes_to_write > (size - total_written)); + if (bytes_to_write > (size - total_written)) bytes_to_write = (size - total_written); memcpy(wzaes->buffer, buf_ptr, bytes_to_write); diff --git a/test/random.bin b/test/random.bin new file mode 100644 index 0000000..d6bb1ef Binary files /dev/null and b/test/random.bin differ diff --git a/test/empty.zip b/test/tiny.zip similarity index 100% rename from test/empty.zip rename to test/tiny.zip diff --git a/test/uniform.bin b/test/uniform.bin new file mode 100644 index 0000000..eb4b8f0 --- /dev/null +++ b/test/uniform.bin @@ -0,0 +1 @@ + \ No newline at end of file