Lines Matching refs:zip
11 contrib/zip/.gitignore | 2 +
12 contrib/zip/CMakeLists.txt | 83 +++++-
13 contrib/zip/README.md | 12 +-
14 contrib/zip/appveyor.yml | 2 +-
15 contrib/zip/src/miniz.h | 457 ++++++++++++++++++++++++++++----
16 contrib/zip/src/zip.c | 62 +++--
17 contrib/zip/src/zip.h | 457 ++++++++++++++++----------------
18 contrib/zip/test/CMakeLists.txt | 27 +-
19 contrib/zip/test/test.c | 38 ++-
20 contrib/zip/test/test_miniz.c | 25 +-
23 diff --git a/contrib/zip/CMakeLists.txt b/contrib/zip/CMakeLists.txt
25 --- a/contrib/zip/CMakeLists.txt
26 +++ b/contrib/zip/CMakeLists.txt
29 -project(zip)
33 +project(zip
56 # zip
57 set(SRC src/miniz.h src/zip.h src/zip.c)
125 -install(FILES ${PROJECT_SOURCE_DIR}/src/zip.h DESTINATION include)
128 +install(FILES ${PROJECT_SOURCE_DIR}/src/zip.h DESTINATION ${INCLUDE_INSTALL_DIR}/zip)
145 diff --git a/contrib/zip/README.md b/contrib/zip/README.md
147 --- a/contrib/zip/README.md
148 +++ b/contrib/zip/README.md
150 zip_extract("foo.zip", "/tmp", on_extract_entry, &arg);
153 -* Extract a zip entry into memory.
154 +* Extract a zip entry into memory.
158 @@ -89,7 +89,7 @@ zip_close(zip);
162 -* Extract a zip entry into memory (no internal allocation).
163 +* Extract a zip entry into memory (no internal allocation).
167 @@ -110,7 +110,7 @@ zip_close(zip);
171 -* Extract a zip entry into memory using callback.
172 +* Extract a zip entry into memory using callback.
180 -* Extract a zip entry into a file.
181 +* Extract a zip entry into a file.
183 struct zip_t *zip = zip_open("foo.zip", 0, 'r');
185 @@ -157,7 +157,7 @@ struct zip_t *zip = zip_open("foo.zip", 0, 'r');
186 zip_close(zip);
189 -* List of all zip entries
190 +* List of all zip entries
192 struct zip_t *zip = zip_open("foo.zip", 0, 'r');
193 int i, n = zip_total_entries(zip);
195 zip_close(zip);
200 Compile zip library as a dynamic library.
203 diff --git a/contrib/zip/src/miniz.h b/contrib/zip/src/miniz.h
205 --- a/contrib/zip/src/miniz.h
206 +++ b/contrib/zip/src/miniz.h
772 + * (this can occur with infozip's zip util when it reads
828 diff --git a/contrib/zip/src/zip.c b/contrib/zip/src/zip.c
830 --- a/contrib/zip/src/zip.c
831 +++ b/contrib/zip/src/zip.c
896 @@ -279,7 +286,14 @@ int zip_entry_open(struct zip_t *zip, const char *entryname) {
897 zip->entry.header_offset = zip->archive.m_archive_size;
898 memset(zip->entry.header, 0, MZ_ZIP_LOCAL_DIR_HEADER_SIZE * sizeof(mz_uint8));
899 zip->entry.method = 0;
904 + zip->entry.external_attr = (mz_uint32)(0100644) << 16;
906 zip->entry.external_attr = 0;
911 @@ -660,7 +674,7 @@ ssize_t zip_entry_noallocread(struct zip_t *zip, void *buf, size_t bufsize) {
914 if (!mz_zip_reader_extract_to_mem_no_alloc(pzip, (mz_uint)zip->entry.index,
920 @@ -670,10 +684,7 @@ ssize_t zip_entry_noallocread(struct zip_t *zip, void *buf, size_t bufsize) {
921 int zip_entry_fread(struct zip_t *zip, const char *filename) {
930 if (!zip) {
935 …fo.m_version_made_by >> 8) == 19)) // if zip is produced on Unix or macOS (3 and 19 from section 4…
939 + 19)) // if zip is produced on Unix or macOS (3 and 19 from
940 + // section 4.4.2.2 of zip standard)
955 diff --git a/contrib/zip/src/zip.h b/contrib/zip/src/zip.h
957 --- a/contrib/zip/src/zip.h
958 +++ b/contrib/zip/src/zip.h
994 + * Documenation for @ref zip.
998 + * @addtogroup zip
1003 + * Default zip compression level.
1009 - This data structure is used throughout the library to represent zip archive
1015 + * This data structure is used throughout the library to represent zip archive -
1021 - Opens zip archive with compression level using the given mode.
1024 - zipname: zip archive file name.
1032 - The zip archive handler or NULL on error
1035 + * Opens zip archive with compression level using the given mode.
1037 + * @param zipname zip archive file name.
1044 + * @return the zip archive handler or NULL on error
1049 - Closes the zip archive, releases resources - always finalize.
1052 - zip: zip archive handler.
1055 + * Closes the zip archive, releases resources - always finalize.
1057 + * @param zip zip archive handler.
1059 extern void zip_close(struct zip_t *zip);
1062 - Opens an entry by name in the zip archive.
1063 - For zip archive opened in 'w' or 'a' mode the function will append
1068 - zip: zip archive handler.
1075 + * Opens an entry by name in the zip archive.
1077 + * For zip archive opened in 'w' or 'a' mode the function will append
1081 + * @param zip zip archive handler.
1086 extern int zip_entry_open(struct zip_t *zip, const char *entryname);
1089 - Opens a new entry by index in the zip archive.
1090 - This function is only valid if zip archive was opened in 'r' (readonly) mode.
1093 - zip: zip archive handler.
1100 + * Opens a new entry by index in the zip archive.
1102 + * This function is only valid if zip archive was opened in 'r' (readonly) mode.
1104 + * @param zip zip archive handler.
1109 extern int zip_entry_openbyindex(struct zip_t *zip, int index);
1112 - Closes a zip entry, flushes buffer and releases resources.
1115 - zip: zip archive handler.
1121 + * Closes a zip entry, flushes buffer and releases resources.
1123 + * @param zip zip archive handler.
1127 extern int zip_entry_close(struct zip_t *zip);
1130 - Returns a local name of the current zip entry.
1139 - zip: zip archive handler.
1142 - The pointer to the current zip entry name, or NULL on error.
1145 + * Returns a local name of the current zip entry.
1154 + * @param zip: zip archive handler.
1156 + * @return the pointer to the current zip entry name, or NULL on error.
1158 extern const char *zip_entry_name(struct zip_t *zip);
1161 - Returns an index of the current zip entry.
1164 - zip: zip archive handler.
1170 + * Returns an index of the current zip entry.
1172 + * @param zip zip archive handler.
1176 extern int zip_entry_index(struct zip_t *zip);
1179 - Determines if the current zip entry is a directory entry.
1182 - zip: zip archive handler.
1188 + * Determines if the current zip entry is a directory entry.
1190 + * @param zip zip archive handler.
1195 extern int zip_entry_isdir(struct zip_t *zip);
1198 - Returns an uncompressed size of the current zip entry.
1201 - zip: zip archive handler.
1207 + * Returns an uncompressed size of the current zip entry.
1209 + * @param zip zip archive handler.
1213 extern unsigned long long zip_entry_size(struct zip_t *zip);
1216 - Returns CRC-32 checksum of the current zip entry.
1219 - zip: zip archive handler.
1225 + * Returns CRC-32 checksum of the current zip entry.
1227 + * @param zip zip archive handler.
1231 extern unsigned int zip_entry_crc32(struct zip_t *zip);
1234 - Compresses an input buffer for the current zip entry.
1237 - zip: zip archive handler.
1245 + * Compresses an input buffer for the current zip entry.
1247 + * @param zip zip archive handler.
1253 extern int zip_entry_write(struct zip_t *zip, const void *buf, size_t bufsize);
1256 - Compresses a file for the current zip entry.
1259 - zip: zip archive handler.
1266 + * Compresses a file for the current zip entry.
1268 + * @param zip zip archive handler.
1273 extern int zip_entry_fwrite(struct zip_t *zip, const char *filename);
1276 - Extracts the current zip entry into output buffer.
1280 - zip: zip archive handler.
1293 + * Extracts the current zip entry into output buffer.
1297 + * @param zip zip archive handler.
1307 extern ssize_t zip_entry_read(struct zip_t *zip, void **buf, size_t *bufsize);
1310 - Extracts the current zip entry into a memory buffer using no memory
1314 - zip: zip archive handler.
1328 -extern ssize_t zip_entry_noallocread(struct zip_t *zip, void *buf, size_t bufsize);
1331 - Extracts the current zip entry into output file.
1334 - zip: zip archive handler.
1341 + * Extracts the current zip entry into a memory buffer using no memory
1344 + * @param zip zip archive handler.
1356 +extern ssize_t zip_entry_noallocread(struct zip_t *zip, void *buf,
1360 + * Extracts the current zip entry into output file.
1362 + * @param zip zip archive handler.
1367 extern int zip_entry_fread(struct zip_t *zip, const char *filename);
1370 - Extracts the current zip entry using a callback function (on_extract).
1373 - zip: zip archive handler.
1381 + * Extracts the current zip entry using a callback function (on_extract).
1383 + * @param zip zip archive handler.
1391 zip_entry_extract(struct zip_t *zip,
1392 @@ -262,53 +261,49 @@ zip_entry_extract(struct zip_t *zip,
1397 - Returns the number of all entries (files and directories) in the zip archive.
1400 - zip: zip archive handler.
1407 + * Returns the number of all entries (files and directories) in the zip archive.
1409 + * @param zip zip archive handler.
1414 extern int zip_total_entries(struct zip_t *zip);
1417 - Creates a new archive and puts files into a single zip archive.
1420 - zipname: zip archive file.
1428 + * Creates a new archive and puts files into a single zip archive.
1430 + * @param zipname zip archive file.
1439 - Extracts a zip archive file into directory.
1442 - successfully extracted each zip entry.
1448 - zipname: zip archive file.
1457 + * Extracts a zip archive file into directory.
1460 + * successfully extracted each zip entry.
1465 + * @param zipname zip archive file.
1481 diff --git a/contrib/zip/test/CMakeLists.txt b/contrib/zip/test/CMakeLists.txt
1483 --- a/contrib/zip/test/CMakeLists.txt
1484 +++ b/contrib/zip/test/CMakeLists.txt
1500 -add_executable(test.exe test.c ../src/zip.c)
1506 +target_link_libraries(${test_out} zip)
1508 +target_link_libraries(${test_miniz_out} zip)
1517 diff --git a/contrib/zip/test/test.c b/contrib/zip/test/test.c
1519 --- a/contrib/zip/test/test.c
1520 +++ b/contrib/zip/test/test.c
1531 assert(0 == zip_entry_close(zip));
1537 assert(0 == zip_entry_open(zip, "test/test-2.txt"));
1538 assert(strlen(TESTDATA2) == zip_entry_size(zip));
1539 assert(CRC32DATA2 == zip_entry_crc32(zip));
1541 assert(0 == zip_entry_close(zip));
1549 assert(0 == zip_entry_open(zip, "test/test-1.txt"));
1562 + struct zip_t *zip = zip_open(ZIPNAME, ZIP_DEFAULT_COMPRESSION_LEVEL, 'w');
1563 + assert(zip != NULL);
1565 + assert(0 == zip_entry_open(zip, RFILE));
1566 + assert(0 == zip_entry_write(zip, TESTDATA1, strlen(TESTDATA1)));
1567 + assert(0 == zip_entry_close(zip));
1569 + zip_close(zip);
1594 diff --git a/contrib/zip/test/test_miniz.c b/contrib/zip/test/test_miniz.c
1596 --- a/contrib/zip/test/test_miniz.c
1597 +++ b/contrib/zip/test/test_miniz.c