diff --git a/src/zip.c b/src/zip.c index 4abddc0..1c6d77d 100644 --- a/src/zip.c +++ b/src/zip.c @@ -833,8 +833,7 @@ int zip_create(const char *zipname, const char *filenames[], size_t len) { } static inline int extract(mz_zip_archive *zip_archive, const char *dir, - int (*on_extract)(const char *filename, void *arg), - void *arg) { + int (*on_extract)(const char *filename, void *arg), void *arg){ int status = -1; mz_uint i, n; char path[MAX_PATH + 1]; @@ -940,13 +939,13 @@ out: status = -1; } return status; + } -static inline mz_zip_archive *zip_archive_init_file(const char *zipname, - mz_uint32 flags) { +static inline mz_zip_archive * zip_archive_init_file(const char *zipname, mz_uint32 flags){ mz_zip_archive *zip_archive = NULL; zip_archive = (mz_zip_archive *)malloc(sizeof(mz_zip_archive)); - if (!zip_archive) { + if (!zip_archive){ // malloc failed. return NULL; } @@ -965,14 +964,14 @@ static inline mz_zip_archive *zip_archive_init_file(const char *zipname, } int zip_extract(const char *zipname, const char *dir, - int (*on_extract)(const char *filename, void *arg), void *arg) { + int (*on_extract)(const char *filename, void *arg), void *arg) { if (!zipname || !dir) { // Cannot parse zip archive name return -1; } // init zip_archive and set reader mz_zip_archive *zip_archive = zip_archive_init_file(zipname, 0); - if (!zip_archive) { + if (!zip_archive){ return -1; } @@ -983,11 +982,11 @@ int zip_extract(const char *zipname, const char *dir, return status; } -static inline mz_zip_archive * -zip_archive_init_mem(const void *stream, size_t size, mz_uint32 flags) { +static inline mz_zip_archive * zip_archive_init_mem(const void *stream, + size_t size, mz_uint32 flags){ mz_zip_archive *zip_archive = NULL; zip_archive = (mz_zip_archive *)malloc(sizeof(mz_zip_archive)); - if (!zip_archive) { + if (!zip_archive){ // malloc failed. return NULL; } @@ -1006,15 +1005,14 @@ zip_archive_init_mem(const void *stream, size_t size, mz_uint32 flags) { } int zip_extract_stream(const char *stream, size_t size, const char *dir, - int (*on_extract)(const char *filename, void *arg), - void *arg) { + int (*on_extract)(const char *filename, void *arg), void *arg) { if (!stream || !dir) { // Cannot parse zip archive stream return -1; } // init zip_archive and set reader mz_zip_archive *zip_archive = zip_archive_init_mem(stream, size, 0); - if (!zip_archive) { + if (!zip_archive){ return -1; } @@ -1023,4 +1021,5 @@ int zip_extract_stream(const char *stream, size_t size, const char *dir, free(zip_archive); return status; -} + +} \ No newline at end of file diff --git a/src/zip.h b/src/zip.h index 8bee7d2..450d46f 100644 --- a/src/zip.h +++ b/src/zip.h @@ -331,9 +331,7 @@ extern int zip_extract(const char *zipname, const char *dir, * @return the return code - 0 on success, negative number (< 0) on error. */ extern int zip_extract_stream(const char *stream, size_t size, const char *dir, - int (*on_extract)(const char *filename, - void *arg), - void *arg); + int (*on_extract)(const char *filename, void *arg), void *arg); /** @} */ #ifdef __cplusplus diff --git a/test/test.c b/test/test.c index 9edd337..c092a6d 100644 --- a/test/test.c +++ b/test/test.c @@ -462,7 +462,7 @@ static void test_unix_permissions(void) { remove(RFILE); remove(ZIPNAME); #endif -} + } static void test_extract_stream(void) { @@ -482,7 +482,7 @@ static void test_extract_stream(void) { FILE *fp = NULL; fp = fopen(ZIPNAME, "r+"); assert(fp != NULL); - + fseek(fp, 0L, SEEK_END); size_t filesize = ftell(fp); fseek(fp, 0L, SEEK_SET);