From 16dec49e088380c829b6fee6e78a16fbb14edfa0 Mon Sep 17 00:00:00 2001 From: flyinghead Date: Tue, 19 Jan 2021 11:11:01 +0100 Subject: [PATCH] windows: use utf8 internally. Support latin2, cyrillic, etc. pathnames upgrade libzip to 1.7 imgui: use all glyphs from font including latin2, cyrillic, greek, etc. --- CMakeLists.txt | 109 +- core/archive/7zArchive.cpp | 15 +- core/archive/ZipArchive.cpp | 16 +- core/archive/archive.cpp | 4 - core/archive/rzip.cpp | 26 +- core/cfg/cfg.cpp | 8 +- core/cfg/ini.cpp | 8 +- core/core.mk | 150 +- core/deps/chdpsr/cdipsr.cpp | 9 +- core/deps/chdpsr/cdipsr.h | 14 +- core/deps/chdr/chd.h | 3 + core/deps/chdr/coretypes.h | 2 +- core/deps/dirent/dirent.h | 10 +- core/deps/libzip/API-CHANGES.md | 162 + core/deps/libzip/AUTHORS | 2 + core/deps/libzip/CMakeLists.txt | 445 +++ core/deps/libzip/INSTALL.md | 69 + core/deps/libzip/LICENSE | 31 + core/deps/libzip/NEWS.md | 281 ++ core/deps/libzip/README.md | 39 + core/deps/libzip/THANKS | 117 + core/deps/libzip/TODO.md | 172 + core/deps/libzip/android/do.sh | 63 + core/deps/libzip/android/docker/Dockerfile | 122 + core/deps/libzip/android/readme.txt | 10 + .../cmake-compat/CMakePushCheckState.cmake | 91 + .../cmake-compat/CheckLibraryExists.cmake | 102 + .../cmake-compat/CheckSymbolExists.cmake | 169 + core/deps/libzip/cmake-compat/FindBZip2.cmake | 104 + .../deps/libzip/cmake-compat/FindGnuTLS.cmake | 82 + .../libzip/cmake-compat/FindLibLZMA.cmake | 124 + .../FindPackageHandleStandardArgs.cmake | 453 +++ .../cmake-compat/FindPackageMessage.cmake | 48 + .../SelectLibraryConfigurations.cmake | 80 + core/deps/libzip/cmake-config.h.in | 62 + core/deps/libzip/cmake-zipconf.h.in | 47 + core/deps/libzip/cmake/Dist.cmake | 83 + core/deps/libzip/cmake/FindMbedTLS.cmake | 132 + core/deps/libzip/cmake/FindNettle.cmake | 141 + core/deps/libzip/cmake/FindZstd.cmake | 135 + core/deps/libzip/config.h | 99 - core/deps/libzip/developer-xcode/Info.plist | 46 + .../developer-xcode/README Xcode Project.md | 6 + core/deps/libzip/developer-xcode/config.h | 94 + .../libzip/developer-xcode/extract-version.sh | 20 + .../libzip.xcodeproj/project.pbxproj | 2934 +++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../deps/libzip/developer-xcode/mkconfig-h.sh | 12 + .../{ => developer-xcode}/zip_err_str.c | 28 +- core/deps/libzip/developer-xcode/zipconf.h | 47 + core/deps/libzip/examples/CMakeLists.txt | 3 + core/deps/libzip/examples/in-memory.c | 217 ++ core/deps/libzip/examples/windows-open.c | 60 + core/deps/libzip/lib/CMakeLists.txt | 228 ++ core/deps/libzip/lib/compat.h | 194 ++ core/deps/libzip/lib/zip.h | 481 +++ core/deps/libzip/{ => lib}/zip_add.c | 26 +- .../{zip_source_free.c => lib/zip_add_dir.c} | 23 +- core/deps/libzip/lib/zip_add_entry.c | 80 + core/deps/libzip/lib/zip_algorithm_bzip2.c | 285 ++ core/deps/libzip/lib/zip_algorithm_deflate.c | 265 ++ core/deps/libzip/lib/zip_algorithm_xz.c | 407 +++ core/deps/libzip/lib/zip_algorithm_zstd.c | 294 ++ core/deps/libzip/lib/zip_buffer.c | 324 ++ core/deps/libzip/lib/zip_close.c | 700 ++++ core/deps/libzip/lib/zip_crypto.h | 54 + .../deps/libzip/lib/zip_crypto_commoncrypto.c | 110 + .../deps/libzip/lib/zip_crypto_commoncrypto.h | 53 + core/deps/libzip/lib/zip_crypto_gnutls.c | 135 + core/deps/libzip/lib/zip_crypto_gnutls.h | 68 + core/deps/libzip/lib/zip_crypto_mbedtls.c | 162 + core/deps/libzip/lib/zip_crypto_mbedtls.h | 56 + core/deps/libzip/lib/zip_crypto_openssl.c | 137 + core/deps/libzip/lib/zip_crypto_openssl.h | 56 + core/deps/libzip/lib/zip_crypto_win.c | 495 +++ core/deps/libzip/lib/zip_crypto_win.h | 53 + core/deps/libzip/{ => lib}/zip_delete.c | 36 +- core/deps/libzip/lib/zip_dir_add.c | 92 + core/deps/libzip/lib/zip_dirent.c | 1163 +++++++ .../libzip/{zip_free.c => lib/zip_discard.c} | 51 +- .../{zip_stat_init.c => lib/zip_entry.c} | 34 +- core/deps/libzip/lib/zip_err_str.c | 84 + core/deps/libzip/lib/zip_error.c | 150 + core/deps/libzip/{ => lib}/zip_error_clear.c | 12 +- core/deps/libzip/{ => lib}/zip_error_get.c | 22 +- .../libzip/{ => lib}/zip_error_get_sys_type.c | 13 +- .../libzip/{ => lib}/zip_error_strerror.c | 63 +- core/deps/libzip/{ => lib}/zip_error_to_str.c | 34 +- core/deps/libzip/lib/zip_extra_field.c | 426 +++ core/deps/libzip/lib/zip_extra_field_api.c | 355 ++ core/deps/libzip/{ => lib}/zip_fclose.c | 33 +- .../{zip_entry_new.c => lib/zip_fdopen.c} | 84 +- core/deps/libzip/lib/zip_file_add.c | 52 + .../libzip/{ => lib}/zip_file_error_clear.c | 12 +- .../libzip/{ => lib}/zip_file_error_get.c | 11 +- core/deps/libzip/lib/zip_file_get_comment.c | 55 + .../lib/zip_file_get_external_attributes.c | 50 + core/deps/libzip/lib/zip_file_get_offset.c | 117 + .../{zip_set_name.c => lib/zip_file_rename.c} | 56 +- core/deps/libzip/lib/zip_file_replace.c | 105 + core/deps/libzip/lib/zip_file_set_comment.c | 101 + .../deps/libzip/lib/zip_file_set_encryption.c | 116 + .../lib/zip_file_set_external_attributes.c | 82 + core/deps/libzip/lib/zip_file_set_mtime.c | 68 + .../deps/libzip/{ => lib}/zip_file_strerror.c | 11 +- core/deps/libzip/{ => lib}/zip_fopen.c | 19 +- core/deps/libzip/lib/zip_fopen_encrypted.c | 46 + core/deps/libzip/lib/zip_fopen_index.c | 41 + .../zip_fopen_index_encrypted.c} | 71 +- core/deps/libzip/lib/zip_fread.c | 62 + core/deps/libzip/lib/zip_fseek.c | 51 + core/deps/libzip/lib/zip_ftell.c | 54 + .../{ => lib}/zip_get_archive_comment.c | 44 +- .../libzip/{ => lib}/zip_get_archive_flag.c | 11 +- .../zip_get_encryption_implementation.c} | 66 +- .../libzip/{ => lib}/zip_get_file_comment.c | 30 +- core/deps/libzip/{ => lib}/zip_get_name.c | 41 +- .../zip_get_num_entries.c} | 31 +- .../deps/libzip/{ => lib}/zip_get_num_files.c | 20 +- core/deps/libzip/lib/zip_hash.c | 410 +++ core/deps/libzip/lib/zip_io_util.c | 134 + core/deps/libzip/lib/zip_libzip_version.c | 41 + core/deps/libzip/{ => lib}/zip_memdup.c | 15 +- core/deps/libzip/lib/zip_mkstempm.c | 93 + core/deps/libzip/{ => lib}/zip_name_locate.c | 84 +- core/deps/libzip/{ => lib}/zip_new.c | 45 +- core/deps/libzip/lib/zip_open.c | 849 +++++ core/deps/libzip/lib/zip_pkware.c | 112 + core/deps/libzip/lib/zip_progress.c | 293 ++ core/deps/libzip/lib/zip_random_unix.c | 104 + core/deps/libzip/lib/zip_random_uwp.c | 82 + .../{zip_error.c => lib/zip_random_win32.c} | 104 +- .../zip_rename.c} | 19 +- .../{zip_entry_free.c => lib/zip_replace.c} | 24 +- .../deps/libzip/lib/zip_set_archive_comment.c | 80 + .../zip_set_archive_flag.c} | 51 +- .../zip_set_default_password.c} | 35 +- core/deps/libzip/lib/zip_set_file_comment.c | 46 + .../libzip/lib/zip_set_file_compression.c | 91 + core/deps/libzip/lib/zip_set_name.c | 157 + .../deps/libzip/lib/zip_source_accept_empty.c | 52 + core/deps/libzip/lib/zip_source_begin_write.c | 52 + .../zip_source_begin_write_cloning.c} | 37 +- core/deps/libzip/lib/zip_source_buffer.c | 620 ++++ core/deps/libzip/lib/zip_source_call.c | 68 + core/deps/libzip/lib/zip_source_close.c | 57 + .../zip_source_commit_write.c} | 48 +- core/deps/libzip/lib/zip_source_compress.c | 398 +++ core/deps/libzip/lib/zip_source_crc.c | 197 ++ core/deps/libzip/lib/zip_source_error.c | 46 + core/deps/libzip/lib/zip_source_file.h | 90 + core/deps/libzip/lib/zip_source_file_common.c | 378 +++ core/deps/libzip/lib/zip_source_file_stdio.c | 208 ++ core/deps/libzip/lib/zip_source_file_stdio.h | 47 + .../libzip/lib/zip_source_file_stdio_named.c | 313 ++ core/deps/libzip/lib/zip_source_file_win32.c | 234 ++ core/deps/libzip/lib/zip_source_file_win32.h | 76 + .../libzip/lib/zip_source_file_win32_ansi.c | 85 + .../libzip/lib/zip_source_file_win32_named.c | 275 ++ .../libzip/lib/zip_source_file_win32_utf16.c | 111 + .../libzip/lib/zip_source_file_win32_utf8.c | 73 + .../{zip_add_dir.c => lib/zip_source_free.c} | 61 +- core/deps/libzip/lib/zip_source_function.c | 98 + .../lib/zip_source_get_file_attributes.c | 106 + core/deps/libzip/lib/zip_source_is_deleted.c | 41 + core/deps/libzip/lib/zip_source_layered.c | 67 + .../{zip_unchange.c => lib/zip_source_open.c} | 74 +- .../libzip/lib/zip_source_pkware_decode.c | 220 ++ .../libzip/lib/zip_source_pkware_encode.c | 249 ++ core/deps/libzip/lib/zip_source_read.c | 96 + core/deps/libzip/lib/zip_source_remove.c | 60 + .../libzip/lib/zip_source_rollback_write.c | 46 + core/deps/libzip/lib/zip_source_seek.c | 95 + core/deps/libzip/lib/zip_source_seek_write.c | 51 + .../zip_source_stat.c} | 51 +- core/deps/libzip/lib/zip_source_supports.c | 65 + core/deps/libzip/lib/zip_source_tell.c | 57 + core/deps/libzip/lib/zip_source_tell_write.c | 46 + core/deps/libzip/lib/zip_source_window.c | 294 ++ .../libzip/lib/zip_source_winzip_aes_decode.c | 265 ++ .../libzip/lib/zip_source_winzip_aes_encode.c | 254 ++ core/deps/libzip/lib/zip_source_write.c | 46 + core/deps/libzip/lib/zip_source_zip.c | 56 + core/deps/libzip/lib/zip_source_zip_new.c | 191 ++ core/deps/libzip/{ => lib}/zip_stat.c | 17 +- core/deps/libzip/{ => lib}/zip_stat_index.c | 76 +- core/deps/libzip/lib/zip_stat_init.c | 83 + core/deps/libzip/{ => lib}/zip_strerror.c | 11 +- core/deps/libzip/lib/zip_string.c | 178 + core/deps/libzip/lib/zip_unchange.c | 93 + core/deps/libzip/{ => lib}/zip_unchange_all.c | 22 +- .../libzip/{ => lib}/zip_unchange_archive.c | 17 +- .../deps/libzip/{ => lib}/zip_unchange_data.c | 30 +- core/deps/libzip/lib/zip_utf-8.c | 226 ++ core/deps/libzip/lib/zip_winzip_aes.c | 162 + core/deps/libzip/lib/zipint.h | 609 ++++ core/deps/libzip/libzip-config.cmake.in | 11 + core/deps/libzip/libzip.pc.in | 15 + core/deps/libzip/man/CMakeLists.txt | 161 + core/deps/libzip/man/ZIP_SOURCE_GET_ARGS.html | 114 + core/deps/libzip/man/ZIP_SOURCE_GET_ARGS.man | 83 + core/deps/libzip/man/ZIP_SOURCE_GET_ARGS.mdoc | 79 + core/deps/libzip/man/fix-man-links.sh | 6 + core/deps/libzip/man/handle_links | 74 + core/deps/libzip/man/libzip.html | 265 ++ core/deps/libzip/man/libzip.man | 319 ++ core/deps/libzip/man/libzip.mdoc | 260 ++ core/deps/libzip/man/links | 23 + core/deps/libzip/man/make_zip_errors.sh | 114 + core/deps/libzip/man/mkdocset.pl | 216 ++ core/deps/libzip/man/nih-man.css | 61 + core/deps/libzip/man/update-html.cmake | 12 + core/deps/libzip/man/update-man.cmake | 7 + core/deps/libzip/man/zip_add.html | 121 + core/deps/libzip/man/zip_add.man | 106 + core/deps/libzip/man/zip_add.mdoc | 96 + core/deps/libzip/man/zip_add_dir.html | 102 + core/deps/libzip/man/zip_add_dir.man | 74 + core/deps/libzip/man/zip_add_dir.mdoc | 69 + core/deps/libzip/man/zip_close.html | 145 + core/deps/libzip/man/zip_close.man | 134 + core/deps/libzip/man/zip_close.mdoc | 117 + .../man/zip_compression_method_supported.html | 105 + .../man/zip_compression_method_supported.man | 70 + .../man/zip_compression_method_supported.mdoc | 65 + core/deps/libzip/man/zip_delete.html | 114 + core/deps/libzip/man/zip_delete.man | 84 + core/deps/libzip/man/zip_delete.mdoc | 80 + core/deps/libzip/man/zip_dir_add.html | 134 + core/deps/libzip/man/zip_dir_add.man | 116 + core/deps/libzip/man/zip_dir_add.mdoc | 109 + core/deps/libzip/man/zip_discard.html | 97 + core/deps/libzip/man/zip_discard.man | 66 + core/deps/libzip/man/zip_discard.mdoc | 61 + .../man/zip_encryption_method_supported.html | 105 + .../man/zip_encryption_method_supported.man | 70 + .../man/zip_encryption_method_supported.mdoc | 65 + core/deps/libzip/man/zip_error_clear.html | 104 + core/deps/libzip/man/zip_error_clear.man | 79 + core/deps/libzip/man/zip_error_clear.mdoc | 69 + .../libzip/man/zip_error_code_system.html | 99 + .../deps/libzip/man/zip_error_code_system.man | 68 + .../libzip/man/zip_error_code_system.mdoc | 63 + core/deps/libzip/man/zip_error_code_zip.html | 96 + core/deps/libzip/man/zip_error_code_zip.man | 65 + core/deps/libzip/man/zip_error_code_zip.mdoc | 60 + core/deps/libzip/man/zip_error_fini.html | 97 + core/deps/libzip/man/zip_error_fini.man | 65 + core/deps/libzip/man/zip_error_fini.mdoc | 60 + core/deps/libzip/man/zip_error_get.html | 150 + core/deps/libzip/man/zip_error_get.man | 139 + core/deps/libzip/man/zip_error_get.mdoc | 117 + .../libzip/man/zip_error_get_sys_type.html | 116 + .../libzip/man/zip_error_get_sys_type.man | 88 + .../libzip/man/zip_error_get_sys_type.mdoc | 77 + core/deps/libzip/man/zip_error_init.html | 108 + core/deps/libzip/man/zip_error_init.man | 85 + core/deps/libzip/man/zip_error_init.mdoc | 76 + core/deps/libzip/man/zip_error_set.html | 101 + core/deps/libzip/man/zip_error_set.man | 74 + core/deps/libzip/man/zip_error_set.mdoc | 69 + core/deps/libzip/man/zip_error_strerror.html | 101 + core/deps/libzip/man/zip_error_strerror.man | 72 + core/deps/libzip/man/zip_error_strerror.mdoc | 67 + .../libzip/man/zip_error_system_type.html | 107 + .../deps/libzip/man/zip_error_system_type.man | 83 + .../libzip/man/zip_error_system_type.mdoc | 77 + core/deps/libzip/man/zip_error_to_data.html | 108 + core/deps/libzip/man/zip_error_to_data.man | 74 + core/deps/libzip/man/zip_error_to_data.mdoc | 69 + core/deps/libzip/man/zip_error_to_str.html | 124 + core/deps/libzip/man/zip_error_to_str.man | 99 + core/deps/libzip/man/zip_error_to_str.mdoc | 88 + core/deps/libzip/man/zip_errors.html | 150 + core/deps/libzip/man/zip_errors.man | 147 + core/deps/libzip/man/zip_errors.mdoc | 117 + core/deps/libzip/man/zip_fclose.html | 103 + core/deps/libzip/man/zip_fclose.man | 70 + core/deps/libzip/man/zip_fclose.mdoc | 65 + core/deps/libzip/man/zip_fdopen.html | 154 + core/deps/libzip/man/zip_fdopen.man | 158 + core/deps/libzip/man/zip_fdopen.mdoc | 147 + core/deps/libzip/man/zip_file_add.html | 178 + core/deps/libzip/man/zip_file_add.man | 183 + core/deps/libzip/man/zip_file_add.mdoc | 164 + .../libzip/man/zip_file_attributes_init.html | 97 + .../libzip/man/zip_file_attributes_init.man | 66 + .../libzip/man/zip_file_attributes_init.mdoc | 61 + .../man/zip_file_extra_field_delete.html | 159 + .../man/zip_file_extra_field_delete.man | 141 + .../man/zip_file_extra_field_delete.mdoc | 130 + .../libzip/man/zip_file_extra_field_get.html | 176 + .../libzip/man/zip_file_extra_field_get.man | 169 + .../libzip/man/zip_file_extra_field_get.mdoc | 157 + .../libzip/man/zip_file_extra_field_set.html | 148 + .../libzip/man/zip_file_extra_field_set.man | 123 + .../libzip/man/zip_file_extra_field_set.mdoc | 115 + .../man/zip_file_extra_fields_count.html | 149 + .../man/zip_file_extra_fields_count.man | 124 + .../man/zip_file_extra_fields_count.mdoc | 113 + .../deps/libzip/man/zip_file_get_comment.html | 143 + core/deps/libzip/man/zip_file_get_comment.man | 126 + .../deps/libzip/man/zip_file_get_comment.mdoc | 119 + core/deps/libzip/man/zip_file_get_error.html | 95 + core/deps/libzip/man/zip_file_get_error.man | 62 + core/deps/libzip/man/zip_file_get_error.mdoc | 57 + .../man/zip_file_get_external_attributes.html | 176 + .../man/zip_file_get_external_attributes.man | 174 + .../man/zip_file_get_external_attributes.mdoc | 165 + core/deps/libzip/man/zip_file_rename.html | 132 + core/deps/libzip/man/zip_file_rename.man | 111 + core/deps/libzip/man/zip_file_rename.mdoc | 104 + .../deps/libzip/man/zip_file_set_comment.html | 137 + core/deps/libzip/man/zip_file_set_comment.man | 123 + .../deps/libzip/man/zip_file_set_comment.mdoc | 116 + .../libzip/man/zip_file_set_encryption.html | 150 + .../libzip/man/zip_file_set_encryption.man | 132 + .../libzip/man/zip_file_set_encryption.mdoc | 121 + .../man/zip_file_set_external_attributes.html | 125 + .../man/zip_file_set_external_attributes.man | 95 + .../man/zip_file_set_external_attributes.mdoc | 89 + core/deps/libzip/man/zip_file_set_mtime.html | 164 + core/deps/libzip/man/zip_file_set_mtime.man | 141 + core/deps/libzip/man/zip_file_set_mtime.mdoc | 124 + core/deps/libzip/man/zip_file_strerror.html | 115 + core/deps/libzip/man/zip_file_strerror.man | 95 + core/deps/libzip/man/zip_file_strerror.mdoc | 85 + core/deps/libzip/man/zip_fopen.html | 171 + core/deps/libzip/man/zip_fopen.man | 166 + core/deps/libzip/man/zip_fopen.mdoc | 147 + core/deps/libzip/man/zip_fopen_encrypted.html | 158 + core/deps/libzip/man/zip_fopen_encrypted.man | 144 + core/deps/libzip/man/zip_fopen_encrypted.mdoc | 135 + core/deps/libzip/man/zip_fread.html | 110 + core/deps/libzip/man/zip_fread.man | 83 + core/deps/libzip/man/zip_fread.mdoc | 78 + core/deps/libzip/man/zip_fseek.html | 110 + core/deps/libzip/man/zip_fseek.man | 80 + core/deps/libzip/man/zip_fseek.mdoc | 75 + core/deps/libzip/man/zip_ftell.html | 105 + core/deps/libzip/man/zip_ftell.man | 71 + core/deps/libzip/man/zip_ftell.mdoc | 66 + .../libzip/man/zip_get_archive_comment.html | 131 + .../libzip/man/zip_get_archive_comment.man | 115 + .../libzip/man/zip_get_archive_comment.mdoc | 112 + .../deps/libzip/man/zip_get_archive_flag.html | 118 + core/deps/libzip/man/zip_get_archive_flag.man | 98 + .../deps/libzip/man/zip_get_archive_flag.mdoc | 94 + core/deps/libzip/man/zip_get_error.html | 97 + core/deps/libzip/man/zip_get_error.man | 65 + core/deps/libzip/man/zip_get_error.mdoc | 60 + .../deps/libzip/man/zip_get_file_comment.html | 105 + core/deps/libzip/man/zip_get_file_comment.man | 78 + .../deps/libzip/man/zip_get_file_comment.mdoc | 73 + core/deps/libzip/man/zip_get_name.html | 146 + core/deps/libzip/man/zip_get_name.man | 141 + core/deps/libzip/man/zip_get_name.mdoc | 132 + core/deps/libzip/man/zip_get_num_entries.html | 111 + core/deps/libzip/man/zip_get_num_entries.man | 87 + core/deps/libzip/man/zip_get_num_entries.mdoc | 82 + core/deps/libzip/man/zip_get_num_files.html | 110 + core/deps/libzip/man/zip_get_num_files.man | 80 + core/deps/libzip/man/zip_get_num_files.mdoc | 75 + core/deps/libzip/man/zip_libzip_version.html | 98 + core/deps/libzip/man/zip_libzip_version.man | 71 + core/deps/libzip/man/zip_libzip_version.mdoc | 66 + core/deps/libzip/man/zip_name_locate.html | 149 + core/deps/libzip/man/zip_name_locate.man | 137 + core/deps/libzip/man/zip_name_locate.mdoc | 125 + core/deps/libzip/man/zip_open.html | 176 + core/deps/libzip/man/zip_open.man | 192 ++ core/deps/libzip/man/zip_open.mdoc | 170 + .../man/zip_register_progress_callback.html | 111 + .../man/zip_register_progress_callback.man | 83 + .../man/zip_register_progress_callback.mdoc | 77 + ...register_progress_callback_with_state.html | 118 + ..._register_progress_callback_with_state.man | 92 + ...register_progress_callback_with_state.mdoc | 86 + core/deps/libzip/man/zip_rename.html | 104 + core/deps/libzip/man/zip_rename.man | 75 + core/deps/libzip/man/zip_rename.mdoc | 70 + .../libzip/man/zip_set_archive_comment.html | 124 + .../libzip/man/zip_set_archive_comment.man | 98 + .../libzip/man/zip_set_archive_comment.mdoc | 93 + .../deps/libzip/man/zip_set_archive_flag.html | 107 + core/deps/libzip/man/zip_set_archive_flag.man | 79 + .../deps/libzip/man/zip_set_archive_flag.mdoc | 74 + .../libzip/man/zip_set_default_password.html | 123 + .../libzip/man/zip_set_default_password.man | 94 + .../libzip/man/zip_set_default_password.mdoc | 90 + .../deps/libzip/man/zip_set_file_comment.html | 109 + core/deps/libzip/man/zip_set_file_comment.man | 84 + .../deps/libzip/man/zip_set_file_comment.mdoc | 79 + .../libzip/man/zip_set_file_compression.html | 149 + .../libzip/man/zip_set_file_compression.man | 132 + .../libzip/man/zip_set_file_compression.mdoc | 124 + core/deps/libzip/man/zip_source.html | 117 + core/deps/libzip/man/zip_source.man | 89 + core/deps/libzip/man/zip_source.mdoc | 88 + .../libzip/man/zip_source_begin_write.html | 123 + .../libzip/man/zip_source_begin_write.man | 99 + .../libzip/man/zip_source_begin_write.mdoc | 89 + core/deps/libzip/man/zip_source_buffer.html | 135 + core/deps/libzip/man/zip_source_buffer.man | 112 + core/deps/libzip/man/zip_source_buffer.mdoc | 102 + .../man/zip_source_buffer_fragment.html | 150 + .../libzip/man/zip_source_buffer_fragment.man | 125 + .../man/zip_source_buffer_fragment.mdoc | 112 + core/deps/libzip/man/zip_source_close.html | 105 + core/deps/libzip/man/zip_source_close.man | 72 + core/deps/libzip/man/zip_source_close.mdoc | 67 + .../libzip/man/zip_source_commit_write.html | 109 + .../libzip/man/zip_source_commit_write.man | 75 + .../libzip/man/zip_source_commit_write.mdoc | 70 + core/deps/libzip/man/zip_source_error.html | 97 + core/deps/libzip/man/zip_source_error.man | 65 + core/deps/libzip/man/zip_source_error.mdoc | 60 + core/deps/libzip/man/zip_source_file.html | 141 + core/deps/libzip/man/zip_source_file.man | 125 + core/deps/libzip/man/zip_source_file.mdoc | 114 + core/deps/libzip/man/zip_source_filep.html | 137 + core/deps/libzip/man/zip_source_filep.man | 117 + core/deps/libzip/man/zip_source_filep.mdoc | 107 + core/deps/libzip/man/zip_source_free.html | 104 + core/deps/libzip/man/zip_source_free.man | 81 + core/deps/libzip/man/zip_source_free.mdoc | 76 + core/deps/libzip/man/zip_source_function.html | 380 +++ core/deps/libzip/man/zip_source_function.man | 413 +++ core/deps/libzip/man/zip_source_function.mdoc | 399 +++ .../libzip/man/zip_source_is_deleted.html | 103 + .../deps/libzip/man/zip_source_is_deleted.man | 67 + .../libzip/man/zip_source_is_deleted.mdoc | 62 + core/deps/libzip/man/zip_source_keep.html | 97 + core/deps/libzip/man/zip_source_keep.man | 65 + core/deps/libzip/man/zip_source_keep.mdoc | 60 + .../man/zip_source_make_command_bitmap.html | 99 + .../man/zip_source_make_command_bitmap.man | 67 + .../man/zip_source_make_command_bitmap.mdoc | 62 + core/deps/libzip/man/zip_source_open.html | 108 + core/deps/libzip/man/zip_source_open.man | 75 + core/deps/libzip/man/zip_source_open.mdoc | 70 + core/deps/libzip/man/zip_source_read.html | 112 + core/deps/libzip/man/zip_source_read.man | 83 + core/deps/libzip/man/zip_source_read.mdoc | 78 + .../libzip/man/zip_source_rollback_write.html | 110 + .../libzip/man/zip_source_rollback_write.man | 78 + .../libzip/man/zip_source_rollback_write.mdoc | 73 + core/deps/libzip/man/zip_source_seek.html | 120 + core/deps/libzip/man/zip_source_seek.man | 89 + core/deps/libzip/man/zip_source_seek.mdoc | 81 + .../man/zip_source_seek_compute_offset.html | 119 + .../man/zip_source_seek_compute_offset.man | 85 + .../man/zip_source_seek_compute_offset.mdoc | 81 + .../libzip/man/zip_source_seek_write.html | 123 + .../deps/libzip/man/zip_source_seek_write.man | 92 + .../libzip/man/zip_source_seek_write.mdoc | 84 + core/deps/libzip/man/zip_source_stat.html | 154 + core/deps/libzip/man/zip_source_stat.man | 144 + core/deps/libzip/man/zip_source_stat.mdoc | 125 + core/deps/libzip/man/zip_source_tell.html | 108 + core/deps/libzip/man/zip_source_tell.man | 79 + core/deps/libzip/man/zip_source_tell.mdoc | 74 + .../libzip/man/zip_source_tell_write.html | 112 + .../deps/libzip/man/zip_source_tell_write.man | 82 + .../libzip/man/zip_source_tell_write.mdoc | 77 + core/deps/libzip/man/zip_source_win32a.html | 143 + core/deps/libzip/man/zip_source_win32a.man | 127 + core/deps/libzip/man/zip_source_win32a.mdoc | 116 + .../libzip/man/zip_source_win32handle.html | 143 + .../libzip/man/zip_source_win32handle.man | 127 + .../libzip/man/zip_source_win32handle.mdoc | 116 + core/deps/libzip/man/zip_source_win32w.html | 142 + core/deps/libzip/man/zip_source_win32w.man | 125 + core/deps/libzip/man/zip_source_win32w.mdoc | 114 + core/deps/libzip/man/zip_source_write.html | 115 + core/deps/libzip/man/zip_source_write.man | 85 + core/deps/libzip/man/zip_source_write.mdoc | 80 + core/deps/libzip/man/zip_source_zip.html | 143 + core/deps/libzip/man/zip_source_zip.man | 129 + core/deps/libzip/man/zip_source_zip.mdoc | 120 + core/deps/libzip/man/zip_stat.html | 190 ++ core/deps/libzip/man/zip_stat.man | 203 ++ core/deps/libzip/man/zip_stat.mdoc | 179 + core/deps/libzip/man/zip_stat_init.html | 109 + core/deps/libzip/man/zip_stat_init.man | 81 + core/deps/libzip/man/zip_stat_init.mdoc | 76 + core/deps/libzip/man/zip_unchange.html | 116 + core/deps/libzip/man/zip_unchange.man | 86 + core/deps/libzip/man/zip_unchange.mdoc | 81 + core/deps/libzip/man/zip_unchange_all.html | 103 + core/deps/libzip/man/zip_unchange_all.man | 69 + core/deps/libzip/man/zip_unchange_all.mdoc | 64 + .../deps/libzip/man/zip_unchange_archive.html | 103 + core/deps/libzip/man/zip_unchange_archive.man | 69 + .../deps/libzip/man/zip_unchange_archive.mdoc | 64 + core/deps/libzip/man/zipcmp.html | 122 + core/deps/libzip/man/zipcmp.man | 96 + core/deps/libzip/man/zipcmp.mdoc | 90 + core/deps/libzip/man/zipmerge.html | 125 + core/deps/libzip/man/zipmerge.man | 97 + core/deps/libzip/man/zipmerge.mdoc | 91 + core/deps/libzip/man/ziptool.html | 315 ++ core/deps/libzip/man/ziptool.man | 389 +++ core/deps/libzip/man/ziptool.mdoc | 330 ++ core/deps/libzip/mkstemp.c | 143 - core/deps/libzip/regress/nihtest.conf.in | 4 + core/deps/libzip/regress/runtest.in | 60 + core/deps/libzip/vstudio/readme.txt | 77 + core/deps/libzip/vstudio/vsbuild.cmd | 186 ++ .../libzip/vstudio/zlib/unpack_zlib_here.txt | 1 + core/deps/libzip/zip.h | 232 -- core/deps/libzip/zip_close.c | 679 ---- core/deps/libzip/zip_dirent.c | 615 ---- core/deps/libzip/zip_fopen_index.c | 216 -- core/deps/libzip/zip_fread.c | 130 - core/deps/libzip/zip_open.c | 567 ---- core/deps/libzip/zip_source_buffer.c | 157 - core/deps/libzip/zip_source_filep.c | 216 -- core/deps/libzip/zip_source_zip.c | 188 -- core/deps/libzip/zipint.h | 264 -- core/deps/nowide/CMakeLists.txt | 359 ++ core/deps/nowide/COPYING | 23 + core/deps/nowide/Doxyfile.in | 2387 ++++++++++++++ core/deps/nowide/README.md | 245 ++ .../contrib/CMake/modules/FindHHC.cmake | 13 + .../contrib/MSVC/NoWide-Android.vcxproj | 154 + .../MSVC/NoWide-Android.vcxproj.filters | 73 + .../contrib/MSVC/NoWide-Windows.vcxproj | 211 ++ .../MSVC/NoWide-Windows.vcxproj.filters | 78 + core/deps/nowide/contrib/MSVC/NoWide.sln | 44 + core/deps/nowide/include/nowide/args.hpp | 167 + core/deps/nowide/include/nowide/cenv.hpp | 126 + core/deps/nowide/include/nowide/config.hpp | 38 + core/deps/nowide/include/nowide/convert.hpp | 154 + core/deps/nowide/include/nowide/cstdio.hpp | 101 + core/deps/nowide/include/nowide/cstdlib.hpp | 16 + .../nowide/include/nowide/encoding_errors.hpp | 58 + .../nowide/include/nowide/encoding_utf.hpp | 83 + core/deps/nowide/include/nowide/filebuf.hpp | 408 +++ core/deps/nowide/include/nowide/fstream.hpp | 309 ++ core/deps/nowide/include/nowide/iostream.hpp | 99 + .../deps/nowide/include/nowide/scoped_ptr.hpp | 93 + .../nowide/include/nowide/stackstring.hpp | 154 + core/deps/nowide/include/nowide/system.hpp | 46 + core/deps/nowide/include/nowide/utf.hpp | 469 +++ core/deps/nowide/include/nowide/windows.hpp | 39 + core/deps/nowide/src/iostream.cpp | 265 ++ core/deps/nowide/test/test.hpp | 25 + core/deps/nowide/test/test_convert.cpp | 101 + core/deps/nowide/test/test_env.cpp | 49 + core/deps/nowide/test/test_fstream.cpp | 152 + core/deps/nowide/test/test_iostream.cpp | 52 + core/deps/nowide/test/test_stdio.cpp | 60 + core/deps/nowide/test/test_system.cpp | 91 + core/deps/zlib/zconf.h | 534 --- core/hw/aica/aica.cpp | 1 + core/hw/aica/sgc_if.cpp | 1 + core/hw/arm7/arm_mem.h | 1 + core/hw/flashrom/flashrom.h | 12 +- core/hw/gdrom/gdrom_if.h | 25 +- core/hw/gdrom/gdromv3.cpp | 6 +- core/hw/gdrom/gdromv3.h | 12 - core/hw/maple/maple_devs.cpp | 22 +- core/hw/maple/maple_jvs.cpp | 12 +- core/hw/naomi/naomi_cart.cpp | 23 +- core/hw/sh4/dyna/driver.cpp | 5 - core/hw/sh4/interpr/sh4_opcodes.cpp | 1 - core/imgread/cdi.cpp | 26 +- core/imgread/chd.cpp | 40 +- core/imgread/common.h | 54 +- core/imgread/cue.cpp | 17 +- core/imgread/gd_driver.h | 9 - core/imgread/gdi.cpp | 12 +- core/input/gamepad_device.cpp | 2 +- core/input/mapping.cpp | 8 +- core/linux-dist/main.cpp | 67 +- core/nullDC.cpp | 18 +- core/oslib/directory.h | 127 + core/reios/descrambl.cpp | 1 + core/reios/reios.cpp | 13 +- core/reios/reios_elf.cpp | 18 +- core/rend/CustomTexture.cpp | 16 +- core/rend/TexCache.h | 13 + core/rend/game_scanner.h | 11 +- core/rend/gui.cpp | 10 +- core/rend/gui_util.cpp | 33 +- core/rend/osd.cpp | 9 +- core/rend/vulkan/vulkan_context.cpp | 18 +- core/serialize.cpp | 1 + core/stdclass.cpp | 14 +- core/types.h | 73 +- core/windows/winmain.cpp | 3 +- gdtool/gdtool.vcxproj | 1 - gdtool/gdtool.vcxproj.filters | 3 - .../reicast-ios.xcodeproj/project.pbxproj | 2 - .../emulator-osx/include/config.h | 73 + .../emulator-osx/include/zipconf.h | 50 + .../reicast-osx.xcodeproj/project.pbxproj | 758 +++-- shell/linux/Makefile | 17 +- shell/linux/include/mingw/config.h | 73 + shell/linux/include/mingw/zipconf.h | 52 + wercker.yml | 2 +- 603 files changed, 67820 insertions(+), 5638 deletions(-) create mode 100644 core/deps/libzip/API-CHANGES.md create mode 100644 core/deps/libzip/AUTHORS create mode 100644 core/deps/libzip/CMakeLists.txt create mode 100644 core/deps/libzip/INSTALL.md create mode 100644 core/deps/libzip/LICENSE create mode 100644 core/deps/libzip/NEWS.md create mode 100644 core/deps/libzip/README.md create mode 100644 core/deps/libzip/THANKS create mode 100644 core/deps/libzip/TODO.md create mode 100644 core/deps/libzip/android/do.sh create mode 100644 core/deps/libzip/android/docker/Dockerfile create mode 100644 core/deps/libzip/android/readme.txt create mode 100644 core/deps/libzip/cmake-compat/CMakePushCheckState.cmake create mode 100644 core/deps/libzip/cmake-compat/CheckLibraryExists.cmake create mode 100644 core/deps/libzip/cmake-compat/CheckSymbolExists.cmake create mode 100644 core/deps/libzip/cmake-compat/FindBZip2.cmake create mode 100644 core/deps/libzip/cmake-compat/FindGnuTLS.cmake create mode 100644 core/deps/libzip/cmake-compat/FindLibLZMA.cmake create mode 100644 core/deps/libzip/cmake-compat/FindPackageHandleStandardArgs.cmake create mode 100644 core/deps/libzip/cmake-compat/FindPackageMessage.cmake create mode 100644 core/deps/libzip/cmake-compat/SelectLibraryConfigurations.cmake create mode 100644 core/deps/libzip/cmake-config.h.in create mode 100644 core/deps/libzip/cmake-zipconf.h.in create mode 100644 core/deps/libzip/cmake/Dist.cmake create mode 100644 core/deps/libzip/cmake/FindMbedTLS.cmake create mode 100644 core/deps/libzip/cmake/FindNettle.cmake create mode 100644 core/deps/libzip/cmake/FindZstd.cmake delete mode 100644 core/deps/libzip/config.h create mode 100644 core/deps/libzip/developer-xcode/Info.plist create mode 100644 core/deps/libzip/developer-xcode/README Xcode Project.md create mode 100644 core/deps/libzip/developer-xcode/config.h create mode 100644 core/deps/libzip/developer-xcode/extract-version.sh create mode 100644 core/deps/libzip/developer-xcode/libzip.xcodeproj/project.pbxproj create mode 100644 core/deps/libzip/developer-xcode/libzip.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 core/deps/libzip/developer-xcode/libzip.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 core/deps/libzip/developer-xcode/mkconfig-h.sh rename core/deps/libzip/{ => developer-xcode}/zip_err_str.c (70%) create mode 100644 core/deps/libzip/developer-xcode/zipconf.h create mode 100644 core/deps/libzip/examples/CMakeLists.txt create mode 100644 core/deps/libzip/examples/in-memory.c create mode 100644 core/deps/libzip/examples/windows-open.c create mode 100644 core/deps/libzip/lib/CMakeLists.txt create mode 100644 core/deps/libzip/lib/compat.h create mode 100644 core/deps/libzip/lib/zip.h rename core/deps/libzip/{ => lib}/zip_add.c (76%) rename core/deps/libzip/{zip_source_free.c => lib/zip_add_dir.c} (83%) create mode 100644 core/deps/libzip/lib/zip_add_entry.c create mode 100644 core/deps/libzip/lib/zip_algorithm_bzip2.c create mode 100644 core/deps/libzip/lib/zip_algorithm_deflate.c create mode 100644 core/deps/libzip/lib/zip_algorithm_xz.c create mode 100644 core/deps/libzip/lib/zip_algorithm_zstd.c create mode 100644 core/deps/libzip/lib/zip_buffer.c create mode 100644 core/deps/libzip/lib/zip_close.c create mode 100644 core/deps/libzip/lib/zip_crypto.h create mode 100644 core/deps/libzip/lib/zip_crypto_commoncrypto.c create mode 100644 core/deps/libzip/lib/zip_crypto_commoncrypto.h create mode 100644 core/deps/libzip/lib/zip_crypto_gnutls.c create mode 100644 core/deps/libzip/lib/zip_crypto_gnutls.h create mode 100644 core/deps/libzip/lib/zip_crypto_mbedtls.c create mode 100644 core/deps/libzip/lib/zip_crypto_mbedtls.h create mode 100644 core/deps/libzip/lib/zip_crypto_openssl.c create mode 100644 core/deps/libzip/lib/zip_crypto_openssl.h create mode 100644 core/deps/libzip/lib/zip_crypto_win.c create mode 100644 core/deps/libzip/lib/zip_crypto_win.h rename core/deps/libzip/{ => lib}/zip_delete.c (75%) create mode 100644 core/deps/libzip/lib/zip_dir_add.c create mode 100644 core/deps/libzip/lib/zip_dirent.c rename core/deps/libzip/{zip_free.c => lib/zip_discard.c} (70%) rename core/deps/libzip/{zip_stat_init.c => lib/zip_entry.c} (80%) create mode 100644 core/deps/libzip/lib/zip_err_str.c create mode 100644 core/deps/libzip/lib/zip_error.c rename core/deps/libzip/{ => lib}/zip_error_clear.c (92%) rename core/deps/libzip/{ => lib}/zip_error_get.c (84%) rename core/deps/libzip/{ => lib}/zip_error_get_sys_type.c (92%) rename core/deps/libzip/{ => lib}/zip_error_strerror.c (69%) rename core/deps/libzip/{ => lib}/zip_error_to_str.c (81%) create mode 100644 core/deps/libzip/lib/zip_extra_field.c create mode 100644 core/deps/libzip/lib/zip_extra_field_api.c rename core/deps/libzip/{ => lib}/zip_fclose.c (75%) rename core/deps/libzip/{zip_entry_new.c => lib/zip_fdopen.c} (54%) create mode 100644 core/deps/libzip/lib/zip_file_add.c rename core/deps/libzip/{ => lib}/zip_file_error_clear.c (92%) rename core/deps/libzip/{ => lib}/zip_file_error_get.c (91%) create mode 100644 core/deps/libzip/lib/zip_file_get_comment.c create mode 100644 core/deps/libzip/lib/zip_file_get_external_attributes.c create mode 100644 core/deps/libzip/lib/zip_file_get_offset.c rename core/deps/libzip/{zip_set_name.c => lib/zip_file_rename.c} (64%) create mode 100644 core/deps/libzip/lib/zip_file_replace.c create mode 100644 core/deps/libzip/lib/zip_file_set_comment.c create mode 100644 core/deps/libzip/lib/zip_file_set_encryption.c create mode 100644 core/deps/libzip/lib/zip_file_set_external_attributes.c create mode 100644 core/deps/libzip/lib/zip_file_set_mtime.c rename core/deps/libzip/{ => lib}/zip_file_strerror.c (91%) rename core/deps/libzip/{ => lib}/zip_fopen.c (82%) create mode 100644 core/deps/libzip/lib/zip_fopen_encrypted.c create mode 100644 core/deps/libzip/lib/zip_fopen_index.c rename core/deps/libzip/{zip_file_get_offset.c => lib/zip_fopen_index_encrypted.c} (58%) create mode 100644 core/deps/libzip/lib/zip_fread.c create mode 100644 core/deps/libzip/lib/zip_fseek.c create mode 100644 core/deps/libzip/lib/zip_ftell.c rename core/deps/libzip/{ => lib}/zip_get_archive_comment.c (74%) rename core/deps/libzip/{ => lib}/zip_get_archive_flag.c (91%) rename core/deps/libzip/{zip_replace.c => lib/zip_get_encryption_implementation.c} (64%) rename core/deps/libzip/{ => lib}/zip_get_file_comment.c (75%) rename core/deps/libzip/{ => lib}/zip_get_name.c (70%) rename core/deps/libzip/{zip_source_file.c => lib/zip_get_num_entries.c} (77%) rename core/deps/libzip/{ => lib}/zip_get_num_files.c (84%) create mode 100644 core/deps/libzip/lib/zip_hash.c create mode 100644 core/deps/libzip/lib/zip_io_util.c create mode 100644 core/deps/libzip/lib/zip_libzip_version.c rename core/deps/libzip/{ => lib}/zip_memdup.c (88%) create mode 100644 core/deps/libzip/lib/zip_mkstempm.c rename core/deps/libzip/{ => lib}/zip_name_locate.c (58%) rename core/deps/libzip/{ => lib}/zip_new.c (74%) create mode 100644 core/deps/libzip/lib/zip_open.c create mode 100644 core/deps/libzip/lib/zip_pkware.c create mode 100644 core/deps/libzip/lib/zip_progress.c create mode 100644 core/deps/libzip/lib/zip_random_unix.c create mode 100644 core/deps/libzip/lib/zip_random_uwp.c rename core/deps/libzip/{zip_error.c => lib/zip_random_win32.c} (61%) rename core/deps/libzip/{zip_set_archive_flag.c => lib/zip_rename.c} (85%) rename core/deps/libzip/{zip_entry_free.c => lib/zip_replace.c} (82%) create mode 100644 core/deps/libzip/lib/zip_set_archive_comment.c rename core/deps/libzip/{zip_set_file_comment.c => lib/zip_set_archive_flag.c} (69%) rename core/deps/libzip/{zip_set_archive_comment.c => lib/zip_set_default_password.c} (74%) create mode 100644 core/deps/libzip/lib/zip_set_file_comment.c create mode 100644 core/deps/libzip/lib/zip_set_file_compression.c create mode 100644 core/deps/libzip/lib/zip_set_name.c create mode 100644 core/deps/libzip/lib/zip_source_accept_empty.c create mode 100644 core/deps/libzip/lib/zip_source_begin_write.c rename core/deps/libzip/{zip_source_function.c => lib/zip_source_begin_write_cloning.c} (75%) create mode 100644 core/deps/libzip/lib/zip_source_buffer.c create mode 100644 core/deps/libzip/lib/zip_source_call.c create mode 100644 core/deps/libzip/lib/zip_source_close.c rename core/deps/libzip/{zip_rename.c => lib/zip_source_commit_write.c} (68%) create mode 100644 core/deps/libzip/lib/zip_source_compress.c create mode 100644 core/deps/libzip/lib/zip_source_crc.c create mode 100644 core/deps/libzip/lib/zip_source_error.c create mode 100644 core/deps/libzip/lib/zip_source_file.h create mode 100644 core/deps/libzip/lib/zip_source_file_common.c create mode 100644 core/deps/libzip/lib/zip_source_file_stdio.c create mode 100644 core/deps/libzip/lib/zip_source_file_stdio.h create mode 100644 core/deps/libzip/lib/zip_source_file_stdio_named.c create mode 100644 core/deps/libzip/lib/zip_source_file_win32.c create mode 100644 core/deps/libzip/lib/zip_source_file_win32.h create mode 100644 core/deps/libzip/lib/zip_source_file_win32_ansi.c create mode 100644 core/deps/libzip/lib/zip_source_file_win32_named.c create mode 100644 core/deps/libzip/lib/zip_source_file_win32_utf16.c create mode 100644 core/deps/libzip/lib/zip_source_file_win32_utf8.c rename core/deps/libzip/{zip_add_dir.c => lib/zip_source_free.c} (67%) create mode 100644 core/deps/libzip/lib/zip_source_function.c create mode 100644 core/deps/libzip/lib/zip_source_get_file_attributes.c create mode 100644 core/deps/libzip/lib/zip_source_is_deleted.c create mode 100644 core/deps/libzip/lib/zip_source_layered.c rename core/deps/libzip/{zip_unchange.c => lib/zip_source_open.c} (58%) create mode 100644 core/deps/libzip/lib/zip_source_pkware_decode.c create mode 100644 core/deps/libzip/lib/zip_source_pkware_encode.c create mode 100644 core/deps/libzip/lib/zip_source_read.c create mode 100644 core/deps/libzip/lib/zip_source_remove.c create mode 100644 core/deps/libzip/lib/zip_source_rollback_write.c create mode 100644 core/deps/libzip/lib/zip_source_seek.c create mode 100644 core/deps/libzip/lib/zip_source_seek_write.c rename core/deps/libzip/{zip_filerange_crc.c => lib/zip_source_stat.c} (71%) create mode 100644 core/deps/libzip/lib/zip_source_supports.c create mode 100644 core/deps/libzip/lib/zip_source_tell.c create mode 100644 core/deps/libzip/lib/zip_source_tell_write.c create mode 100644 core/deps/libzip/lib/zip_source_window.c create mode 100644 core/deps/libzip/lib/zip_source_winzip_aes_decode.c create mode 100644 core/deps/libzip/lib/zip_source_winzip_aes_encode.c create mode 100644 core/deps/libzip/lib/zip_source_write.c create mode 100644 core/deps/libzip/lib/zip_source_zip.c create mode 100644 core/deps/libzip/lib/zip_source_zip_new.c rename core/deps/libzip/{ => lib}/zip_stat.c (84%) rename core/deps/libzip/{ => lib}/zip_stat_index.c (56%) create mode 100644 core/deps/libzip/lib/zip_stat_init.c rename core/deps/libzip/{ => lib}/zip_strerror.c (92%) create mode 100644 core/deps/libzip/lib/zip_string.c create mode 100644 core/deps/libzip/lib/zip_unchange.c rename core/deps/libzip/{ => lib}/zip_unchange_all.c (85%) rename core/deps/libzip/{ => lib}/zip_unchange_archive.c (87%) rename core/deps/libzip/{ => lib}/zip_unchange_data.c (76%) create mode 100644 core/deps/libzip/lib/zip_utf-8.c create mode 100644 core/deps/libzip/lib/zip_winzip_aes.c create mode 100644 core/deps/libzip/lib/zipint.h create mode 100644 core/deps/libzip/libzip-config.cmake.in create mode 100644 core/deps/libzip/libzip.pc.in create mode 100644 core/deps/libzip/man/CMakeLists.txt create mode 100644 core/deps/libzip/man/ZIP_SOURCE_GET_ARGS.html create mode 100644 core/deps/libzip/man/ZIP_SOURCE_GET_ARGS.man create mode 100644 core/deps/libzip/man/ZIP_SOURCE_GET_ARGS.mdoc create mode 100644 core/deps/libzip/man/fix-man-links.sh create mode 100644 core/deps/libzip/man/handle_links create mode 100644 core/deps/libzip/man/libzip.html create mode 100644 core/deps/libzip/man/libzip.man create mode 100644 core/deps/libzip/man/libzip.mdoc create mode 100644 core/deps/libzip/man/links create mode 100644 core/deps/libzip/man/make_zip_errors.sh create mode 100644 core/deps/libzip/man/mkdocset.pl create mode 100644 core/deps/libzip/man/nih-man.css create mode 100644 core/deps/libzip/man/update-html.cmake create mode 100644 core/deps/libzip/man/update-man.cmake create mode 100644 core/deps/libzip/man/zip_add.html create mode 100644 core/deps/libzip/man/zip_add.man create mode 100644 core/deps/libzip/man/zip_add.mdoc create mode 100644 core/deps/libzip/man/zip_add_dir.html create mode 100644 core/deps/libzip/man/zip_add_dir.man create mode 100644 core/deps/libzip/man/zip_add_dir.mdoc create mode 100644 core/deps/libzip/man/zip_close.html create mode 100644 core/deps/libzip/man/zip_close.man create mode 100644 core/deps/libzip/man/zip_close.mdoc create mode 100644 core/deps/libzip/man/zip_compression_method_supported.html create mode 100644 core/deps/libzip/man/zip_compression_method_supported.man create mode 100644 core/deps/libzip/man/zip_compression_method_supported.mdoc create mode 100644 core/deps/libzip/man/zip_delete.html create mode 100644 core/deps/libzip/man/zip_delete.man create mode 100644 core/deps/libzip/man/zip_delete.mdoc create mode 100644 core/deps/libzip/man/zip_dir_add.html create mode 100644 core/deps/libzip/man/zip_dir_add.man create mode 100644 core/deps/libzip/man/zip_dir_add.mdoc create mode 100644 core/deps/libzip/man/zip_discard.html create mode 100644 core/deps/libzip/man/zip_discard.man create mode 100644 core/deps/libzip/man/zip_discard.mdoc create mode 100644 core/deps/libzip/man/zip_encryption_method_supported.html create mode 100644 core/deps/libzip/man/zip_encryption_method_supported.man create mode 100644 core/deps/libzip/man/zip_encryption_method_supported.mdoc create mode 100644 core/deps/libzip/man/zip_error_clear.html create mode 100644 core/deps/libzip/man/zip_error_clear.man create mode 100644 core/deps/libzip/man/zip_error_clear.mdoc create mode 100644 core/deps/libzip/man/zip_error_code_system.html create mode 100644 core/deps/libzip/man/zip_error_code_system.man create mode 100644 core/deps/libzip/man/zip_error_code_system.mdoc create mode 100644 core/deps/libzip/man/zip_error_code_zip.html create mode 100644 core/deps/libzip/man/zip_error_code_zip.man create mode 100644 core/deps/libzip/man/zip_error_code_zip.mdoc create mode 100644 core/deps/libzip/man/zip_error_fini.html create mode 100644 core/deps/libzip/man/zip_error_fini.man create mode 100644 core/deps/libzip/man/zip_error_fini.mdoc create mode 100644 core/deps/libzip/man/zip_error_get.html create mode 100644 core/deps/libzip/man/zip_error_get.man create mode 100644 core/deps/libzip/man/zip_error_get.mdoc create mode 100644 core/deps/libzip/man/zip_error_get_sys_type.html create mode 100644 core/deps/libzip/man/zip_error_get_sys_type.man create mode 100644 core/deps/libzip/man/zip_error_get_sys_type.mdoc create mode 100644 core/deps/libzip/man/zip_error_init.html create mode 100644 core/deps/libzip/man/zip_error_init.man create mode 100644 core/deps/libzip/man/zip_error_init.mdoc create mode 100644 core/deps/libzip/man/zip_error_set.html create mode 100644 core/deps/libzip/man/zip_error_set.man create mode 100644 core/deps/libzip/man/zip_error_set.mdoc create mode 100644 core/deps/libzip/man/zip_error_strerror.html create mode 100644 core/deps/libzip/man/zip_error_strerror.man create mode 100644 core/deps/libzip/man/zip_error_strerror.mdoc create mode 100644 core/deps/libzip/man/zip_error_system_type.html create mode 100644 core/deps/libzip/man/zip_error_system_type.man create mode 100644 core/deps/libzip/man/zip_error_system_type.mdoc create mode 100644 core/deps/libzip/man/zip_error_to_data.html create mode 100644 core/deps/libzip/man/zip_error_to_data.man create mode 100644 core/deps/libzip/man/zip_error_to_data.mdoc create mode 100644 core/deps/libzip/man/zip_error_to_str.html create mode 100644 core/deps/libzip/man/zip_error_to_str.man create mode 100644 core/deps/libzip/man/zip_error_to_str.mdoc create mode 100644 core/deps/libzip/man/zip_errors.html create mode 100644 core/deps/libzip/man/zip_errors.man create mode 100644 core/deps/libzip/man/zip_errors.mdoc create mode 100644 core/deps/libzip/man/zip_fclose.html create mode 100644 core/deps/libzip/man/zip_fclose.man create mode 100644 core/deps/libzip/man/zip_fclose.mdoc create mode 100644 core/deps/libzip/man/zip_fdopen.html create mode 100644 core/deps/libzip/man/zip_fdopen.man create mode 100644 core/deps/libzip/man/zip_fdopen.mdoc create mode 100644 core/deps/libzip/man/zip_file_add.html create mode 100644 core/deps/libzip/man/zip_file_add.man create mode 100644 core/deps/libzip/man/zip_file_add.mdoc create mode 100644 core/deps/libzip/man/zip_file_attributes_init.html create mode 100644 core/deps/libzip/man/zip_file_attributes_init.man create mode 100644 core/deps/libzip/man/zip_file_attributes_init.mdoc create mode 100644 core/deps/libzip/man/zip_file_extra_field_delete.html create mode 100644 core/deps/libzip/man/zip_file_extra_field_delete.man create mode 100644 core/deps/libzip/man/zip_file_extra_field_delete.mdoc create mode 100644 core/deps/libzip/man/zip_file_extra_field_get.html create mode 100644 core/deps/libzip/man/zip_file_extra_field_get.man create mode 100644 core/deps/libzip/man/zip_file_extra_field_get.mdoc create mode 100644 core/deps/libzip/man/zip_file_extra_field_set.html create mode 100644 core/deps/libzip/man/zip_file_extra_field_set.man create mode 100644 core/deps/libzip/man/zip_file_extra_field_set.mdoc create mode 100644 core/deps/libzip/man/zip_file_extra_fields_count.html create mode 100644 core/deps/libzip/man/zip_file_extra_fields_count.man create mode 100644 core/deps/libzip/man/zip_file_extra_fields_count.mdoc create mode 100644 core/deps/libzip/man/zip_file_get_comment.html create mode 100644 core/deps/libzip/man/zip_file_get_comment.man create mode 100644 core/deps/libzip/man/zip_file_get_comment.mdoc create mode 100644 core/deps/libzip/man/zip_file_get_error.html create mode 100644 core/deps/libzip/man/zip_file_get_error.man create mode 100644 core/deps/libzip/man/zip_file_get_error.mdoc create mode 100644 core/deps/libzip/man/zip_file_get_external_attributes.html create mode 100644 core/deps/libzip/man/zip_file_get_external_attributes.man create mode 100644 core/deps/libzip/man/zip_file_get_external_attributes.mdoc create mode 100644 core/deps/libzip/man/zip_file_rename.html create mode 100644 core/deps/libzip/man/zip_file_rename.man create mode 100644 core/deps/libzip/man/zip_file_rename.mdoc create mode 100644 core/deps/libzip/man/zip_file_set_comment.html create mode 100644 core/deps/libzip/man/zip_file_set_comment.man create mode 100644 core/deps/libzip/man/zip_file_set_comment.mdoc create mode 100644 core/deps/libzip/man/zip_file_set_encryption.html create mode 100644 core/deps/libzip/man/zip_file_set_encryption.man create mode 100644 core/deps/libzip/man/zip_file_set_encryption.mdoc create mode 100644 core/deps/libzip/man/zip_file_set_external_attributes.html create mode 100644 core/deps/libzip/man/zip_file_set_external_attributes.man create mode 100644 core/deps/libzip/man/zip_file_set_external_attributes.mdoc create mode 100644 core/deps/libzip/man/zip_file_set_mtime.html create mode 100644 core/deps/libzip/man/zip_file_set_mtime.man create mode 100644 core/deps/libzip/man/zip_file_set_mtime.mdoc create mode 100644 core/deps/libzip/man/zip_file_strerror.html create mode 100644 core/deps/libzip/man/zip_file_strerror.man create mode 100644 core/deps/libzip/man/zip_file_strerror.mdoc create mode 100644 core/deps/libzip/man/zip_fopen.html create mode 100644 core/deps/libzip/man/zip_fopen.man create mode 100644 core/deps/libzip/man/zip_fopen.mdoc create mode 100644 core/deps/libzip/man/zip_fopen_encrypted.html create mode 100644 core/deps/libzip/man/zip_fopen_encrypted.man create mode 100644 core/deps/libzip/man/zip_fopen_encrypted.mdoc create mode 100644 core/deps/libzip/man/zip_fread.html create mode 100644 core/deps/libzip/man/zip_fread.man create mode 100644 core/deps/libzip/man/zip_fread.mdoc create mode 100644 core/deps/libzip/man/zip_fseek.html create mode 100644 core/deps/libzip/man/zip_fseek.man create mode 100644 core/deps/libzip/man/zip_fseek.mdoc create mode 100644 core/deps/libzip/man/zip_ftell.html create mode 100644 core/deps/libzip/man/zip_ftell.man create mode 100644 core/deps/libzip/man/zip_ftell.mdoc create mode 100644 core/deps/libzip/man/zip_get_archive_comment.html create mode 100644 core/deps/libzip/man/zip_get_archive_comment.man create mode 100644 core/deps/libzip/man/zip_get_archive_comment.mdoc create mode 100644 core/deps/libzip/man/zip_get_archive_flag.html create mode 100644 core/deps/libzip/man/zip_get_archive_flag.man create mode 100644 core/deps/libzip/man/zip_get_archive_flag.mdoc create mode 100644 core/deps/libzip/man/zip_get_error.html create mode 100644 core/deps/libzip/man/zip_get_error.man create mode 100644 core/deps/libzip/man/zip_get_error.mdoc create mode 100644 core/deps/libzip/man/zip_get_file_comment.html create mode 100644 core/deps/libzip/man/zip_get_file_comment.man create mode 100644 core/deps/libzip/man/zip_get_file_comment.mdoc create mode 100644 core/deps/libzip/man/zip_get_name.html create mode 100644 core/deps/libzip/man/zip_get_name.man create mode 100644 core/deps/libzip/man/zip_get_name.mdoc create mode 100644 core/deps/libzip/man/zip_get_num_entries.html create mode 100644 core/deps/libzip/man/zip_get_num_entries.man create mode 100644 core/deps/libzip/man/zip_get_num_entries.mdoc create mode 100644 core/deps/libzip/man/zip_get_num_files.html create mode 100644 core/deps/libzip/man/zip_get_num_files.man create mode 100644 core/deps/libzip/man/zip_get_num_files.mdoc create mode 100644 core/deps/libzip/man/zip_libzip_version.html create mode 100644 core/deps/libzip/man/zip_libzip_version.man create mode 100644 core/deps/libzip/man/zip_libzip_version.mdoc create mode 100644 core/deps/libzip/man/zip_name_locate.html create mode 100644 core/deps/libzip/man/zip_name_locate.man create mode 100644 core/deps/libzip/man/zip_name_locate.mdoc create mode 100644 core/deps/libzip/man/zip_open.html create mode 100644 core/deps/libzip/man/zip_open.man create mode 100644 core/deps/libzip/man/zip_open.mdoc create mode 100644 core/deps/libzip/man/zip_register_progress_callback.html create mode 100644 core/deps/libzip/man/zip_register_progress_callback.man create mode 100644 core/deps/libzip/man/zip_register_progress_callback.mdoc create mode 100644 core/deps/libzip/man/zip_register_progress_callback_with_state.html create mode 100644 core/deps/libzip/man/zip_register_progress_callback_with_state.man create mode 100644 core/deps/libzip/man/zip_register_progress_callback_with_state.mdoc create mode 100644 core/deps/libzip/man/zip_rename.html create mode 100644 core/deps/libzip/man/zip_rename.man create mode 100644 core/deps/libzip/man/zip_rename.mdoc create mode 100644 core/deps/libzip/man/zip_set_archive_comment.html create mode 100644 core/deps/libzip/man/zip_set_archive_comment.man create mode 100644 core/deps/libzip/man/zip_set_archive_comment.mdoc create mode 100644 core/deps/libzip/man/zip_set_archive_flag.html create mode 100644 core/deps/libzip/man/zip_set_archive_flag.man create mode 100644 core/deps/libzip/man/zip_set_archive_flag.mdoc create mode 100644 core/deps/libzip/man/zip_set_default_password.html create mode 100644 core/deps/libzip/man/zip_set_default_password.man create mode 100644 core/deps/libzip/man/zip_set_default_password.mdoc create mode 100644 core/deps/libzip/man/zip_set_file_comment.html create mode 100644 core/deps/libzip/man/zip_set_file_comment.man create mode 100644 core/deps/libzip/man/zip_set_file_comment.mdoc create mode 100644 core/deps/libzip/man/zip_set_file_compression.html create mode 100644 core/deps/libzip/man/zip_set_file_compression.man create mode 100644 core/deps/libzip/man/zip_set_file_compression.mdoc create mode 100644 core/deps/libzip/man/zip_source.html create mode 100644 core/deps/libzip/man/zip_source.man create mode 100644 core/deps/libzip/man/zip_source.mdoc create mode 100644 core/deps/libzip/man/zip_source_begin_write.html create mode 100644 core/deps/libzip/man/zip_source_begin_write.man create mode 100644 core/deps/libzip/man/zip_source_begin_write.mdoc create mode 100644 core/deps/libzip/man/zip_source_buffer.html create mode 100644 core/deps/libzip/man/zip_source_buffer.man create mode 100644 core/deps/libzip/man/zip_source_buffer.mdoc create mode 100644 core/deps/libzip/man/zip_source_buffer_fragment.html create mode 100644 core/deps/libzip/man/zip_source_buffer_fragment.man create mode 100644 core/deps/libzip/man/zip_source_buffer_fragment.mdoc create mode 100644 core/deps/libzip/man/zip_source_close.html create mode 100644 core/deps/libzip/man/zip_source_close.man create mode 100644 core/deps/libzip/man/zip_source_close.mdoc create mode 100644 core/deps/libzip/man/zip_source_commit_write.html create mode 100644 core/deps/libzip/man/zip_source_commit_write.man create mode 100644 core/deps/libzip/man/zip_source_commit_write.mdoc create mode 100644 core/deps/libzip/man/zip_source_error.html create mode 100644 core/deps/libzip/man/zip_source_error.man create mode 100644 core/deps/libzip/man/zip_source_error.mdoc create mode 100644 core/deps/libzip/man/zip_source_file.html create mode 100644 core/deps/libzip/man/zip_source_file.man create mode 100644 core/deps/libzip/man/zip_source_file.mdoc create mode 100644 core/deps/libzip/man/zip_source_filep.html create mode 100644 core/deps/libzip/man/zip_source_filep.man create mode 100644 core/deps/libzip/man/zip_source_filep.mdoc create mode 100644 core/deps/libzip/man/zip_source_free.html create mode 100644 core/deps/libzip/man/zip_source_free.man create mode 100644 core/deps/libzip/man/zip_source_free.mdoc create mode 100644 core/deps/libzip/man/zip_source_function.html create mode 100644 core/deps/libzip/man/zip_source_function.man create mode 100644 core/deps/libzip/man/zip_source_function.mdoc create mode 100644 core/deps/libzip/man/zip_source_is_deleted.html create mode 100644 core/deps/libzip/man/zip_source_is_deleted.man create mode 100644 core/deps/libzip/man/zip_source_is_deleted.mdoc create mode 100644 core/deps/libzip/man/zip_source_keep.html create mode 100644 core/deps/libzip/man/zip_source_keep.man create mode 100644 core/deps/libzip/man/zip_source_keep.mdoc create mode 100644 core/deps/libzip/man/zip_source_make_command_bitmap.html create mode 100644 core/deps/libzip/man/zip_source_make_command_bitmap.man create mode 100644 core/deps/libzip/man/zip_source_make_command_bitmap.mdoc create mode 100644 core/deps/libzip/man/zip_source_open.html create mode 100644 core/deps/libzip/man/zip_source_open.man create mode 100644 core/deps/libzip/man/zip_source_open.mdoc create mode 100644 core/deps/libzip/man/zip_source_read.html create mode 100644 core/deps/libzip/man/zip_source_read.man create mode 100644 core/deps/libzip/man/zip_source_read.mdoc create mode 100644 core/deps/libzip/man/zip_source_rollback_write.html create mode 100644 core/deps/libzip/man/zip_source_rollback_write.man create mode 100644 core/deps/libzip/man/zip_source_rollback_write.mdoc create mode 100644 core/deps/libzip/man/zip_source_seek.html create mode 100644 core/deps/libzip/man/zip_source_seek.man create mode 100644 core/deps/libzip/man/zip_source_seek.mdoc create mode 100644 core/deps/libzip/man/zip_source_seek_compute_offset.html create mode 100644 core/deps/libzip/man/zip_source_seek_compute_offset.man create mode 100644 core/deps/libzip/man/zip_source_seek_compute_offset.mdoc create mode 100644 core/deps/libzip/man/zip_source_seek_write.html create mode 100644 core/deps/libzip/man/zip_source_seek_write.man create mode 100644 core/deps/libzip/man/zip_source_seek_write.mdoc create mode 100644 core/deps/libzip/man/zip_source_stat.html create mode 100644 core/deps/libzip/man/zip_source_stat.man create mode 100644 core/deps/libzip/man/zip_source_stat.mdoc create mode 100644 core/deps/libzip/man/zip_source_tell.html create mode 100644 core/deps/libzip/man/zip_source_tell.man create mode 100644 core/deps/libzip/man/zip_source_tell.mdoc create mode 100644 core/deps/libzip/man/zip_source_tell_write.html create mode 100644 core/deps/libzip/man/zip_source_tell_write.man create mode 100644 core/deps/libzip/man/zip_source_tell_write.mdoc create mode 100644 core/deps/libzip/man/zip_source_win32a.html create mode 100644 core/deps/libzip/man/zip_source_win32a.man create mode 100644 core/deps/libzip/man/zip_source_win32a.mdoc create mode 100644 core/deps/libzip/man/zip_source_win32handle.html create mode 100644 core/deps/libzip/man/zip_source_win32handle.man create mode 100644 core/deps/libzip/man/zip_source_win32handle.mdoc create mode 100644 core/deps/libzip/man/zip_source_win32w.html create mode 100644 core/deps/libzip/man/zip_source_win32w.man create mode 100644 core/deps/libzip/man/zip_source_win32w.mdoc create mode 100644 core/deps/libzip/man/zip_source_write.html create mode 100644 core/deps/libzip/man/zip_source_write.man create mode 100644 core/deps/libzip/man/zip_source_write.mdoc create mode 100644 core/deps/libzip/man/zip_source_zip.html create mode 100644 core/deps/libzip/man/zip_source_zip.man create mode 100644 core/deps/libzip/man/zip_source_zip.mdoc create mode 100644 core/deps/libzip/man/zip_stat.html create mode 100644 core/deps/libzip/man/zip_stat.man create mode 100644 core/deps/libzip/man/zip_stat.mdoc create mode 100644 core/deps/libzip/man/zip_stat_init.html create mode 100644 core/deps/libzip/man/zip_stat_init.man create mode 100644 core/deps/libzip/man/zip_stat_init.mdoc create mode 100644 core/deps/libzip/man/zip_unchange.html create mode 100644 core/deps/libzip/man/zip_unchange.man create mode 100644 core/deps/libzip/man/zip_unchange.mdoc create mode 100644 core/deps/libzip/man/zip_unchange_all.html create mode 100644 core/deps/libzip/man/zip_unchange_all.man create mode 100644 core/deps/libzip/man/zip_unchange_all.mdoc create mode 100644 core/deps/libzip/man/zip_unchange_archive.html create mode 100644 core/deps/libzip/man/zip_unchange_archive.man create mode 100644 core/deps/libzip/man/zip_unchange_archive.mdoc create mode 100644 core/deps/libzip/man/zipcmp.html create mode 100644 core/deps/libzip/man/zipcmp.man create mode 100644 core/deps/libzip/man/zipcmp.mdoc create mode 100644 core/deps/libzip/man/zipmerge.html create mode 100644 core/deps/libzip/man/zipmerge.man create mode 100644 core/deps/libzip/man/zipmerge.mdoc create mode 100644 core/deps/libzip/man/ziptool.html create mode 100644 core/deps/libzip/man/ziptool.man create mode 100644 core/deps/libzip/man/ziptool.mdoc delete mode 100644 core/deps/libzip/mkstemp.c create mode 100644 core/deps/libzip/regress/nihtest.conf.in create mode 100644 core/deps/libzip/regress/runtest.in create mode 100644 core/deps/libzip/vstudio/readme.txt create mode 100644 core/deps/libzip/vstudio/vsbuild.cmd create mode 100644 core/deps/libzip/vstudio/zlib/unpack_zlib_here.txt delete mode 100644 core/deps/libzip/zip.h delete mode 100644 core/deps/libzip/zip_close.c delete mode 100644 core/deps/libzip/zip_dirent.c delete mode 100644 core/deps/libzip/zip_fopen_index.c delete mode 100644 core/deps/libzip/zip_fread.c delete mode 100644 core/deps/libzip/zip_open.c delete mode 100644 core/deps/libzip/zip_source_buffer.c delete mode 100644 core/deps/libzip/zip_source_filep.c delete mode 100644 core/deps/libzip/zip_source_zip.c delete mode 100644 core/deps/libzip/zipint.h create mode 100644 core/deps/nowide/CMakeLists.txt create mode 100644 core/deps/nowide/COPYING create mode 100644 core/deps/nowide/Doxyfile.in create mode 100644 core/deps/nowide/README.md create mode 100644 core/deps/nowide/contrib/CMake/modules/FindHHC.cmake create mode 100644 core/deps/nowide/contrib/MSVC/NoWide-Android.vcxproj create mode 100644 core/deps/nowide/contrib/MSVC/NoWide-Android.vcxproj.filters create mode 100644 core/deps/nowide/contrib/MSVC/NoWide-Windows.vcxproj create mode 100644 core/deps/nowide/contrib/MSVC/NoWide-Windows.vcxproj.filters create mode 100644 core/deps/nowide/contrib/MSVC/NoWide.sln create mode 100644 core/deps/nowide/include/nowide/args.hpp create mode 100644 core/deps/nowide/include/nowide/cenv.hpp create mode 100644 core/deps/nowide/include/nowide/config.hpp create mode 100644 core/deps/nowide/include/nowide/convert.hpp create mode 100644 core/deps/nowide/include/nowide/cstdio.hpp create mode 100644 core/deps/nowide/include/nowide/cstdlib.hpp create mode 100644 core/deps/nowide/include/nowide/encoding_errors.hpp create mode 100644 core/deps/nowide/include/nowide/encoding_utf.hpp create mode 100644 core/deps/nowide/include/nowide/filebuf.hpp create mode 100644 core/deps/nowide/include/nowide/fstream.hpp create mode 100644 core/deps/nowide/include/nowide/iostream.hpp create mode 100644 core/deps/nowide/include/nowide/scoped_ptr.hpp create mode 100644 core/deps/nowide/include/nowide/stackstring.hpp create mode 100644 core/deps/nowide/include/nowide/system.hpp create mode 100644 core/deps/nowide/include/nowide/utf.hpp create mode 100644 core/deps/nowide/include/nowide/windows.hpp create mode 100644 core/deps/nowide/src/iostream.cpp create mode 100644 core/deps/nowide/test/test.hpp create mode 100644 core/deps/nowide/test/test_convert.cpp create mode 100644 core/deps/nowide/test/test_env.cpp create mode 100644 core/deps/nowide/test/test_fstream.cpp create mode 100644 core/deps/nowide/test/test_iostream.cpp create mode 100644 core/deps/nowide/test/test_stdio.cpp create mode 100644 core/deps/nowide/test/test_system.cpp delete mode 100644 core/deps/zlib/zconf.h delete mode 100644 core/imgread/gd_driver.h create mode 100644 core/oslib/directory.h create mode 100644 shell/apple/emulator-osx/emulator-osx/include/config.h create mode 100644 shell/apple/emulator-osx/emulator-osx/include/zipconf.h create mode 100644 shell/linux/include/mingw/config.h create mode 100644 shell/linux/include/mingw/zipconf.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 19dbd07cd..3a170ac59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,6 +171,15 @@ else() add_subdirectory(core/deps/zlib) target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/core/deps/zlib" "${CMAKE_CURRENT_BINARY_DIR}/core/deps/zlib") target_link_libraries(${PROJECT_NAME} PRIVATE zlibstatic) + # help libzip find the package + set(ZLIB_FOUND TRUE) + if(MSVC) + # FIXME + set(ZLIB_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/core/deps/zlib/Release/zlibstatic.lib") + else() + set(ZLIB_LIBRARY "libzlibstatic.a") + endif() + set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/core/deps/zlib" "${CMAKE_CURRENT_BINARY_DIR}/core/deps/zlib") endif() find_package(PkgConfig QUIET) @@ -288,6 +297,8 @@ target_sources(${PROJECT_NAME} PRIVATE core/deps/crypto/sha256.cpp core/deps/crypto/sha256.h) +target_include_directories(${PROJECT_NAME} PRIVATE core/deps/nowide/include) + if(NOT FLAC_FOUND) target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_CONFIG_H $<$:HAVE_FSEEKO>) target_include_directories(${PROJECT_NAME} PRIVATE core/deps/flac/include core/deps/flac/src/libFLAC/include) @@ -325,9 +336,31 @@ if(NOT MINIUPNP_FOUND) target_link_libraries(${PROJECT_NAME} PRIVATE miniupnpc::miniupnpc) endif() -if(MSVC) +if(NOT LIBZIP_FOUND) + option(ENABLE_COMMONCRYPTO "Enable use of CommonCrypto" OFF) + option(ENABLE_GNUTLS "Enable use of GnuTLS" OFF) + option(ENABLE_MBEDTLS "Enable use of mbed TLS" OFF) + option(ENABLE_OPENSSL "Enable use of OpenSSL" OFF) + option(ENABLE_WINDOWS_CRYPTO "Enable use of Windows cryptography libraries" OFF) + option(ENABLE_BZIP2 "Enable use of BZip2" OFF) + option(ENABLE_LZMA "Enable use of LZMA" OFF) + option(ENABLE_ZSTD "Enable use of Zstandard" OFF) + option(BUILD_TOOLS "Build tools in the src directory (zipcmp, zipmerge, ziptool)" OFF) + option(BUILD_REGRESS "Build regression tests" OFF) + option(BUILD_EXAMPLES "Build examples" OFF) + option(BUILD_DOC "Build documentation" OFF) + option(BUILD_SHARED_LIBS "Build shared libraries" OFF) + option(LIBZIP_DO_INSTALL "Install libzip and the related files" OFF) + add_subdirectory(core/deps/libzip) + target_include_directories(${PROJECT_NAME} PRIVATE core/deps/libzip/lib) + target_link_libraries(${PROJECT_NAME} PRIVATE zip) +endif() + +if(WIN32) target_include_directories(${PROJECT_NAME} PRIVATE core/deps/dirent) -else() +endif() + +if(NOT MSVC) target_include_directories(${PROJECT_NAME} PRIVATE core/deps/picotcp/include core/deps/picotcp/modules) target_sources(${PROJECT_NAME} PRIVATE core/deps/picotcp/include/arch/pico_arm9.h @@ -387,68 +420,6 @@ else() core/deps/picotcp/stack/pico_socket_multicast.c core/deps/picotcp/stack/pico_stack.c core/deps/picotcp/stack/pico_tree.c) - - if(NOT LIBZIP_FOUND) - target_include_directories(${PROJECT_NAME} PRIVATE core/deps/libzip) - target_sources(${PROJECT_NAME} PRIVATE - core/deps/libzip/config.h - core/deps/libzip/mkstemp.c - core/deps/libzip/zip.h - core/deps/libzip/zip_add.c - core/deps/libzip/zip_add_dir.c - core/deps/libzip/zip_close.c - core/deps/libzip/zip_delete.c - core/deps/libzip/zip_dirent.c - core/deps/libzip/zip_entry_free.c - core/deps/libzip/zip_entry_new.c - core/deps/libzip/zip_error.c - core/deps/libzip/zip_error_clear.c - core/deps/libzip/zip_error_get.c - core/deps/libzip/zip_error_get_sys_type.c - core/deps/libzip/zip_error_strerror.c - core/deps/libzip/zip_error_to_str.c - core/deps/libzip/zip_err_str.c - core/deps/libzip/zip_fclose.c - core/deps/libzip/zip_file_error_clear.c - core/deps/libzip/zip_file_error_get.c - core/deps/libzip/zip_file_get_offset.c - core/deps/libzip/zip_filerange_crc.c - core/deps/libzip/zip_file_strerror.c - core/deps/libzip/zip_fopen.c - core/deps/libzip/zip_fopen_index.c - core/deps/libzip/zip_fread.c - core/deps/libzip/zip_free.c - core/deps/libzip/zip_get_archive_comment.c - core/deps/libzip/zip_get_archive_flag.c - core/deps/libzip/zip_get_file_comment.c - core/deps/libzip/zip_get_name.c - core/deps/libzip/zip_get_num_files.c - core/deps/libzip/zip_memdup.c - core/deps/libzip/zip_name_locate.c - core/deps/libzip/zip_new.c - core/deps/libzip/zip_open.c - core/deps/libzip/zip_rename.c - core/deps/libzip/zip_replace.c - core/deps/libzip/zip_set_archive_comment.c - core/deps/libzip/zip_set_archive_flag.c - core/deps/libzip/zip_set_file_comment.c - core/deps/libzip/zip_set_name.c - core/deps/libzip/zip_source_buffer.c - core/deps/libzip/zip_source_file.c - core/deps/libzip/zip_source_filep.c - core/deps/libzip/zip_source_free.c - core/deps/libzip/zip_source_function.c - core/deps/libzip/zip_source_zip.c - core/deps/libzip/zip_stat.c - core/deps/libzip/zip_stat_index.c - core/deps/libzip/zip_stat_init.c - core/deps/libzip/zip_strerror.c - core/deps/libzip/zip_unchange_all.c - core/deps/libzip/zip_unchange_archive.c - core/deps/libzip/zip_unchange.c - core/deps/libzip/zip_unchange_data.c - core/deps/libzip/zipint.h) - endif() endif() target_compile_definitions(${PROJECT_NAME} PRIVATE _7ZIP_ST) @@ -463,12 +434,9 @@ target_sources(${PROJECT_NAME} PRIVATE core/archive/archive.cpp core/archive/archive.h core/archive/rzip.cpp - core/archive/rzip.h) -if(NOT MSVC) - target_sources(${PROJECT_NAME} PRIVATE - core/archive/ZipArchive.cpp - core/archive/ZipArchive.h) -endif() + core/archive/rzip.h + core/archive/ZipArchive.cpp + core/archive/ZipArchive.h) target_sources(${PROJECT_NAME} PRIVATE core/arm_emitter/arm_coding.h @@ -672,7 +640,6 @@ target_sources(${PROJECT_NAME} PRIVATE core/imgread/common.cpp core/imgread/common.h core/imgread/cue.cpp - core/imgread/gd_driver.h core/imgread/gdi.cpp core/imgread/ImgReader.cpp core/imgread/ioctl.cpp diff --git a/core/archive/7zArchive.cpp b/core/archive/7zArchive.cpp index b244893a7..cb7919679 100644 --- a/core/archive/7zArchive.cpp +++ b/core/archive/7zArchive.cpp @@ -31,8 +31,21 @@ bool SzArchive::Open(const char* path) { SzArEx_Init(&szarchive); - if (InFile_Open(&archiveStream.file, path)) + File_Construct(&archiveStream.file); +#ifdef USE_WINDOWS_FILE + nowide::wstackstring wpath; + if (!wpath.convert(path)) return false; + archiveStream.file.handle = CreateFileW(wpath.c_str(), + GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (archiveStream.file.handle == INVALID_HANDLE_VALUE) + return false; +#else + archiveStream.file.file = nowide::fopen(path, "rb"); + if (archiveStream.file.file == nullptr) + return false; +#endif FileInStream_CreateVTable(&archiveStream); LookToRead2_CreateVTable(&lookStream, false); lookStream.buf = (Byte *)ISzAlloc_Alloc(&g_Alloc, kInputBufSize); diff --git a/core/archive/ZipArchive.cpp b/core/archive/ZipArchive.cpp index c5328e8ce..394f919ac 100644 --- a/core/archive/ZipArchive.cpp +++ b/core/archive/ZipArchive.cpp @@ -27,8 +27,20 @@ ZipArchive::~ZipArchive() bool ZipArchive::Open(const char* path) { - zip = zip_open(path, 0, NULL); - return (zip != NULL); + FILE *file = nowide::fopen(path, "rb"); + if (file == nullptr) + return false; + zip_error_t error; + zip_source_t *source = zip_source_filep_create(file, 0, -1, &error); + if (source == nullptr) + { + std::fclose(file); + return false; + } + zip = zip_open_from_source(source, 0, NULL); + if (zip == nullptr) + zip_source_free(source); + return zip != nullptr; } ArchiveFile* ZipArchive::OpenFile(const char* name) diff --git a/core/archive/archive.cpp b/core/archive/archive.cpp index 973e320fe..904839a5f 100644 --- a/core/archive/archive.cpp +++ b/core/archive/archive.cpp @@ -21,9 +21,7 @@ #include "archive.h" #include "7zArchive.h" -#ifndef _MSC_VER #include "ZipArchive.h" -#endif Archive *OpenArchive(const char *path) { @@ -34,12 +32,10 @@ Archive *OpenArchive(const char *path) return sz_archive; delete sz_archive; -#ifndef _MSC_VER Archive *zip_archive = new ZipArchive(); if (zip_archive->Open(base_path.c_str()) || zip_archive->Open((base_path + ".zip").c_str()) || zip_archive->Open((base_path + ".ZIP").c_str())) return zip_archive; delete zip_archive; -#endif return NULL; } diff --git a/core/archive/rzip.cpp b/core/archive/rzip.cpp index f48bf7b43..d87762ea6 100644 --- a/core/archive/rzip.cpp +++ b/core/archive/rzip.cpp @@ -25,16 +25,16 @@ bool RZipFile::Open(const std::string& path, bool write) { verify(file == nullptr); - file = fopen(path.c_str(), write ? "wb" : "rb"); + file = nowide::fopen(path.c_str(), write ? "wb" : "rb"); if (file == nullptr) return false; if (!write) { u8 header[sizeof(RZipHeader)]; - if (fread(header, sizeof(header), 1, file) != 1 + if (std::fread(header, sizeof(header), 1, file) != 1 || memcmp(header, RZipHeader, sizeof(header)) - || fread(&maxChunkSize, sizeof(maxChunkSize), 1, file) != 1 - || fread(&size, sizeof(size), 1, file) != 1) + || std::fread(&maxChunkSize, sizeof(maxChunkSize), 1, file) != 1 + || std::fread(&size, sizeof(size), 1, file) != 1) { Close(); return false; @@ -51,7 +51,7 @@ void RZipFile::Close() { if (file != nullptr) { - fclose(file); + std::fclose(file); file = nullptr; if (chunk != nullptr) { @@ -74,10 +74,10 @@ size_t RZipFile::Read(void *data, size_t length) chunkSize = 0; chunkIndex = 0; u32 zippedSize; - if (fread(&zippedSize, sizeof(zippedSize), 1, file) != 1) + if (std::fread(&zippedSize, sizeof(zippedSize), 1, file) != 1) break; u8 *zipped = new u8[zippedSize]; - if (fread(zipped, zippedSize, 1, file) != 1) + if (std::fread(zipped, zippedSize, 1, file) != 1) { delete [] zipped; break; @@ -104,12 +104,12 @@ size_t RZipFile::Read(void *data, size_t length) size_t RZipFile::Write(const void *data, size_t length) { verify(file != nullptr); - verify(ftell(file) == 0); + verify(std::ftell(file) == 0); maxChunkSize = 1024 * 1024; - if (fwrite(RZipHeader, sizeof(RZipHeader), 1, file) != 1 - || fwrite(&maxChunkSize, sizeof(maxChunkSize), 1, file) != 1 - || fwrite(&length, sizeof(length), 1, file) != 1) + if (std::fwrite(RZipHeader, sizeof(RZipHeader), 1, file) != 1 + || std::fwrite(&maxChunkSize, sizeof(maxChunkSize), 1, file) != 1 + || std::fwrite(&length, sizeof(length), 1, file) != 1) return 0; const u8 *p = (const u8 *)data; u8 *zipped = new u8[maxChunkSize]; @@ -121,8 +121,8 @@ size_t RZipFile::Write(const void *data, size_t length) if (compress(zipped, &zippedSize, p, uncompressedSize) != Z_OK) break; u32 sz = (u32)zippedSize; - if (fwrite(&sz, sizeof(sz), 1, file) != 1 - || fwrite(zipped, zippedSize, 1, file) != 1) + if (std::fwrite(&sz, sizeof(sz), 1, file) != 1 + || std::fwrite(zipped, zippedSize, 1, file) != 1) return 0; p += uncompressedSize; rv += uncompressedSize; diff --git a/core/cfg/cfg.cpp b/core/cfg/cfg.cpp index 250089038..c407f1119 100644 --- a/core/cfg/cfg.cpp +++ b/core/cfg/cfg.cpp @@ -20,7 +20,7 @@ static bool has_game_specific_config = false; void savecfgf() { - FILE* cfgfile = fopen(cfgPath.c_str(),"wt"); + FILE* cfgfile = nowide::fopen(cfgPath.c_str(), "wt"); if (!cfgfile) { WARN_LOG(COMMON, "Error: Unable to open file '%s' for saving", cfgPath.c_str()); @@ -28,7 +28,7 @@ void savecfgf() else { cfgdb.save(cfgfile); - fclose(cfgfile); + std::fclose(cfgfile); } } void cfgSaveStr(const char * Section, const char * Key, const char * String) @@ -85,10 +85,10 @@ bool cfgOpen() std::string config_path_read = get_readonly_config_path(filename); cfgPath = get_writable_config_path(filename); - FILE* cfgfile = fopen(config_path_read.c_str(),"r"); + FILE* cfgfile = nowide::fopen(config_path_read.c_str(), "r"); if(cfgfile != NULL) { cfgdb.parse(cfgfile); - fclose(cfgfile); + std::fclose(cfgfile); } else { diff --git a/core/cfg/ini.cpp b/core/cfg/ini.cpp index e698231c4..601c16f55 100644 --- a/core/cfg/ini.cpp +++ b/core/cfg/ini.cpp @@ -205,7 +205,7 @@ void ConfigFile::parse(FILE* file) int cline = 0; while(file && !feof(file)) { - if (fgets(line, 512, file) == NULL || feof(file)) + if (std::fgets(line, 512, file) == NULL || std::feof(file)) { break; } @@ -274,16 +274,16 @@ void ConfigFile::save(FILE* file) const std::string& section_name = section_it.first; const ConfigSection& section = section_it.second; - fprintf(file, "[%s]\n", section_name.c_str()); + std::fprintf(file, "[%s]\n", section_name.c_str()); for (const auto& entry_it : section.entries) { const std::string& entry_name = entry_it.first; const ConfigEntry& entry = entry_it.second; - fprintf(file, "%s = %s\n", entry_name.c_str(), entry.get_string().c_str()); + std::fprintf(file, "%s = %s\n", entry_name.c_str(), entry.get_string().c_str()); } - fputs("\n", file); + std::fputs("\n", file); } } diff --git a/core/core.mk b/core/core.mk index 4394d7365..424f8de62 100755 --- a/core/core.mk +++ b/core/core.mk @@ -7,7 +7,7 @@ RZDCY_MODULES := cfg/ hw/arm7/ hw/aica/ hw/holly/ hw/ hw/gdrom/ hw/maple/ \ hw/mem/ hw/pvr/ hw/sh4/ hw/sh4/interpr/ hw/sh4/modules/ plugins/ profiler/ oslib/ \ hw/extdev/ hw/arm/ hw/naomi/ imgread/ ./ deps/coreio/ deps/zlib/ deps/chdr/ deps/crypto/ \ deps/libelf/ deps/chdpsr/ arm_emitter/ rend/ reios/ deps/xbrz/ \ - deps/libzip/ deps/imgui/ archive/ input/ log/ wsi/ network/ hw/bba/ + deps/imgui/ archive/ input/ log/ wsi/ network/ hw/bba/ ifndef NOT_ARM RZDCY_MODULES += rec-ARM/ @@ -59,6 +59,9 @@ endif ifdef USE_SDL RZDCY_MODULES += sdl/ + ifdef FOR_WINDOWS + RZDCY_CFLAGS += -I$(RZDCY_SRC_DIR)/deps/SDL2-2.0.12/include + endif endif ifdef FOR_LINUX @@ -70,10 +73,11 @@ endif ifdef FOR_WINDOWS RZDCY_MODULES += windows/ + RZDCY_CFLAGS += -I$(RZDCY_SRC_DIR)/deps/dirent endif ifdef FOR_PANDORA -RZDCY_CFLAGS := \ +RZDCY_CFLAGS += \ $(CFLAGS) -c -O3 \ -DNDEBUG -DPANDORA\ -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp \ @@ -82,7 +86,7 @@ RZDCY_CFLAGS := \ RZDCY_CFLAGS += -march=armv7-a -mtune=cortex-a8 -mfpu=neon else ifdef FOR_ANDROID -RZDCY_CFLAGS := \ +RZDCY_CFLAGS += \ $(CFLAGS) -c -O3 \ -D_ANDROID -DNDEBUG \ -frename-registers -fsingle-precision-constant -ffast-math \ @@ -95,17 +99,9 @@ RZDCY_CFLAGS := \ RZDCY_CFLAGS += -march=armv8-a endif endif - else -RZDCY_CFLAGS := endif endif -ifdef FOR_WINDOWS - ifdef USE_SDL - RZDCY_CFLAGS += -I$(RZDCY_SRC_DIR)/deps/SDL2-2.0.12/include - endif -endif - ifdef USE_VULKAN ifdef FOR_WINDOWS RZDCY_CFLAGS += -DVK_USE_PLATFORM_WIN32_KHR @@ -121,11 +117,11 @@ endif RZDCY_CFLAGS += -I$(RZDCY_SRC_DIR) -I$(RZDCY_SRC_DIR)/rend/gles -I$(RZDCY_SRC_DIR)/deps \ -I$(RZDCY_SRC_DIR)/deps/vixl -I$(RZDCY_SRC_DIR)/khronos -I$(RZDCY_SRC_DIR)/deps/glslang \ - -I$(RZDCY_SRC_DIR)/deps/glm -I$(RZDCY_SRC_DIR)/deps/xbyak + -I$(RZDCY_SRC_DIR)/deps/glm -I$(RZDCY_SRC_DIR)/deps/xbyak -I$(RZDCY_SRC_DIR)/deps/nowide/include RZDCY_CFLAGS += -I$(RZDCY_SRC_DIR)/deps/picotcp/include -I$(RZDCY_SRC_DIR)/deps/picotcp/modules RZDCY_MODULES += hw/modem/ deps/picotcp/modules/ deps/picotcp/stack/ -ifndef FOR_WINDOWS +ifdef USE_SYSTEM_MINIUPNPC RZDCY_CFLAGS += -I/usr/include/miniupnpc else RZDCY_CFLAGS += -I$(RZDCY_SRC_DIR)/deps/miniupnpc @@ -153,7 +149,6 @@ ifdef CHD5_LZMA RZDCY_CFLAGS += -D_7ZIP_ST -DCHD5_LZMA endif -RZDCY_CFLAGS += -I$(RZDCY_SRC_DIR)/deps/libzip RZDCY_CFLAGS += -DZ_HAVE_UNISTD_H -I$(RZDCY_SRC_DIR)/deps/zlib RZDCY_CFLAGS += -DXXH_INLINE_ALL -I$(RZDCY_SRC_DIR)/deps/xxHash -I$(RZDCY_SRC_DIR)/deps/stb @@ -164,6 +159,133 @@ RZDCY_FILES += $(foreach dir,$(addprefix $(RZDCY_SRC_DIR)/,$(RZDCY_MODULES)),$(w RZDCY_FILES += $(foreach dir,$(addprefix $(RZDCY_SRC_DIR)/,$(RZDCY_MODULES)),$(wildcard $(dir)*.c)) RZDCY_FILES += $(foreach dir,$(addprefix $(RZDCY_SRC_DIR)/,$(RZDCY_MODULES)),$(wildcard $(dir)*.S)) +ifdef STATIC_LIBZIP +RZDCY_CFLAGS += -I$(RZDCY_SRC_DIR)/deps/libzip/lib +LIBZIP_DIR = $(RZDCY_SRC_DIR)/deps/libzip/lib +RZDCY_FILES += $(LIBZIP_DIR)/zip_add.c \ + $(LIBZIP_DIR)/zip_add_dir.c \ + $(LIBZIP_DIR)/zip_add_entry.c \ + $(LIBZIP_DIR)/zip_algorithm_deflate.c \ + $(LIBZIP_DIR)/zip_buffer.c \ + $(LIBZIP_DIR)/zip_close.c \ + $(LIBZIP_DIR)/zip_delete.c \ + $(LIBZIP_DIR)/zip_dir_add.c \ + $(LIBZIP_DIR)/zip_dirent.c \ + $(LIBZIP_DIR)/zip_discard.c \ + $(LIBZIP_DIR)/zip_entry.c \ + $(LIBZIP_DIR)/zip_error.c \ + $(LIBZIP_DIR)/zip_error_clear.c \ + $(LIBZIP_DIR)/zip_error_get.c \ + $(LIBZIP_DIR)/zip_error_get_sys_type.c \ + $(LIBZIP_DIR)/zip_error_strerror.c \ + $(LIBZIP_DIR)/zip_error_to_str.c \ + $(LIBZIP_DIR)/zip_extra_field.c \ + $(LIBZIP_DIR)/zip_extra_field_api.c \ + $(LIBZIP_DIR)/zip_fclose.c \ + $(LIBZIP_DIR)/zip_fdopen.c \ + $(LIBZIP_DIR)/zip_file_add.c \ + $(LIBZIP_DIR)/zip_file_error_clear.c \ + $(LIBZIP_DIR)/zip_file_error_get.c \ + $(LIBZIP_DIR)/zip_file_get_comment.c \ + $(LIBZIP_DIR)/zip_file_get_external_attributes.c \ + $(LIBZIP_DIR)/zip_file_get_offset.c \ + $(LIBZIP_DIR)/zip_file_rename.c \ + $(LIBZIP_DIR)/zip_file_replace.c \ + $(LIBZIP_DIR)/zip_file_set_comment.c \ + $(LIBZIP_DIR)/zip_file_set_encryption.c \ + $(LIBZIP_DIR)/zip_file_set_external_attributes.c \ + $(LIBZIP_DIR)/zip_file_set_mtime.c \ + $(LIBZIP_DIR)/zip_file_strerror.c \ + $(LIBZIP_DIR)/zip_fopen.c \ + $(LIBZIP_DIR)/zip_fopen_encrypted.c \ + $(LIBZIP_DIR)/zip_fopen_index.c \ + $(LIBZIP_DIR)/zip_fopen_index_encrypted.c \ + $(LIBZIP_DIR)/zip_fread.c \ + $(LIBZIP_DIR)/zip_fseek.c \ + $(LIBZIP_DIR)/zip_ftell.c \ + $(LIBZIP_DIR)/zip_get_archive_comment.c \ + $(LIBZIP_DIR)/zip_get_archive_flag.c \ + $(LIBZIP_DIR)/zip_get_encryption_implementation.c \ + $(LIBZIP_DIR)/zip_get_file_comment.c \ + $(LIBZIP_DIR)/zip_get_name.c \ + $(LIBZIP_DIR)/zip_get_num_entries.c \ + $(LIBZIP_DIR)/zip_get_num_files.c \ + $(LIBZIP_DIR)/zip_hash.c \ + $(LIBZIP_DIR)/zip_io_util.c \ + $(LIBZIP_DIR)/zip_libzip_version.c \ + $(LIBZIP_DIR)/zip_memdup.c \ + $(LIBZIP_DIR)/zip_name_locate.c \ + $(LIBZIP_DIR)/zip_new.c \ + $(LIBZIP_DIR)/zip_open.c \ + $(LIBZIP_DIR)/zip_pkware.c \ + $(LIBZIP_DIR)/zip_progress.c \ + $(LIBZIP_DIR)/zip_rename.c \ + $(LIBZIP_DIR)/zip_replace.c \ + $(LIBZIP_DIR)/zip_set_archive_comment.c \ + $(LIBZIP_DIR)/zip_set_archive_flag.c \ + $(LIBZIP_DIR)/zip_set_default_password.c \ + $(LIBZIP_DIR)/zip_set_file_comment.c \ + $(LIBZIP_DIR)/zip_set_file_compression.c \ + $(LIBZIP_DIR)/zip_set_name.c \ + $(LIBZIP_DIR)/zip_source_accept_empty.c \ + $(LIBZIP_DIR)/zip_source_begin_write.c \ + $(LIBZIP_DIR)/zip_source_begin_write_cloning.c \ + $(LIBZIP_DIR)/zip_source_buffer.c \ + $(LIBZIP_DIR)/zip_source_call.c \ + $(LIBZIP_DIR)/zip_source_close.c \ + $(LIBZIP_DIR)/zip_source_commit_write.c \ + $(LIBZIP_DIR)/zip_source_compress.c \ + $(LIBZIP_DIR)/zip_source_crc.c \ + $(LIBZIP_DIR)/zip_source_error.c \ + $(LIBZIP_DIR)/zip_source_file_common.c \ + $(LIBZIP_DIR)/zip_source_file_stdio.c \ + $(LIBZIP_DIR)/zip_source_free.c \ + $(LIBZIP_DIR)/zip_source_function.c \ + $(LIBZIP_DIR)/zip_source_get_file_attributes.c \ + $(LIBZIP_DIR)/zip_source_is_deleted.c \ + $(LIBZIP_DIR)/zip_source_layered.c \ + $(LIBZIP_DIR)/zip_source_open.c \ + $(LIBZIP_DIR)/zip_source_pkware_decode.c \ + $(LIBZIP_DIR)/zip_source_pkware_encode.c \ + $(LIBZIP_DIR)/zip_source_read.c \ + $(LIBZIP_DIR)/zip_source_remove.c \ + $(LIBZIP_DIR)/zip_source_rollback_write.c \ + $(LIBZIP_DIR)/zip_source_seek.c \ + $(LIBZIP_DIR)/zip_source_seek_write.c \ + $(LIBZIP_DIR)/zip_source_stat.c \ + $(LIBZIP_DIR)/zip_source_supports.c \ + $(LIBZIP_DIR)/zip_source_tell.c \ + $(LIBZIP_DIR)/zip_source_tell_write.c \ + $(LIBZIP_DIR)/zip_source_window.c \ + $(LIBZIP_DIR)/zip_source_write.c \ + $(LIBZIP_DIR)/zip_source_zip.c \ + $(LIBZIP_DIR)/zip_source_zip_new.c \ + $(LIBZIP_DIR)/zip_stat.c \ + $(LIBZIP_DIR)/zip_stat_index.c \ + $(LIBZIP_DIR)/zip_stat_init.c \ + $(LIBZIP_DIR)/zip_strerror.c \ + $(LIBZIP_DIR)/zip_string.c \ + $(LIBZIP_DIR)/zip_unchange.c \ + $(LIBZIP_DIR)/zip_unchange_all.c \ + $(LIBZIP_DIR)/zip_unchange_archive.c \ + $(LIBZIP_DIR)/zip_unchange_data.c \ + $(LIBZIP_DIR)/zip_utf-8.c \ + $(LIBZIP_DIR)/zip_err_str.c + + ifdef FOR_WINDOWS + RZDCY_FILES += $(LIBZIP_DIR)/zip_source_file_win32.c \ + $(LIBZIP_DIR)/zip_source_file_win32_named.c \ + $(LIBZIP_DIR)/zip_source_file_win32_utf16.c \ + $(LIBZIP_DIR)/zip_source_file_win32_utf8.c \ + $(LIBZIP_DIR)/zip_source_file_win32_ansi.c \ + $(LIBZIP_DIR)/zip_random_win32.c + else + RZDCY_FILES += $(LIBZIP_DIR)/zip_mkstempm.c \ + $(LIBZIP_DIR)/zip_source_file_stdio_named.c \ + $(LIBZIP_DIR)/zip_random_unix.c + endif +endif + $(VERSION_HEADER): echo "#define REICAST_VERSION \"`git describe --tags --always`\"" > $(VERSION_HEADER) echo "#define GIT_HASH \"`git rev-parse --short HEAD`\"" >> $(VERSION_HEADER) diff --git a/core/deps/chdpsr/cdipsr.cpp b/core/deps/chdpsr/cdipsr.cpp index ad8949461..751570eb6 100644 --- a/core/deps/chdpsr/cdipsr.cpp +++ b/core/deps/chdpsr/cdipsr.cpp @@ -2,7 +2,6 @@ #include #include #include -#include "deps/coreio/coreio.h" #include "cdipsr.h" // Global variables @@ -12,11 +11,6 @@ unsigned long temp_value; ///////////////////////////////////////////////////////////////////////////// -#define FILE core_file -#define fread(buff,sz,cnt,fc) core_fread(fc,buff,sz*cnt) -#define fseek core_fseek -#define ftell core_ftell - unsigned long ask_type(FILE *fsource, long header_position) { @@ -117,7 +111,8 @@ void CDI_get_tracks (FILE *fsource, image_s *image) bool CDI_init (FILE *fsource, image_s *image, const char *fsourcename) { - image->length = core_fsize(fsource); + fseek(fsource, 0, SEEK_END); + image->length = ftell(fsource); if (image->length < 8) { diff --git a/core/deps/chdpsr/cdipsr.h b/core/deps/chdpsr/cdipsr.h index 206fe50b6..fe8395d93 100644 --- a/core/deps/chdpsr/cdipsr.h +++ b/core/deps/chdpsr/cdipsr.h @@ -1,8 +1,6 @@ #ifndef __CDI_H__ #define __CDI_H__ -#include "deps/coreio/coreio.h" - /* Basic structures */ typedef struct image_s @@ -38,11 +36,11 @@ typedef struct track_s #define CDI_V3 0x80000005 #define CDI_V35 0x80000006 -unsigned long ask_type(core_file *fsource, long header_position); -bool CDI_init(core_file *fsource, image_s *image, const char *fsourcename); -void CDI_get_sessions(core_file *fsource, image_s *image); -void CDI_get_tracks(core_file *fsource, image_s *image); -void CDI_read_track(core_file *fsource, image_s *image, track_s *track); -void CDI_skip_next_session(core_file *fsource, image_s *image); +unsigned long ask_type(FILE *fsource, long header_position); +bool CDI_init(FILE *fsource, image_s *image, const char *fsourcename); +void CDI_get_sessions(FILE *fsource, image_s *image); +void CDI_get_tracks(FILE *fsource, image_s *image); +void CDI_read_track(FILE *fsource, image_s *image, track_s *track); +void CDI_skip_next_session(FILE *fsource, image_s *image); #endif diff --git a/core/deps/chdr/chd.h b/core/deps/chdr/chd.h index dc950715f..85a09dd50 100644 --- a/core/deps/chdr/chd.h +++ b/core/deps/chdr/chd.h @@ -359,6 +359,9 @@ struct _chd_verify_result /* open an existing CHD file */ chd_error chd_open(const char *filename, int mode, chd_file *parent, chd_file **chd); +/* open an existing CHD with an already-opened core_file */ +chd_error chd_open_file(core_file *file, int mode, chd_file *parent, chd_file **chd); + /* close a CHD file */ void chd_close(chd_file *chd); diff --git a/core/deps/chdr/coretypes.h b/core/deps/chdr/coretypes.h index 5aecc14de..241a47ee1 100644 --- a/core/deps/chdr/coretypes.h +++ b/core/deps/chdr/coretypes.h @@ -22,7 +22,7 @@ typedef int8_t INT8; #define core_fread(fc, buff, len) fread(buff, 1, len, fc) #define core_fclose fclose #define core_ftell ftell -static size_t core_fsize(core_file *f) +inline static size_t core_fsize(core_file *f) { long p = ftell(f); fseek(f, 0, SEEK_END); diff --git a/core/deps/dirent/dirent.h b/core/deps/dirent/dirent.h index 332c798ad..87609bd3b 100644 --- a/core/deps/dirent/dirent.h +++ b/core/deps/dirent/dirent.h @@ -455,7 +455,7 @@ _wopendir( * Returns pointer to static directory entry which may be overwritten by * subsequent calls to _wreaddir(). */ -static struct _wdirent* +inline static struct _wdirent* _wreaddir( _WDIR *dirp) { @@ -723,7 +723,7 @@ opendir( /* * Read next directory entry. */ -static struct dirent* +inline static struct dirent* readdir( DIR *dirp) { @@ -861,7 +861,7 @@ closedir( /* * Rewind directory stream to beginning. */ -static void +inline static void rewinddir( DIR* dirp) { @@ -872,7 +872,7 @@ rewinddir( /* * Scan directory for entries. */ -static int +inline static int scandir( const char *dirname, struct dirent ***namelist, @@ -1019,7 +1019,7 @@ alphasort( } /* Sort versions */ -static int +inline static int versionsort( const struct dirent **a, const struct dirent **b) { diff --git a/core/deps/libzip/API-CHANGES.md b/core/deps/libzip/API-CHANGES.md new file mode 100644 index 000000000..24e3d8e1a --- /dev/null +++ b/core/deps/libzip/API-CHANGES.md @@ -0,0 +1,162 @@ +# libzip API changes + +This file describes changes in the libzip API and how to adapt your +code for them. + +You can define `ZIP_DISABLE_DEPRECATED` before including `` to hide +prototypes for deprecated functions, to find out about functions that +might be removed at some point. + +## Changed in libzip-1.0 + +### new type `zip_error_t` + +Error information is stored in the newly public type `zip_error_t`. Use +this to access information about an error, instead of the deprecated +functions that operated on two ints. + +deprecated functions: +- `zip_error_get_sys_type()` +- `zip_error_get()` +- `zip_error_to_str()` +- `zip_file_error_get()` + +See their man pages for instructions on how to replace them. + +The most common affected use is `zip_open`. The new recommended usage +is: + +```c +int err; +if ((za = zip_open(archive, flags, &err)) == NULL) { + zip_error_t error; + zip_error_init_with_code(&error, err); + fprintf(stderr, "can't open zip archive '%s': %s\n", archive, zip_error_strerror(&error)); + zip_error_fini(&error); +} +``` + +### more typedefs + +The following typedefs have been added for better readability: + +```c +typedef struct zip zip_t; +typedef struct zip_file zip_file_t; +typedef struct zip_source zip_source_t; +typedef struct zip_stat zip_stat_t; +``` + +This means you can use "`zip_t`" instead of "`struct zip`", etc. + + +### torrentzip support removed + +torrentzip depends on a particular zlib version which is by now quite +old. + +## Changed in libzip-0.11 + +### new type `zip_flags_t` + +The functions which have flags now use the `zip_flags_t` type for this. +All old flags fit; you need only to adapt code if you were saving flags in a +local variable. Use `zip_flags_t` for such a variable. +This affects: +- `zip_fopen()` +- `zip_fopen_encrypted()` +- `zip_fopen_index()` +- `zip_fopen_index_encrypted()` +- `zip_get_archive_comment()` +- `zip_get_archive_flag()` +- `zip_get_num_entries()` +- `zip_get_name()` +- `zip_name_locate()` +- `zip_set_archive_flag()` +- `zip_source_zip()` +- `zip_stat()` +- `zip_stat_index()` + +#### `ZIP_FL_*`, `ZIP_AFL_*`, `ZIP_STAT_*` are now unsigned constants + +To match the new `zip_flags_t` type. + +#### `zip_add()`, `zip_add_dir()` + +These functions were replaced with `zip_file_add()` and `zip_dir_add()`, respectively, +to add a flags argument. + +#### `zip_rename()`, `zip_replace()` + +These functions were replaced with `zip_file_rename()` and `zip_file_replace()`, +respectively, to add a flags argument. + +#### `zip_get_file_comment()` + +This function was replaced with `zip_file_get_comment()`; one argument was promoted from +`int` to `zip_uint32_t`, the other is now a `zip_flags_t`. + +#### `zip_set_file_comment()` + +This function was replaced with `zip_file_set_comment()`; an argument was promoted from +`int` to `zip_uint16_t`, and a `zip_flags_t` argument was added. + +### integer type size changes + +Some argument and return values were not the right size or sign. + +#### `zip_name_locate()` + +The return value was `int`, which can be too small. The function now returns `zip_int64_t`. + + +#### `zip_get_num_entries()` + +The return type is now signed, to allow signaling errors. + +#### `zip_set_archive_comment()` + +The last argument changed from `int` to `zip_uint16_t`. + +### extra field handling rewritten + +The `zip_get_file_extra()` and `zip_set_file_extra()` functions were removed. +They only worked on the whole extra field set. + +Instead, you can now set, get, count, and delete each extra field separately, +using the functions: +- `zip_file_extra_field_delete()` +- `zip_file_extra_field_delete_by_id()` +- `zip_file_extra_field_get()` +- `zip_file_extra_field_get_by_id()` +- `zip_file_extra_fields_count()` +- `zip_file_extra_fields_count_by_id()` +- `zip_file_extra_field_set()` + +Please read the corresponding man pages for details. + +### new functions + +#### `zip_discard()` + +The new `zip_discard()` function closes an archive without committing the +scheduled changes. + +#### `zip_set_file_compression()` + +The new `zip_set_file_compression()` function allows setting compression +levels for files. + +### argument changes + +#### file names + +File names arguments are now allowed to be `NULL` to have an empty file name. +This mostly affects `zip_file_add()`, `zip_dir_add()`, and `zip_file_rename()`. + +For `zip_get_name()`, `zip_file_get_comment()`, and `zip_get_archive_comment()`, if +the file name or comment is empty, a string of length 0 is returned. +`NULL` is returned for errors only. + +Previously, `NULL` was returned for empty/unset file names and comments and +errors, leaving no way to differentiate between the two. diff --git a/core/deps/libzip/AUTHORS b/core/deps/libzip/AUTHORS new file mode 100644 index 000000000..a33707b01 --- /dev/null +++ b/core/deps/libzip/AUTHORS @@ -0,0 +1,2 @@ +Dieter Baron +Thomas Klausner diff --git a/core/deps/libzip/CMakeLists.txt b/core/deps/libzip/CMakeLists.txt new file mode 100644 index 000000000..afcc6fc31 --- /dev/null +++ b/core/deps/libzip/CMakeLists.txt @@ -0,0 +1,445 @@ +cmake_minimum_required(VERSION 3.0.2) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +if (${CMAKE_VERSION} VERSION_LESS "3.17.0") + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake-compat) +endif() + +project(libzip + VERSION 1.7.3.1 + LANGUAGES C) + +option(ENABLE_COMMONCRYPTO "Enable use of CommonCrypto" ON) +option(ENABLE_GNUTLS "Enable use of GnuTLS" ON) +option(ENABLE_MBEDTLS "Enable use of mbed TLS" ON) +option(ENABLE_OPENSSL "Enable use of OpenSSL" ON) +option(ENABLE_WINDOWS_CRYPTO "Enable use of Windows cryptography libraries" ON) + +option(ENABLE_BZIP2 "Enable use of BZip2" ON) +option(ENABLE_LZMA "Enable use of LZMA" ON) +option(ENABLE_ZSTD "Enable use of Zstandard" ON) + +option(BUILD_TOOLS "Build tools in the src directory (zipcmp, zipmerge, ziptool)" ON) +option(BUILD_REGRESS "Build regression tests" ON) +option(BUILD_EXAMPLES "Build examples" ON) +option(BUILD_DOC "Build documentation" ON) + +include(CheckFunctionExists) +include(CheckIncludeFiles) +include(CheckLibraryExists) +include(CheckSymbolExists) +include(CheckTypeSize) +include(CheckCSourceRuns) +include(CheckCSourceCompiles) +include(CheckStructHasMember) +include(TestBigEndian) +include(GNUInstallDirs) + +if(ENABLE_COMMONCRYPTO) + check_include_files(CommonCrypto/CommonCrypto.h COMMONCRYPTO_FOUND) +endif() +if(ENABLE_GNUTLS) + find_package(Nettle 3.0) + find_package(GnuTLS) +endif() +if(ENABLE_MBEDTLS) + find_package(MbedTLS 1.0) +endif() +if(ENABLE_OPENSSL) + find_package(OpenSSL) +endif() +if(WIN32) + if(ENABLE_WINDOWS_CRYPTO) + set(WINDOWS_CRYPTO_FOUND TRUE) + endif() +endif() + +option(BUILD_SHARED_LIBS "Build shared libraries" ON) +option(LIBZIP_DO_INSTALL "Install libzip and the related files" ON) + +option(SHARED_LIB_VERSIONNING "Add SO version in .so build" ON) + +find_program(MDOCTOOL NAMES mandoc groff) +if (MDOCTOOL) + set(DOCUMENTATION_FORMAT "mdoc" CACHE STRING "Documentation format") +else() + find_program(MANTOOL NAMES nroff) + if (MANTOOL) + set(DOCUMENTATION_FORMAT "man" CACHE STRING "Documentation format") + else() + set(DOCUMENTATION_FORMAT "html" CACHE STRING "Documentation format") + endif() +endif() + +include(Dist) +Dist(${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}) + +#ADD_CUSTOM_TARGET(uninstall +# COMMAND cat ${PROJECT_BINARY_DIR}/install_manifest.txt | xargs rm +# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +# ) + +if(BUILD_SHARED_LIBS) + set(HAVE_SHARED TRUE) +else() + set(ZIP_STATIC TRUE) +endif() + +# Checks + +check_function_exists(_close HAVE__CLOSE) +check_function_exists(_dup HAVE__DUP) +check_function_exists(_fdopen HAVE__FDOPEN) +check_function_exists(_fileno HAVE__FILENO) +check_function_exists(_setmode HAVE__SETMODE) +check_function_exists(_snprintf HAVE__SNPRINTF) +check_function_exists(_strdup HAVE__STRDUP) +check_function_exists(_stricmp HAVE__STRICMP) +check_function_exists(_strtoi64 HAVE__STRTOI64) +check_function_exists(_strtoui64 HAVE__STRTOUI64) +check_function_exists(_unlink HAVE__UNLINK) +check_function_exists(arc4random HAVE_ARC4RANDOM) +check_function_exists(clonefile HAVE_CLONEFILE) +check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO) +check_function_exists(explicit_memset HAVE_EXPLICIT_MEMSET) +check_function_exists(fileno HAVE_FILENO) +check_function_exists(fseeko HAVE_FSEEKO) +check_function_exists(ftello HAVE_FTELLO) +check_function_exists(getprogname HAVE_GETPROGNAME) +check_function_exists(localtime_r HAVE_LOCALTIME_R) +check_function_exists(setmode HAVE_SETMODE) +check_function_exists(strcasecmp HAVE_STRCASECMP) +check_function_exists(strdup HAVE_STRDUP) +check_function_exists(stricmp HAVE_STRICMP) +check_function_exists(strtoll HAVE_STRTOLL) +check_function_exists(strtoull HAVE_STRTOULL) + +check_include_files("sys/types.h;sys/stat.h;fts.h" HAVE_FTS_H) +# fts functions may be in external library +if(HAVE_FTS_H) + check_function_exists(fts_open HAVE_FTS_OPEN) + if(NOT HAVE_FTS_OPEN) + check_library_exists(fts fts_open "" HAVE_LIB_FTS) + else(NOT HAVE_FTS_OPEN) + set(HAVE_LIB_FTS "" CACHE INTERNAL "") + endif(NOT HAVE_FTS_OPEN) +else(HAVE_FTS_H) + set(HAVE_LIB_FTS "" CACHE INTERNAL "") +endif(HAVE_FTS_H) + +if(HAVE_LIB_FTS) + set(FTS_LIB fts CACHE INTERNAL "") +else() + set(FTS_LIB "" CACHE INTERNAL "") +endif() + +check_include_files(stdbool.h HAVE_STDBOOL_H) +check_include_files(strings.h HAVE_STRINGS_H) +check_include_files(unistd.h HAVE_UNISTD_H) + +check_include_files(inttypes.h HAVE_INTTYPES_H_LIBZIP) +check_include_files(stdint.h HAVE_STDINT_H_LIBZIP) +check_include_files(sys/types.h HAVE_SYS_TYPES_H_LIBZIP) + +# TODO: fix test +# this test does not find __progname even when it exists +#check_symbol_exists(__progname stdlib.h HAVE___PROGNAME) + +check_type_size(__int8 __INT8_LIBZIP) +check_type_size(int8_t INT8_T_LIBZIP) +check_type_size(uint8_t UINT8_T_LIBZIP) +check_type_size(__int16 __INT16_LIBZIP) +check_type_size(int16_t INT16_T_LIBZIP) +check_type_size(uint16_t UINT16_T_LIBZIP) +check_type_size(__int32 __INT32_LIBZIP) +check_type_size(int32_t INT32_T_LIBZIP) +check_type_size(uint32_t UINT32_T_LIBZIP) +check_type_size(__int64 __INT64_LIBZIP) +check_type_size(int64_t INT64_T_LIBZIP) +check_type_size(uint64_t UINT64_T_LIBZIP) +check_type_size("short" SHORT_LIBZIP) +check_type_size("int" INT_LIBZIP) +check_type_size("long" LONG_LIBZIP) +check_type_size("long long" LONG_LONG_LIBZIP) +check_type_size("off_t" SIZEOF_OFF_T) +check_type_size("size_t" SIZEOF_SIZE_T) + +check_c_source_compiles("#include +#include +int main(int argc, char *argv[]) { unsigned long x = FICLONERANGE; }" HAVE_FICLONERANGE) + +check_c_source_compiles(" +int foo(char * _Nullable bar); +int main(int argc, char *argv[]) { }" HAVE_NULLABLE) + +test_big_endian(WORDS_BIGENDIAN) + +find_package(ZLIB 1.1.2 REQUIRED) + +if(ENABLE_BZIP2) + find_package(BZip2) + if(BZIP2_FOUND) + set(HAVE_LIBBZ2 1) + else() + message(WARNING "-- bzip2 library not found; bzip2 support disabled") + endif(BZIP2_FOUND) +endif(ENABLE_BZIP2) + +if(ENABLE_LZMA) + find_package(LibLZMA 5.2) + if(LIBLZMA_FOUND) + set(HAVE_LIBLZMA 1) + else() + message(WARNING "-- lzma library not found; lzma/xz support disabled") + endif(LIBLZMA_FOUND) +endif(ENABLE_LZMA) + +if(ENABLE_ZSTD) + find_package(Zstd) + if(Zstd_FOUND) + set(HAVE_LIBZSTD 1) + else() + message(WARNING "-- zstd library not found; zstandard support disabled") + endif(Zstd_FOUND) +endif(ENABLE_ZSTD) + +if (COMMONCRYPTO_FOUND) + set(HAVE_CRYPTO 1) + set(HAVE_COMMONCRYPTO 1) +elseif (WINDOWS_CRYPTO_FOUND) + set(HAVE_CRYPTO 1) + set(HAVE_WINDOWS_CRYPTO 1) +elseif (GNUTLS_FOUND AND NETTLE_FOUND) + set(HAVE_CRYPTO 1) + set(HAVE_GNUTLS 1) +elseif (OPENSSL_FOUND) + set(HAVE_CRYPTO 1) + set(HAVE_OPENSSL 1) +elseif (MBEDTLS_FOUND) + set(HAVE_CRYPTO 1) + set(HAVE_MBEDTLS 1) +endif() + +if (NOT HAVE_CRYPTO) + message(WARNING "-- neither Common Crypto, GnuTLS, mbed TLS, OpenSSL, nor Windows Cryptography found; AES support disabled") +endif() + +if(MSVC) + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) + add_compile_definitions(_CRT_NONSTDC_NO_DEPRECATE) +endif(MSVC) + +if(WIN32) + if(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore) + add_compile_definitions(MS_UWP) + endif(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore) +endif(WIN32) + +# rpath handling: use rpath in installed binaries +if(NOT CMAKE_SYSTEM_NAME MATCHES Linux) + set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +endif() + +# for code completion frameworks +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +# Testing +ENABLE_TESTING() + +# Targets +ADD_SUBDIRECTORY(lib) + +if(BUILD_DOC) + ADD_SUBDIRECTORY(man) +endif() + +if(BUILD_TOOLS) + ADD_SUBDIRECTORY(src) +else(BUILD_TOOLS) + if(BUILD_REGRESS) + message(WARNING "-- tools build has been disabled, but they are needed for regression tests; regression testing disabled") + set(BUILD_REGRESS OFF) + endif(BUILD_REGRESS) +endif() + +include(FindPerl) + +if(NOT PERL_FOUND) + message(WARNING "-- perl not found, regression testing disabled") + set(BUILD_REGRESS OFF) +endif() + +if(BUILD_REGRESS) + add_subdirectory(regress) +endif() + +if(BUILD_EXAMPLES) + add_subdirectory(examples) +endif() + + +# pkgconfig file +set(prefix ${CMAKE_INSTALL_PREFIX}) +set(exec_prefix \${prefix}) +SET(bindir ${CMAKE_INSTALL_FULL_BINDIR}) +SET(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) +SET(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}) +if(CMAKE_SYSTEM_NAME MATCHES BSD) + set(PKG_CONFIG_RPATH "-Wl,-R\${libdir}") +endif(CMAKE_SYSTEM_NAME MATCHES BSD) +get_target_property(LIBS_PRIVATE zip LINK_LIBRARIES) +foreach(LIB ${LIBS_PRIVATE}) + if(LIB MATCHES "^/") + get_filename_component(LIB ${LIB} NAME_WE) + string(REGEX REPLACE "^lib" "" LIB ${LIB}) + endif() + set(LIBS "${LIBS} -l${LIB}") +endforeach() +string(REGEX REPLACE "-lBZip2::BZip2" "-lbz2" LIBS ${LIBS}) +string(REGEX REPLACE "-lLibLZMA::LibLZMA" "-llzma" LIBS ${LIBS}) +string(REGEX REPLACE "-lOpenSSL::Crypto" "-lssl -lcrypto" LIBS ${LIBS}) +string(REGEX REPLACE "-lZLIB::ZLIB" "-lz" LIBS ${LIBS}) +string(REGEX REPLACE "-lGnuTLS::GnuTLS" "-lgnutls" LIBS ${LIBS}) +string(REGEX REPLACE "-lNettle::Nettle" "-lnettle" LIBS ${LIBS}) +configure_file(libzip.pc.in libzip.pc @ONLY) +if(LIBZIP_DO_INSTALL) + install(FILES ${PROJECT_BINARY_DIR}/libzip.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +endif() + +# fixed size integral types + +if(HAVE_INTTYPES_H_LIBZIP) + set(LIBZIP_TYPES_INCLUDE "#if !defined(__STDC_FORMAT_MACROS) +#define __STDC_FORMAT_MACROS 1 +#endif +#include ") +elseif(HAVE_STDINT_H_LIBZIP) + set(LIBZIP_TYPES_INCLUDE "#include ") +elseif(HAVE_SYS_TYPES_H_LIBZIP) + set(LIBZIP_TYPES_INCLUDE "#include ") +endif() + +if(HAVE_INT8_T_LIBZIP) + set(ZIP_INT8_T int8_t) +elseif(HAVE___INT8_LIBZIP) + set(ZIP_INT8_T __int8) +else() + set(ZIP_INT8_T "signed char") +endif() + +if(HAVE_UINT8_T_LIBZIP) + set(ZIP_UINT8_T uint8_t) +elseif(HAVE___INT8_LIBZIP) + set(ZIP_UINT8_T "unsigned __int8") +else() + set(ZIP_UINT8_T "unsigned char") +endif() + +if(HAVE_INT16_T_LIBZIP) + set(ZIP_INT16_T int16_t) +elseif(HAVE___INT16_LIBZIP) + set(INT16_T_LIBZIP __int16) +elseif(SHORT_LIBZIP EQUAL 2) + set(INT16_T_LIBZIP short) +endif() + +if(HAVE_UINT16_T_LIBZIP) + set(ZIP_UINT16_T uint16_t) +elseif(HAVE___INT16_LIBZIP) + set(UINT16_T_LIBZIP "unsigned __int16") +elseif(SHORT_LIBZIP EQUAL 2) + set(UINT16_T_LIBZIP "unsigned short") +endif() + +if(HAVE_INT32_T_LIBZIP) + set(ZIP_INT32_T int32_t) +elseif(HAVE___INT32_LIBZIP) + set(ZIP_INT32_T __int32) +elseif(INT_LIBZIP EQUAL 4) + set(ZIP_INT32_T int) +elseif(LONG_LIBZIP EQUAL 4) + set(ZIP_INT32_T long) +endif() + +if(HAVE_UINT32_T_LIBZIP) + set(ZIP_UINT32_T uint32_t) +elseif(HAVE___INT32_LIBZIP) + set(ZIP_UINT32_T "unsigned __int32") +elseif(INT_LIBZIP EQUAL 4) + set(ZIP_UINT32_T "unsigned int") +elseif(LONG_LIBZIP EQUAL 4) + set(ZIP_UINT32_T "unsigned long") +endif() + +if(HAVE_INT64_T_LIBZIP) + set(ZIP_INT64_T int64_t) +elseif(HAVE___INT64_LIBZIP) + set(ZIP_INT64_T __int64) +elseif(LONG_LIBZIP EQUAL 8) + set(ZIP_INT64_T long) +elseif(LONG_LONG_LIBZIP EQUAL 8) + set(ZIP_INT64_T "long long") +endif() + +if(HAVE_UINT64_T_LIBZIP) + set(ZIP_UINT64_T uint64_t) +elseif(HAVE___INT64_LIBZIP) + set(ZIP_UINT64_T "unsigned __int64") +elseif(LONG_LIBZIP EQUAL 8) + set(ZIP_UINT64_T "unsigned long") +elseif(LONG_LONG_LIBZIP EQUAL 8) + set(ZIP_UINT64_T "unsigned long long") +endif() + +if(HAVE_NULLABLE) + set(ZIP_NULLABLE_DEFINES) +else() + set(ZIP_NULLABLE_DEFINES "#define _Nullable +#define _Nonnull") +endif() + +# write out config file +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake-config.h.in ${PROJECT_BINARY_DIR}/config.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake-zipconf.h.in ${PROJECT_BINARY_DIR}/zipconf.h) + +# for tests + +set(srcdir ${CMAKE_CURRENT_SOURCE_DIR}/regress) +set(abs_srcdir ${CMAKE_CURRENT_SOURCE_DIR}/regress) +set(top_builddir ${PROJECT_BINARY_DIR}) # used to find config.h + +configure_file(regress/nihtest.conf.in ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/nihtest.conf @ONLY) +file(COPY ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/nihtest.conf + DESTINATION ${PROJECT_BINARY_DIR}/regress + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + +configure_file(regress/runtest.in ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/runtest @ONLY) +file(COPY ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/runtest + DESTINATION ${PROJECT_BINARY_DIR}/regress + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + +# create package config file +include(CMakePackageConfigHelpers) +write_basic_package_version_file("${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" + COMPATIBILITY AnyNewerVersion) + +configure_package_config_file("${PROJECT_NAME}-config.cmake.in" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libzip) + +if(LIBZIP_DO_INSTALL) + # Add targets to the build-tree export set + export(TARGETS zip + FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-targets.cmake") + + # installation + install(FILES ${PROJECT_BINARY_DIR}/zipconf.h DESTINATION include) + install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} + ) + install(EXPORT ${PROJECT_NAME}-targets NAMESPACE libzip:: FILE ${PROJECT_NAME}-targets.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} + ) +endif() + diff --git a/core/deps/libzip/INSTALL.md b/core/deps/libzip/INSTALL.md new file mode 100644 index 000000000..512768cf5 --- /dev/null +++ b/core/deps/libzip/INSTALL.md @@ -0,0 +1,69 @@ +libzip uses [cmake](https://cmake.org) to build. + +For running the tests, you need to have [perl](https://www.perl.org). + +You'll need [zlib](http://www.zlib.net/) (at least version 1.1.2). It +comes with most operating systems. + +For supporting bzip2-compressed zip archives, you need +[bzip2](http://bzip.org/). + +For supporting lzma- and xz-compressed zip archives, you need +[liblzma](https://tukaani.org/xz/) which is part of xz, at least version 5.2. + +For supporting zstd-compressed zip archives, you need +[zstd](https://github.com/facebook/zstd/). + +For AES (encryption) support, you need one of these cryptographic libraries, +listed in order of preference: + +- Apple's CommonCrypto (available on macOS and iOS) +- [GnuTLS](https://www.gnutls.org/) and [Nettle](https://www.lysator.liu.se/~nisse/nettle/) (at least nettle 3.0) +- [mbed TLS](https://tls.mbed.org/) +- [OpenSSL](https://www.openssl.org/) >= 1.0. +- Microsoft Windows Cryptography Framework + +If you don't want a library even if it is installed, you can +pass `-DENABLE_=OFF` to cmake, where `` is one of +`COMMONCRYPTO`, `GNUTLS`, `MBEDTLS`, or `OPENSSL`. + +The basic usage is +```sh +mkdir build +cd build +cmake .. +make +make test +make install +``` + +Some useful parameters you can pass to `cmake` with `-Dparameter=value`: + +- `BUILD_SHARED_LIBS`: set to `ON` or `OFF` to enable/disable building + of shared libraries, defaults to `ON` +- `CMAKE_INSTALL_PREFIX`: for setting the installation path +- `DOCUMENTATION_FORMAT`: choose one of `man`, `mdoc`, and `html` for + the installed documentation (default: decided by cmake depending on + available tools) +- `LIBZIP_DO_INSTALL`: If you include libzip as a subproject, link it + statically and do not want to let it install its files, set this + variable to `OFF`. Defaults to `ON`. + +If you want to compile with custom `CFLAGS`, set them in the environment +before running `cmake`: +```sh +CFLAGS=-DMY_CUSTOM_FLAG cmake .. +``` + +If you are compiling on a system with a small stack size, add +`-DZIP_ALLOCATE_BUFFER` to `CFLAGS`. + +If you are building on a 32-bit Linux system it might be necessary +to define `_FILE_OFFSET_BITS` to `64`. Your distro will need to provide +a `fts.h` file that is new enough to support this, or the build +will break in `zipcmp`. + +You can get verbose build output with by passing `VERBOSE=1` to +`make`. + +You can also check the [cmake FAQ](https://cmake.org/Wiki/CMake_FAQ). diff --git a/core/deps/libzip/LICENSE b/core/deps/libzip/LICENSE new file mode 100644 index 000000000..573d5d94d --- /dev/null +++ b/core/deps/libzip/LICENSE @@ -0,0 +1,31 @@ +Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + +The authors can be contacted at + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/core/deps/libzip/NEWS.md b/core/deps/libzip/NEWS.md new file mode 100644 index 000000000..ea1dd9ff4 --- /dev/null +++ b/core/deps/libzip/NEWS.md @@ -0,0 +1,281 @@ +1.8.0 [2020-xx-xx] +================== + +* Add support for zstd (Zstandard) compression. +* Add support for lzma (ID 14) compression. + +1.7.3 [2020-07-15] +================== + +* Support cmake < 3.17 again. +* Fix pkgconfig file (regression in 1.7.2). + +1.7.2 [2020-07-11] +================== + +* Fixes for the CMake `find_project()` files. +* libzip moved to the CMake `libzip::` `NAMESPACE`. +* CMake usage best practice cleanups. + +1.7.1 [2020-06-13] +================== + +* Restore `LIBZIP_VERSION_{MAJOR,MINOR,MICRO}` symbols. +* Fixes warnings reported by PVS-Studio. +* Add `LIBZIP_DO_INSTALL` build setting to make it easier to use + libzip as subproject. + +1.7.0 [2020-06-05] +================== + +* Add support for encrypting using traditional PKWare encryption. +* Add `zip_compression_method_supported()`. +* Add `zip_encryption_method_supported()`. +* Add the `ZIP_SOURCE_GET_FILE_ATTRIBUTES` source command. +* Refactor stdio file backend. +* Add CMake find_project() support. + +1.6.1 [2020-02-03] +================== + +* Bugfix for double-free in `zipcmp(1)` during cleanup. + +1.6.0 [2020-01-24] +================== + +* Avoid using `umask()` since it's not thread-safe. +* Set close-on-exec flag when opening files. +* Do not accept empty files as valid zip archives any longer. +* Add support for XZ compressed files (using liblzma). +* Add support for cancelling while closing zip archives. +* Add support for setting the time in the on-disk format. + +1.5.2 [2019-03-12] +================== + +* Fix bug in AES encryption affecting certain file sizes +* Keep file permissions when modifying zip archives +* Support systems with small stack size. +* Support mbed TLS as crypto backend. +* Add nullability annotations. + +1.5.1 [2018-04-11] +================== + +* Choose format of installed documentation based on available tools. +* Fix visibility of symbols. +* Fix zipcmp directory support. +* Don't set RPATH on Linux. +* Use Libs.private for link dependencies in pkg-config file. +* Fix build with LibreSSL. +* Various bugfixes. + +1.5.0 [2018-03-11] +================== + +* Use standard cryptographic library instead of custom AES implementation. + This also simplifies the license. +* Use `clang-format` to format the source code. +* More Windows improvements. + +1.4.0 [2017-12-29] +================== + +* Improve build with cmake +* Retire autoconf/automake build system +* Add `zip_source_buffer_fragment()`. +* Add support to clone unchanged beginning of archive (instead of rewriting it). + Supported for buffer sources and on Apple File System. +* Add support for Microsoft Universal Windows Platform. + +1.3.2 [2017-11-20] +================== + +* Fix bug introduced in last: zip_t was erroneously freed if zip_close() failed. + +1.3.1 [2017-11-19] +================== + +* Install zipconf.h into ${PREFIX}/include +* Add zip_libzip_version() +* Fix AES tests on Linux + +1.3.0 [2017-09-02] +================== + +* Support bzip2 compressed zip archives +* Improve file progress callback code +* Fix zip_fdopen() +* CVE-2017-12858: Fix double free() +* CVE-2017-14107: Improve EOCD64 parsing + +1.2.0 [2017-02-19] +================== + +* Support for AES encryption (Winzip version), both encryption + and decryption +* Support legacy zip files with >64k entries +* Fix seeking in zip_source_file if start > 0 +* Add zip_fseek() for seeking in uncompressed data +* Add zip_ftell() for telling position in uncompressed data +* Add zip_register_progress_callback() for UI updates during zip_close() + +1.1.3 [2016-05-28] +================== + +* Fix build on Windows when using autoconf + +1.1.2 [2016-02-19] +================== + +* Improve support for 3MF files + +1.1.1 [2016-02-07] +================== + +* Build fixes for Linux +* Fix some warnings reported by PVS-Studio + +1.1 [2016-01-26] +================ + +* ziptool(1): command line tool to modify zip archives +* Speedups for archives with many entries +* Coverity fixes +* Better APK support +* Support for running tests on Windows +* More build fixes for Windows +* Portability fixes +* Documentation improvements + +1.0.1 [2015-05-04] +================== + +* Build fixes for Windows + +1.0 [2015-05-03] +================ + +* Implemented an I/O abstraction layer +* Added support for native Windows API for files +* Added support for setting the last modification time for a file +* Added a new type zip_error_t for errors +* Added more typedefs for structs +* Torrentzip support was removed +* CVE-2015-2331 was fixed +* Addressed all Coverity CIDs + +0.11.2 [2013-12-19] +=================== + +* Support querying/setting operating system and external attributes +* For newly added files, set operating system to UNIX, permissions + to 0666 (0777 for directories) +* Fix bug when writing zip archives containing files bigger than 4GB + +0.11.1 [2013-04-27] +=================== + +* Fix bugs in zip_set_file_compression() +* Include Xcode build infrastructure + +0.11 [2013-03-23] +================= + +* Added Zip64 support (large file support) +* Added UTF-8 support for file names, file comments, and archive comments +* Changed API for name and comment related functions for UTF-8 support +* Added zip_discard() +* Added ZIP_TRUNCATE for zip_open() +* Added zip_set_file_compression() +* Added API for accessing and modifying extra fields +* Improved API type consistency +* Use gcc4's visibility __attribute__ +* More changes for Windows support +* Additional test cases + +0.10.1 [2012-03-20] +=================== + +* Fixed CVE-2012-1162 +* Fixed CVE-2012-1163 + +0.10 [2010-03-18] +================= + +* Added zip_get_num_entries(), deprecated zip_get_num_files() +* Better windows support +* Support for traditional PKWARE encryption added +* Fix opening archives with more than 65535 entries +* Fix some memory leaks +* Fix cmake build and installation +* Fix memory leak in error case in zip_open() +* Fixed CVE-2011-0421 (no security implications though) +* More documentation + +0.9.3 [2010-02-01] +================== + +* Include m4/ directory in distribution; some packagers need it + +0.9.2 [2010-01-31] +================== + +* Avoid passing uninitialized data to deflate() +* Fix memory leak when closing zip archives + +0.9.1 [2010-01-24] +================== + +* Fix infinite loop on reading some broken files +* Optimization in time conversion (don't call localtime()) +* Clear data descriptor flag in central directory, fixing Open Office files +* Allow more than 64k entries + +0.9 [2008-07-25] +================== + +* on Windows, explicitly set dllimport/dllexport +* remove erroneous references to GPL +* add support for torrentzip +* new functions: zip_get_archive_flag, zip_set_archive_flag +* zip_source_zip: add flag to force recompression +* zip_sorce_file: only keep file open while reading from it + +0.8 [2007-06-06] +================== + +* fix for zip archives larger than 2GiB +* fix zip_error_strerror to include libzip error string +* add support for reading streamed zip files +* new functions: zip_add_dir, zip_error_clear, zip_file_error_clear +* add basic support for building with CMake (incomplete) + +0.7.1 [2006-05-18] +================== + +* bugfix for zip_close + +0.7 [2006-05-06] +================ + +* struct zip_stat increased for future encryption support +* zip_add return value changed (now returns new index of added file) +* shared library major bump because of previous two +* added functions for reading and writing file and archive comments + New functions: zip_get_archive_comment, zip_get_file_comment, + zip_set_archive_comment, zip_set_file_comment, zip_unchange_archive + +0.6.1 [2005-07-14] +================== + +* various bug fixes + +0.6 [2005-06-09] +================ + +* first standalone release +* changed license to three-clause BSD +* overhauled API +* added man pages +* install zipcmp and zipmerge diff --git a/core/deps/libzip/README.md b/core/deps/libzip/README.md new file mode 100644 index 000000000..9262c3def --- /dev/null +++ b/core/deps/libzip/README.md @@ -0,0 +1,39 @@ +This is libzip, a C library for reading, creating, and modifying +zip and zip64 archives. Files can be added from data buffers, files, +or compressed data copied directly from other zip archives. Changes +made without closing the archive can be reverted. Decryption and +encryption of Winzip AES and legacy PKware encrypted files is +supported. The API is documented by man pages. + +libzip is fully documented via man pages. HTML versions of the man +pages are on [libzip.org](https://libzip.org/documentation/) and +in the [man](man) directory. You can start with +[libzip(3)](https://libzip.org/documentation/libzip.html), which +lists +all others. Example source code is in the [examples](examples) and +[src](src) subdirectories. + +If you have developed an application using libzip, you can find out +about API changes and how to adapt your code for them in the included +file [API-CHANGES.md](API-CHANGES.md). + +See the [INSTALL.md](INSTALL.md) file for installation instructions and +dependencies. + +If you make a binary distribution, please include a pointer to the +distribution site: +> https://libzip.org/ + +The latest version can always be found there. The official repository +is at [github](https://github.com/nih-at/libzip/). + +There is a mailing list for developers using libzip. You can +subscribe to it by sending a mail with the subject "subscribe +libzip-discuss" to minimalist at nih.at. List mail should be sent +to libzip-discuss at nih.at. Use this for bug reports or questions. + +If you want to reach the authors in private, use . + +[![Travis Build Status](https://api.travis-ci.org/nih-at/libzip.svg?branch=master)](https://travis-ci.org/nih-at/libzip) +[![Appveyor Build status](https://ci.appveyor.com/api/projects/status/f1bqqt9djvf22f5g?svg=true)](https://ci.appveyor.com/project/nih-at/libzip) +[![Coverity Status](https://scan.coverity.com/projects/127/badge.svg)](https://scan.coverity.com/projects/libzip) diff --git a/core/deps/libzip/THANKS b/core/deps/libzip/THANKS new file mode 100644 index 000000000..b7e4497f6 --- /dev/null +++ b/core/deps/libzip/THANKS @@ -0,0 +1,117 @@ +Thanks to Info-ZIP for info on the DOS-time/date conversion code, +and some other general information gathered from their sources. + +Thanks to these people for suggestions, testing, and bug reports: + +Agostino Sarubbo +Alexander Galanin +Alexandr Shadchin +Alexey Bykov +Andreas Falkenhahn +Andrew Brampton +Andrew Molyneux +Ankur Kothari +Antonin Décimo +Arseniy Terekhin +BALATON Zoltan +Benjamin Gilbert +Beuc +Boaz Stolk +Bogdan +Brian 'geeknik' Carpenter +Carl Mastrangelo +Cédric Tabin +celan69 +Charlie Li +Chris Nehren +Christoph Cullmann +Christoph M. Becker +Coverity +Dane Springmeyer +Ларионов Даниил +David Demelier +Dean Ellis +Declan Moran +Del Merritt +Dmytro Rybachenko +Elvis Angelaccio +Erwin Haid +Eun-cheol Joo +Fabrice Fontaine +Florian Delizy +Force Charlie +François Simon +Frederik Ramm +gk7huki +Hanno Böck +HeeMyung +Heiko Becker +Heiko Hund +Ilya Voronin +Info-ZIP group +Jan Weiß +Jay Freeman (saurik) +jloqfjgk@github +Joachim Reichel +João Custódio +Joel Ebrahimi +Jono Spiro +Julien Schueller +kensington +Keith Jones +Khaled Mardam-Bey +Kohei Yoshida +Leith Bade +Lubomir I. Ivanov +Maël Nison +Martin Buchholz +Martin Herkt +Martin Szulecki +Michael Balzer +Michael Beck +Michał Janiszewski +Michal Vyskocil +Mikhail Gusarov . +Miklos Vajna +Morris Hafner +Oliver Kaiser +Oliver Kuckertz +OSS-Fuzz Team +Ørjan Malde +Pascal Terjan +Patrick Spendrin +Paul Harris +Paul Sheppard +Pavel Raiskup +Pierre Joye +Pierre-Louis Cabelguen +Randy +Remi Collet +Richard Schütz +Rick Carback +Rikard Falkeborn +Robert Norris +Roberto Tirabassi +Roland Ortloff +Rosen Penev +Ryan Burns +Sebastian Kemper +Sebastian Schmitt +Sergei Ozerov +Simon Talbot +Stephen Bryant +Tabata Shintaro +Tarmo Pikaro +Taylor C. Richberger +TC +Tim Lunn +Timo Warns +Tom Callaway +Tomas Hoger +Tomáš Malý +Torsten Paul +Transporter +Vassili Courzakis +William Lee +Wojciech Michalski +Wolfgang Glunz diff --git a/core/deps/libzip/TODO.md b/core/deps/libzip/TODO.md new file mode 100644 index 000000000..bd81107ac --- /dev/null +++ b/core/deps/libzip/TODO.md @@ -0,0 +1,172 @@ +## Prefixes + +For example for adding extractors for self-extracting zip archives. +````c +zip_set_archive_prefix(struct zip *za, const zip_uint8_t *data, zip_uint64_t length); +const zip_uint8_t *zip_get_archive_prefix(struct zip *za, zip_uint64_t *lengthp); +```` + +## Compression + +* add lzma2 support +* add deflate64 support (https://github.com/madler/zlib/blob/master/contrib/infback9/infback9.h) + +## API Issues + +* `zip_get_archive_comment` has `int *lenp` argument. Cleaner would be `zip_uint32_t *`. + rename and fix. which other functions for naming consistency? +* rename remaining `zip_XXX_{file,archive}_*` to `zip_{file,archive}_XXX_*`? +* compression/crypt implementations: how to set error code on failure +* compression/crypt error messages a la `ZIP_ER_ZLIB` (no detailed info passing) + +## Features + +* add seek support for AES-encrypted files +* consistently use `_zip_crypto_clear()` for passwords +* support setting extra fields from `zip_source` + * introduce layers of extra fields: + * original + * from `zip_source` + * manually set + * when querying extra fields, search all of them in reverse order + * add whiteout (deleted) flag + * allow invalid data flag, used when computing extra field size before writing data + * new command `ZIP_SOURCE_EXTRA_FIELDS` + * no support for multiple copies of same extra field +* delete all extra fields during `zip_replace()` +* function to copy file from one archive to another +* set `O_CLOEXEC` flag after fopen and mkstemp +* `zip_file_set_mtime()`: support InfoZIP time stamps +* support streaming output (creating new archive to e.g. stdout) +* add function to read/set ASCII file flag +* `zip_commit()` (to finish changes without closing archive) +* add custom compression function support +* `zip_source_zip()`: allow rewinding +* `zipcmp`: add option for file content comparison +* `zipcmp`: add more paranoid checks: + * external attributes/opsys + * last_mod + * version needed/made by + * general purpose bit flags +* add more consistency checks: + * for stored files, test compressed = uncompressed + * data descriptor + * local headers come before central dir +* support for old compression methods? + +## Bugs + +* ensure that nentries is small enough not to cause overflow (size_t for entry, uint64 for CD on disk) +* check for limits imposed by format (central dir size, file size, extra fields, ...) +* `_zip_u2d_time()`: handle `localtime(3)` failure +* POSIX: `zip_open()`: check whether file can be created and fail if not +* fix inconsistent usage of valid flags (not checked in many places) +* `cdr == NULL` -> `ER_NOENT` vs. `idx > cdir->nentry` -> `ER_INVAL` inconsistent (still there?) + +## Cleanup + +* go over cdir parser and rename various offset/size variables to make it clearer +* use bool +* use `ZIP_SOURCE_SUPPORTS_{READABLE,SEEKABLE,WRITABLE}` +* use `zip_source_seek_compute_offset()` +* get rid of `zip_get_{compression,encryption}_implementation()` +* use `zip_*int*_t` internally +* `zip_source_file()`: don't allow write if start/len specify a part of the file + +## Documentation + +* document: `zip_source_write()`: length can't be > `ZIP_INT64_MAX` +* document: `ZIP_SOURCE_CLOSE` implementation can't return error +* keep error codes in man pages in sync +* document error codes in new man pages + +## Infrastructure + +* review guidelines/community standards + - [Linux Foundation Core Infrastructure Initiative Best Practices](https://bestpractices.coreinfrastructure.org/) + - [Readme Maturity Level](https://github.com/LappleApple/feedmereadmes/blob/master/README-maturity-model.md) + - [Github Community Profile](https://github.com/nih-at/libzip/community) +* test different crypto backends with TravisCI. +* improve man page formatting of tagged lists on webpage (`
`) +* rewrite `make_zip_errors.sh` in cmake +* script to check if all exported symbols are marked with `ZIP_EXTERN`, add to `make distcheck` + +## macOS / iOS framework + +* get cmake to optionally build frameworks + +## Test Case Issues + +* test error cases with special source + - tell it which command should fail + - use it both as source for `zip_add` and `zip_open_from_source` + - `ziptool_regress`: + - `-e error_spec`: source containing zip fails depending on `error_spec` + - `add_with_error name content error_spec`: add content to archive, where source fails depending on `error_spec` + - `add_file_with_error name file_to_add offset len error_spec`: add file to archive, len bytes starting from offset, where source fails depending on `error_spec` + - `error_spec`: + - source command that fails + - error code that source returns + - conditions that must be met for error to trigger + - Nth call of command + - read/write: total byte count so far + - state of source (opened, EOF reached, ...) +* test for zipcmp reading directory (requires fts) +* add test case for clone with files > 4k +* consider testing for malloc/realloc failures +* Winzip AES support + * test cases decryption: <=20, >20, stat for both + * test cases encryption: no password, default password, file-specific password, 128/192/256, <=20, >20 + * support testing on macOS +* add test cases for lots of files (including too many) +* add test cases for holes (between files, between files and cdir, between cdir and eocd, + zip64 where appropriate) +* test seek in `zip_source_crc()` +* test cases for `set_extra*`, `delete_extra*`, `*extra_field*` +* test cases for in memory archives + * add + * delete + * delete all + * modify +* use gcov output to increase test coverage +* add test case to change values for newly added files (name, compression method, comment, mtime, . . .) +* `zip_open()` file less than `EOCDLEN` bytes long +* test calls against old API +* rename file to dir/ and vice versa (fails) +* fix comment test to be newline insensitive +* check if http://bugs.python.org/issue20078 provides ideas for new tests + +* (`add`, `replace`) + * add to empty zip + * add to existing zip + * add w/ existing file name [E] + * replace ok + * replace w/ illegal index [E] + * replace w/ deleted name [E] + * unchange added/replaced file +* (`close`) + * copy zip file + * open copy + * rename, delete, replace, add w/ new name, add w/ deleted name + * close + * zipcmp copy expected + * remove copy +* (`error_get) +* (`error_get_sys_type`) +* (`error_to_str`) +* (`extra_fields`) +* (`file_error_get`) +* (`file_strerror`) +* (`replace`) +* (`source_buffer`) +* (`source_file`) +* (`source_filep`) +* (`source_free`) +* (`source_function`) +* (`source_zip`) +* (`strerror`) +* (`unchange`) +* (`unchange_all`) +* `open(ZIP_RDONLY)` +* I/O abstraction layer + * `zip_open_from_source` +* read two zip entries interleaved diff --git a/core/deps/libzip/android/do.sh b/core/deps/libzip/android/do.sh new file mode 100644 index 000000000..c4641c9f2 --- /dev/null +++ b/core/deps/libzip/android/do.sh @@ -0,0 +1,63 @@ + +# Author: Declan Moran +# www.silverglint.com +# Thanks to damaex (https://github.com/damaex), for significant contributions + +ANDROID_NDK_ROOT=/home/android/android-ndk-r19c + +INSTALL_DIR=install +BUILD_DIR=build +START_DIR=$(pwd) + +rm -rf $INSTALL_DIR +rm -rf $BUILD_DIR +mkdir -p $BUILD_DIR #"${ANDROID_TARGET_PLATFORM}" + +#-------------------------------------------------------------------- +build_it() +{ + # builds either a static or shared lib depending on parm passed (ON or OFF) + want_shared=$1 + + cmake -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake \ + -DCMAKE_INSTALL_PREFIX:PATH=../../${INSTALL_DIR}/${ANDROID_TARGET_PLATFORM} \ + -DANDROID_ABI=${ANDROID_TARGET_PLATFORM} \ + -DENABLE_OPENSSL:BOOL=OFF \ + -DENABLE_COMMONCRYPTO:BOOL=OFF \ + -DENABLE_GNUTLS:BOOL=OFF \ + -DENABLE_MBEDTLS:BOOL=OFF \ + -DENABLE_OPENSSL:BOOL=OFF \ + -DENABLE_WINDOWS_CRYPTO:BOOL=OFF \ + -DBUILD_TOOLS:BOOL=OFF \ + -DBUILD_REGRESS:BOOL=OFF \ + -DBUILD_EXAMPLES:BOOL=OFF \ + -DBUILD_SHARED_LIBS:BOOL=$want_shared \ + -DBUILD_DOC:BOOL=OFF \ + -DANDROID_TOOLCHAIN=clang cmake -H.. -B$BUILD_DIR/${ANDROID_TARGET_PLATFORM} + + #run make with all system threads and install + cd $BUILD_DIR/${ANDROID_TARGET_PLATFORM} + make install -j$(nproc --all) + cd $START_DIR + } + +#-------------------------------------------------------------------- +for ANDROID_TARGET_PLATFORM in armeabi-v7a arm64-v8a x86 x86_64 +do + echo "Building libzip for ${ANDROID_TARGET_PLATFORM}" + + build_it ON + build_it OFF + + if [ $? -ne 0 ]; then + echo "Error executing: cmake" + exit 1 + fi + + + if [ $? -ne 0 ]; then + echo "Error executing make install for platform: ${ANDROID_TARGET_PLATFORM}" + exit 1 + fi + +done diff --git a/core/deps/libzip/android/docker/Dockerfile b/core/deps/libzip/android/docker/Dockerfile new file mode 100644 index 000000000..5532bde28 --- /dev/null +++ b/core/deps/libzip/android/docker/Dockerfile @@ -0,0 +1,122 @@ +# Version: 1.0 + +# Dockerfile for building libzip for android +# https://github.com/dec1/libzip.git +# creates docker container with all tools, libraries and sources required to build libzip for android. + +# Author: Declan Moran +# www.silverglint.com + + +# Usage: +#--------- +# download the libzip repository +# > git clone https://github.com/dec1/libzip.git +# > cd libzip +# +# build docker image "my_img_zip" from the dockerfile in "docker" dir +# > docker build -t my_img_zip ./android/docker +# +# run docker container "my_ctr_zip" from this image, mounting the current dir. (Need to pass absolute host paths to mount volume- hence "pwd") +# > docker run -v $(pwd):/home/docker-share/libzip -it --entrypoint=/bin/bash --name my_ctr_zip my_img_zip +# +# Now inside docker container +# $ cd /home/docker-share/libzip/android +# +# Modify ./do.sh (on host), to match the boost and android ndk versions/paths in the "Configure here" section below +# Build from running docker container. +# $./do.sh +# +# "./build" dir contains required build, but owned by root. chown to your username/group +# > sudo chown -R : ./build +# > sudo chown -R : ./install +# +# Exit container, when build is finished. +# $ exit +# + + + + +FROM ubuntu:18.04 + + +## -------------------------------------------------------------------- +## Configure here +# --------------------------------------------------------------------- +# --------------------------------------------------------------------- +# Here you can speciofy exactly what android ndk (and sdk) version you want to use. + + + +# (2) Android SDK +# https://developer.android.com/studio#downloads +ARG SDK_URL_BASE=https://dl.google.com/android/repository +ARG SDK_FILE=sdk-tools-linux-4333796.zip + +# the sdk platform to use +# https://developer.android.com/guide/topics/manifest/uses-sdk-element +ARG ANDROID_SDK_PLATFORM_VERS="platforms;android-28" + + + +# (3) Android NDK +# https://developer.android.com/ndk/downloads +ARG NDK_URL_BASE=https://dl.google.com/android/repository +ARG NDK_FILE=android-ndk-r19c-linux-x86_64.zip +# --------------------------------------------------------------------- +## -------------------------------------------------------------------- + +RUN apt-get update +RUN apt-get -y dist-upgrade + + +# for downloading archives +RUN apt-get -y install wget + +# for unzipping downloaded android archives +RUN apt-get -y install zip +RUN apt-get -y install cmake + +RUN apt-get -y install lib32z1 + + +# need this this to install some (32 bit) prerequisites for android builds +RUN dpkg --add-architecture i386 +RUN apt-get update +RUN apt-get -y dist-upgrade +RUN apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 libbz2-1.0:i386 + + +# need c compiler to set up create boost build system (before building boost with it and android toolchain) +RUN apt-get -y install build-essential +RUN apt-get -y install libc6-dev-i386 +RUN apt-get -y install clang + +RUN apt-get -y install openjdk-8-jdk +#-------------------------------------- + +ARG ANDROID_HOME=/home/android +WORKDIR ${ANDROID_HOME} + + +# SDK +# ---- +# download android sdk command line tools +RUN wget ${SDK_URL_BASE}/$SDK_FILE +RUN unzip $SDK_FILE + +ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools + + +RUN yes | sdkmanager --licenses + +RUN sdkmanager "platform-tools" $ANDROID_SDK_PLATFORM_VERS +#RUN sdkmanager "platform-tools" "platforms;android-28" + + +# NDK +# ---- +RUN wget ${NDK_URL_BASE}/$NDK_FILE +RUN unzip $NDK_FILE + diff --git a/core/deps/libzip/android/readme.txt b/core/deps/libzip/android/readme.txt new file mode 100644 index 000000000..aa69fbd45 --- /dev/null +++ b/core/deps/libzip/android/readme.txt @@ -0,0 +1,10 @@ + +Cross compile libzip for android. +-------------------------------- +Modify "do.sh" as appropriate if you need to specify a different ndk dir or wish to specify different build parameters + +Prerequisites for the development machine - see docker/Dockerfile + +You can either set you host machine up with these prerequisites or simply use docker (in which case you need not install anything on your host machine except docker itself). + +See "Usage" in docker/Dockerfile for detailed instructions. diff --git a/core/deps/libzip/cmake-compat/CMakePushCheckState.cmake b/core/deps/libzip/cmake-compat/CMakePushCheckState.cmake new file mode 100644 index 000000000..3e519ee51 --- /dev/null +++ b/core/deps/libzip/cmake-compat/CMakePushCheckState.cmake @@ -0,0 +1,91 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +CMakePushCheckState +------------------- + + + +This module defines three macros: ``CMAKE_PUSH_CHECK_STATE()`` +``CMAKE_POP_CHECK_STATE()`` and ``CMAKE_RESET_CHECK_STATE()`` These macros can +be used to save, restore and reset (i.e., clear contents) the state of +the variables ``CMAKE_REQUIRED_FLAGS``, ``CMAKE_REQUIRED_DEFINITIONS``, +``CMAKE_REQUIRED_LINK_OPTIONS``, ``CMAKE_REQUIRED_LIBRARIES``, +``CMAKE_REQUIRED_INCLUDES`` and ``CMAKE_EXTRA_INCLUDE_FILES`` used by the +various Check-files coming with CMake, like e.g. ``check_function_exists()`` +etc. +The variable contents are pushed on a stack, pushing multiple times is +supported. This is useful e.g. when executing such tests in a Find-module, +where they have to be set, but after the Find-module has been executed they +should have the same value as they had before. + +``CMAKE_PUSH_CHECK_STATE()`` macro receives optional argument ``RESET``. +Whether it's specified, ``CMAKE_PUSH_CHECK_STATE()`` will set all +``CMAKE_REQUIRED_*`` variables to empty values, same as +``CMAKE_RESET_CHECK_STATE()`` call will do. + +Usage: + +.. code-block:: cmake + + cmake_push_check_state(RESET) + set(CMAKE_REQUIRED_DEFINITIONS -DSOME_MORE_DEF) + check_function_exists(...) + cmake_reset_check_state() + set(CMAKE_REQUIRED_DEFINITIONS -DANOTHER_DEF) + check_function_exists(...) + cmake_pop_check_state() +#]=======================================================================] + +macro(CMAKE_RESET_CHECK_STATE) + + set(CMAKE_EXTRA_INCLUDE_FILES) + set(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_DEFINITIONS) + set(CMAKE_REQUIRED_LINK_OPTIONS) + set(CMAKE_REQUIRED_LIBRARIES) + set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_QUIET) + +endmacro() + +macro(CMAKE_PUSH_CHECK_STATE) + + if(NOT DEFINED _CMAKE_PUSH_CHECK_STATE_COUNTER) + set(_CMAKE_PUSH_CHECK_STATE_COUNTER 0) + endif() + + math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}+1") + + set(_CMAKE_EXTRA_INCLUDE_FILES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_EXTRA_INCLUDE_FILES}) + set(_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_INCLUDES}) + set(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS}) + set(_CMAKE_REQUIRED_LINK_OPTIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LINK_OPTIONS}) + set(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES}) + set(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS}) + set(_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_QUIET}) + + if (${ARGC} GREATER 0 AND "${ARGV0}" STREQUAL "RESET") + cmake_reset_check_state() + endif() + +endmacro() + +macro(CMAKE_POP_CHECK_STATE) + +# don't pop more than we pushed + if("${_CMAKE_PUSH_CHECK_STATE_COUNTER}" GREATER "0") + + set(CMAKE_EXTRA_INCLUDE_FILES ${_CMAKE_EXTRA_INCLUDE_FILES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_LINK_OPTIONS ${_CMAKE_REQUIRED_LINK_OPTIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_QUIET ${_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + + math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1") + endif() + +endmacro() diff --git a/core/deps/libzip/cmake-compat/CheckLibraryExists.cmake b/core/deps/libzip/cmake-compat/CheckLibraryExists.cmake new file mode 100644 index 000000000..76901ab61 --- /dev/null +++ b/core/deps/libzip/cmake-compat/CheckLibraryExists.cmake @@ -0,0 +1,102 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +CheckLibraryExists +------------------ + +Check if the function exists. + +.. command:: CHECK_LIBRARY_EXISTS + + .. code-block:: cmake + + CHECK_LIBRARY_EXISTS(LIBRARY FUNCTION LOCATION VARIABLE) + + :: + + LIBRARY - the name of the library you are looking for + FUNCTION - the name of the function + LOCATION - location where the library should be found + VARIABLE - variable to store the result + Will be created as an internal cache variable. + + + +The following variables may be set before calling this macro to modify +the way the check is run: + +:: + + CMAKE_REQUIRED_FLAGS = string of compile command line flags + CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) + CMAKE_REQUIRED_LINK_OPTIONS = list of options to pass to link command + CMAKE_REQUIRED_LIBRARIES = list of libraries to link + CMAKE_REQUIRED_QUIET = execute quietly without messages +#]=======================================================================] + +if(__CheckLibraryExists_cmake__) + return() +endif() +set(__CheckLibraryExists_cmake__ TRUE) + +macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) + if(NOT DEFINED "${VARIABLE}") + set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION + "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") + if(NOT CMAKE_REQUIRED_QUIET) + message(CHECK_START "Looking for ${FUNCTION} in ${LIBRARY}") + endif() + set(CHECK_LIBRARY_EXISTS_LINK_OPTIONS) + if(CMAKE_REQUIRED_LINK_OPTIONS) + set(CHECK_LIBRARY_EXISTS_LINK_OPTIONS + LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS}) + endif() + set(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY}) + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_LIBRARY_EXISTS_LIBRARIES + ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${CMAKE_REQUIRED_LIBRARIES}) + endif() + + if(CMAKE_C_COMPILER_LOADED) + set(_cle_source ${CMAKE_ROOT}/Modules/CheckFunctionExists.c) + elseif(CMAKE_CXX_COMPILER_LOADED) + set(_cle_source ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckLibraryExists/CheckFunctionExists.cxx) + configure_file(${CMAKE_ROOT}/Modules/CheckFunctionExists.c "${_cle_source}" COPYONLY) + else() + message(FATAL_ERROR "CHECK_FUNCTION_EXISTS needs either C or CXX language enabled") + endif() + + try_compile(${VARIABLE} + ${CMAKE_BINARY_DIR} + ${_cle_source} + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_LIBRARY_EXISTS_LINK_OPTIONS} + LINK_LIBRARIES ${CHECK_LIBRARY_EXISTS_LIBRARIES} + CMAKE_FLAGS + -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_LIBRARY_EXISTS_DEFINITION} + -DLINK_DIRECTORIES:STRING=${LOCATION} + OUTPUT_VARIABLE OUTPUT) + unset(_cle_source) + + if(${VARIABLE}) + if(NOT CMAKE_REQUIRED_QUIET) + message(CHECK_PASS "found") + endif() + set(${VARIABLE} 1 CACHE INTERNAL "Have library ${LIBRARY}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " + "passed with the following output:\n" + "${OUTPUT}\n\n") + else() + if(NOT CMAKE_REQUIRED_QUIET) + message(CHECK_FAIL "not found") + endif() + set(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " + "failed with the following output:\n" + "${OUTPUT}\n\n") + endif() + endif() +endmacro() diff --git a/core/deps/libzip/cmake-compat/CheckSymbolExists.cmake b/core/deps/libzip/cmake-compat/CheckSymbolExists.cmake new file mode 100644 index 000000000..79d3d7d78 --- /dev/null +++ b/core/deps/libzip/cmake-compat/CheckSymbolExists.cmake @@ -0,0 +1,169 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +CheckSymbolExists +----------------- + +Provides a macro to check if a symbol exists as a function, variable, +or macro in ``C``. + +.. command:: check_symbol_exists + + .. code-block:: cmake + + check_symbol_exists( ) + + Check that the ```` is available after including given header + ```` and store the result in a ````. Specify the list + of files in one argument as a semicolon-separated list. + ```` will be created as an internal cache variable. + +If the header files define the symbol as a macro it is considered +available and assumed to work. If the header files declare the symbol +as a function or variable then the symbol must also be available for +linking (so intrinsics may not be detected). +If the symbol is a type, enum value, or intrinsic it will not be recognized +(consider using :module:`CheckTypeSize` or :module:`CheckCSourceCompiles`). +If the check needs to be done in C++, consider using +:module:`CheckCXXSymbolExists` instead. + +The following variables may be set before calling this macro to modify +the way the check is run: + +``CMAKE_REQUIRED_FLAGS`` + string of compile command line flags. +``CMAKE_REQUIRED_DEFINITIONS`` + a :ref:`;-list ` of macros to define (-DFOO=bar). +``CMAKE_REQUIRED_INCLUDES`` + a :ref:`;-list ` of header search paths to pass to + the compiler. +``CMAKE_REQUIRED_LINK_OPTIONS`` + a :ref:`;-list ` of options to add to the link command. +``CMAKE_REQUIRED_LIBRARIES`` + a :ref:`;-list ` of libraries to add to the link + command. See policy :policy:`CMP0075`. +``CMAKE_REQUIRED_QUIET`` + execute quietly without messages. + +For example: + +.. code-block:: cmake + + include(CheckSymbolExists) + + # Check for macro SEEK_SET + check_symbol_exists(SEEK_SET "stdio.h" HAVE_SEEK_SET) + # Check for function fopen + check_symbol_exists(fopen "stdio.h" HAVE_FOPEN) +#]=======================================================================] + +if(__CheckSymbolExists_cmake__) + return() +endif() +set(__CheckSymbolExists_cmake__ TRUE) + +cmake_policy(PUSH) +cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced + +macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) + if(CMAKE_C_COMPILER_LOADED) + __CHECK_SYMBOL_EXISTS_IMPL("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" ) + elseif(CMAKE_CXX_COMPILER_LOADED) + __CHECK_SYMBOL_EXISTS_IMPL("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.cxx" "${SYMBOL}" "${FILES}" "${VARIABLE}" ) + else() + message(FATAL_ERROR "CHECK_SYMBOL_EXISTS needs either C or CXX language enabled") + endif() +endmacro() + +macro(__CHECK_SYMBOL_EXISTS_IMPL SOURCEFILE SYMBOL FILES VARIABLE) + if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") + set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n") + set(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS}) + if(CMAKE_REQUIRED_LINK_OPTIONS) + set(CHECK_SYMBOL_EXISTS_LINK_OPTIONS + LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS}) + else() + set(CHECK_SYMBOL_EXISTS_LINK_OPTIONS) + endif() + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_SYMBOL_EXISTS_LIBS + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() + set(CHECK_SYMBOL_EXISTS_LIBS) + endif() + if(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_SYMBOL_EXISTS_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + else() + set(CMAKE_SYMBOL_EXISTS_INCLUDES) + endif() + foreach(FILE ${FILES}) + string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT + "#include <${FILE}>\n") + endforeach() + string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT " +int main(int argc, char** argv) +{ + (void)argv;") + set(_CSE_CHECK_NON_MACRO "return ((int*)(&${SYMBOL}))[argc];") + if("${SYMBOL}" MATCHES "^[a-zA-Z_][a-zA-Z0-9_]*$") + # The SYMBOL has a legal macro name. Test whether it exists as a macro. + string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT " +#ifndef ${SYMBOL} + ${_CSE_CHECK_NON_MACRO} +#else + (void)argc; + return 0; +#endif") + else() + # The SYMBOL cannot be a macro (e.g., a template function). + string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT " + ${_CSE_CHECK_NON_MACRO}") + endif() + string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT " +}") + unset(_CSE_CHECK_NON_MACRO) + + configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" + "${SOURCEFILE}" @ONLY) + + if(NOT CMAKE_REQUIRED_QUIET) + message(CHECK_START "Looking for ${SYMBOL}") + endif() + try_compile(${VARIABLE} + ${CMAKE_BINARY_DIR} + "${SOURCEFILE}" + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_SYMBOL_EXISTS_LINK_OPTIONS} + ${CHECK_SYMBOL_EXISTS_LIBS} + CMAKE_FLAGS + -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_SYMBOL_EXISTS_FLAGS} + "${CMAKE_SYMBOL_EXISTS_INCLUDES}" + OUTPUT_VARIABLE OUTPUT) + if(${VARIABLE}) + if(NOT CMAKE_REQUIRED_QUIET) + message(CHECK_PASS "found") + endif() + set(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the ${SYMBOL} " + "exist passed with the following output:\n" + "${OUTPUT}\nFile ${SOURCEFILE}:\n" + "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n") + else() + if(NOT CMAKE_REQUIRED_QUIET) + message(CHECK_FAIL "not found") + endif() + set(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the ${SYMBOL} " + "exist failed with the following output:\n" + "${OUTPUT}\nFile ${SOURCEFILE}:\n" + "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n") + endif() + unset(CMAKE_CONFIGURABLE_FILE_CONTENT) + endif() +endmacro() + +cmake_policy(POP) diff --git a/core/deps/libzip/cmake-compat/FindBZip2.cmake b/core/deps/libzip/cmake-compat/FindBZip2.cmake new file mode 100644 index 000000000..98ab72cd8 --- /dev/null +++ b/core/deps/libzip/cmake-compat/FindBZip2.cmake @@ -0,0 +1,104 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindBZip2 +--------- + +Try to find BZip2 + +IMPORTED Targets +^^^^^^^^^^^^^^^^ + +This module defines :prop_tgt:`IMPORTED` target ``BZip2::BZip2``, if +BZip2 has been found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``BZIP2_FOUND`` + system has BZip2 +``BZIP2_INCLUDE_DIRS`` + the BZip2 include directories +``BZIP2_LIBRARIES`` + Link these to use BZip2 +``BZIP2_NEED_PREFIX`` + this is set if the functions are prefixed with ``BZ2_`` +``BZIP2_VERSION_STRING`` + the version of BZip2 found + +Cache variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``BZIP2_INCLUDE_DIR`` + the BZip2 include directory +#]=======================================================================] + +set(_BZIP2_PATHS PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Bzip2;InstallPath]" + ) + +find_path(BZIP2_INCLUDE_DIR bzlib.h ${_BZIP2_PATHS} PATH_SUFFIXES include) + +if (NOT BZIP2_LIBRARIES) + find_library(BZIP2_LIBRARY_RELEASE NAMES bz2 bzip2 libbz2 libbzip2 ${_BZIP2_PATHS} PATH_SUFFIXES lib) + find_library(BZIP2_LIBRARY_DEBUG NAMES bz2d bzip2d libbz2d libbzip2d ${_BZIP2_PATHS} PATH_SUFFIXES lib) + + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + SELECT_LIBRARY_CONFIGURATIONS(BZIP2) +else () + file(TO_CMAKE_PATH "${BZIP2_LIBRARIES}" BZIP2_LIBRARIES) +endif () + +if (BZIP2_INCLUDE_DIR AND EXISTS "${BZIP2_INCLUDE_DIR}/bzlib.h") + file(STRINGS "${BZIP2_INCLUDE_DIR}/bzlib.h" BZLIB_H REGEX "bzip2/libbzip2 version [0-9]+\\.[^ ]+ of [0-9]+ ") + string(REGEX REPLACE ".* bzip2/libbzip2 version ([0-9]+\\.[^ ]+) of [0-9]+ .*" "\\1" BZIP2_VERSION_STRING "${BZLIB_H}") +endif () + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 + REQUIRED_VARS BZIP2_LIBRARIES BZIP2_INCLUDE_DIR + VERSION_VAR BZIP2_VERSION_STRING) + +if (BZIP2_FOUND) + set(BZIP2_INCLUDE_DIRS ${BZIP2_INCLUDE_DIR}) + include(${CMAKE_CURRENT_LIST_DIR}/CheckSymbolExists.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) + cmake_push_check_state() + set(CMAKE_REQUIRED_QUIET ${BZip2_FIND_QUIETLY}) + set(CMAKE_REQUIRED_INCLUDES ${BZIP2_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES ${BZIP2_LIBRARIES}) + CHECK_SYMBOL_EXISTS(BZ2_bzCompressInit "bzlib.h" BZIP2_NEED_PREFIX) + cmake_pop_check_state() + + if(NOT TARGET BZip2::BZip2) + add_library(BZip2::BZip2 UNKNOWN IMPORTED) + set_target_properties(BZip2::BZip2 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIRS}") + + if(BZIP2_LIBRARY_RELEASE) + set_property(TARGET BZip2::BZip2 APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(BZip2::BZip2 PROPERTIES + IMPORTED_LOCATION_RELEASE "${BZIP2_LIBRARY_RELEASE}") + endif() + + if(BZIP2_LIBRARY_DEBUG) + set_property(TARGET BZip2::BZip2 APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(BZip2::BZip2 PROPERTIES + IMPORTED_LOCATION_DEBUG "${BZIP2_LIBRARY_DEBUG}") + endif() + + if(NOT BZIP2_LIBRARY_RELEASE AND NOT BZIP2_LIBRARY_DEBUG) + set_property(TARGET BZip2::BZip2 APPEND PROPERTY + IMPORTED_LOCATION "${BZIP2_LIBRARY}") + endif() + endif() +endif () + +mark_as_advanced(BZIP2_INCLUDE_DIR) diff --git a/core/deps/libzip/cmake-compat/FindGnuTLS.cmake b/core/deps/libzip/cmake-compat/FindGnuTLS.cmake new file mode 100644 index 000000000..819f00012 --- /dev/null +++ b/core/deps/libzip/cmake-compat/FindGnuTLS.cmake @@ -0,0 +1,82 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindGnuTLS +---------- + +Find the GNU Transport Layer Security library (gnutls) + +IMPORTED Targets +^^^^^^^^^^^^^^^^ + +This module defines :prop_tgt:`IMPORTED` target ``GnuTLS::GnuTLS``, if +gnutls has been found. + +Result Variables +^^^^^^^^^^^^^^^^ + +``GNUTLS_FOUND`` + System has gnutls +``GNUTLS_INCLUDE_DIR`` + The gnutls include directory +``GNUTLS_LIBRARIES`` + The libraries needed to use gnutls +``GNUTLS_DEFINITIONS`` + Compiler switches required for using gnutls +``GNUTLS_VERSION`` + version of gnutls. +#]=======================================================================] + +# Note that this doesn't try to find the gnutls-extra package. + + +if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY) + # in cache already + set(gnutls_FIND_QUIETLY TRUE) +endif () + +if (NOT WIN32) + # try using pkg-config to get the directories and then use these values + # in the find_path() and find_library() calls + # also fills in GNUTLS_DEFINITIONS, although that isn't normally useful + find_package(PkgConfig QUIET) + PKG_CHECK_MODULES(PC_GNUTLS QUIET gnutls) + set(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER}) + set(GNUTLS_VERSION ${PC_GNUTLS_VERSION}) + # keep for backward compatibility + set(GNUTLS_VERSION_STRING ${PC_GNUTLS_VERSION}) +endif () + +find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h + HINTS + ${PC_GNUTLS_INCLUDEDIR} + ${PC_GNUTLS_INCLUDE_DIRS} + ) + +find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls + HINTS + ${PC_GNUTLS_LIBDIR} + ${PC_GNUTLS_LIBRARY_DIRS} + ) + +mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY) + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS + REQUIRED_VARS GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR + VERSION_VAR GNUTLS_VERSION_STRING) + +if(GNUTLS_FOUND) + set(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY}) + set(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR}) + + if(NOT TARGET GnuTLS::GnuTLS) + add_library(GnuTLS::GnuTLS UNKNOWN IMPORTED) + set_target_properties(GnuTLS::GnuTLS PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIRS}" + INTERFACE_COMPILE_DEFINITIONS "${GNUTLS_DEFINITIONS}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${GNUTLS_LIBRARIES}") + endif() +endif() diff --git a/core/deps/libzip/cmake-compat/FindLibLZMA.cmake b/core/deps/libzip/cmake-compat/FindLibLZMA.cmake new file mode 100644 index 000000000..200d6bf8d --- /dev/null +++ b/core/deps/libzip/cmake-compat/FindLibLZMA.cmake @@ -0,0 +1,124 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindLibLZMA +----------- + +Find LZMA compression algorithm headers and library. + + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module defines :prop_tgt:`IMPORTED` target ``LibLZMA::LibLZMA``, if +liblzma has been found. + +Result variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project: + +``LIBLZMA_FOUND`` + True if liblzma headers and library were found. +``LIBLZMA_INCLUDE_DIRS`` + Directory where liblzma headers are located. +``LIBLZMA_LIBRARIES`` + Lzma libraries to link against. +``LIBLZMA_HAS_AUTO_DECODER`` + True if lzma_auto_decoder() is found (required). +``LIBLZMA_HAS_EASY_ENCODER`` + True if lzma_easy_encoder() is found (required). +``LIBLZMA_HAS_LZMA_PRESET`` + True if lzma_lzma_preset() is found (required). +``LIBLZMA_VERSION_MAJOR`` + The major version of lzma +``LIBLZMA_VERSION_MINOR`` + The minor version of lzma +``LIBLZMA_VERSION_PATCH`` + The patch version of lzma +``LIBLZMA_VERSION_STRING`` + version number as a string (ex: "5.0.3") +#]=======================================================================] + +find_path(LIBLZMA_INCLUDE_DIR lzma.h ) +if(NOT LIBLZMA_LIBRARY) + find_library(LIBLZMA_LIBRARY_RELEASE NAMES lzma liblzma PATH_SUFFIXES lib) + find_library(LIBLZMA_LIBRARY_DEBUG NAMES lzmad liblzmad PATH_SUFFIXES lib) + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(LIBLZMA) +else() + file(TO_CMAKE_PATH "${LIBLZMA_LIBRARY}" LIBLZMA_LIBRARY) +endif() + +if(LIBLZMA_INCLUDE_DIR AND EXISTS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h") + file(STRINGS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h" LIBLZMA_HEADER_CONTENTS REGEX "#define LZMA_VERSION_[A-Z]+ [0-9]+") + + string(REGEX REPLACE ".*#define LZMA_VERSION_MAJOR ([0-9]+).*" "\\1" LIBLZMA_VERSION_MAJOR "${LIBLZMA_HEADER_CONTENTS}") + string(REGEX REPLACE ".*#define LZMA_VERSION_MINOR ([0-9]+).*" "\\1" LIBLZMA_VERSION_MINOR "${LIBLZMA_HEADER_CONTENTS}") + string(REGEX REPLACE ".*#define LZMA_VERSION_PATCH ([0-9]+).*" "\\1" LIBLZMA_VERSION_PATCH "${LIBLZMA_HEADER_CONTENTS}") + + set(LIBLZMA_VERSION_STRING "${LIBLZMA_VERSION_MAJOR}.${LIBLZMA_VERSION_MINOR}.${LIBLZMA_VERSION_PATCH}") + unset(LIBLZMA_HEADER_CONTENTS) +endif() + +# We're using new code known now as XZ, even library still been called LZMA +# it can be found in http://tukaani.org/xz/ +# Avoid using old codebase +if (LIBLZMA_LIBRARY) + include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) + set(CMAKE_REQUIRED_QUIET ${LibLZMA_FIND_QUIETLY}) + if(NOT LIBLZMA_LIBRARY_RELEASE AND NOT LIBLZMA_LIBRARY_DEBUG) + set(LIBLZMA_LIBRARY_check ${LIBLZMA_LIBRARY}) + elseif(LIBLZMA_LIBRARY_RELEASE) + set(LIBLZMA_LIBRARY_check ${LIBLZMA_LIBRARY_RELEASE}) + elseif(LIBLZMA_LIBRARY_DEBUG) + set(LIBLZMA_LIBRARY_check ${LIBLZMA_LIBRARY_DEBUG}) + endif() + CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY_check} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER) + CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY_check} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER) + CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY_check} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET) + unset(LIBLZMA_LIBRARY_check) + set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) +endif () + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(LibLZMA REQUIRED_VARS LIBLZMA_LIBRARY + LIBLZMA_INCLUDE_DIR + LIBLZMA_HAS_AUTO_DECODER + LIBLZMA_HAS_EASY_ENCODER + LIBLZMA_HAS_LZMA_PRESET + VERSION_VAR LIBLZMA_VERSION_STRING + ) +mark_as_advanced( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY ) + +if (LIBLZMA_FOUND) + set(LIBLZMA_LIBRARIES ${LIBLZMA_LIBRARY}) + set(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_INCLUDE_DIR}) + if(NOT TARGET LibLZMA::LibLZMA) + add_library(LibLZMA::LibLZMA UNKNOWN IMPORTED) + set_target_properties(LibLZMA::LibLZMA PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${LIBLZMA_INCLUDE_DIR} + IMPORTED_LINK_INTERFACE_LANGUAGES C) + + if(LIBLZMA_LIBRARY_RELEASE) + set_property(TARGET LibLZMA::LibLZMA APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(LibLZMA::LibLZMA PROPERTIES + IMPORTED_LOCATION_RELEASE "${LIBLZMA_LIBRARY_RELEASE}") + endif() + + if(LIBLZMA_LIBRARY_DEBUG) + set_property(TARGET LibLZMA::LibLZMA APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(LibLZMA::LibLZMA PROPERTIES + IMPORTED_LOCATION_DEBUG "${LIBLZMA_LIBRARY_DEBUG}") + endif() + + if(NOT LIBLZMA_LIBRARY_RELEASE AND NOT LIBLZMA_LIBRARY_DEBUG) + set_target_properties(LibLZMA::LibLZMA PROPERTIES + IMPORTED_LOCATION "${LIBLZMA_LIBRARY}") + endif() + endif() +endif () diff --git a/core/deps/libzip/cmake-compat/FindPackageHandleStandardArgs.cmake b/core/deps/libzip/cmake-compat/FindPackageHandleStandardArgs.cmake new file mode 100644 index 000000000..a078049e2 --- /dev/null +++ b/core/deps/libzip/cmake-compat/FindPackageHandleStandardArgs.cmake @@ -0,0 +1,453 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindPackageHandleStandardArgs +----------------------------- + +This module provides a function intended to be used in :ref:`Find Modules` +implementing :command:`find_package()` calls. It handles the +``REQUIRED``, ``QUIET`` and version-related arguments of ``find_package``. +It also sets the ``_FOUND`` variable. The package is +considered found if all variables listed contain valid results, e.g. +valid filepaths. + +.. command:: find_package_handle_standard_args + + There are two signatures:: + + find_package_handle_standard_args( + (DEFAULT_MSG|) + ... + ) + + find_package_handle_standard_args( + [FOUND_VAR ] + [REQUIRED_VARS ...] + [VERSION_VAR ] + [HANDLE_COMPONENTS] + [CONFIG_MODE] + [NAME_MISMATCHED] + [REASON_FAILURE_MESSAGE ] + [FAIL_MESSAGE ] + ) + + The ``_FOUND`` variable will be set to ``TRUE`` if all + the variables ``...`` are valid and any optional + constraints are satisfied, and ``FALSE`` otherwise. A success or + failure message may be displayed based on the results and on + whether the ``REQUIRED`` and/or ``QUIET`` option was given to + the :command:`find_package` call. + + The options are: + + ``(DEFAULT_MSG|)`` + In the simple signature this specifies the failure message. + Use ``DEFAULT_MSG`` to ask for a default message to be computed + (recommended). Not valid in the full signature. + + ``FOUND_VAR `` + Obsolete. Specifies either ``_FOUND`` or + ``_FOUND`` as the result variable. This exists only + for compatibility with older versions of CMake and is now ignored. + Result variables of both names are always set for compatibility. + + ``REQUIRED_VARS ...`` + Specify the variables which are required for this package. + These may be named in the generated failure message asking the + user to set the missing variable values. Therefore these should + typically be cache entries such as ``FOO_LIBRARY`` and not output + variables like ``FOO_LIBRARIES``. + + ``VERSION_VAR `` + Specify the name of a variable that holds the version of the package + that has been found. This version will be checked against the + (potentially) specified required version given to the + :command:`find_package` call, including its ``EXACT`` option. + The default messages include information about the required + version and the version which has been actually found, both + if the version is ok or not. + + ``HANDLE_COMPONENTS`` + Enable handling of package components. In this case, the command + will report which components have been found and which are missing, + and the ``_FOUND`` variable will be set to ``FALSE`` + if any of the required components (i.e. not the ones listed after + the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are + missing. + + ``CONFIG_MODE`` + Specify that the calling find module is a wrapper around a + call to ``find_package( NO_MODULE)``. This implies + a ``VERSION_VAR`` value of ``_VERSION``. The command + will automatically check whether the package configuration file + was found. + + ``REASON_FAILURE_MESSAGE `` + Specify a custom message of the reason for the failure which will be + appended to the default generated message. + + ``FAIL_MESSAGE `` + Specify a custom failure message instead of using the default + generated message. Not recommended. + + ``NAME_MISMATCHED`` + Indicate that the ```` does not match + ``${CMAKE_FIND_PACKAGE_NAME}``. This is usually a mistake and raises a + warning, but it may be intentional for usage of the command for components + of a larger package. + +Example for the simple signature: + +.. code-block:: cmake + + find_package_handle_standard_args(LibXml2 DEFAULT_MSG + LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) + +The ``LibXml2`` package is considered to be found if both +``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid. +Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found +and ``REQUIRED`` was used, it fails with a +:command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was +used or not. If it is found, success will be reported, including +the content of the first ````. On repeated CMake runs, +the same message will not be printed again. + +.. note:: + + If ```` does not match ``CMAKE_FIND_PACKAGE_NAME`` for the + calling module, a warning that there is a mismatch is given. The + ``FPHSA_NAME_MISMATCHED`` variable may be set to bypass the warning if using + the old signature and the ``NAME_MISMATCHED`` argument using the new + signature. To avoid forcing the caller to require newer versions of CMake for + usage, the variable's value will be used if defined when the + ``NAME_MISMATCHED`` argument is not passed for the new signature (but using + both is an error).. + +Example for the full signature: + +.. code-block:: cmake + + find_package_handle_standard_args(LibArchive + REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR + VERSION_VAR LibArchive_VERSION) + +In this case, the ``LibArchive`` package is considered to be found if +both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid. +Also the version of ``LibArchive`` will be checked by using the version +contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given, +the default messages will be printed. + +Another example for the full signature: + +.. code-block:: cmake + + find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) + find_package_handle_standard_args(Automoc4 CONFIG_MODE) + +In this case, a ``FindAutmoc4.cmake`` module wraps a call to +``find_package(Automoc4 NO_MODULE)`` and adds an additional search +directory for ``automoc4``. Then the call to +``find_package_handle_standard_args`` produces a proper success/failure +message. +#]=======================================================================] + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake) + +# internal helper macro +macro(_FPHSA_FAILURE_MESSAGE _msg) + set (__msg "${_msg}") + if (FPHSA_REASON_FAILURE_MESSAGE) + string(APPEND __msg "\n Reason given by package: ${FPHSA_REASON_FAILURE_MESSAGE}\n") + endif() + if (${_NAME}_FIND_REQUIRED) + message(FATAL_ERROR "${__msg}") + else () + if (NOT ${_NAME}_FIND_QUIETLY) + message(STATUS "${__msg}") + endif () + endif () +endmacro() + + +# internal helper macro to generate the failure message when used in CONFIG_MODE: +macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) + # _CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: + if(${_NAME}_CONFIG) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing:${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") + else() + # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. + # List them all in the error message: + if(${_NAME}_CONSIDERED_CONFIGS) + set(configsText "") + list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) + math(EXPR configsCount "${configsCount} - 1") + foreach(currentConfigIndex RANGE ${configsCount}) + list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) + list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) + string(APPEND configsText "\n ${filename} (version ${version})") + endforeach() + if (${_NAME}_NOT_FOUND_MESSAGE) + if (FPHSA_REASON_FAILURE_MESSAGE) + string(PREPEND FPHSA_REASON_FAILURE_MESSAGE "${${_NAME}_NOT_FOUND_MESSAGE}\n ") + else() + set(FPHSA_REASON_FAILURE_MESSAGE "${${_NAME}_NOT_FOUND_MESSAGE}") + endif() + else() + string(APPEND configsText "\n") + endif() + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:${configsText}") + + else() + # Simple case: No Config-file was found at all: + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") + endif() + endif() +endmacro() + + +function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) + + # Set up the arguments for `cmake_parse_arguments`. + set(options CONFIG_MODE HANDLE_COMPONENTS NAME_MISMATCHED) + set(oneValueArgs FAIL_MESSAGE REASON_FAILURE_MESSAGE VERSION_VAR FOUND_VAR) + set(multiValueArgs REQUIRED_VARS) + + # Check whether we are in 'simple' or 'extended' mode: + set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) + list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) + + unset(FPHSA_NAME_MISMATCHED_override) + if (DEFINED FPHSA_NAME_MISMATCHED) + # If the variable NAME_MISMATCHED variable is set, error if it is passed as + # an argument. The former is for old signatures, the latter is for new + # signatures. + list(FIND ARGN "NAME_MISMATCHED" name_mismatched_idx) + if (NOT name_mismatched_idx EQUAL "-1") + message(FATAL_ERROR + "The `NAME_MISMATCHED` argument may only be specified by the argument or " + "the variable, not both.") + endif () + + # But use the variable if it is not an argument to avoid forcing minimum + # CMake version bumps for calling modules. + set(FPHSA_NAME_MISMATCHED_override "${FPHSA_NAME_MISMATCHED}") + endif () + + if(${INDEX} EQUAL -1) + set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) + set(FPHSA_REQUIRED_VARS ${ARGN}) + set(FPHSA_VERSION_VAR) + else() + cmake_parse_arguments(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) + + if(FPHSA_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") + endif() + + if(NOT FPHSA_FAIL_MESSAGE) + set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") + endif() + + # In config-mode, we rely on the variable _CONFIG, which is set by find_package() + # when it successfully found the config-file, including version checking: + if(FPHSA_CONFIG_MODE) + list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) + list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) + set(FPHSA_VERSION_VAR ${_NAME}_VERSION) + endif() + + if(NOT FPHSA_REQUIRED_VARS) + message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") + endif() + endif() + + if (DEFINED FPHSA_NAME_MISMATCHED_override) + set(FPHSA_NAME_MISMATCHED "${FPHSA_NAME_MISMATCHED_override}") + endif () + + if (DEFINED CMAKE_FIND_PACKAGE_NAME + AND NOT FPHSA_NAME_MISMATCHED + AND NOT _NAME STREQUAL CMAKE_FIND_PACKAGE_NAME) + message(AUTHOR_WARNING + "The package name passed to `find_package_handle_standard_args` " + "(${_NAME}) does not match the name of the calling package " + "(${CMAKE_FIND_PACKAGE_NAME}). This can lead to problems in calling " + "code that expects `find_package` result variables (e.g., `_FOUND`) " + "to follow a certain pattern.") + endif () + +# now that we collected all arguments, process them + + if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG") + set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") + endif() + + list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) + + string(TOUPPER ${_NAME} _NAME_UPPER) + string(TOLOWER ${_NAME} _NAME_LOWER) + + if(FPHSA_FOUND_VAR) + set(_FOUND_VAR_UPPER ${_NAME_UPPER}_FOUND) + set(_FOUND_VAR_MIXED ${_NAME}_FOUND) + if(FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_MIXED OR FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_UPPER) + set(_FOUND_VAR ${FPHSA_FOUND_VAR}) + else() + message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_FOUND_VAR_MIXED}\" and \"${_FOUND_VAR_UPPER}\" are valid names.") + endif() + else() + set(_FOUND_VAR ${_NAME_UPPER}_FOUND) + endif() + + # collect all variables which were not found, so they can be printed, so the + # user knows better what went wrong (#6375) + set(MISSING_VARS "") + set(DETAILS "") + # check if all passed variables are valid + set(FPHSA_FOUND_${_NAME} TRUE) + foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) + if(NOT ${_CURRENT_VAR}) + set(FPHSA_FOUND_${_NAME} FALSE) + string(APPEND MISSING_VARS " ${_CURRENT_VAR}") + else() + string(APPEND DETAILS "[${${_CURRENT_VAR}}]") + endif() + endforeach() + if(FPHSA_FOUND_${_NAME}) + set(${_NAME}_FOUND TRUE) + set(${_NAME_UPPER}_FOUND TRUE) + else() + set(${_NAME}_FOUND FALSE) + set(${_NAME_UPPER}_FOUND FALSE) + endif() + + # component handling + unset(FOUND_COMPONENTS_MSG) + unset(MISSING_COMPONENTS_MSG) + + if(FPHSA_HANDLE_COMPONENTS) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(${_NAME}_${comp}_FOUND) + + if(NOT DEFINED FOUND_COMPONENTS_MSG) + set(FOUND_COMPONENTS_MSG "found components:") + endif() + string(APPEND FOUND_COMPONENTS_MSG " ${comp}") + + else() + + if(NOT DEFINED MISSING_COMPONENTS_MSG) + set(MISSING_COMPONENTS_MSG "missing components:") + endif() + string(APPEND MISSING_COMPONENTS_MSG " ${comp}") + + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + string(APPEND MISSING_VARS " ${comp}") + endif() + + endif() + endforeach() + set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}") + string(APPEND DETAILS "[c${COMPONENT_MSG}]") + endif() + + # version handling: + set(VERSION_MSG "") + set(VERSION_OK TRUE) + + # check with DEFINED here as the requested or found version may be "0" + if (DEFINED ${_NAME}_FIND_VERSION) + if(DEFINED ${FPHSA_VERSION_VAR}) + set(_FOUND_VERSION ${${FPHSA_VERSION_VAR}}) + + if(${_NAME}_FIND_VERSION_EXACT) # exact version required + # count the dots in the version string + string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${_FOUND_VERSION}") + # add one dot because there is one dot more than there are components + string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS) + if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT) + # Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT + # is at most 4 here. Therefore a simple lookup table is used. + if (${_NAME}_FIND_VERSION_COUNT EQUAL 1) + set(_VERSION_REGEX "[^.]*") + elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2) + set(_VERSION_REGEX "[^.]*\\.[^.]*") + elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3) + set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*") + else () + set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*") + endif () + string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${_FOUND_VERSION}") + unset(_VERSION_REGEX) + if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD) + set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")") + endif () + unset(_VERSION_HEAD) + else () + if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _FOUND_VERSION) + set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")") + endif () + endif () + unset(_VERSION_DOTS) + + else() # minimum version specified: + if (${_NAME}_FIND_VERSION VERSION_GREATER _FOUND_VERSION) + set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable version \"${_FOUND_VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")") + endif () + endif() + + else() + + # if the package was not found, but a version was given, add that to the output: + if(${_NAME}_FIND_VERSION_EXACT) + set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") + else() + set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") + endif() + + endif() + else () + # Check with DEFINED as the found version may be 0. + if(DEFINED ${FPHSA_VERSION_VAR}) + set(VERSION_MSG "(found version \"${${FPHSA_VERSION_VAR}}\")") + endif() + endif () + + if(VERSION_OK) + string(APPEND DETAILS "[v${${FPHSA_VERSION_VAR}}(${${_NAME}_FIND_VERSION})]") + else() + set(${_NAME}_FOUND FALSE) + endif() + + + # print the result: + if (${_NAME}_FOUND) + FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}") + else () + + if(FPHSA_CONFIG_MODE) + _FPHSA_HANDLE_FAILURE_CONFIG_MODE() + else() + if(NOT VERSION_OK) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") + else() + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing:${MISSING_VARS}) ${VERSION_MSG}") + endif() + endif() + + endif () + + set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) + set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) +endfunction() diff --git a/core/deps/libzip/cmake-compat/FindPackageMessage.cmake b/core/deps/libzip/cmake-compat/FindPackageMessage.cmake new file mode 100644 index 000000000..0628b9816 --- /dev/null +++ b/core/deps/libzip/cmake-compat/FindPackageMessage.cmake @@ -0,0 +1,48 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindPackageMessage +------------------ + +.. code-block:: cmake + + find_package_message( "message for user" "find result details") + +This function is intended to be used in FindXXX.cmake modules files. +It will print a message once for each unique find result. This is +useful for telling the user where a package was found. The first +argument specifies the name (XXX) of the package. The second argument +specifies the message to display. The third argument lists details +about the find result so that if they change the message will be +displayed again. The macro also obeys the QUIET argument to the +find_package command. + +Example: + +.. code-block:: cmake + + if(X11_FOUND) + find_package_message(X11 "Found X11: ${X11_X11_LIB}" + "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") + else() + ... + endif() +#]=======================================================================] + +function(find_package_message pkg msg details) + # Avoid printing a message repeatedly for the same find result. + if(NOT ${pkg}_FIND_QUIETLY) + string(REPLACE "\n" "" details "${details}") + set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg}) + if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") + # The message has not yet been printed. + message(STATUS "${msg}") + + # Save the find details in the cache to avoid printing the same + # message again. + set("${DETAILS_VAR}" "${details}" + CACHE INTERNAL "Details about finding ${pkg}") + endif() + endif() +endfunction() diff --git a/core/deps/libzip/cmake-compat/SelectLibraryConfigurations.cmake b/core/deps/libzip/cmake-compat/SelectLibraryConfigurations.cmake new file mode 100644 index 000000000..4c0e9a8c0 --- /dev/null +++ b/core/deps/libzip/cmake-compat/SelectLibraryConfigurations.cmake @@ -0,0 +1,80 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +SelectLibraryConfigurations +--------------------------- + +.. code-block:: cmake + + select_library_configurations(basename) + +This macro takes a library base name as an argument, and will choose +good values for the variables + +:: + + basename_LIBRARY + basename_LIBRARIES + basename_LIBRARY_DEBUG + basename_LIBRARY_RELEASE + +depending on what has been found and set. + +If only ``basename_LIBRARY_RELEASE`` is defined, ``basename_LIBRARY`` will +be set to the release value, and ``basename_LIBRARY_DEBUG`` will be set +to ``basename_LIBRARY_DEBUG-NOTFOUND``. If only ``basename_LIBRARY_DEBUG`` +is defined, then ``basename_LIBRARY`` will take the debug value, and +``basename_LIBRARY_RELEASE`` will be set to ``basename_LIBRARY_RELEASE-NOTFOUND``. + +If the generator supports configuration types, then ``basename_LIBRARY`` +and ``basename_LIBRARIES`` will be set with debug and optimized flags +specifying the library to be used for the given configuration. If no +build type has been set or the generator in use does not support +configuration types, then ``basename_LIBRARY`` and ``basename_LIBRARIES`` +will take only the release value, or the debug value if the release one +is not set. +#]=======================================================================] + +# This macro was adapted from the FindQt4 CMake module and is maintained by Will +# Dicharry . + +macro(select_library_configurations basename) + if(NOT ${basename}_LIBRARY_RELEASE) + set(${basename}_LIBRARY_RELEASE "${basename}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library.") + endif() + if(NOT ${basename}_LIBRARY_DEBUG) + set(${basename}_LIBRARY_DEBUG "${basename}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.") + endif() + + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND + NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE AND + ( _isMultiConfig OR CMAKE_BUILD_TYPE ) ) + # if the generator is multi-config or if CMAKE_BUILD_TYPE is set for + # single-config generators, set optimized and debug libraries + set( ${basename}_LIBRARY "" ) + foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE ) + list( APPEND ${basename}_LIBRARY optimized "${_libname}" ) + endforeach() + foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG ) + list( APPEND ${basename}_LIBRARY debug "${_libname}" ) + endforeach() + elseif( ${basename}_LIBRARY_RELEASE ) + set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) + elseif( ${basename}_LIBRARY_DEBUG ) + set( ${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG} ) + else() + set( ${basename}_LIBRARY "${basename}_LIBRARY-NOTFOUND") + endif() + + set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" ) + + if( ${basename}_LIBRARY ) + set( ${basename}_FOUND TRUE ) + endif() + + mark_as_advanced( ${basename}_LIBRARY_RELEASE + ${basename}_LIBRARY_DEBUG + ) +endmacro() diff --git a/core/deps/libzip/cmake-config.h.in b/core/deps/libzip/cmake-config.h.in new file mode 100644 index 000000000..b234acba9 --- /dev/null +++ b/core/deps/libzip/cmake-config.h.in @@ -0,0 +1,62 @@ +#ifndef HAD_CONFIG_H +#define HAD_CONFIG_H +#ifndef _HAD_ZIPCONF_H +#include "zipconf.h" +#endif +/* BEGIN DEFINES */ +#cmakedefine HAVE___PROGNAME +#cmakedefine HAVE__CLOSE +#cmakedefine HAVE__DUP +#cmakedefine HAVE__FDOPEN +#cmakedefine HAVE__FILENO +#cmakedefine HAVE__SETMODE +#cmakedefine HAVE__SNPRINTF +#cmakedefine HAVE__STRDUP +#cmakedefine HAVE__STRICMP +#cmakedefine HAVE__STRTOI64 +#cmakedefine HAVE__STRTOUI64 +#cmakedefine HAVE__UMASK +#cmakedefine HAVE__UNLINK +#cmakedefine HAVE_ARC4RANDOM +#cmakedefine HAVE_CLONEFILE +#cmakedefine HAVE_COMMONCRYPTO +#cmakedefine HAVE_CRYPTO +#cmakedefine HAVE_FICLONERANGE +#cmakedefine HAVE_FILENO +#cmakedefine HAVE_FSEEKO +#cmakedefine HAVE_FTELLO +#cmakedefine HAVE_GETPROGNAME +#cmakedefine HAVE_GNUTLS +#cmakedefine HAVE_LIBBZ2 +#cmakedefine HAVE_LIBLZMA +#cmakedefine HAVE_LIBZSTD +#cmakedefine HAVE_LOCALTIME_R +#cmakedefine HAVE_MBEDTLS +#cmakedefine HAVE_MKSTEMP +#cmakedefine HAVE_NULLABLE +#cmakedefine HAVE_OPENSSL +#cmakedefine HAVE_SETMODE +#cmakedefine HAVE_STRCASECMP +#cmakedefine HAVE_STRDUP +#cmakedefine HAVE_STRICMP +#cmakedefine HAVE_STRTOLL +#cmakedefine HAVE_STRTOULL +#cmakedefine HAVE_STRUCT_TM_TM_ZONE +#cmakedefine HAVE_STDBOOL_H +#cmakedefine HAVE_STRINGS_H +#cmakedefine HAVE_UNISTD_H +#cmakedefine HAVE_WINDOWS_CRYPTO +#cmakedefine SIZEOF_OFF_T ${SIZEOF_OFF_T} +#cmakedefine SIZEOF_SIZE_T ${SIZEOF_SIZE_T} +#cmakedefine HAVE_DIRENT_H +#cmakedefine HAVE_FTS_H +#cmakedefine HAVE_NDIR_H +#cmakedefine HAVE_SYS_DIR_H +#cmakedefine HAVE_SYS_NDIR_H +#cmakedefine WORDS_BIGENDIAN +#cmakedefine HAVE_SHARED +/* END DEFINES */ +#define PACKAGE "@CMAKE_PROJECT_NAME@" +#define VERSION "@CMAKE_PROJECT_VERSION@" + +#endif /* HAD_CONFIG_H */ diff --git a/core/deps/libzip/cmake-zipconf.h.in b/core/deps/libzip/cmake-zipconf.h.in new file mode 100644 index 000000000..b88ed267f --- /dev/null +++ b/core/deps/libzip/cmake-zipconf.h.in @@ -0,0 +1,47 @@ +#ifndef _HAD_ZIPCONF_H +#define _HAD_ZIPCONF_H + +/* + zipconf.h -- platform specific include file + + This file was generated automatically by CMake + based on ../cmake-zipconf.h.in. + */ + +#define LIBZIP_VERSION "${libzip_VERSION}" +#define LIBZIP_VERSION_MAJOR ${libzip_VERSION_MAJOR} +#define LIBZIP_VERSION_MINOR ${libzip_VERSION_MINOR} +#define LIBZIP_VERSION_MICRO ${libzip_VERSION_PATCH} + +#cmakedefine ZIP_STATIC + +${ZIP_NULLABLE_DEFINES} + +${LIBZIP_TYPES_INCLUDE} + +typedef ${ZIP_INT8_T} zip_int8_t; +typedef ${ZIP_UINT8_T} zip_uint8_t; +typedef ${ZIP_INT16_T} zip_int16_t; +typedef ${ZIP_UINT16_T} zip_uint16_t; +typedef ${ZIP_INT32_T} zip_int32_t; +typedef ${ZIP_UINT32_T} zip_uint32_t; +typedef ${ZIP_INT64_T} zip_int64_t; +typedef ${ZIP_UINT64_T} zip_uint64_t; + +#define ZIP_INT8_MIN (-ZIP_INT8_MAX-1) +#define ZIP_INT8_MAX 0x7f +#define ZIP_UINT8_MAX 0xff + +#define ZIP_INT16_MIN (-ZIP_INT16_MAX-1) +#define ZIP_INT16_MAX 0x7fff +#define ZIP_UINT16_MAX 0xffff + +#define ZIP_INT32_MIN (-ZIP_INT32_MAX-1L) +#define ZIP_INT32_MAX 0x7fffffffL +#define ZIP_UINT32_MAX 0xffffffffLU + +#define ZIP_INT64_MIN (-ZIP_INT64_MAX-1LL) +#define ZIP_INT64_MAX 0x7fffffffffffffffLL +#define ZIP_UINT64_MAX 0xffffffffffffffffULL + +#endif /* zipconf.h */ diff --git a/core/deps/libzip/cmake/Dist.cmake b/core/deps/libzip/cmake/Dist.cmake new file mode 100644 index 000000000..829112f44 --- /dev/null +++ b/core/deps/libzip/cmake/Dist.cmake @@ -0,0 +1,83 @@ +# Copyright (C) 2020 Dieter Baron and Thomas Klausner +# +# The authors can be contacted at +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# 3. The names of the authors may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#[=======================================================================[.rst: +Dist +------- + +Provide ``dist`` and ``distcheck`` targets similar to +autoconf/automake functionality. + +The ``dist`` target creates tarballs of the project in ``.tar.gz`` and +``.tar.xz`` formats. + +The ``distcheck`` target extracts one of created tarballs, builds the +software using its defaults, and runs the tests. + +Both targets use Unix shell commands. + +The Dist target takes one argument, the file name (before the extension). + +The ``distcheck`` target creates (and removes) ``${ARCHIVE_NAME}-build`` +and ``${ARCHIVE_NAME}-dest``. + +#]=======================================================================] +function(Dist ARCHIVE_NAME) + if(NOT TARGET dist AND NOT TARGET distcheck) + add_custom_target(dist + COMMAND git config tar.tar.xz.command "xz -c" + COMMAND git archive --prefix=${ARCHIVE_NAME}/ -o ${ARCHIVE_NAME}.tar.gz HEAD + COMMAND git archive --prefix=${ARCHIVE_NAME}/ -o ${ARCHIVE_NAME}.tar.xz HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + add_custom_target(distcheck + COMMAND chmod -R u+w ${ARCHIVE_NAME} ${ARCHIVE_NAME}-build ${ARCHIVE_NAME}-dest 2>/dev/null || true + COMMAND rm -rf ${ARCHIVE_NAME} ${ARCHIVE_NAME}-build ${ARCHIVE_NAME}-dest + COMMAND ${CMAKE_COMMAND} -E tar xf ${ARCHIVE_NAME}.tar.gz + COMMAND chmod -R u-w ${ARCHIVE_NAME} + COMMAND mkdir ${ARCHIVE_NAME}-build + COMMAND mkdir ${ARCHIVE_NAME}-dest + COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${ARCHIVE_NAME}-dest ${ARCHIVE_NAME} -B ${ARCHIVE_NAME}-build + COMMAND make -C ${ARCHIVE_NAME}-build -j4 + COMMAND make -C ${ARCHIVE_NAME}-build test + COMMAND make -C ${ARCHIVE_NAME}-build install + # COMMAND make -C ${ARCHIVE_NAME}-build uninstall + # COMMAND if [ `find ${ARCHIVE_NAME}-dest ! -type d | wc -l` -ne 0 ]; then echo leftover files in ${ARCHIVE_NAME}-dest; false; fi + COMMAND make -C ${ARCHIVE_NAME}-build clean + COMMAND chmod -R u+w ${ARCHIVE_NAME} ${ARCHIVE_NAME}-build ${ARCHIVE_NAME}-dest + COMMAND rm -rf ${ARCHIVE_NAME} ${ARCHIVE_NAME}-build ${ARCHIVE_NAME}-dest + COMMAND echo "${ARCHIVE_NAME}.tar.gz is ready for distribution." + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + add_dependencies(distcheck dist) + endif() +endfunction() diff --git a/core/deps/libzip/cmake/FindMbedTLS.cmake b/core/deps/libzip/cmake/FindMbedTLS.cmake new file mode 100644 index 000000000..244b0c57c --- /dev/null +++ b/core/deps/libzip/cmake/FindMbedTLS.cmake @@ -0,0 +1,132 @@ +# Copyright (C) 2020 Dieter Baron and Thomas Klausner +# +# The authors can be contacted at +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# 3. The names of the authors may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#[=======================================================================[.rst: +FindMbedTLS +------- + +Finds the Mbed TLS library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``MbedTLS::MbedTLS`` + The Mbed TLS library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``MbedTLS_FOUND`` + True if the system has the Mbed TLS library. +``MbedTLS_VERSION`` + The version of the Mbed TLS library which was found. +``MbedTLS_INCLUDE_DIRS`` + Include directories needed to use Mbed TLS. +``MbedTLS_LIBRARIES`` + Libraries needed to link to Mbed TLS. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``MbedTLS_INCLUDE_DIR`` + The directory containing ``mbedtls/aes.h``. +``MbedTLS_LIBRARY`` + The path to the Mbed TLS library. + +#]=======================================================================] + +# I'm not aware of a pkg-config file for mbedtls as of 2020/07/08. +#find_package(PkgConfig) +#pkg_check_modules(PC_MbedTLS QUIET mbedtls) + +find_path(MbedTLS_INCLUDE_DIR + NAMES mbedtls/aes.h +# PATHS ${PC_MbedTLS_INCLUDE_DIRS} +) +find_library(MbedTLS_LIBRARY + NAMES mbedcrypto +# PATHS ${PC_MbedTLS_LIBRARY_DIRS} +) + +# Extract version information from the header file +if(MbedTLS_INCLUDE_DIR) + if(EXISTS ${MbedTLS_INCLUDE_DIR}/mbedtls/version.h) + file(STRINGS ${MbedTLS_INCLUDE_DIR}/mbedtls/version.h _ver_line + REGEX "^#define MBEDTLS_VERSION_STRING *\"[0-9]+\\.[0-9]+\\.[0-9]+\"" + LIMIT_COUNT 1) + string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" + MbedTLS_VERSION "${_ver_line}") + unset(_ver_line) + else() + if(PC_MbedTLS_VERSION) + set(MbedTLS_VERSION ${PC_MbedTLS_VERSION}) + else() + # version unknown + set(MbedTLS_VERSION "0.0") + endif() + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MbedTLS + FOUND_VAR MbedTLS_FOUND + REQUIRED_VARS + MbedTLS_LIBRARY + MbedTLS_INCLUDE_DIR + VERSION_VAR MbedTLS_VERSION +) + +if(MbedTLS_FOUND) + set(MbedTLS_LIBRARIES ${MbedTLS_LIBRARY}) + set(MbedTLS_INCLUDE_DIRS ${MbedTLS_INCLUDE_DIR}) +# set(MbedTLS_DEFINITIONS ${PC_MbedTLS_CFLAGS_OTHER}) +endif() + +if(MbedTLS_FOUND AND NOT TARGET MbedTLS::MbedTLS) + add_library(MbedTLS::MbedTLS UNKNOWN IMPORTED) + set_target_properties(MbedTLS::MbedTLS PROPERTIES + IMPORTED_LOCATION "${MbedTLS_LIBRARY}" +# INTERFACE_COMPILE_OPTIONS "${PC_MbedTLS_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${MbedTLS_INCLUDE_DIR}" + ) +endif() + +mark_as_advanced( + MbedTLS_INCLUDE_DIR + MbedTLS_LIBRARY + ) diff --git a/core/deps/libzip/cmake/FindNettle.cmake b/core/deps/libzip/cmake/FindNettle.cmake new file mode 100644 index 000000000..982ac81ee --- /dev/null +++ b/core/deps/libzip/cmake/FindNettle.cmake @@ -0,0 +1,141 @@ +# Copyright (C) 2020 Dieter Baron and Thomas Klausner +# +# The authors can be contacted at +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# 3. The names of the authors may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#[=======================================================================[.rst: +FindNettle +------- + +Finds the Nettle library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``Nettle::Nettle`` + The Nettle library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``Nettle_FOUND`` + True if the system has the Nettle library. +``Nettle_VERSION`` + The version of the Nettle library which was found. +``Nettle_INCLUDE_DIRS`` + Include directories needed to use Nettle. +``Nettle_LIBRARIES`` + Libraries needed to link to Nettle. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``Nettle_INCLUDE_DIR`` + The directory containing ``nettle/aes.h``. +``Nettle_LIBRARY`` + The path to the Nettle library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_Nettle QUIET nettle) + +find_path(Nettle_INCLUDE_DIR + NAMES nettle/aes.h nettle/md5.h nettle/pbkdf2.h nettle/ripemd160.h nettle/sha.h + PATHS ${PC_Nettle_INCLUDE_DIRS} +) +find_library(Nettle_LIBRARY + NAMES nettle + PATHS ${PC_Nettle_LIBRARY_DIRS} +) + +# Extract version information from the header file +if(Nettle_INCLUDE_DIR) + # This file only exists in nettle>=3.0 + if(EXISTS ${Nettle_INCLUDE_DIR}/nettle/version.h) + file(STRINGS ${Nettle_INCLUDE_DIR}/nettle/version.h _ver_major_line + REGEX "^#define NETTLE_VERSION_MAJOR *[0-9]+" + LIMIT_COUNT 1) + string(REGEX MATCH "[0-9]+" + Nettle_MAJOR_VERSION "${_ver_major_line}") + file(STRINGS ${Nettle_INCLUDE_DIR}/nettle/version.h _ver_minor_line + REGEX "^#define NETTLE_VERSION_MINOR *[0-9]+" + LIMIT_COUNT 1) + string(REGEX MATCH "[0-9]+" + Nettle_MINOR_VERSION "${_ver_minor_line}") + set(Nettle_VERSION "${Nettle_MAJOR_VERSION}.${Nettle_MINOR_VERSION}") + unset(_ver_major_line) + unset(_ver_minor_line) + else() + if(PC_Nettle_VERSION) + set(Nettle_VERSION ${PC_Nettle_VERSION}) + else() + set(Nettle_VERSION "1.0") + endif() + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Nettle + FOUND_VAR Nettle_FOUND + REQUIRED_VARS + Nettle_LIBRARY + Nettle_INCLUDE_DIR + VERSION_VAR Nettle_VERSION +) + +if(Nettle_FOUND) + set(Nettle_LIBRARIES ${Nettle_LIBRARY}) + set(Nettle_INCLUDE_DIRS ${Nettle_INCLUDE_DIR}) + set(Nettle_DEFINITIONS ${PC_Nettle_CFLAGS_OTHER}) +endif() + +if(Nettle_FOUND AND NOT TARGET Nettle::Nettle) + add_library(Nettle::Nettle UNKNOWN IMPORTED) + set_target_properties(Nettle::Nettle PROPERTIES + IMPORTED_LOCATION "${Nettle_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_Nettle_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Nettle_INCLUDE_DIR}" + ) +endif() + +mark_as_advanced( + Nettle_INCLUDE_DIR + Nettle_LIBRARY +) + +# compatibility variables +set(Nettle_VERSION_STRING ${Nettle_VERSION}) diff --git a/core/deps/libzip/cmake/FindZstd.cmake b/core/deps/libzip/cmake/FindZstd.cmake new file mode 100644 index 000000000..a0da50381 --- /dev/null +++ b/core/deps/libzip/cmake/FindZstd.cmake @@ -0,0 +1,135 @@ +# Copyright (C) 2020 Dieter Baron and Thomas Klausner +# +# The authors can be contacted at +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# 3. The names of the authors may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#[=======================================================================[.rst: +FindZstd +------- + +Finds the Zstandard (zstd) library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``Zstd::Zstd`` + The Zstandard library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``Zstd_FOUND`` + True if the system has the Zstandard library. +``Zstd_VERSION`` + The version of the Zstandard library which was found. +``Zstd_INCLUDE_DIRS`` + Include directories needed to use Zstandard. +``Zstd_LIBRARIES`` + Libraries needed to link to Zstandard. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``Zstd_INCLUDE_DIR`` + The directory containing ``zstd.h``. +``Zstd_LIBRARY`` + The path to the Zstandard library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_Zstd QUIET zstd) + +find_path(Zstd_INCLUDE_DIR + NAMES zstd.h + PATHS ${PC_Zstd_INCLUDE_DIRS} +) +find_library(Zstd_LIBRARY + NAMES zstd + PATHS ${PC_Zstd_LIBRARY_DIRS} +) + +# Extract version information from the header file +if(Zstd_INCLUDE_DIR) + file(STRINGS ${Zstd_INCLUDE_DIR}/zstd.h _ver_major_line + REGEX "^#define ZSTD_VERSION_MAJOR *[0-9]+" + LIMIT_COUNT 1) + string(REGEX MATCH "[0-9]+" + Zstd_MAJOR_VERSION "${_ver_major_line}") + file(STRINGS ${Zstd_INCLUDE_DIR}/zstd.h _ver_minor_line + REGEX "^#define ZSTD_VERSION_MINOR *[0-9]+" + LIMIT_COUNT 1) + string(REGEX MATCH "[0-9]+" + Zstd_MINOR_VERSION "${_ver_minor_line}") + file(STRINGS ${Zstd_INCLUDE_DIR}/zstd.h _ver_release_line + REGEX "^#define ZSTD_VERSION_RELEASE *[0-9]+" + LIMIT_COUNT 1) + string(REGEX MATCH "[0-9]+" + Zstd_RELEASE_VERSION "${_ver_release_line}") + set(Zstd_VERSION "${Zstd_MAJOR_VERSION}.${Zstd_MINOR_VERSION}.${Zstd_RELEASE_VERSION}") + unset(_ver_major_line) + unset(_ver_minor_line) + unset(_ver_release_line) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Zstd + FOUND_VAR Zstd_FOUND + REQUIRED_VARS + Zstd_LIBRARY + Zstd_INCLUDE_DIR + VERSION_VAR Zstd_VERSION +) + +if(Zstd_FOUND) + set(Zstd_LIBRARIES ${Zstd_LIBRARY}) + set(Zstd_INCLUDE_DIRS ${Zstd_INCLUDE_DIR}) + set(Zstd_DEFINITIONS ${PC_Zstd_CFLAGS_OTHER}) +endif() + +if(Zstd_FOUND AND NOT TARGET Zstd::Zstd) + add_library(Zstd::Zstd UNKNOWN IMPORTED) + set_target_properties(Zstd::Zstd PROPERTIES + IMPORTED_LOCATION "${Zstd_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_Zstd_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Zstd_INCLUDE_DIR}" + ) +endif() + +mark_as_advanced( + Zstd_INCLUDE_DIR + Zstd_LIBRARY +) diff --git a/core/deps/libzip/config.h b/core/deps/libzip/config.h deleted file mode 100644 index b0e0a8a4e..000000000 --- a/core/deps/libzip/config.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Config header for Android */ -/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. - */ -/* #undef HAVE_DECL_TZNAME */ - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 0 - -/* Define to 1 if you have the `fseeko' function. */ -#define HAVE_FSEEKO 0 - -/* Define to 1 if you have the `ftello' function. */ -#define HAVE_FTELLO 0 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 0 - -/* Define to 1 if you have the `z' library (-lz). */ -#define HAVE_LIBZ 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 0 - -/* Define to 1 if you have the `mkstemp' function. */ -#define HAVE_MKSTEMP 0 - -/* Define to 1 if you have the `MoveFileExA' function. */ -/* #undef HAVE_MOVEFILEEXA */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -#ifndef _WIN32 -/* Define to 1 if `tm_zone' is a member of `struct tm'. */ -#define HAVE_STRUCT_TM_TM_ZONE 1 -#endif - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use - `HAVE_STRUCT_TM_TM_ZONE' instead. */ -#define HAVE_TM_ZONE 1 - -/* Define to 1 if you don't have `tm_zone' but do have the external array - `tzname'. */ -/* #undef HAVE_TZNAME */ - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -/* #undef NO_MINUS_C_MINUS_O */ - -/* Name of package */ -#define PACKAGE "libzip" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "libzip@nih.at" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "libzip" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libzip 0.9.3" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "libzip" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "0.9.3" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define to 1 if your declares `struct tm'. */ -/* #undef TM_IN_SYS_TIME */ - -/* Version number of package */ -#define VERSION "0.9.3" diff --git a/core/deps/libzip/developer-xcode/Info.plist b/core/deps/libzip/developer-xcode/Info.plist new file mode 100644 index 000000000..4cc3a77e5 --- /dev/null +++ b/core/deps/libzip/developer-xcode/Info.plist @@ -0,0 +1,46 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + BNDL + CFBundleShortVersionString + PACKAGE_VERSION + CFBundleSignature + ???? + CFBundleVersion + 1 + CFPlugInDynamicRegisterFunction + + CFPlugInDynamicRegistration + NO + CFPlugInFactories + + 00000000-0000-0000-0000-000000000000 + MyFactoryFunction + + CFPlugInTypes + + 00000000-0000-0000-0000-000000000000 + + 00000000-0000-0000-0000-000000000000 + + + CFPlugInUnloadFunction + + NSHumanReadableCopyright + Copyright © 2014 Dieter Baron and Thomas Klausner + + diff --git a/core/deps/libzip/developer-xcode/README Xcode Project.md b/core/deps/libzip/developer-xcode/README Xcode Project.md new file mode 100644 index 000000000..8ae1f65bb --- /dev/null +++ b/core/deps/libzip/developer-xcode/README Xcode Project.md @@ -0,0 +1,6 @@ +This Xcode project is for development only, it is not meant to +compile production builds. + +It is used internally to develop libzip and to run Xcode's diagnostic +tools on the source, and is not always kept up-to-date. Please use +the standard build method instead. diff --git a/core/deps/libzip/developer-xcode/config.h b/core/deps/libzip/developer-xcode/config.h new file mode 100644 index 000000000..a89b2fe2f --- /dev/null +++ b/core/deps/libzip/developer-xcode/config.h @@ -0,0 +1,94 @@ +#ifndef HAD_CONFIG_H +#define HAD_CONFIG_H +#ifndef _HAD_ZIPCONF_H +#include "zipconf.h" +#endif +/* BEGIN DEFINES */ +/* #undef HAVE___PROGNAME */ +/* #undef HAVE__CHMOD */ +/* #undef HAVE__CLOSE */ +/* #undef HAVE__DUP */ +/* #undef HAVE__FDOPEN */ +/* #undef HAVE__FILENO */ +/* #undef HAVE__OPEN */ +/* #undef HAVE__SETMODE */ +/* #undef HAVE__SNPRINTF */ +/* #undef HAVE__STRDUP */ +/* #undef HAVE__STRICMP */ +/* #undef HAVE__STRTOI64 */ +/* #undef HAVE__STRTOUI64 */ +/* #undef HAVE__UMASK */ +/* #undef HAVE__UNLINK */ +#define HAVE_ARC4RANDOM +#define HAVE_CLONEFILE +#define HAVE_COMMONCRYPTO +#define HAVE_CRYPTO +/* #undef HAVE_FICLONERANGE */ +#define HAVE_FILENO +#define HAVE_FSEEKO +#define HAVE_FTELLO +#define HAVE_GETPROGNAME +/* #undef HAVE_GNUTLS */ +#define HAVE_LIBBZ2 +#define HAVE_LIBLZMA +#define HAVE_LOCALTIME_R +/* #undef HAVE_MBEDTLS */ +/* #undef HAVE_MKSTEMP */ +#define HAVE_NULLABLE +#define HAVE_OPEN +/* #undef HAVE_OPENSSL */ +#define HAVE_SETMODE +#define HAVE_SSIZE_T_LIBZIP +#define HAVE_STRCASECMP +#define HAVE_STRDUP +/* #undef HAVE_STRICMP */ +#define HAVE_STRTOLL +#define HAVE_STRTOULL +/* #undef HAVE_STRUCT_TM_TM_ZONE */ +#define HAVE_STDBOOL_H +#define HAVE_STRINGS_H +#define HAVE_UNISTD_H +/* #undef HAVE_WINDOWS_CRYPTO */ +/* #undef __INT8_LIBZIP */ +#define INT8_T_LIBZIP 1 +#define UINT8_T_LIBZIP 1 +/* #undef __INT16_LIBZIP */ +#define INT16_T_LIBZIP 2 +#define UINT16_T_LIBZIP 2 +/* #undef __INT32_LIBZIP */ +#define INT32_T_LIBZIP 4 +#define UINT32_T_LIBZIP 4 +/* #undef __INT64_LIBZIP */ +#define INT64_T_LIBZIP 8 +#define UINT64_T_LIBZIP 8 +#define SHORT_LIBZIP 2 +#define INT_LIBZIP 4 +#define LONG_LIBZIP 8 +#define LONG_LONG_LIBZIP 8 +#define SIZEOF_OFF_T 8 +#define SIZE_T_LIBZIP 8 +#define SSIZE_T_LIBZIP 8 +/* #undef HAVE_DIRENT_H */ +#define HAVE_FTS_H +/* #undef HAVE_NDIR_H */ +/* #undef HAVE_SYS_DIR_H */ +/* #undef HAVE_SYS_NDIR_H */ +/* #undef WORDS_BIGENDIAN */ +#define HAVE_SHARED +/* END DEFINES */ +#define PACKAGE "libzip" +#define VERSION "1.5.2a" + +#ifndef HAVE_SSIZE_T_LIBZIP +#if SIZE_T_LIBZIP == INT_LIBZIP +typedef int ssize_t; +#elif SIZE_T_LIBZIP == LONG_LIBZIP +typedef long ssize_t; +#elif SIZE_T_LIBZIP == LONG_LONG_LIBZIP +typedef long long ssize_t; +#else +#error no suitable type for ssize_t found +#endif +#endif + +#endif /* HAD_CONFIG_H */ diff --git a/core/deps/libzip/developer-xcode/extract-version.sh b/core/deps/libzip/developer-xcode/extract-version.sh new file mode 100644 index 000000000..85e83fcb3 --- /dev/null +++ b/core/deps/libzip/developer-xcode/extract-version.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# Replace the value for PLIST_KEY with the resolved definition from the header file that was passed in. + +SOURCE_HEADER_FILE_PATH=$1 +SOURCE_PLIST_PATH=$2 + +PLIST_KEY="CFBundleShortVersionString" + +VERSION_KEY=`/usr/libexec/PlistBuddy -c "Print :${PLIST_KEY}" "${SOURCE_PLIST_PATH}"` + +#echo "Key: ${VERSION_KEY}" + +VERSION_NUM=`cat "${SOURCE_HEADER_FILE_PATH}" | sed -n "s|#define ${VERSION_KEY} \"\(.*\)\".*|\1|p"` + +#echo "Value: ${VERSION_NUM}" + +TARGET_PLIST_PATH="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" + +/usr/libexec/PlistBuddy -c "Set :${PLIST_KEY} ${VERSION_NUM}" "${TARGET_PLIST_PATH}" diff --git a/core/deps/libzip/developer-xcode/libzip.xcodeproj/project.pbxproj b/core/deps/libzip/developer-xcode/libzip.xcodeproj/project.pbxproj new file mode 100644 index 000000000..8e7d23b2f --- /dev/null +++ b/core/deps/libzip/developer-xcode/libzip.xcodeproj/project.pbxproj @@ -0,0 +1,2934 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXAggregateTarget section */ + 4B01D72815B2F5A2002D5007 /* command line tools */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 4B01D72915B2F5A2002D5007 /* Build configuration list for PBXAggregateTarget "command line tools" */; + buildPhases = ( + ); + dependencies = ( + 4B2CADAC1C50D57800291DE6 /* PBXTargetDependency */, + 4B01D72D15B2F5AC002D5007 /* PBXTargetDependency */, + 4B01D72F15B2F5AC002D5007 /* PBXTargetDependency */, + ); + name = "command line tools"; + productName = "command line tools"; + }; + 4B54447915C977A20067BA33 /* all */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 4B54447C15C977A20067BA33 /* Build configuration list for PBXAggregateTarget "all" */; + buildPhases = ( + ); + dependencies = ( + 4BCF6A7B1C3BDDFF00F036E9 /* PBXTargetDependency */, + 4B54447F15C977AF0067BA33 /* PBXTargetDependency */, + 4B54448115C977B10067BA33 /* PBXTargetDependency */, + ); + name = all; + productName = all; + }; + 4BACD5A715BC2D8200920691 /* test programs */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 4BACD5AE15BC2D8200920691 /* Build configuration list for PBXAggregateTarget "test programs" */; + buildPhases = ( + ); + dependencies = ( + 4BFF2B531FE13002006EF3F3 /* PBXTargetDependency */, + 4BD6CB6E19E71D0800710654 /* PBXTargetDependency */, + 4BACD65515BC303B00920691 /* PBXTargetDependency */, + 4BACD65715BC303B00920691 /* PBXTargetDependency */, + 4BACD65915BC303B00920691 /* PBXTargetDependency */, + 4BACD66915BC303B00920691 /* PBXTargetDependency */, + 4B51DDC51FDAE2F000C5CA85 /* PBXTargetDependency */, + ); + name = "test programs"; + productName = "test programs"; + }; + 4BCF6A681C3BDDD500F036E9 /* examples */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 4BCF6A751C3BDDD500F036E9 /* Build configuration list for PBXAggregateTarget "examples" */; + buildPhases = ( + ); + dependencies = ( + 4BCF6A791C3BDDF900F036E9 /* PBXTargetDependency */, + ); + name = examples; + productName = examples; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 3D7E35431B33063F00022624 /* in-memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 3D7E35401B33063600022624 /* in-memory.c */; }; + 3D7E35461B33064B00022624 /* libzip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D68B15B2F3F1002D5007 /* libzip.framework */; }; + 3D7E35481B33076C00022624 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D7E35471B33076C00022624 /* libz.dylib */; }; + 3D7E35491B330AD500022624 /* zip_source_is_deleted.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BE402AC19D94AE400298248 /* zip_source_is_deleted.c */; }; + 3D9284821C309510001EABA7 /* zip_hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 3D9284801C309510001EABA7 /* zip_hash.c */; }; + 4B00CA24242F59D700E0B71C /* zip_source_pkware_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B00CA21242F59D700E0B71C /* zip_source_pkware_decode.c */; }; + 4B00CA25242F59D700E0B71C /* zip_pkware.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B00CA22242F59D700E0B71C /* zip_pkware.c */; }; + 4B00CA26242F59D700E0B71C /* zip_source_pkware_encode.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B00CA23242F59D700E0B71C /* zip_source_pkware_encode.c */; }; + 4B00CA2D242F5C2500E0B71C /* set_file_dostime.test in Resources */ = {isa = PBXBuildFile; fileRef = 4B00CA27242F5C2500E0B71C /* set_file_dostime.test */; }; + 4B00CA2E242F5C2500E0B71C /* cancel_45.test in Resources */ = {isa = PBXBuildFile; fileRef = 4B00CA28242F5C2500E0B71C /* cancel_45.test */; }; + 4B00CA2F242F5C2500E0B71C /* set_compression_store_to_xz.test in Resources */ = {isa = PBXBuildFile; fileRef = 4B00CA29242F5C2500E0B71C /* set_compression_store_to_xz.test */; }; + 4B00CA30242F5C2500E0B71C /* encryption-nonrandom-pkware.test in Resources */ = {isa = PBXBuildFile; fileRef = 4B00CA2A242F5C2500E0B71C /* encryption-nonrandom-pkware.test */; }; + 4B00CA31242F5C2500E0B71C /* cancel_90.test in Resources */ = {isa = PBXBuildFile; fileRef = 4B00CA2B242F5C2500E0B71C /* cancel_90.test */; }; + 4B00CA32242F5C2500E0B71C /* set_compression_xz_to_store.test in Resources */ = {isa = PBXBuildFile; fileRef = 4B00CA2C242F5C2500E0B71C /* set_compression_xz_to_store.test */; }; + 4B01D6A615B2F46B002D5007 /* zip_add_dir.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71F115B1B25E00236D3C /* zip_add_dir.c */; }; + 4B01D6A715B2F46B002D5007 /* zip_add_entry.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71F215B1B25E00236D3C /* zip_add_entry.c */; }; + 4B01D6A815B2F46B002D5007 /* zip_add.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71F315B1B25E00236D3C /* zip_add.c */; }; + 4B01D6A915B2F46B002D5007 /* zip_close.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71F415B1B25E00236D3C /* zip_close.c */; }; + 4B01D6AA15B2F46B002D5007 /* zip_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71F515B1B25E00236D3C /* zip_delete.c */; }; + 4B01D6AB15B2F46B002D5007 /* zip_dir_add.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71F615B1B25E00236D3C /* zip_dir_add.c */; }; + 4B01D6AC15B2F46B002D5007 /* zip_dirent.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71F715B1B25E00236D3C /* zip_dirent.c */; }; + 4B01D6AD15B2F46B002D5007 /* zip_discard.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71F815B1B25E00236D3C /* zip_discard.c */; }; + 4B01D6AE15B2F46B002D5007 /* zip_entry.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71F915B1B25E00236D3C /* zip_entry.c */; }; + 4B01D6B015B2F46B002D5007 /* zip_error_clear.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71FB15B1B25E00236D3C /* zip_error_clear.c */; }; + 4B01D6B115B2F46B002D5007 /* zip_error_get_sys_type.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71FC15B1B25E00236D3C /* zip_error_get_sys_type.c */; }; + 4B01D6B215B2F46B002D5007 /* zip_error_get.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71FD15B1B25E00236D3C /* zip_error_get.c */; }; + 4B01D6B315B2F46B002D5007 /* zip_error_strerror.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71FE15B1B25E00236D3C /* zip_error_strerror.c */; }; + 4B01D6B415B2F46B002D5007 /* zip_error_to_str.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71FF15B1B25E00236D3C /* zip_error_to_str.c */; }; + 4B01D6B515B2F46B002D5007 /* zip_error.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC720015B1B25E00236D3C /* zip_error.c */; }; + 4B01D6B615B2F46B002D5007 /* zip_extra_field_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC720115B1B25E00236D3C /* zip_extra_field_api.c */; }; + 4B01D6B715B2F46B002D5007 /* zip_extra_field.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC720215B1B25E00236D3C /* zip_extra_field.c */; }; + 4B01D6B815B2F46B002D5007 /* zip_fclose.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC720315B1B25E00236D3C /* zip_fclose.c */; }; + 4B01D6B915B2F46B002D5007 /* zip_fdopen.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC720415B1B25E00236D3C /* zip_fdopen.c */; }; + 4B01D6BA15B2F46B002D5007 /* zip_file_add.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC720515B1B25E00236D3C /* zip_file_add.c */; }; + 4B01D6BB15B2F46B002D5007 /* zip_file_error_clear.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC720615B1B25E00236D3C /* zip_file_error_clear.c */; }; + 4B01D6BC15B2F46B002D5007 /* zip_file_error_get.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC720715B1B25E00236D3C /* zip_file_error_get.c */; }; + 4B01D6BD15B2F46B002D5007 /* zip_file_get_comment.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC720815B1B25E00236D3C /* zip_file_get_comment.c */; }; + 4B01D6BE15B2F46B002D5007 /* zip_file_get_offset.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC720915B1B25E00236D3C /* zip_file_get_offset.c */; }; + 4B01D6BF15B2F46B002D5007 /* zip_file_rename.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC720A15B1B25E00236D3C /* zip_file_rename.c */; }; + 4B01D6C015B2F46B002D5007 /* zip_file_replace.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC720B15B1B25E00236D3C /* zip_file_replace.c */; }; + 4B01D6C115B2F46B002D5007 /* zip_file_set_comment.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC720C15B1B25E00236D3C /* zip_file_set_comment.c */; }; + 4B01D6C215B2F46B002D5007 /* zip_file_strerror.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC720D15B1B25E00236D3C /* zip_file_strerror.c */; }; + 4B01D6C415B2F46B002D5007 /* zip_fopen_encrypted.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC720F15B1B25E00236D3C /* zip_fopen_encrypted.c */; }; + 4B01D6C515B2F46B002D5007 /* zip_fopen_index_encrypted.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC721015B1B25E00236D3C /* zip_fopen_index_encrypted.c */; }; + 4B01D6C615B2F46B002D5007 /* zip_fopen_index.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC721115B1B25E00236D3C /* zip_fopen_index.c */; }; + 4B01D6C715B2F46B002D5007 /* zip_fopen.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC721215B1B25E00236D3C /* zip_fopen.c */; }; + 4B01D6C815B2F46B002D5007 /* zip_fread.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC721315B1B25E00236D3C /* zip_fread.c */; }; + 4B01D6C915B2F46B002D5007 /* zip_get_archive_comment.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC721415B1B25E00236D3C /* zip_get_archive_comment.c */; }; + 4B01D6CA15B2F46B002D5007 /* zip_get_archive_flag.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC721515B1B25E00236D3C /* zip_get_archive_flag.c */; }; + 4B01D6CC15B2F46B002D5007 /* zip_get_encryption_implementation.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC721715B1B25E00236D3C /* zip_get_encryption_implementation.c */; }; + 4B01D6CD15B2F46B002D5007 /* zip_get_file_comment.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC721815B1B25E00236D3C /* zip_get_file_comment.c */; }; + 4B01D6CE15B2F46B002D5007 /* zip_get_name.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC721915B1B25E00236D3C /* zip_get_name.c */; }; + 4B01D6CF15B2F46B002D5007 /* zip_get_num_entries.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC721A15B1B25E00236D3C /* zip_get_num_entries.c */; }; + 4B01D6D015B2F46B002D5007 /* zip_get_num_files.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC721B15B1B25E00236D3C /* zip_get_num_files.c */; }; + 4B01D6D115B2F46B002D5007 /* zip_memdup.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC721C15B1B25E00236D3C /* zip_memdup.c */; }; + 4B01D6D215B2F46B002D5007 /* zip_name_locate.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC721D15B1B25E00236D3C /* zip_name_locate.c */; }; + 4B01D6D315B2F46B002D5007 /* zip_new.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC721E15B1B25E00236D3C /* zip_new.c */; }; + 4B01D6D415B2F46B002D5007 /* zip_open.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC721F15B1B25E00236D3C /* zip_open.c */; }; + 4B01D6D515B2F46B002D5007 /* zip_rename.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC722015B1B25E00236D3C /* zip_rename.c */; }; + 4B01D6D615B2F46B002D5007 /* zip_replace.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC722115B1B25E00236D3C /* zip_replace.c */; }; + 4B01D6D715B2F46B002D5007 /* zip_set_archive_comment.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC722215B1B25E00236D3C /* zip_set_archive_comment.c */; }; + 4B01D6D815B2F46B002D5007 /* zip_set_archive_flag.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC722315B1B25E00236D3C /* zip_set_archive_flag.c */; }; + 4B01D6D915B2F46B002D5007 /* zip_set_default_password.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC722415B1B25E00236D3C /* zip_set_default_password.c */; }; + 4B01D6DA15B2F46B002D5007 /* zip_set_file_comment.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC722515B1B25E00236D3C /* zip_set_file_comment.c */; }; + 4B01D6DB15B2F46B002D5007 /* zip_set_file_compression.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC722615B1B25E00236D3C /* zip_set_file_compression.c */; }; + 4B01D6DC15B2F46B002D5007 /* zip_set_name.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC722715B1B25E00236D3C /* zip_set_name.c */; }; + 4B01D6DD15B2F46B002D5007 /* zip_source_buffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC722815B1B25E00236D3C /* zip_source_buffer.c */; }; + 4B01D6DE15B2F46B002D5007 /* zip_source_close.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC722915B1B25E00236D3C /* zip_source_close.c */; }; + 4B01D6DF15B2F46B002D5007 /* zip_source_crc.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC722A15B1B25E00236D3C /* zip_source_crc.c */; }; + 4B01D6E115B2F46B002D5007 /* zip_source_error.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC722C15B1B25E00236D3C /* zip_source_error.c */; }; + 4B01D6E415B2F46B002D5007 /* zip_source_free.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC722F15B1B25E00236D3C /* zip_source_free.c */; }; + 4B01D6E515B2F46B002D5007 /* zip_source_function.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC723015B1B25E00236D3C /* zip_source_function.c */; }; + 4B01D6E615B2F46B002D5007 /* zip_source_layered.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC723115B1B25E00236D3C /* zip_source_layered.c */; }; + 4B01D6E715B2F46B002D5007 /* zip_source_open.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC723215B1B25E00236D3C /* zip_source_open.c */; }; + 4B01D6EA15B2F46B002D5007 /* zip_source_read.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC723515B1B25E00236D3C /* zip_source_read.c */; }; + 4B01D6EB15B2F46B002D5007 /* zip_source_stat.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC723615B1B25E00236D3C /* zip_source_stat.c */; }; + 4B01D6EC15B2F46B002D5007 /* zip_source_window.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC723715B1B25E00236D3C /* zip_source_window.c */; }; + 4B01D6ED15B2F46B002D5007 /* zip_source_zip_new.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC723815B1B25E00236D3C /* zip_source_zip_new.c */; }; + 4B01D6EE15B2F46B002D5007 /* zip_source_zip.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC723915B1B25E00236D3C /* zip_source_zip.c */; }; + 4B01D6EF15B2F46B002D5007 /* zip_stat_index.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC723A15B1B25E00236D3C /* zip_stat_index.c */; }; + 4B01D6F015B2F46B002D5007 /* zip_stat_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC723B15B1B25E00236D3C /* zip_stat_init.c */; }; + 4B01D6F115B2F46B002D5007 /* zip_stat.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC723C15B1B25E00236D3C /* zip_stat.c */; }; + 4B01D6F215B2F46B002D5007 /* zip_strerror.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC723D15B1B25E00236D3C /* zip_strerror.c */; }; + 4B01D6F315B2F46B002D5007 /* zip_string.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC723E15B1B25E00236D3C /* zip_string.c */; }; + 4B01D6F415B2F46B002D5007 /* zip_unchange_all.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC723F15B1B25E00236D3C /* zip_unchange_all.c */; }; + 4B01D6F515B2F46B002D5007 /* zip_unchange_archive.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC724015B1B25E00236D3C /* zip_unchange_archive.c */; }; + 4B01D6F615B2F46B002D5007 /* zip_unchange_data.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC724115B1B25E00236D3C /* zip_unchange_data.c */; }; + 4B01D6F715B2F46B002D5007 /* zip_unchange.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC724215B1B25E00236D3C /* zip_unchange.c */; }; + 4B01D6F815B2F46B002D5007 /* zip_utf-8.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC724315B1B25E00236D3C /* zip_utf-8.c */; }; + 4B01D70715B2F4C5002D5007 /* libzip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D68B15B2F3F1002D5007 /* libzip.framework */; }; + 4B01D70915B2F4CF002D5007 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D70815B2F4CF002D5007 /* libz.dylib */; }; + 4B01D70D15B2F4EB002D5007 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D70815B2F4CF002D5007 /* libz.dylib */; }; + 4B01D70E15B2F4EB002D5007 /* libzip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D68B15B2F3F1002D5007 /* libzip.framework */; }; + 4B01D72515B2F57B002D5007 /* zipcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B01D72115B2F572002D5007 /* zipcmp.c */; }; + 4B01D72615B2F57F002D5007 /* zipmerge.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B01D72215B2F572002D5007 /* zipmerge.c */; }; + 4B01D73215B2F5EE002D5007 /* zipconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDC729E15B1B4E900236D3C /* zipconf.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4B01D73C15B2F6AF002D5007 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D70815B2F4CF002D5007 /* libz.dylib */; }; + 4B0454BA1E8E3E08002FA1F9 /* zip_source_compress.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B0454B61E8E3DF7002FA1F9 /* zip_source_compress.c */; }; + 4B0454BC1E8E3E24002FA1F9 /* zip_algorithm_bzip2.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B0454B41E8E3DF7002FA1F9 /* zip_algorithm_bzip2.c */; }; + 4B0454BD1E8E3E24002FA1F9 /* zip_algorithm_deflate.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B0454B51E8E3DF7002FA1F9 /* zip_algorithm_deflate.c */; }; + 4B3A5F521DF96EB4005A53A1 /* zip_fseek.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3A5F4D1DF96D83005A53A1 /* zip_fseek.c */; }; + 4B3A5F531DF96EB4005A53A1 /* zip_ftell.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3A5F4E1DF96D83005A53A1 /* zip_ftell.c */; }; + 4B3FAE802385C5CC00192D6A /* zip_algorithm_xz.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3FAE7F2385C5A300192D6A /* zip_algorithm_xz.c */; }; + 4B3FAE822385C79200192D6A /* liblzma.5.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B3FAE812385C79200192D6A /* liblzma.5.dylib */; }; + 4B5169A822A7993E00AA4340 /* zip_mkstempm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B5169A722A7993D00AA4340 /* zip_mkstempm.c */; }; + 4B51DDBA1FDAE20A00C5CA85 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D70815B2F4CF002D5007 /* libz.dylib */; }; + 4B51DDBB1FDAE20A00C5CA85 /* libzip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D68B15B2F3F1002D5007 /* libzip.framework */; }; + 4B51DDC11FDAE25B00C5CA85 /* ziptool.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BACD57C15BC2AEF00920691 /* ziptool.c */; }; + 4B51DDC21FDAE25F00C5CA85 /* ziptool_regress.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B51DDB31FDAE1DB00C5CA85 /* ziptool_regress.c */; }; + 4B51DDC31FDAE26600C5CA85 /* source_hole.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BD6CB5C19E6A5D900710654 /* source_hole.c */; }; + 4B542C2C22B12E3900960B38 /* zip_random_unix.c in Sources */ = {isa = PBXBuildFile; fileRef = 736ED9B81E3D688C00C36873 /* zip_random_unix.c */; }; + 4B5D0CD5244B154E006C2E93 /* zip_source_get_file_attributes.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B5D0CD4244B154E006C2E93 /* zip_source_get_file_attributes.c */; }; + 4B69E6EE2032F18B0001EEE7 /* zip_winzip_aes.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B69E6ED2032F1870001EEE7 /* zip_winzip_aes.c */; }; + 4B82CED519915F360097BC18 /* zip_file_set_mtime.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B82CED319915F360097BC18 /* zip_file_set_mtime.c */; }; + 4B908F532385BE6D00886355 /* zip_libzip_version.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B908F502385BE6C00886355 /* zip_libzip_version.c */; }; + 4B908F552385BE6D00886355 /* zip_source_accept_empty.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B908F522385BE6D00886355 /* zip_source_accept_empty.c */; }; + 4B93995A24631B3E00AEBDA4 /* zip_source_file_stdio_named.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B93995524631B3D00AEBDA4 /* zip_source_file_stdio_named.c */; }; + 4B93995B24631B3E00AEBDA4 /* zip_source_file_common.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B93995624631B3E00AEBDA4 /* zip_source_file_common.c */; }; + 4B93995C24631B3E00AEBDA4 /* zip_source_file_stdio.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B93995724631B3E00AEBDA4 /* zip_source_file_stdio.c */; }; + 4B93995D24631B3E00AEBDA4 /* zip_source_file_stdio.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B93995824631B3E00AEBDA4 /* zip_source_file_stdio.h */; }; + 4B93995E24631B3E00AEBDA4 /* zip_source_file.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B93995924631B3E00AEBDA4 /* zip_source_file.h */; }; + 4B972050188EBE85002FAFAD /* zip_file_get_external_attributes.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B97204D188EBE85002FAFAD /* zip_file_get_external_attributes.c */; }; + 4B972052188EBE85002FAFAD /* zip_file_set_external_attributes.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B97204E188EBE85002FAFAD /* zip_file_set_external_attributes.c */; }; + 4B9E577C24C7202000CEE0D6 /* zip_algorithm_zstd.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B9E577A24C7026B00CEE0D6 /* zip_algorithm_zstd.c */; }; + 4B9E578824C9770C00CEE0D6 /* libzstd.1.4.5.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B9E578724C9770C00CEE0D6 /* libzstd.1.4.5.dylib */; }; + 4B9E578A24C9779900CEE0D6 /* zip_err_str.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B9E578924C9779900CEE0D6 /* zip_err_str.c */; }; + 4BACD59315BC2CFA00920691 /* libzip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D68B15B2F3F1002D5007 /* libzip.framework */; }; + 4BACD59415BC2D0800920691 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D70815B2F4CF002D5007 /* libz.dylib */; }; + 4BACD5BB15BC2DC900920691 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D70815B2F4CF002D5007 /* libz.dylib */; }; + 4BACD5BC15BC2DC900920691 /* libzip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D68B15B2F3F1002D5007 /* libzip.framework */; }; + 4BACD5C315BC2DE000920691 /* add_from_filep.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BACD57715BC2AEF00920691 /* add_from_filep.c */; }; + 4BACD5CA15BC2DF200920691 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D70815B2F4CF002D5007 /* libz.dylib */; }; + 4BACD5CB15BC2DF200920691 /* libzip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D68B15B2F3F1002D5007 /* libzip.framework */; }; + 4BACD5D215BC2EFE00920691 /* fopen_unchanged.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BACD57A15BC2AEF00920691 /* fopen_unchanged.c */; }; + 4BACD5D915BC2F3700920691 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D70815B2F4CF002D5007 /* libz.dylib */; }; + 4BACD5DA15BC2F3700920691 /* libzip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D68B15B2F3F1002D5007 /* libzip.framework */; }; + 4BACD5E115BC2F4500920691 /* fread.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BACD57B15BC2AEF00920691 /* fread.c */; }; + 4BACD64A15BC301300920691 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D70815B2F4CF002D5007 /* libz.dylib */; }; + 4BACD64B15BC301300920691 /* libzip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D68B15B2F3F1002D5007 /* libzip.framework */; }; + 4BACD65315BC302500920691 /* tryopen.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BACD58415BC2AEF00920691 /* tryopen.c */; }; + 4BC03FA41FDD6B6F003C7B62 /* zip_source_begin_write_cloning.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BC03FA21FDD6B6F003C7B62 /* zip_source_begin_write_cloning.c */; }; + 4BCB434319E9347E0067FAA3 /* zip_buffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BCB434119E9347E0067FAA3 /* zip_buffer.c */; }; + 4BCF3022199A2F820064207B /* zip_io_util.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF3019199A2F820064207B /* zip_io_util.c */; }; + 4BCF3024199A2F820064207B /* zip_source_begin_write.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF301A199A2F820064207B /* zip_source_begin_write.c */; }; + 4BCF3026199A2F820064207B /* zip_source_commit_write.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF301B199A2F820064207B /* zip_source_commit_write.c */; }; + 4BCF3028199A2F820064207B /* zip_source_rollback_write.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF301C199A2F820064207B /* zip_source_rollback_write.c */; }; + 4BCF302A199A2F820064207B /* zip_source_seek.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF301D199A2F820064207B /* zip_source_seek.c */; }; + 4BCF302C199A2F820064207B /* zip_source_supports.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF301E199A2F820064207B /* zip_source_supports.c */; }; + 4BCF302E199A2F820064207B /* zip_source_tell.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF301F199A2F820064207B /* zip_source_tell.c */; }; + 4BCF3030199A2F820064207B /* zip_source_write.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF3020199A2F820064207B /* zip_source_write.c */; }; + 4BCF3033199ABD3A0064207B /* zip_source_remove.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF3031199ABD3A0064207B /* zip_source_remove.c */; }; + 4BCF3037199ABDDA0064207B /* zip_source_seek_write.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF3034199ABDDA0064207B /* zip_source_seek_write.c */; }; + 4BCF3039199ABDDA0064207B /* zip_source_tell_write.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF3035199ABDDA0064207B /* zip_source_tell_write.c */; }; + 4BD5053419A01BB0007DD28A /* zip_source_call.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BD5053219A0116D007DD28A /* zip_source_call.c */; }; + 4BD6CB6419E71CD100710654 /* source_hole.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BD6CB5C19E6A5D900710654 /* source_hole.c */; }; + 4BD6CB6619E71CD100710654 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D70815B2F4CF002D5007 /* libz.dylib */; }; + 4BD6CB6719E71CD100710654 /* libzip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D68B15B2F3F1002D5007 /* libzip.framework */; }; + 4BD6CB6F19E71D6900710654 /* hole.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BD6CB5E19E71B3B00710654 /* hole.c */; }; + 4BD7087A1EB1CF73003F351F /* zip_progress.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BD708781EB1CF73003F351F /* zip_progress.c */; }; + 4BE92AA720345E3800509BC8 /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BE92AA620345E3800509BC8 /* libbz2.tbd */; }; + 4BE92AAD20346B1900509BC8 /* zip_crypto_openssl.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE92AAA20346B1900509BC8 /* zip_crypto_openssl.h */; }; + 4BE92AB3203597D700509BC8 /* zip_crypto_commoncrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE92AB0203597D700509BC8 /* zip_crypto_commoncrypto.h */; }; + 4BE92AB5203597D700509BC8 /* zip_crypto_commoncrypto.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BE92AB1203597D700509BC8 /* zip_crypto_commoncrypto.c */; }; + 4BFF2B551FE13033006EF3F3 /* can_clone_file.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BFF2B541FE13033006EF3F3 /* can_clone_file.c */; }; + 736ED9BB1E3D6B6B00C36873 /* zip_source_winzip_aes_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 736ED9B91E3D688C00C36873 /* zip_source_winzip_aes_decode.c */; }; + 736ED9BC1E3D6B6F00C36873 /* zip_source_winzip_aes_encode.c in Sources */ = {isa = PBXBuildFile; fileRef = 736ED9BA1E3D688C00C36873 /* zip_source_winzip_aes_encode.c */; }; + 736ED9BF1E3D6B7C00C36873 /* zip_file_set_encryption.c in Sources */ = {isa = PBXBuildFile; fileRef = 736ED9B71E3D688C00C36873 /* zip_file_set_encryption.c */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 3D7E35441B33064500022624 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4B01D68A15B2F3F1002D5007; + remoteInfo = libzip; + }; + 4B01D72C15B2F5AC002D5007 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4B01D6FC15B2F4B1002D5007; + remoteInfo = zipmerge; + }; + 4B01D72E15B2F5AC002D5007 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4B01D70A15B2F4EB002D5007; + remoteInfo = zipcmp; + }; + 4B01D73515B2F639002D5007 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4B01D68A15B2F3F1002D5007; + remoteInfo = "libzip Mac"; + }; + 4B01D73715B2F643002D5007 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4B01D68A15B2F3F1002D5007; + remoteInfo = "libzip Mac"; + }; + 4B2CADAB1C50D57800291DE6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4BACD58815BC2CEA00920691; + remoteInfo = ziptool; + }; + 4B51DDB61FDAE20A00C5CA85 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4B01D68A15B2F3F1002D5007; + remoteInfo = "libzip Mac"; + }; + 4B51DDC41FDAE2F000C5CA85 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4B51DDB41FDAE20A00C5CA85; + remoteInfo = ziptool_regress; + }; + 4B54447E15C977AF0067BA33 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4B01D72815B2F5A2002D5007; + remoteInfo = "command line tools"; + }; + 4B54448015C977B10067BA33 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4BACD5A715BC2D8200920691; + remoteInfo = "test programs"; + }; + 4BACD59615BC2D3800920691 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4B01D68A15B2F3F1002D5007; + remoteInfo = "libzip Mac"; + }; + 4BACD5B715BC2DC900920691 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4B01D68A15B2F3F1002D5007; + remoteInfo = "libzip Mac"; + }; + 4BACD5C615BC2DF200920691 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4B01D68A15B2F3F1002D5007; + remoteInfo = "libzip Mac"; + }; + 4BACD5D515BC2F3700920691 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4B01D68A15B2F3F1002D5007; + remoteInfo = "libzip Mac"; + }; + 4BACD64715BC301300920691 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4B01D68A15B2F3F1002D5007; + remoteInfo = "libzip Mac"; + }; + 4BACD65415BC303B00920691 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4BACD5B515BC2DC900920691; + remoteInfo = add_from_filep; + }; + 4BACD65615BC303B00920691 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4BACD5C415BC2DF200920691; + remoteInfo = fopen_unchanged; + }; + 4BACD65815BC303B00920691 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4BACD5D315BC2F3700920691; + remoteInfo = fread; + }; + 4BACD66815BC303B00920691 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4BACD64515BC301300920691; + remoteInfo = tryopen; + }; + 4BCF6A781C3BDDF900F036E9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3D7E35361B3305FB00022624; + remoteInfo = "in-memory"; + }; + 4BCF6A7A1C3BDDFF00F036E9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4BCF6A681C3BDDD500F036E9; + remoteInfo = examples; + }; + 4BD6CB6119E71CD100710654 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4B01D68A15B2F3F1002D5007; + remoteInfo = "libzip Mac"; + }; + 4BD6CB6D19E71D0800710654 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4BD6CB5F19E71CD100710654; + remoteInfo = hole; + }; + 4BFF2B521FE13002006EF3F3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4BFF2B451FE12FCA006EF3F3; + remoteInfo = can_clone_file; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 3D7E35351B3305FB00022624 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; + 4B01D6FB15B2F4B1002D5007 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; + 4B01D70F15B2F4EB002D5007 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; + 4B51DDBC1FDAE20A00C5CA85 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 12; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BACD58715BC2CEA00920691 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 12; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BACD5BD15BC2DC900920691 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 12; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BACD5CC15BC2DF200920691 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 12; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BACD5DB15BC2F3700920691 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 12; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BACD64C15BC301300920691 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 12; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BD6CB6819E71CD100710654 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 12; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BFF2B4D1FE12FCA006EF3F3 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 12; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 3D77B86517009AA1000A5794 /* extract-version.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "extract-version.sh"; sourceTree = SOURCE_ROOT; }; + 3D7E35371B3305FB00022624 /* in-memory */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "in-memory"; sourceTree = BUILT_PRODUCTS_DIR; }; + 3D7E35401B33063600022624 /* in-memory.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "in-memory.c"; sourceTree = ""; }; + 3D7E35421B33063600022624 /* windows-open.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "windows-open.c"; sourceTree = ""; }; + 3D7E35471B33076C00022624 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; + 3D9284801C309510001EABA7 /* zip_hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_hash.c; sourceTree = ""; usesTabs = 1; }; + 4B00CA21242F59D700E0B71C /* zip_source_pkware_decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_pkware_decode.c; sourceTree = ""; }; + 4B00CA22242F59D700E0B71C /* zip_pkware.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_pkware.c; sourceTree = ""; }; + 4B00CA23242F59D700E0B71C /* zip_source_pkware_encode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_pkware_encode.c; sourceTree = ""; }; + 4B00CA27242F5C2500E0B71C /* set_file_dostime.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = set_file_dostime.test; sourceTree = ""; }; + 4B00CA28242F5C2500E0B71C /* cancel_45.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cancel_45.test; sourceTree = ""; }; + 4B00CA29242F5C2500E0B71C /* set_compression_store_to_xz.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = set_compression_store_to_xz.test; sourceTree = ""; }; + 4B00CA2A242F5C2500E0B71C /* encryption-nonrandom-pkware.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "encryption-nonrandom-pkware.test"; sourceTree = ""; }; + 4B00CA2B242F5C2500E0B71C /* cancel_90.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cancel_90.test; sourceTree = ""; }; + 4B00CA2C242F5C2500E0B71C /* set_compression_xz_to_store.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = set_compression_xz_to_store.test; sourceTree = ""; }; + 4B01D68B15B2F3F1002D5007 /* libzip.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = libzip.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 4B01D6FD15B2F4B1002D5007 /* zipmerge */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = zipmerge; sourceTree = BUILT_PRODUCTS_DIR; }; + 4B01D70815B2F4CF002D5007 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; }; + 4B01D71315B2F4EB002D5007 /* zipcmp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = zipcmp; sourceTree = BUILT_PRODUCTS_DIR; }; + 4B01D72115B2F572002D5007 /* zipcmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = zipcmp.c; sourceTree = ""; }; + 4B01D72215B2F572002D5007 /* zipmerge.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = zipmerge.c; sourceTree = ""; }; + 4B01D73D15B2FB6B002D5007 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; }; + 4B0454B41E8E3DF7002FA1F9 /* zip_algorithm_bzip2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_algorithm_bzip2.c; sourceTree = ""; }; + 4B0454B51E8E3DF7002FA1F9 /* zip_algorithm_deflate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_algorithm_deflate.c; sourceTree = ""; }; + 4B0454B61E8E3DF7002FA1F9 /* zip_source_compress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_compress.c; sourceTree = ""; }; + 4B1ABD1A1A2E5DA700C93867 /* links */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = links; sourceTree = ""; }; + 4B1ABD1B1A2E5E4D00C93867 /* handle_links */ = {isa = PBXFileReference; explicitFileType = text.script.perl; fileEncoding = 4; path = handle_links; sourceTree = ""; }; + 4B1E46E51A08CB7600A376D2 /* zip_error_code_system.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_error_code_system.mdoc; sourceTree = ""; }; + 4B1E46E61A08CB7600A376D2 /* zip_error_code_zip.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_error_code_zip.mdoc; sourceTree = ""; }; + 4B1E46E71A08CB7600A376D2 /* zip_error_fini.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_error_fini.mdoc; sourceTree = ""; }; + 4B1E46E81A08CB7600A376D2 /* zip_error_init.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_error_init.mdoc; sourceTree = ""; }; + 4B1E46E91A08CB7600A376D2 /* zip_error_set.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_error_set.mdoc; sourceTree = ""; }; + 4B1E46EA1A08CB7600A376D2 /* zip_error_strerror.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_error_strerror.mdoc; sourceTree = ""; }; + 4B1E46EB1A08CB7600A376D2 /* zip_error_system_type.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_error_system_type.mdoc; sourceTree = ""; }; + 4B26FF151A07DF1A000E9788 /* zip_file_get_external_attributes.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_file_get_external_attributes.mdoc; sourceTree = ""; }; + 4B26FF161A07DF1A000E9788 /* zip_file_set_external_attributes.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_file_set_external_attributes.mdoc; sourceTree = ""; }; + 4B26FF171A07DF1A000E9788 /* zip_file_set_mtime.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_file_set_mtime.mdoc; sourceTree = ""; }; + 4B26FF181A07DFEA000E9788 /* mkdocset.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = mkdocset.pl; sourceTree = ""; }; + 4B28A9EC15BACC3900D0C17D /* libzip.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = libzip.mdoc; sourceTree = ""; }; + 4B28A9ED15BACC3900D0C17D /* zip_add_dir.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_add_dir.mdoc; sourceTree = ""; }; + 4B28A9EE15BACC3900D0C17D /* zip_add.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_add.mdoc; sourceTree = ""; }; + 4B28A9EF15BACC3900D0C17D /* zip_close.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_close.mdoc; sourceTree = ""; }; + 4B28A9F015BACC3900D0C17D /* zip_delete.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_delete.mdoc; sourceTree = ""; }; + 4B28A9F115BACC3900D0C17D /* zip_dir_add.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_dir_add.mdoc; sourceTree = ""; }; + 4B28A9F215BACC3900D0C17D /* zip_discard.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_discard.mdoc; sourceTree = ""; }; + 4B28A9F315BACC3900D0C17D /* zip_error_clear.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_error_clear.mdoc; sourceTree = ""; }; + 4B28A9F415BACC3900D0C17D /* zip_error_get_sys_type.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_error_get_sys_type.mdoc; sourceTree = ""; }; + 4B28A9F515BACC3900D0C17D /* zip_error_get.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_error_get.mdoc; sourceTree = ""; }; + 4B28A9F615BACC3900D0C17D /* zip_error_to_str.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_error_to_str.mdoc; sourceTree = ""; }; + 4B28A9F715BACC3900D0C17D /* zip_errors.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_errors.mdoc; sourceTree = ""; }; + 4B28A9F815BACC3900D0C17D /* zip_fclose.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_fclose.mdoc; sourceTree = ""; }; + 4B28A9F915BACC3900D0C17D /* zip_fdopen.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_fdopen.mdoc; sourceTree = ""; }; + 4B28A9FA15BACC3900D0C17D /* zip_file_add.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_file_add.mdoc; sourceTree = ""; }; + 4B28A9FB15BACC3900D0C17D /* zip_file_extra_field_delete.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_file_extra_field_delete.mdoc; sourceTree = ""; }; + 4B28A9FC15BACC3900D0C17D /* zip_file_extra_field_get.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_file_extra_field_get.mdoc; sourceTree = ""; }; + 4B28A9FD15BACC3900D0C17D /* zip_file_extra_field_set.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_file_extra_field_set.mdoc; sourceTree = ""; }; + 4B28A9FE15BACC3900D0C17D /* zip_file_extra_fields_count.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_file_extra_fields_count.mdoc; sourceTree = ""; }; + 4B28A9FF15BACC3900D0C17D /* zip_file_get_comment.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_file_get_comment.mdoc; sourceTree = ""; }; + 4B28AA0015BACC3900D0C17D /* zip_file_rename.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_file_rename.mdoc; sourceTree = ""; }; + 4B28AA0115BACC3900D0C17D /* zip_file_set_comment.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_file_set_comment.mdoc; sourceTree = ""; }; + 4B28AA0215BACC3900D0C17D /* zip_file_strerror.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_file_strerror.mdoc; sourceTree = ""; }; + 4B28AA0315BACC3900D0C17D /* zip_fopen_encrypted.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_fopen_encrypted.mdoc; sourceTree = ""; }; + 4B28AA0415BACC3900D0C17D /* zip_fopen.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_fopen.mdoc; sourceTree = ""; }; + 4B28AA0515BACC3900D0C17D /* zip_fread.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_fread.mdoc; sourceTree = ""; }; + 4B28AA0615BACC3900D0C17D /* zip_get_archive_comment.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_get_archive_comment.mdoc; sourceTree = ""; }; + 4B28AA0715BACC3900D0C17D /* zip_get_archive_flag.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_get_archive_flag.mdoc; sourceTree = ""; }; + 4B28AA0815BACC3900D0C17D /* zip_get_file_comment.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_get_file_comment.mdoc; sourceTree = ""; }; + 4B28AA0915BACC3900D0C17D /* zip_get_name.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_get_name.mdoc; sourceTree = ""; }; + 4B28AA0A15BACC3900D0C17D /* zip_get_num_entries.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_get_num_entries.mdoc; sourceTree = ""; }; + 4B28AA0B15BACC3900D0C17D /* zip_get_num_files.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_get_num_files.mdoc; sourceTree = ""; }; + 4B28AA0C15BACC3900D0C17D /* zip_name_locate.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_name_locate.mdoc; sourceTree = ""; }; + 4B28AA0D15BACC3900D0C17D /* zip_open.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_open.mdoc; sourceTree = ""; }; + 4B28AA0E15BACC3900D0C17D /* zip_rename.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_rename.mdoc; sourceTree = ""; }; + 4B28AA0F15BACC3900D0C17D /* zip_set_archive_comment.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_set_archive_comment.mdoc; sourceTree = ""; }; + 4B28AA1015BACC3900D0C17D /* zip_set_archive_flag.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_set_archive_flag.mdoc; sourceTree = ""; }; + 4B28AA1115BACC3900D0C17D /* zip_set_default_password.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_set_default_password.mdoc; sourceTree = ""; }; + 4B28AA1215BACC3900D0C17D /* zip_set_file_comment.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_set_file_comment.mdoc; sourceTree = ""; }; + 4B28AA1315BACC3900D0C17D /* zip_set_file_compression.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_set_file_compression.mdoc; sourceTree = ""; }; + 4B28AA1415BACC3900D0C17D /* zip_source_buffer.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_buffer.mdoc; sourceTree = ""; }; + 4B28AA1515BACC3900D0C17D /* zip_source_file.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_file.mdoc; sourceTree = ""; }; + 4B28AA1615BACC3900D0C17D /* zip_source_filep.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_filep.mdoc; sourceTree = ""; }; + 4B28AA1715BACC3900D0C17D /* zip_source_free.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_free.mdoc; sourceTree = ""; }; + 4B28AA1815BACC3900D0C17D /* zip_source_function.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_function.mdoc; sourceTree = ""; }; + 4B28AA1915BACC3900D0C17D /* zip_source_zip.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_zip.mdoc; sourceTree = ""; }; + 4B28AA1A15BACC3900D0C17D /* zip_stat_init.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_stat_init.mdoc; sourceTree = ""; }; + 4B28AA1B15BACC3900D0C17D /* zip_stat.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_stat.mdoc; sourceTree = ""; }; + 4B28AA1C15BACC3900D0C17D /* zip_unchange_all.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_unchange_all.mdoc; sourceTree = ""; }; + 4B28AA1D15BACC3900D0C17D /* zip_unchange_archive.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_unchange_archive.mdoc; sourceTree = ""; }; + 4B28AA1E15BACC3900D0C17D /* zip_unchange.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_unchange.mdoc; sourceTree = ""; }; + 4B28AA1F15BACC3900D0C17D /* zipcmp.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zipcmp.mdoc; sourceTree = ""; }; + 4B28AA2015BACC3900D0C17D /* zipmerge.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zipmerge.mdoc; sourceTree = ""; }; + 4B28AA2215BAD4E200D0C17D /* API-CHANGES.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = "API-CHANGES.md"; sourceTree = ""; }; + 4B28AA2315BAD4E200D0C17D /* AUTHORS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AUTHORS; sourceTree = ""; }; + 4B28AA2415BAD4E200D0C17D /* NEWS.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = NEWS.md; sourceTree = ""; }; + 4B28AA2515BAD4E200D0C17D /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; + 4B28AA2615BAD4E200D0C17D /* THANKS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = THANKS; sourceTree = ""; }; + 4B28AA2715BAD4E200D0C17D /* TODO.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = TODO.md; sourceTree = ""; }; + 4B3A5F4D1DF96D83005A53A1 /* zip_fseek.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_fseek.c; sourceTree = ""; }; + 4B3A5F4E1DF96D83005A53A1 /* zip_ftell.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_ftell.c; sourceTree = ""; }; + 4B3FAE7F2385C5A300192D6A /* zip_algorithm_xz.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_algorithm_xz.c; sourceTree = ""; }; + 4B3FAE812385C79200192D6A /* liblzma.5.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = liblzma.5.dylib; path = ../../../../../../opt/pkg/lib/liblzma.5.dylib; sourceTree = ""; }; + 4B3FAE832385C9E900192D6A /* README Xcode Project.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = "README Xcode Project.md"; sourceTree = ""; }; + 4B41A2651FE15E99005D8C91 /* clone-fs-add.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "clone-fs-add.test"; sourceTree = ""; }; + 4B41A2661FE15FCE005D8C91 /* clone-fs-delete.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "clone-fs-delete.test"; sourceTree = ""; }; + 4B41A2671FE1604E005D8C91 /* clone-fs-replace.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "clone-fs-replace.test"; sourceTree = ""; }; + 4B4CB5572483D7B7005C5428 /* nihtest.conf.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nihtest.conf.in; sourceTree = ""; }; + 4B5169A722A7993D00AA4340 /* zip_mkstempm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_mkstempm.c; sourceTree = ""; }; + 4B51DDB21FDADEDF00C5CA85 /* INSTALL.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = INSTALL.md; sourceTree = ""; }; + 4B51DDB31FDAE1DB00C5CA85 /* ziptool_regress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ziptool_regress.c; sourceTree = ""; }; + 4B51DDC01FDAE20A00C5CA85 /* ziptool_regress */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ziptool_regress; sourceTree = BUILT_PRODUCTS_DIR; }; + 4B55D93F2475274B00CE8C38 /* CMakeLists.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = ""; }; + 4B5D0CD4244B154E006C2E93 /* zip_source_get_file_attributes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_get_file_attributes.c; sourceTree = ""; }; + 4B69E6ED2032F1870001EEE7 /* zip_winzip_aes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_winzip_aes.c; sourceTree = ""; }; + 4B69E6F020330D460001EEE7 /* zip_crypto_gnutls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_crypto_gnutls.c; sourceTree = ""; }; + 4B69E6F2203341D50001EEE7 /* zip_crypto_gnutls.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = zip_crypto_gnutls.h; sourceTree = ""; }; + 4B69E6F3203342E30001EEE7 /* zip_crypto.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = zip_crypto.h; sourceTree = ""; }; + 4B77E61A1FDDCD3A006786BA /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = ""; }; + 4B77E61B1FDEDEA4006786BA /* clone-buffer-delete.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "clone-buffer-delete.test"; sourceTree = ""; }; + 4B77E61C1FDEDEA5006786BA /* clone-buffer-replace.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "clone-buffer-replace.test"; sourceTree = ""; }; + 4B77E61D1FDEDEA5006786BA /* clone-buffer-add.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "clone-buffer-add.test"; sourceTree = ""; }; + 4B82CED319915F360097BC18 /* zip_file_set_mtime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_file_set_mtime.c; sourceTree = ""; }; + 4B908F502385BE6C00886355 /* zip_libzip_version.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_libzip_version.c; sourceTree = ""; }; + 4B908F522385BE6D00886355 /* zip_source_accept_empty.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_accept_empty.c; sourceTree = ""; }; + 4B93995524631B3D00AEBDA4 /* zip_source_file_stdio_named.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_file_stdio_named.c; sourceTree = ""; }; + 4B93995624631B3E00AEBDA4 /* zip_source_file_common.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_file_common.c; sourceTree = ""; }; + 4B93995724631B3E00AEBDA4 /* zip_source_file_stdio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_file_stdio.c; sourceTree = ""; }; + 4B93995824631B3E00AEBDA4 /* zip_source_file_stdio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zip_source_file_stdio.h; sourceTree = ""; }; + 4B93995924631B3E00AEBDA4 /* zip_source_file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zip_source_file.h; sourceTree = ""; }; + 4B93995F24640B1700AEBDA4 /* zip_source_file_win32.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = zip_source_file_win32.h; sourceTree = ""; }; + 4B93996024640B1700AEBDA4 /* zip_source_file_win32.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = zip_source_file_win32.c; sourceTree = ""; }; + 4B93996124641D5700AEBDA4 /* zip_source_file_win32_ansi.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = zip_source_file_win32_ansi.c; sourceTree = ""; }; + 4B93996224643F5700AEBDA4 /* zip_source_file_win32_utf8.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = zip_source_file_win32_utf8.c; sourceTree = ""; }; + 4B9399632464401300AEBDA4 /* zip_source_file_win32_utf16.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_file_win32_utf16.c; sourceTree = ""; }; + 4B93996424644E7E00AEBDA4 /* zip_source_file_win32_named.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = zip_source_file_win32_named.c; sourceTree = ""; }; + 4B939965246553FD00AEBDA4 /* appveyor.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = appveyor.yml; sourceTree = ""; }; + 4B939966246E842200AEBDA4 /* zip_random_win32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_random_win32.c; sourceTree = ""; }; + 4B939967246E842200AEBDA4 /* zip_random_uwp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_random_uwp.c; sourceTree = ""; }; + 4B97204D188EBE85002FAFAD /* zip_file_get_external_attributes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_file_get_external_attributes.c; sourceTree = ""; }; + 4B97204E188EBE85002FAFAD /* zip_file_set_external_attributes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_file_set_external_attributes.c; sourceTree = ""; }; + 4B9E577A24C7026B00CEE0D6 /* zip_algorithm_zstd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_algorithm_zstd.c; sourceTree = ""; }; + 4B9E578324C9769F00CEE0D6 /* zip_crypto_win.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = zip_crypto_win.c; sourceTree = ""; }; + 4B9E578424C9769F00CEE0D6 /* zip_crypto_mbedtls.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = zip_crypto_mbedtls.c; sourceTree = ""; }; + 4B9E578524C9769F00CEE0D6 /* zip_crypto_win.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = zip_crypto_win.h; sourceTree = ""; }; + 4B9E578624C9769F00CEE0D6 /* zip_crypto_mbedtls.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = zip_crypto_mbedtls.h; sourceTree = ""; }; + 4B9E578724C9770C00CEE0D6 /* libzstd.1.4.5.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libzstd.1.4.5.dylib; path = ../../../../../../usr/local/Cellar/zstd/1.4.5/lib/libzstd.1.4.5.dylib; sourceTree = ""; }; + 4B9E578924C9779900CEE0D6 /* zip_err_str.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_err_str.c; sourceTree = SOURCE_ROOT; }; + 4BACD57715BC2AEF00920691 /* add_from_filep.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = add_from_filep.c; path = ../regress/add_from_filep.c; sourceTree = ""; }; + 4BACD57A15BC2AEF00920691 /* fopen_unchanged.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = fopen_unchanged.c; path = ../regress/fopen_unchanged.c; sourceTree = ""; }; + 4BACD57B15BC2AEF00920691 /* fread.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = fread.c; path = ../regress/fread.c; sourceTree = ""; }; + 4BACD57C15BC2AEF00920691 /* ziptool.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ziptool.c; sourceTree = ""; }; + 4BACD58415BC2AEF00920691 /* tryopen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tryopen.c; path = ../regress/tryopen.c; sourceTree = ""; }; + 4BACD58915BC2CEA00920691 /* ziptool */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ziptool; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BACD5C115BC2DC900920691 /* add_from_filep */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = add_from_filep; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BACD5D015BC2DF200920691 /* fopen_unchanged */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fopen_unchanged; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BACD5DF15BC2F3700920691 /* fread */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fread; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BACD65015BC301300920691 /* tryopen */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = tryopen; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BC03F781FDD55C1003C7B62 /* zip-in-archive-comment.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "zip-in-archive-comment.test"; sourceTree = ""; }; + 4BC03F791FDD55C1003C7B62 /* decrypt-wrong-password-aes192.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "decrypt-wrong-password-aes192.test"; sourceTree = ""; }; + 4BC03F7A1FDD55C1003C7B62 /* decrypt-correct-password-pkware.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "decrypt-correct-password-pkware.test"; sourceTree = ""; }; + 4BC03F7B1FDD55C1003C7B62 /* encryption-nonrandom-aes192.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "encryption-nonrandom-aes192.test"; sourceTree = ""; }; + 4BC03F7C1FDD55C1003C7B62 /* decrypt-wrong-password-pkware.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "decrypt-wrong-password-pkware.test"; sourceTree = ""; }; + 4BC03F7D1FDD55C1003C7B62 /* preload.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = preload.test; sourceTree = ""; }; + 4BC03F7E1FDD55C1003C7B62 /* open_file_count.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_file_count.test; sourceTree = ""; }; + 4BC03F7F1FDD55C2003C7B62 /* fseek_fail.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fseek_fail.test; sourceTree = ""; }; + 4BC03F801FDD55C2003C7B62 /* open_multidisk.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_multidisk.test; sourceTree = ""; }; + 4BC03F811FDD55C2003C7B62 /* set_compression_deflate_to_bzip2.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = set_compression_deflate_to_bzip2.test; sourceTree = ""; }; + 4BC03F821FDD55C2003C7B62 /* decrypt-correct-password-aes192.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "decrypt-correct-password-aes192.test"; sourceTree = ""; }; + 4BC03F831FDD55C2003C7B62 /* encryption-nonrandom-aes256.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "encryption-nonrandom-aes256.test"; sourceTree = ""; }; + 4BC03F841FDD55C2003C7B62 /* fseek_ok.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fseek_ok.test; sourceTree = ""; }; + 4BC03F851FDD55C3003C7B62 /* set_compression_store_to_bzip2.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = set_compression_store_to_bzip2.test; sourceTree = ""; }; + 4BC03F861FDD55C3003C7B62 /* open_zip64_3mf.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_zip64_3mf.test; sourceTree = ""; }; + 4BC03F871FDD55C3003C7B62 /* fseek_deflated.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fseek_deflated.test; sourceTree = ""; }; + 4BC03F881FDD55C3003C7B62 /* encryption-remove.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "encryption-remove.test"; sourceTree = ""; }; + 4BC03F891FDD55C3003C7B62 /* add_from_zip_deflated2.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_from_zip_deflated2.test; sourceTree = ""; }; + 4BC03F8A1FDD55C3003C7B62 /* decrypt-wrong-password-aes256.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "decrypt-wrong-password-aes256.test"; sourceTree = ""; }; + 4BC03F8B1FDD55C3003C7B62 /* encryption-nonrandom-aes128.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "encryption-nonrandom-aes128.test"; sourceTree = ""; }; + 4BC03F8C1FDD55C4003C7B62 /* progress.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = progress.test; sourceTree = ""; }; + 4BC03F8D1FDD55C4003C7B62 /* junk_at_start.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = junk_at_start.test; sourceTree = ""; }; + 4BC03F8E1FDD55C4003C7B62 /* buffer-fragment-read.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "buffer-fragment-read.test"; sourceTree = ""; }; + 4BC03F8F1FDD55C4003C7B62 /* decrypt-wrong-password-aes128.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "decrypt-wrong-password-aes128.test"; sourceTree = ""; }; + 4BC03F901FDD55C4003C7B62 /* fdopen_ok.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fdopen_ok.test; sourceTree = ""; }; + 4BC03F911FDD55C4003C7B62 /* junk_at_end.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = junk_at_end.test; sourceTree = ""; }; + 4BC03F921FDD55C4003C7B62 /* decrypt-correct-password-aes128.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "decrypt-correct-password-aes128.test"; sourceTree = ""; }; + 4BC03F931FDD55C5003C7B62 /* decrypt-no-password-aes256.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "decrypt-no-password-aes256.test"; sourceTree = ""; }; + 4BC03F941FDD55C5003C7B62 /* buffer-fragment-write.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "buffer-fragment-write.test"; sourceTree = ""; }; + 4BC03F951FDD55C5003C7B62 /* decrypt-correct-password-aes256.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "decrypt-correct-password-aes256.test"; sourceTree = ""; }; + 4BC03F961FDD55C5003C7B62 /* open_many_fail.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_many_fail.test; sourceTree = ""; }; + 4BC03F971FDD55C5003C7B62 /* set_compression_bzip2_to_deflate.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = set_compression_bzip2_to_deflate.test; sourceTree = ""; }; + 4BC03F981FDD55C5003C7B62 /* set_file_mtime.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = set_file_mtime.test; sourceTree = ""; }; + 4BC03F991FDD5617003C7B62 /* nonrandomopen.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nonrandomopen.c; sourceTree = ""; }; + 4BC03F9A1FDD5617003C7B62 /* fseek.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fseek.c; sourceTree = ""; }; + 4BC03F9B1FDD5617003C7B62 /* nonrandomopentest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nonrandomopentest.c; sourceTree = ""; }; + 4BC03F9C1FDD5617003C7B62 /* malloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = malloc.c; sourceTree = ""; }; + 4BC03F9D1FDD5617003C7B62 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = ""; }; + 4BC03F9E1FDD5642003C7B62 /* extra_field_align.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = extra_field_align.test; sourceTree = ""; }; + 4BC03F9F1FDD5642003C7B62 /* count_entries.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = count_entries.test; sourceTree = ""; }; + 4BC03FA01FDD5660003C7B62 /* cleanup.cmake */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cleanup.cmake; sourceTree = ""; }; + 4BC03FA11FDD603F003C7B62 /* zip_source_buffer_fragment.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_buffer_fragment.mdoc; sourceTree = ""; }; + 4BC03FA21FDD6B6F003C7B62 /* zip_source_begin_write_cloning.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_begin_write_cloning.c; sourceTree = ""; }; + 4BC3863E1A1BE00E00CDCAAC /* zip_get_error.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_get_error.mdoc; sourceTree = ""; }; + 4BC3863F1A1BE00E00CDCAAC /* zip_source_begin_write.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_begin_write.mdoc; sourceTree = ""; }; + 4BC386401A1BE00E00CDCAAC /* zip_source_close.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_close.mdoc; sourceTree = ""; }; + 4BC386411A1BE00E00CDCAAC /* zip_source_commit_write.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_commit_write.mdoc; sourceTree = ""; }; + 4BC386421A1BE00E00CDCAAC /* zip_source_error.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_error.mdoc; sourceTree = ""; }; + 4BC386431A1BE00E00CDCAAC /* ZIP_SOURCE_GET_ARGS.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = ZIP_SOURCE_GET_ARGS.mdoc; sourceTree = ""; }; + 4BC386441A1BE00E00CDCAAC /* zip_source_is_deleted.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_is_deleted.mdoc; sourceTree = ""; }; + 4BC386451A1BE00E00CDCAAC /* zip_source_keep.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_keep.mdoc; sourceTree = ""; }; + 4BC386461A1BE00E00CDCAAC /* zip_source_make_command_bitmap.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_make_command_bitmap.mdoc; sourceTree = ""; }; + 4BC386471A1BE00E00CDCAAC /* zip_source_open.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_open.mdoc; sourceTree = ""; }; + 4BC386481A1BE00E00CDCAAC /* zip_source_read.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_read.mdoc; sourceTree = ""; }; + 4BC386491A1BE00E00CDCAAC /* zip_source_rollback_write.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_rollback_write.mdoc; sourceTree = ""; }; + 4BC3864A1A1BE00E00CDCAAC /* zip_source_seek_write.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_seek_write.mdoc; sourceTree = ""; }; + 4BC3864B1A1BE00E00CDCAAC /* zip_source_seek.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_seek.mdoc; sourceTree = ""; }; + 4BC3864C1A1BE00E00CDCAAC /* zip_source_stat.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_stat.mdoc; sourceTree = ""; }; + 4BC3864D1A1BE00E00CDCAAC /* zip_source_tell_write.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_tell_write.mdoc; sourceTree = ""; }; + 4BC3864E1A1BE00E00CDCAAC /* zip_source_tell.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_tell.mdoc; sourceTree = ""; }; + 4BC3864F1A1BE00E00CDCAAC /* zip_source_write.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source_write.mdoc; sourceTree = ""; }; + 4BC386501A1BE00E00CDCAAC /* zip_source.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_source.mdoc; sourceTree = ""; }; + 4BC386511A1BE04700CDCAAC /* fix-man-links.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "fix-man-links.sh"; sourceTree = ""; }; + 4BC386521A1BE04700CDCAAC /* make_zip_errors.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = make_zip_errors.sh; sourceTree = ""; }; + 4BC386531A1BE04700CDCAAC /* nih-man.css */ = {isa = PBXFileReference; lastKnownFileType = text.css; path = "nih-man.css"; sourceTree = ""; }; + 4BC972001A0A1D85003A2981 /* zip_error_to_data.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_error_to_data.mdoc; sourceTree = ""; }; + 4BCB434119E9347E0067FAA3 /* zip_buffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_buffer.c; sourceTree = ""; }; + 4BCD77A71A14E404001A9F55 /* zip_file_get_error.mdoc */ = {isa = PBXFileReference; lastKnownFileType = text; path = zip_file_get_error.mdoc; sourceTree = ""; }; + 4BCD77A81A14E921001A9F55 /* zip_source_seek_compute_offset.mdoc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = zip_source_seek_compute_offset.mdoc; sourceTree = ""; }; + 4BCD77A91A14ED5C001A9F55 /* CMakeLists.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = ""; }; + 4BCF3019199A2F820064207B /* zip_io_util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_io_util.c; sourceTree = ""; }; + 4BCF301A199A2F820064207B /* zip_source_begin_write.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_begin_write.c; sourceTree = ""; }; + 4BCF301B199A2F820064207B /* zip_source_commit_write.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_commit_write.c; sourceTree = ""; }; + 4BCF301C199A2F820064207B /* zip_source_rollback_write.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_rollback_write.c; sourceTree = ""; }; + 4BCF301D199A2F820064207B /* zip_source_seek.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_seek.c; sourceTree = ""; }; + 4BCF301E199A2F820064207B /* zip_source_supports.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_supports.c; sourceTree = ""; }; + 4BCF301F199A2F820064207B /* zip_source_tell.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_tell.c; sourceTree = ""; }; + 4BCF3020199A2F820064207B /* zip_source_write.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_write.c; sourceTree = ""; }; + 4BCF3031199ABD3A0064207B /* zip_source_remove.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_remove.c; sourceTree = ""; }; + 4BCF3034199ABDDA0064207B /* zip_source_seek_write.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_seek_write.c; sourceTree = ""; }; + 4BCF3035199ABDDA0064207B /* zip_source_tell_write.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_tell_write.c; sourceTree = ""; }; + 4BD155CE191CD28D0046F012 /* NiHTest.pm */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = text.script.perl; path = NiHTest.pm; sourceTree = ""; tabWidth = 4; usesTabs = 1; }; + 4BD155CF191CD28D0046F012 /* runtest.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = runtest.in; sourceTree = ""; }; + 4BD25DA51CF58790005A9EC4 /* compat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compat.h; sourceTree = ""; }; + 4BD35E411A33366200256CB7 /* add_dir.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_dir.test; sourceTree = ""; }; + 4BD35E421A33366200256CB7 /* add_from_buffer.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_from_buffer.test; sourceTree = ""; }; + 4BD35E431A33366200256CB7 /* add_from_file_duplicate.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_from_file_duplicate.test; sourceTree = ""; }; + 4BD35E441A33366200256CB7 /* add_from_file_twice_duplicate.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_from_file_twice_duplicate.test; sourceTree = ""; }; + 4BD35E451A33366200256CB7 /* add_from_file.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_from_file.test; sourceTree = ""; }; + 4BD35E461A33366200256CB7 /* add_from_filep.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_from_filep.test; sourceTree = ""; }; + 4BD35E471A33366200256CB7 /* add_from_stdin.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_from_stdin.test; sourceTree = ""; }; + 4BD35E481A33366200256CB7 /* add_from_zip_closed.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_from_zip_closed.test; sourceTree = ""; }; + 4BD35E491A33366200256CB7 /* add_from_zip_deflated.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_from_zip_deflated.test; sourceTree = ""; }; + 4BD35E4A1A33366200256CB7 /* add_from_zip_partial_deflated.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_from_zip_partial_deflated.test; sourceTree = ""; }; + 4BD35E4B1A33366200256CB7 /* add_from_zip_partial_stored.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_from_zip_partial_stored.test; sourceTree = ""; }; + 4BD35E4C1A33366200256CB7 /* add_from_zip_stored.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_from_zip_stored.test; sourceTree = ""; }; + 4BD35E4E1A33366200256CB7 /* add_stored_in_memory.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_stored_in_memory.test; sourceTree = ""; }; + 4BD35E4F1A33366200256CB7 /* add_stored.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_stored.test; sourceTree = ""; }; + 4BD35E501A33366200256CB7 /* cm-default.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cm-default.test"; sourceTree = ""; }; + 4BD35E511A33366200256CB7 /* delete_add_same.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = delete_add_same.test; sourceTree = ""; }; + 4BD35E521A33366200256CB7 /* delete_invalid.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = delete_invalid.test; sourceTree = ""; }; + 4BD35E531A33366200256CB7 /* delete_last.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = delete_last.test; sourceTree = ""; }; + 4BD35E541A33366200256CB7 /* delete_multiple_last.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = delete_multiple_last.test; sourceTree = ""; }; + 4BD35E551A33366200256CB7 /* delete_multiple_partial.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = delete_multiple_partial.test; sourceTree = ""; }; + 4BD35E561A33366200256CB7 /* delete_renamed_rename.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = delete_renamed_rename.test; sourceTree = ""; }; + 4BD35E5B1A33366200256CB7 /* encrypt.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = encrypt.test; sourceTree = ""; }; + 4BD35E5C1A33366200256CB7 /* extra_add_multiple.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = extra_add_multiple.test; sourceTree = ""; }; + 4BD35E5D1A33366200256CB7 /* extra_add.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = extra_add.test; sourceTree = ""; }; + 4BD35E5E1A33366200256CB7 /* extra_count_by_id.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = extra_count_by_id.test; sourceTree = ""; }; + 4BD35E5F1A33366200256CB7 /* extra_count_ignore_zip64.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = extra_count_ignore_zip64.test; sourceTree = ""; }; + 4BD35E601A33366200256CB7 /* extra_count.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = extra_count.test; sourceTree = ""; }; + 4BD35E611A33366200256CB7 /* extra_delete_by_id.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = extra_delete_by_id.test; sourceTree = ""; }; + 4BD35E621A33366200256CB7 /* extra_delete.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = extra_delete.test; sourceTree = ""; }; + 4BD35E631A33366200256CB7 /* extra_get_by_id.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = extra_get_by_id.test; sourceTree = ""; }; + 4BD35E641A33366200256CB7 /* extra_get.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = extra_get.test; sourceTree = ""; }; + 4BD35E651A33366200256CB7 /* extra_set_modify_c.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = extra_set_modify_c.test; sourceTree = ""; }; + 4BD35E661A33366200256CB7 /* extra_set_modify_l.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = extra_set_modify_l.test; sourceTree = ""; }; + 4BD35E671A33366200256CB7 /* extra_set.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = extra_set.test; sourceTree = ""; }; + 4BD35E681A33366200256CB7 /* file_comment_encmismatch.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = file_comment_encmismatch.test; sourceTree = ""; }; + 4BD35E691A33366200256CB7 /* fopen_unchanged.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fopen_unchanged.test; sourceTree = ""; }; + 4BD35E6A1A33366200256CB7 /* fread.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fread.test; sourceTree = ""; }; + 4BD35E6B1A33366200256CB7 /* get_comment.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = get_comment.test; sourceTree = ""; }; + 4BD35E8E1A33366200256CB7 /* name_locate.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = name_locate.test; sourceTree = ""; }; + 4BD35E8F1A33366200256CB7 /* open_cons_extrabytes.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_cons_extrabytes.test; sourceTree = ""; }; + 4BD35E901A33366200256CB7 /* open_empty_2.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_empty_2.test; sourceTree = ""; }; + 4BD35E911A33366200256CB7 /* open_empty.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_empty.test; sourceTree = ""; }; + 4BD35E921A33366200256CB7 /* open_extrabytes.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_extrabytes.test; sourceTree = ""; }; + 4BD35E931A33366200256CB7 /* open_filename_duplicate_consistency.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_filename_duplicate_consistency.test; sourceTree = ""; }; + 4BD35E941A33366200256CB7 /* open_filename_duplicate_empty_consistency.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_filename_duplicate_empty_consistency.test; sourceTree = ""; }; + 4BD35E951A33366200256CB7 /* open_filename_duplicate_empty.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_filename_duplicate_empty.test; sourceTree = ""; }; + 4BD35E961A33366200256CB7 /* open_filename_duplicate.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_filename_duplicate.test; sourceTree = ""; }; + 4BD35E971A33366200256CB7 /* open_filename_empty.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_filename_empty.test; sourceTree = ""; }; + 4BD35E981A33366200256CB7 /* open_incons.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_incons.test; sourceTree = ""; }; + 4BD35E991A33366200256CB7 /* open_many_ok.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_many_ok.test; sourceTree = ""; }; + 4BD35E9A1A33366200256CB7 /* open_new_but_exists.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_new_but_exists.test; sourceTree = ""; }; + 4BD35E9B1A33366200256CB7 /* open_new_ok.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_new_ok.test; sourceTree = ""; }; + 4BD35E9C1A33366200256CB7 /* open_nonarchive.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_nonarchive.test; sourceTree = ""; }; + 4BD35E9D1A33366200256CB7 /* open_nosuchfile.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_nosuchfile.test; sourceTree = ""; }; + 4BD35E9E1A33366200256CB7 /* open_ok.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_ok.test; sourceTree = ""; }; + 4BD35E9F1A33366200256CB7 /* open_too_short.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_too_short.test; sourceTree = ""; }; + 4BD35EA01A33366200256CB7 /* open_truncate.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_truncate.test; sourceTree = ""; }; + 4BD35EA11A33366200256CB7 /* open_zip64_ok.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = open_zip64_ok.test; sourceTree = ""; }; + 4BD35EA21A33366200256CB7 /* rename_ascii.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rename_ascii.test; sourceTree = ""; }; + 4BD35EA31A33366200256CB7 /* rename_cp437.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rename_cp437.test; sourceTree = ""; }; + 4BD35EA41A33366200256CB7 /* rename_deleted.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rename_deleted.test; sourceTree = ""; }; + 4BD35EA51A33366200256CB7 /* rename_fail.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rename_fail.test; sourceTree = ""; }; + 4BD35EA61A33366200256CB7 /* rename_ok.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rename_ok.test; sourceTree = ""; }; + 4BD35EA81A33366200256CB7 /* rename_utf8_encmismatch.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rename_utf8_encmismatch.test; sourceTree = ""; }; + 4BD35EA91A33366200256CB7 /* rename_utf8.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rename_utf8.test; sourceTree = ""; }; + 4BD35EAA1A33366200256CB7 /* set_comment_all.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = set_comment_all.test; sourceTree = ""; }; + 4BD35EAB1A33366200256CB7 /* set_comment_localonly.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = set_comment_localonly.test; sourceTree = ""; }; + 4BD35EAC1A33366200256CB7 /* set_comment_removeglobal.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = set_comment_removeglobal.test; sourceTree = ""; }; + 4BD35EAD1A33366200256CB7 /* set_comment_revert.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = set_comment_revert.test; sourceTree = ""; }; + 4BD35EAE1A33366200256CB7 /* set_compression_deflate_to_deflate.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = set_compression_deflate_to_deflate.test; sourceTree = ""; }; + 4BD35EAF1A33366200256CB7 /* set_compression_deflate_to_store.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = set_compression_deflate_to_store.test; sourceTree = ""; }; + 4BD35EB01A33366200256CB7 /* set_compression_store_to_deflate.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = set_compression_store_to_deflate.test; sourceTree = ""; }; + 4BD35EB11A33366200256CB7 /* set_compression_store_to_store.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = set_compression_store_to_store.test; sourceTree = ""; }; + 4BD35EB21A33366200256CB7 /* set_compression_unknown.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = set_compression_unknown.test; sourceTree = ""; }; + 4BD35EB41A33366200256CB7 /* stat_index_cp437_guess.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = stat_index_cp437_guess.test; sourceTree = ""; }; + 4BD35EB51A33366200256CB7 /* stat_index_cp437_raw.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = stat_index_cp437_raw.test; sourceTree = ""; }; + 4BD35EB61A33366200256CB7 /* stat_index_cp437_strict.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = stat_index_cp437_strict.test; sourceTree = ""; }; + 4BD35EB71A33366200256CB7 /* stat_index_fileorder.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = stat_index_fileorder.test; sourceTree = ""; }; + 4BD35EB81A33366200256CB7 /* stat_index_streamed_zip64.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = stat_index_streamed_zip64.test; sourceTree = ""; }; + 4BD35EB91A33366200256CB7 /* stat_index_streamed.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = stat_index_streamed.test; sourceTree = ""; }; + 4BD35EBA1A33366200256CB7 /* stat_index_utf8_guess.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = stat_index_utf8_guess.test; sourceTree = ""; }; + 4BD35EBB1A33366200256CB7 /* stat_index_utf8_raw.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = stat_index_utf8_raw.test; sourceTree = ""; }; + 4BD35EBC1A33366200256CB7 /* stat_index_utf8_strict.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = stat_index_utf8_strict.test; sourceTree = ""; }; + 4BD35EBD1A33366200256CB7 /* stat_index_utf8_unmarked_strict.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = stat_index_utf8_unmarked_strict.test; sourceTree = ""; }; + 4BD35EBE1A33366200256CB7 /* stat_index_zip64.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = stat_index_zip64.test; sourceTree = ""; }; + 4BD35EE11A33366300256CB7 /* utf-8-standardization.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "utf-8-standardization.test"; sourceTree = ""; }; + 4BD35EE31A33366300256CB7 /* zip64_creation.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = zip64_creation.test; sourceTree = ""; }; + 4BD35EE41A33366300256CB7 /* zip64_stored_creation.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = zip64_stored_creation.test; sourceTree = ""; }; + 4BD5053219A0116D007DD28A /* zip_source_call.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_call.c; sourceTree = ""; }; + 4BD6CB5C19E6A5D900710654 /* source_hole.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = source_hole.c; sourceTree = ""; }; + 4BD6CB5E19E71B3B00710654 /* hole.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hole.c; sourceTree = ""; }; + 4BD6CB6C19E71CD100710654 /* hole */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = hole; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BD708781EB1CF73003F351F /* zip_progress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_progress.c; sourceTree = ""; }; + 4BDC71F115B1B25E00236D3C /* zip_add_dir.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_add_dir.c; path = ../lib/zip_add_dir.c; sourceTree = ""; }; + 4BDC71F215B1B25E00236D3C /* zip_add_entry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_add_entry.c; path = ../lib/zip_add_entry.c; sourceTree = ""; }; + 4BDC71F315B1B25E00236D3C /* zip_add.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_add.c; path = ../lib/zip_add.c; sourceTree = ""; }; + 4BDC71F415B1B25E00236D3C /* zip_close.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_close.c; path = ../lib/zip_close.c; sourceTree = ""; }; + 4BDC71F515B1B25E00236D3C /* zip_delete.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_delete.c; path = ../lib/zip_delete.c; sourceTree = ""; }; + 4BDC71F615B1B25E00236D3C /* zip_dir_add.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_dir_add.c; path = ../lib/zip_dir_add.c; sourceTree = ""; }; + 4BDC71F715B1B25E00236D3C /* zip_dirent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_dirent.c; path = ../lib/zip_dirent.c; sourceTree = ""; }; + 4BDC71F815B1B25E00236D3C /* zip_discard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_discard.c; path = ../lib/zip_discard.c; sourceTree = ""; }; + 4BDC71F915B1B25E00236D3C /* zip_entry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_entry.c; path = ../lib/zip_entry.c; sourceTree = ""; }; + 4BDC71FB15B1B25E00236D3C /* zip_error_clear.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_error_clear.c; path = ../lib/zip_error_clear.c; sourceTree = ""; }; + 4BDC71FC15B1B25E00236D3C /* zip_error_get_sys_type.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_error_get_sys_type.c; path = ../lib/zip_error_get_sys_type.c; sourceTree = ""; }; + 4BDC71FD15B1B25E00236D3C /* zip_error_get.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_error_get.c; path = ../lib/zip_error_get.c; sourceTree = ""; }; + 4BDC71FE15B1B25E00236D3C /* zip_error_strerror.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_error_strerror.c; path = ../lib/zip_error_strerror.c; sourceTree = ""; }; + 4BDC71FF15B1B25E00236D3C /* zip_error_to_str.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_error_to_str.c; path = ../lib/zip_error_to_str.c; sourceTree = ""; }; + 4BDC720015B1B25E00236D3C /* zip_error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_error.c; path = ../lib/zip_error.c; sourceTree = ""; }; + 4BDC720115B1B25E00236D3C /* zip_extra_field_api.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_extra_field_api.c; path = ../lib/zip_extra_field_api.c; sourceTree = ""; }; + 4BDC720215B1B25E00236D3C /* zip_extra_field.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_extra_field.c; path = ../lib/zip_extra_field.c; sourceTree = ""; }; + 4BDC720315B1B25E00236D3C /* zip_fclose.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_fclose.c; path = ../lib/zip_fclose.c; sourceTree = ""; }; + 4BDC720415B1B25E00236D3C /* zip_fdopen.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_fdopen.c; path = ../lib/zip_fdopen.c; sourceTree = ""; }; + 4BDC720515B1B25E00236D3C /* zip_file_add.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_file_add.c; path = ../lib/zip_file_add.c; sourceTree = ""; }; + 4BDC720615B1B25E00236D3C /* zip_file_error_clear.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_file_error_clear.c; path = ../lib/zip_file_error_clear.c; sourceTree = ""; }; + 4BDC720715B1B25E00236D3C /* zip_file_error_get.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_file_error_get.c; path = ../lib/zip_file_error_get.c; sourceTree = ""; }; + 4BDC720815B1B25E00236D3C /* zip_file_get_comment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_file_get_comment.c; path = ../lib/zip_file_get_comment.c; sourceTree = ""; }; + 4BDC720915B1B25E00236D3C /* zip_file_get_offset.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_file_get_offset.c; path = ../lib/zip_file_get_offset.c; sourceTree = ""; }; + 4BDC720A15B1B25E00236D3C /* zip_file_rename.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_file_rename.c; path = ../lib/zip_file_rename.c; sourceTree = ""; }; + 4BDC720B15B1B25E00236D3C /* zip_file_replace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_file_replace.c; path = ../lib/zip_file_replace.c; sourceTree = ""; }; + 4BDC720C15B1B25E00236D3C /* zip_file_set_comment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_file_set_comment.c; path = ../lib/zip_file_set_comment.c; sourceTree = ""; }; + 4BDC720D15B1B25E00236D3C /* zip_file_strerror.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_file_strerror.c; path = ../lib/zip_file_strerror.c; sourceTree = ""; }; + 4BDC720F15B1B25E00236D3C /* zip_fopen_encrypted.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_fopen_encrypted.c; path = ../lib/zip_fopen_encrypted.c; sourceTree = ""; }; + 4BDC721015B1B25E00236D3C /* zip_fopen_index_encrypted.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_fopen_index_encrypted.c; path = ../lib/zip_fopen_index_encrypted.c; sourceTree = ""; }; + 4BDC721115B1B25E00236D3C /* zip_fopen_index.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_fopen_index.c; path = ../lib/zip_fopen_index.c; sourceTree = ""; }; + 4BDC721215B1B25E00236D3C /* zip_fopen.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_fopen.c; path = ../lib/zip_fopen.c; sourceTree = ""; }; + 4BDC721315B1B25E00236D3C /* zip_fread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_fread.c; path = ../lib/zip_fread.c; sourceTree = ""; }; + 4BDC721415B1B25E00236D3C /* zip_get_archive_comment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_get_archive_comment.c; path = ../lib/zip_get_archive_comment.c; sourceTree = ""; }; + 4BDC721515B1B25E00236D3C /* zip_get_archive_flag.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_get_archive_flag.c; path = ../lib/zip_get_archive_flag.c; sourceTree = ""; }; + 4BDC721715B1B25E00236D3C /* zip_get_encryption_implementation.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_get_encryption_implementation.c; path = ../lib/zip_get_encryption_implementation.c; sourceTree = ""; }; + 4BDC721815B1B25E00236D3C /* zip_get_file_comment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_get_file_comment.c; path = ../lib/zip_get_file_comment.c; sourceTree = ""; }; + 4BDC721915B1B25E00236D3C /* zip_get_name.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_get_name.c; path = ../lib/zip_get_name.c; sourceTree = ""; }; + 4BDC721A15B1B25E00236D3C /* zip_get_num_entries.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_get_num_entries.c; path = ../lib/zip_get_num_entries.c; sourceTree = ""; }; + 4BDC721B15B1B25E00236D3C /* zip_get_num_files.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_get_num_files.c; path = ../lib/zip_get_num_files.c; sourceTree = ""; }; + 4BDC721C15B1B25E00236D3C /* zip_memdup.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_memdup.c; path = ../lib/zip_memdup.c; sourceTree = ""; }; + 4BDC721D15B1B25E00236D3C /* zip_name_locate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_name_locate.c; path = ../lib/zip_name_locate.c; sourceTree = ""; }; + 4BDC721E15B1B25E00236D3C /* zip_new.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_new.c; path = ../lib/zip_new.c; sourceTree = ""; }; + 4BDC721F15B1B25E00236D3C /* zip_open.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_open.c; path = ../lib/zip_open.c; sourceTree = ""; tabWidth = 8; usesTabs = 1; }; + 4BDC722015B1B25E00236D3C /* zip_rename.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_rename.c; path = ../lib/zip_rename.c; sourceTree = ""; }; + 4BDC722115B1B25E00236D3C /* zip_replace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_replace.c; path = ../lib/zip_replace.c; sourceTree = ""; }; + 4BDC722215B1B25E00236D3C /* zip_set_archive_comment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_set_archive_comment.c; path = ../lib/zip_set_archive_comment.c; sourceTree = ""; }; + 4BDC722315B1B25E00236D3C /* zip_set_archive_flag.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_set_archive_flag.c; path = ../lib/zip_set_archive_flag.c; sourceTree = ""; }; + 4BDC722415B1B25E00236D3C /* zip_set_default_password.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_set_default_password.c; path = ../lib/zip_set_default_password.c; sourceTree = ""; }; + 4BDC722515B1B25E00236D3C /* zip_set_file_comment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_set_file_comment.c; path = ../lib/zip_set_file_comment.c; sourceTree = ""; }; + 4BDC722615B1B25E00236D3C /* zip_set_file_compression.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_set_file_compression.c; path = ../lib/zip_set_file_compression.c; sourceTree = ""; }; + 4BDC722715B1B25E00236D3C /* zip_set_name.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_set_name.c; path = ../lib/zip_set_name.c; sourceTree = ""; }; + 4BDC722815B1B25E00236D3C /* zip_source_buffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_source_buffer.c; path = ../lib/zip_source_buffer.c; sourceTree = ""; }; + 4BDC722915B1B25E00236D3C /* zip_source_close.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_source_close.c; path = ../lib/zip_source_close.c; sourceTree = ""; }; + 4BDC722A15B1B25E00236D3C /* zip_source_crc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_source_crc.c; path = ../lib/zip_source_crc.c; sourceTree = ""; }; + 4BDC722C15B1B25E00236D3C /* zip_source_error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_source_error.c; path = ../lib/zip_source_error.c; sourceTree = ""; }; + 4BDC722F15B1B25E00236D3C /* zip_source_free.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_source_free.c; path = ../lib/zip_source_free.c; sourceTree = ""; }; + 4BDC723015B1B25E00236D3C /* zip_source_function.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_source_function.c; path = ../lib/zip_source_function.c; sourceTree = ""; }; + 4BDC723115B1B25E00236D3C /* zip_source_layered.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_source_layered.c; path = ../lib/zip_source_layered.c; sourceTree = ""; }; + 4BDC723215B1B25E00236D3C /* zip_source_open.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_source_open.c; path = ../lib/zip_source_open.c; sourceTree = ""; }; + 4BDC723515B1B25E00236D3C /* zip_source_read.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_source_read.c; path = ../lib/zip_source_read.c; sourceTree = ""; }; + 4BDC723615B1B25E00236D3C /* zip_source_stat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_source_stat.c; path = ../lib/zip_source_stat.c; sourceTree = ""; }; + 4BDC723715B1B25E00236D3C /* zip_source_window.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_source_window.c; path = ../lib/zip_source_window.c; sourceTree = ""; }; + 4BDC723815B1B25E00236D3C /* zip_source_zip_new.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_source_zip_new.c; path = ../lib/zip_source_zip_new.c; sourceTree = ""; }; + 4BDC723915B1B25E00236D3C /* zip_source_zip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_source_zip.c; path = ../lib/zip_source_zip.c; sourceTree = ""; }; + 4BDC723A15B1B25E00236D3C /* zip_stat_index.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_stat_index.c; path = ../lib/zip_stat_index.c; sourceTree = ""; }; + 4BDC723B15B1B25E00236D3C /* zip_stat_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_stat_init.c; path = ../lib/zip_stat_init.c; sourceTree = ""; }; + 4BDC723C15B1B25E00236D3C /* zip_stat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_stat.c; path = ../lib/zip_stat.c; sourceTree = ""; }; + 4BDC723D15B1B25E00236D3C /* zip_strerror.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_strerror.c; path = ../lib/zip_strerror.c; sourceTree = ""; }; + 4BDC723E15B1B25E00236D3C /* zip_string.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_string.c; path = ../lib/zip_string.c; sourceTree = ""; }; + 4BDC723F15B1B25E00236D3C /* zip_unchange_all.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_unchange_all.c; path = ../lib/zip_unchange_all.c; sourceTree = ""; }; + 4BDC724015B1B25E00236D3C /* zip_unchange_archive.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_unchange_archive.c; path = ../lib/zip_unchange_archive.c; sourceTree = ""; }; + 4BDC724115B1B25E00236D3C /* zip_unchange_data.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_unchange_data.c; path = ../lib/zip_unchange_data.c; sourceTree = ""; }; + 4BDC724215B1B25E00236D3C /* zip_unchange.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip_unchange.c; path = ../lib/zip_unchange.c; sourceTree = ""; }; + 4BDC724315B1B25E00236D3C /* zip_utf-8.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "zip_utf-8.c"; path = "../lib/zip_utf-8.c"; sourceTree = ""; }; + 4BDC729815B1B2A600236D3C /* zip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zip.h; path = ../lib/zip.h; sourceTree = ""; }; + 4BDC729915B1B2A600236D3C /* zipint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zipint.h; path = ../lib/zipint.h; sourceTree = ""; }; + 4BDC729E15B1B4E900236D3C /* zipconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zipconf.h; sourceTree = SOURCE_ROOT; }; + 4BDC72A015B1B56400236D3C /* config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = SOURCE_ROOT; }; + 4BE402AC19D94AE400298248 /* zip_source_is_deleted.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_is_deleted.c; sourceTree = ""; }; + 4BE92AA420345E2E00509BC8 /* libgnutls.30.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgnutls.30.dylib; path = ../../../../../../opt/pkg/lib/libgnutls.30.dylib; sourceTree = ""; }; + 4BE92AA620345E3800509BC8 /* libbz2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libbz2.tbd; path = usr/lib/libbz2.tbd; sourceTree = SDKROOT; }; + 4BE92AA820345E5500509BC8 /* libnettle.6.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libnettle.6.dylib; path = ../../../../../../opt/pkg/lib/libnettle.6.dylib; sourceTree = ""; }; + 4BE92AAA20346B1900509BC8 /* zip_crypto_openssl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = zip_crypto_openssl.h; sourceTree = ""; }; + 4BE92AAB20346B1900509BC8 /* zip_crypto_openssl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = zip_crypto_openssl.c; sourceTree = ""; }; + 4BE92AB0203597D700509BC8 /* zip_crypto_commoncrypto.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = zip_crypto_commoncrypto.h; sourceTree = ""; }; + 4BE92AB1203597D700509BC8 /* zip_crypto_commoncrypto.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = zip_crypto_commoncrypto.c; sourceTree = ""; }; + 4BFF2B341FDEEF8B006EF3F3 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = ""; }; + 4BFF2B351FDEF277006EF3F3 /* cmake-config.h.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cmake-config.h.in"; sourceTree = ""; }; + 4BFF2B361FDEF277006EF3F3 /* cmake-zipconf.h.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cmake-zipconf.h.in"; sourceTree = ""; }; + 4BFF2B511FE12FCA006EF3F3 /* can_clone_file */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = can_clone_file; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BFF2B541FE13033006EF3F3 /* can_clone_file.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = can_clone_file.c; sourceTree = ""; }; + 736ED9B71E3D688C00C36873 /* zip_file_set_encryption.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_file_set_encryption.c; sourceTree = ""; }; + 736ED9B81E3D688C00C36873 /* zip_random_unix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_random_unix.c; sourceTree = ""; }; + 736ED9B91E3D688C00C36873 /* zip_source_winzip_aes_decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_winzip_aes_decode.c; sourceTree = ""; }; + 736ED9BA1E3D688C00C36873 /* zip_source_winzip_aes_encode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_winzip_aes_encode.c; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 3D7E35341B3305FB00022624 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3D7E35481B33076C00022624 /* libz.dylib in Frameworks */, + 3D7E35461B33064B00022624 /* libzip.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4B01D68715B2F3F1002D5007 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4B9E578824C9770C00CEE0D6 /* libzstd.1.4.5.dylib in Frameworks */, + 4BE92AA720345E3800509BC8 /* libbz2.tbd in Frameworks */, + 4B01D73C15B2F6AF002D5007 /* libz.dylib in Frameworks */, + 4B3FAE822385C79200192D6A /* liblzma.5.dylib in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4B01D6FA15B2F4B1002D5007 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4B01D70915B2F4CF002D5007 /* libz.dylib in Frameworks */, + 4B01D70715B2F4C5002D5007 /* libzip.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4B01D70C15B2F4EB002D5007 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4B01D70D15B2F4EB002D5007 /* libz.dylib in Frameworks */, + 4B01D70E15B2F4EB002D5007 /* libzip.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4B51DDB91FDAE20A00C5CA85 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4B51DDBA1FDAE20A00C5CA85 /* libz.dylib in Frameworks */, + 4B51DDBB1FDAE20A00C5CA85 /* libzip.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BACD58615BC2CEA00920691 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4BACD59415BC2D0800920691 /* libz.dylib in Frameworks */, + 4BACD59315BC2CFA00920691 /* libzip.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BACD5BA15BC2DC900920691 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4BACD5BB15BC2DC900920691 /* libz.dylib in Frameworks */, + 4BACD5BC15BC2DC900920691 /* libzip.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BACD5C915BC2DF200920691 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4BACD5CA15BC2DF200920691 /* libz.dylib in Frameworks */, + 4BACD5CB15BC2DF200920691 /* libzip.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BACD5D815BC2F3700920691 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4BACD5D915BC2F3700920691 /* libz.dylib in Frameworks */, + 4BACD5DA15BC2F3700920691 /* libzip.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BACD64915BC301300920691 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4BACD64A15BC301300920691 /* libz.dylib in Frameworks */, + 4BACD64B15BC301300920691 /* libzip.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BD6CB6519E71CD100710654 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4BD6CB6619E71CD100710654 /* libz.dylib in Frameworks */, + 4BD6CB6719E71CD100710654 /* libzip.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BFF2B4A1FE12FCA006EF3F3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3D7E353E1B33063600022624 /* examples */ = { + isa = PBXGroup; + children = ( + 3D7E35401B33063600022624 /* in-memory.c */, + 3D7E35421B33063600022624 /* windows-open.c */, + ); + name = examples; + path = ../examples; + sourceTree = ""; + }; + 4B01D72015B2F54C002D5007 /* src */ = { + isa = PBXGroup; + children = ( + 4B55D93F2475274B00CE8C38 /* CMakeLists.txt */, + 4B01D72115B2F572002D5007 /* zipcmp.c */, + 4B01D72215B2F572002D5007 /* zipmerge.c */, + 4BACD57C15BC2AEF00920691 /* ziptool.c */, + ); + name = src; + path = ../src; + sourceTree = ""; + }; + 4B28A9EA15BACBE100D0C17D /* man */ = { + isa = PBXGroup; + children = ( + 4BCD77A91A14ED5C001A9F55 /* CMakeLists.txt */, + 4B1ABD1B1A2E5E4D00C93867 /* handle_links */, + 4B1ABD1A1A2E5DA700C93867 /* links */, + 4BC386511A1BE04700CDCAAC /* fix-man-links.sh */, + 4BC386521A1BE04700CDCAAC /* make_zip_errors.sh */, + 4B26FF181A07DFEA000E9788 /* mkdocset.pl */, + 4BC386531A1BE04700CDCAAC /* nih-man.css */, + 4B28A9EC15BACC3900D0C17D /* libzip.mdoc */, + 4B28A9ED15BACC3900D0C17D /* zip_add_dir.mdoc */, + 4B28A9EE15BACC3900D0C17D /* zip_add.mdoc */, + 4B28A9EF15BACC3900D0C17D /* zip_close.mdoc */, + 4B28A9F015BACC3900D0C17D /* zip_delete.mdoc */, + 4B28A9F115BACC3900D0C17D /* zip_dir_add.mdoc */, + 4B28A9F215BACC3900D0C17D /* zip_discard.mdoc */, + 4B28A9F315BACC3900D0C17D /* zip_error_clear.mdoc */, + 4B1E46E51A08CB7600A376D2 /* zip_error_code_system.mdoc */, + 4B1E46E61A08CB7600A376D2 /* zip_error_code_zip.mdoc */, + 4B1E46E71A08CB7600A376D2 /* zip_error_fini.mdoc */, + 4B28A9F415BACC3900D0C17D /* zip_error_get_sys_type.mdoc */, + 4B28A9F515BACC3900D0C17D /* zip_error_get.mdoc */, + 4B1E46E81A08CB7600A376D2 /* zip_error_init.mdoc */, + 4B1E46E91A08CB7600A376D2 /* zip_error_set.mdoc */, + 4B1E46EA1A08CB7600A376D2 /* zip_error_strerror.mdoc */, + 4B1E46EB1A08CB7600A376D2 /* zip_error_system_type.mdoc */, + 4BC972001A0A1D85003A2981 /* zip_error_to_data.mdoc */, + 4B28A9F615BACC3900D0C17D /* zip_error_to_str.mdoc */, + 4B28A9F715BACC3900D0C17D /* zip_errors.mdoc */, + 4B28A9F815BACC3900D0C17D /* zip_fclose.mdoc */, + 4B28A9F915BACC3900D0C17D /* zip_fdopen.mdoc */, + 4B28A9FA15BACC3900D0C17D /* zip_file_add.mdoc */, + 4B28A9FB15BACC3900D0C17D /* zip_file_extra_field_delete.mdoc */, + 4B28A9FC15BACC3900D0C17D /* zip_file_extra_field_get.mdoc */, + 4B28A9FD15BACC3900D0C17D /* zip_file_extra_field_set.mdoc */, + 4B28A9FE15BACC3900D0C17D /* zip_file_extra_fields_count.mdoc */, + 4B28A9FF15BACC3900D0C17D /* zip_file_get_comment.mdoc */, + 4BCD77A71A14E404001A9F55 /* zip_file_get_error.mdoc */, + 4B26FF151A07DF1A000E9788 /* zip_file_get_external_attributes.mdoc */, + 4B28AA0015BACC3900D0C17D /* zip_file_rename.mdoc */, + 4B28AA0115BACC3900D0C17D /* zip_file_set_comment.mdoc */, + 4B26FF161A07DF1A000E9788 /* zip_file_set_external_attributes.mdoc */, + 4B26FF171A07DF1A000E9788 /* zip_file_set_mtime.mdoc */, + 4B28AA0215BACC3900D0C17D /* zip_file_strerror.mdoc */, + 4B28AA0315BACC3900D0C17D /* zip_fopen_encrypted.mdoc */, + 4B28AA0415BACC3900D0C17D /* zip_fopen.mdoc */, + 4B28AA0515BACC3900D0C17D /* zip_fread.mdoc */, + 4B28AA0615BACC3900D0C17D /* zip_get_archive_comment.mdoc */, + 4B28AA0715BACC3900D0C17D /* zip_get_archive_flag.mdoc */, + 4BC3863E1A1BE00E00CDCAAC /* zip_get_error.mdoc */, + 4B28AA0815BACC3900D0C17D /* zip_get_file_comment.mdoc */, + 4B28AA0915BACC3900D0C17D /* zip_get_name.mdoc */, + 4B28AA0A15BACC3900D0C17D /* zip_get_num_entries.mdoc */, + 4B28AA0B15BACC3900D0C17D /* zip_get_num_files.mdoc */, + 4B28AA0C15BACC3900D0C17D /* zip_name_locate.mdoc */, + 4B28AA0D15BACC3900D0C17D /* zip_open.mdoc */, + 4B28AA0E15BACC3900D0C17D /* zip_rename.mdoc */, + 4B28AA0F15BACC3900D0C17D /* zip_set_archive_comment.mdoc */, + 4B28AA1015BACC3900D0C17D /* zip_set_archive_flag.mdoc */, + 4B28AA1115BACC3900D0C17D /* zip_set_default_password.mdoc */, + 4B28AA1215BACC3900D0C17D /* zip_set_file_comment.mdoc */, + 4B28AA1315BACC3900D0C17D /* zip_set_file_compression.mdoc */, + 4BC3863F1A1BE00E00CDCAAC /* zip_source_begin_write.mdoc */, + 4B28AA1415BACC3900D0C17D /* zip_source_buffer.mdoc */, + 4BC03FA11FDD603F003C7B62 /* zip_source_buffer_fragment.mdoc */, + 4BC386401A1BE00E00CDCAAC /* zip_source_close.mdoc */, + 4BC386411A1BE00E00CDCAAC /* zip_source_commit_write.mdoc */, + 4BC386421A1BE00E00CDCAAC /* zip_source_error.mdoc */, + 4B28AA1515BACC3900D0C17D /* zip_source_file.mdoc */, + 4B28AA1615BACC3900D0C17D /* zip_source_filep.mdoc */, + 4B28AA1715BACC3900D0C17D /* zip_source_free.mdoc */, + 4B28AA1815BACC3900D0C17D /* zip_source_function.mdoc */, + 4BC386431A1BE00E00CDCAAC /* ZIP_SOURCE_GET_ARGS.mdoc */, + 4BC386441A1BE00E00CDCAAC /* zip_source_is_deleted.mdoc */, + 4BC386451A1BE00E00CDCAAC /* zip_source_keep.mdoc */, + 4BC386461A1BE00E00CDCAAC /* zip_source_make_command_bitmap.mdoc */, + 4BC386471A1BE00E00CDCAAC /* zip_source_open.mdoc */, + 4BC386481A1BE00E00CDCAAC /* zip_source_read.mdoc */, + 4BC386491A1BE00E00CDCAAC /* zip_source_rollback_write.mdoc */, + 4BCD77A81A14E921001A9F55 /* zip_source_seek_compute_offset.mdoc */, + 4BC3864A1A1BE00E00CDCAAC /* zip_source_seek_write.mdoc */, + 4BC3864B1A1BE00E00CDCAAC /* zip_source_seek.mdoc */, + 4BC3864C1A1BE00E00CDCAAC /* zip_source_stat.mdoc */, + 4BC3864D1A1BE00E00CDCAAC /* zip_source_tell_write.mdoc */, + 4BC3864E1A1BE00E00CDCAAC /* zip_source_tell.mdoc */, + 4BC3864F1A1BE00E00CDCAAC /* zip_source_write.mdoc */, + 4B28AA1915BACC3900D0C17D /* zip_source_zip.mdoc */, + 4BC386501A1BE00E00CDCAAC /* zip_source.mdoc */, + 4B28AA1A15BACC3900D0C17D /* zip_stat_init.mdoc */, + 4B28AA1B15BACC3900D0C17D /* zip_stat.mdoc */, + 4B28AA1C15BACC3900D0C17D /* zip_unchange_all.mdoc */, + 4B28AA1D15BACC3900D0C17D /* zip_unchange_archive.mdoc */, + 4B28AA1E15BACC3900D0C17D /* zip_unchange.mdoc */, + 4B28AA1F15BACC3900D0C17D /* zipcmp.mdoc */, + 4B28AA2015BACC3900D0C17D /* zipmerge.mdoc */, + ); + name = man; + path = ../man; + sourceTree = ""; + }; + 4B28AA2815BAD4F800D0C17D /* info */ = { + isa = PBXGroup; + children = ( + 4B939965246553FD00AEBDA4 /* appveyor.yml */, + 4B28AA2215BAD4E200D0C17D /* API-CHANGES.md */, + 4B28AA2315BAD4E200D0C17D /* AUTHORS */, + 4B28AA2415BAD4E200D0C17D /* NEWS.md */, + 4B28AA2515BAD4E200D0C17D /* README.md */, + 4B51DDB21FDADEDF00C5CA85 /* INSTALL.md */, + 4B28AA2615BAD4E200D0C17D /* THANKS */, + 4B28AA2715BAD4E200D0C17D /* TODO.md */, + 4BFF2B341FDEEF8B006EF3F3 /* CMakeLists.txt */, + 4BFF2B351FDEF277006EF3F3 /* cmake-config.h.in */, + 4BFF2B361FDEF277006EF3F3 /* cmake-zipconf.h.in */, + ); + name = info; + path = ..; + sourceTree = ""; + }; + 4BACD57415BC2AA100920691 /* regress */ = { + isa = PBXGroup; + children = ( + 4BACD57715BC2AEF00920691 /* add_from_filep.c */, + 4BFF2B541FE13033006EF3F3 /* can_clone_file.c */, + 4BC03FA01FDD5660003C7B62 /* cleanup.cmake */, + 4BC03F9D1FDD5617003C7B62 /* CMakeLists.txt */, + 4BACD57A15BC2AEF00920691 /* fopen_unchanged.c */, + 4BACD57B15BC2AEF00920691 /* fread.c */, + 4BC03F9A1FDD5617003C7B62 /* fseek.c */, + 4BD6CB5E19E71B3B00710654 /* hole.c */, + 4BC03F9C1FDD5617003C7B62 /* malloc.c */, + 4B4CB5572483D7B7005C5428 /* nihtest.conf.in */, + 4BD155CE191CD28D0046F012 /* NiHTest.pm */, + 4BC03F991FDD5617003C7B62 /* nonrandomopen.c */, + 4BC03F9B1FDD5617003C7B62 /* nonrandomopentest.c */, + 4BD155CF191CD28D0046F012 /* runtest.in */, + 4BD6CB5C19E6A5D900710654 /* source_hole.c */, + 4BD35E401A33362A00256CB7 /* test cases */, + 4BACD58415BC2AEF00920691 /* tryopen.c */, + 4B51DDB31FDAE1DB00C5CA85 /* ziptool_regress.c */, + ); + name = regress; + path = ../regress; + sourceTree = ""; + }; + 4BD35E401A33362A00256CB7 /* test cases */ = { + isa = PBXGroup; + children = ( + 4BD35E411A33366200256CB7 /* add_dir.test */, + 4BD35E421A33366200256CB7 /* add_from_buffer.test */, + 4BD35E431A33366200256CB7 /* add_from_file_duplicate.test */, + 4BD35E441A33366200256CB7 /* add_from_file_twice_duplicate.test */, + 4BD35E451A33366200256CB7 /* add_from_file.test */, + 4BD35E461A33366200256CB7 /* add_from_filep.test */, + 4BD35E471A33366200256CB7 /* add_from_stdin.test */, + 4BD35E481A33366200256CB7 /* add_from_zip_closed.test */, + 4BD35E491A33366200256CB7 /* add_from_zip_deflated.test */, + 4BC03F891FDD55C3003C7B62 /* add_from_zip_deflated2.test */, + 4BD35E4A1A33366200256CB7 /* add_from_zip_partial_deflated.test */, + 4BD35E4B1A33366200256CB7 /* add_from_zip_partial_stored.test */, + 4BD35E4C1A33366200256CB7 /* add_from_zip_stored.test */, + 4BD35E4E1A33366200256CB7 /* add_stored_in_memory.test */, + 4BD35E4F1A33366200256CB7 /* add_stored.test */, + 4BC03F8E1FDD55C4003C7B62 /* buffer-fragment-read.test */, + 4BC03F941FDD55C5003C7B62 /* buffer-fragment-write.test */, + 4B00CA28242F5C2500E0B71C /* cancel_45.test */, + 4B00CA2B242F5C2500E0B71C /* cancel_90.test */, + 4B77E61D1FDEDEA5006786BA /* clone-buffer-add.test */, + 4B77E61B1FDEDEA4006786BA /* clone-buffer-delete.test */, + 4B77E61C1FDEDEA5006786BA /* clone-buffer-replace.test */, + 4B41A2651FE15E99005D8C91 /* clone-fs-add.test */, + 4B41A2661FE15FCE005D8C91 /* clone-fs-delete.test */, + 4B41A2671FE1604E005D8C91 /* clone-fs-replace.test */, + 4BD35E501A33366200256CB7 /* cm-default.test */, + 4BC03F9F1FDD5642003C7B62 /* count_entries.test */, + 4BC03F921FDD55C4003C7B62 /* decrypt-correct-password-aes128.test */, + 4BC03F821FDD55C2003C7B62 /* decrypt-correct-password-aes192.test */, + 4BC03F951FDD55C5003C7B62 /* decrypt-correct-password-aes256.test */, + 4BC03F7A1FDD55C1003C7B62 /* decrypt-correct-password-pkware.test */, + 4BC03F931FDD55C5003C7B62 /* decrypt-no-password-aes256.test */, + 4BC03F8F1FDD55C4003C7B62 /* decrypt-wrong-password-aes128.test */, + 4BC03F791FDD55C1003C7B62 /* decrypt-wrong-password-aes192.test */, + 4BC03F8A1FDD55C3003C7B62 /* decrypt-wrong-password-aes256.test */, + 4BC03F7C1FDD55C1003C7B62 /* decrypt-wrong-password-pkware.test */, + 4BD35E511A33366200256CB7 /* delete_add_same.test */, + 4BD35E521A33366200256CB7 /* delete_invalid.test */, + 4BD35E531A33366200256CB7 /* delete_last.test */, + 4BD35E541A33366200256CB7 /* delete_multiple_last.test */, + 4BD35E551A33366200256CB7 /* delete_multiple_partial.test */, + 4BD35E561A33366200256CB7 /* delete_renamed_rename.test */, + 4BD35E5B1A33366200256CB7 /* encrypt.test */, + 4BC03F8B1FDD55C3003C7B62 /* encryption-nonrandom-aes128.test */, + 4BC03F7B1FDD55C1003C7B62 /* encryption-nonrandom-aes192.test */, + 4BC03F831FDD55C2003C7B62 /* encryption-nonrandom-aes256.test */, + 4B00CA2A242F5C2500E0B71C /* encryption-nonrandom-pkware.test */, + 4BC03F881FDD55C3003C7B62 /* encryption-remove.test */, + 4BD35E5C1A33366200256CB7 /* extra_add_multiple.test */, + 4BD35E5D1A33366200256CB7 /* extra_add.test */, + 4BD35E5E1A33366200256CB7 /* extra_count_by_id.test */, + 4BD35E5F1A33366200256CB7 /* extra_count_ignore_zip64.test */, + 4BD35E601A33366200256CB7 /* extra_count.test */, + 4BD35E611A33366200256CB7 /* extra_delete_by_id.test */, + 4BD35E621A33366200256CB7 /* extra_delete.test */, + 4BC03F9E1FDD5642003C7B62 /* extra_field_align.test */, + 4BD35E631A33366200256CB7 /* extra_get_by_id.test */, + 4BD35E641A33366200256CB7 /* extra_get.test */, + 4BD35E651A33366200256CB7 /* extra_set_modify_c.test */, + 4BD35E661A33366200256CB7 /* extra_set_modify_l.test */, + 4BD35E671A33366200256CB7 /* extra_set.test */, + 4BC03F901FDD55C4003C7B62 /* fdopen_ok.test */, + 4BD35E681A33366200256CB7 /* file_comment_encmismatch.test */, + 4BD35E691A33366200256CB7 /* fopen_unchanged.test */, + 4BD35E6A1A33366200256CB7 /* fread.test */, + 4BC03F871FDD55C3003C7B62 /* fseek_deflated.test */, + 4BC03F7F1FDD55C2003C7B62 /* fseek_fail.test */, + 4BC03F841FDD55C2003C7B62 /* fseek_ok.test */, + 4BD35E6B1A33366200256CB7 /* get_comment.test */, + 4BC03F911FDD55C4003C7B62 /* junk_at_end.test */, + 4BC03F8D1FDD55C4003C7B62 /* junk_at_start.test */, + 4BD35E8E1A33366200256CB7 /* name_locate.test */, + 4BD35E8F1A33366200256CB7 /* open_cons_extrabytes.test */, + 4BD35E901A33366200256CB7 /* open_empty_2.test */, + 4BD35E911A33366200256CB7 /* open_empty.test */, + 4BD35E921A33366200256CB7 /* open_extrabytes.test */, + 4BC03F7E1FDD55C1003C7B62 /* open_file_count.test */, + 4BD35E931A33366200256CB7 /* open_filename_duplicate_consistency.test */, + 4BD35E941A33366200256CB7 /* open_filename_duplicate_empty_consistency.test */, + 4BD35E951A33366200256CB7 /* open_filename_duplicate_empty.test */, + 4BD35E961A33366200256CB7 /* open_filename_duplicate.test */, + 4BD35E971A33366200256CB7 /* open_filename_empty.test */, + 4BD35E981A33366200256CB7 /* open_incons.test */, + 4BC03F961FDD55C5003C7B62 /* open_many_fail.test */, + 4BD35E991A33366200256CB7 /* open_many_ok.test */, + 4BC03F801FDD55C2003C7B62 /* open_multidisk.test */, + 4BD35E9A1A33366200256CB7 /* open_new_but_exists.test */, + 4BD35E9B1A33366200256CB7 /* open_new_ok.test */, + 4BD35E9C1A33366200256CB7 /* open_nonarchive.test */, + 4BD35E9D1A33366200256CB7 /* open_nosuchfile.test */, + 4BD35E9E1A33366200256CB7 /* open_ok.test */, + 4BD35E9F1A33366200256CB7 /* open_too_short.test */, + 4BD35EA01A33366200256CB7 /* open_truncate.test */, + 4BC03F861FDD55C3003C7B62 /* open_zip64_3mf.test */, + 4BD35EA11A33366200256CB7 /* open_zip64_ok.test */, + 4BC03F7D1FDD55C1003C7B62 /* preload.test */, + 4BC03F8C1FDD55C4003C7B62 /* progress.test */, + 4BD35EA21A33366200256CB7 /* rename_ascii.test */, + 4BD35EA31A33366200256CB7 /* rename_cp437.test */, + 4BD35EA41A33366200256CB7 /* rename_deleted.test */, + 4BD35EA51A33366200256CB7 /* rename_fail.test */, + 4BD35EA61A33366200256CB7 /* rename_ok.test */, + 4BD35EA81A33366200256CB7 /* rename_utf8_encmismatch.test */, + 4BD35EA91A33366200256CB7 /* rename_utf8.test */, + 4BD35EAA1A33366200256CB7 /* set_comment_all.test */, + 4BD35EAB1A33366200256CB7 /* set_comment_localonly.test */, + 4BD35EAC1A33366200256CB7 /* set_comment_removeglobal.test */, + 4BD35EAD1A33366200256CB7 /* set_comment_revert.test */, + 4BC03F971FDD55C5003C7B62 /* set_compression_bzip2_to_deflate.test */, + 4BC03F811FDD55C2003C7B62 /* set_compression_deflate_to_bzip2.test */, + 4BD35EAE1A33366200256CB7 /* set_compression_deflate_to_deflate.test */, + 4BD35EAF1A33366200256CB7 /* set_compression_deflate_to_store.test */, + 4BC03F851FDD55C3003C7B62 /* set_compression_store_to_bzip2.test */, + 4BD35EB01A33366200256CB7 /* set_compression_store_to_deflate.test */, + 4BD35EB11A33366200256CB7 /* set_compression_store_to_store.test */, + 4B00CA29242F5C2500E0B71C /* set_compression_store_to_xz.test */, + 4BD35EB21A33366200256CB7 /* set_compression_unknown.test */, + 4B00CA2C242F5C2500E0B71C /* set_compression_xz_to_store.test */, + 4B00CA27242F5C2500E0B71C /* set_file_dostime.test */, + 4BC03F981FDD55C5003C7B62 /* set_file_mtime.test */, + 4BD35EB41A33366200256CB7 /* stat_index_cp437_guess.test */, + 4BD35EB51A33366200256CB7 /* stat_index_cp437_raw.test */, + 4BD35EB61A33366200256CB7 /* stat_index_cp437_strict.test */, + 4BD35EB71A33366200256CB7 /* stat_index_fileorder.test */, + 4BD35EB81A33366200256CB7 /* stat_index_streamed_zip64.test */, + 4BD35EB91A33366200256CB7 /* stat_index_streamed.test */, + 4BD35EBA1A33366200256CB7 /* stat_index_utf8_guess.test */, + 4BD35EBB1A33366200256CB7 /* stat_index_utf8_raw.test */, + 4BD35EBC1A33366200256CB7 /* stat_index_utf8_strict.test */, + 4BD35EBD1A33366200256CB7 /* stat_index_utf8_unmarked_strict.test */, + 4BD35EBE1A33366200256CB7 /* stat_index_zip64.test */, + 4BD35EE11A33366300256CB7 /* utf-8-standardization.test */, + 4BC03F781FDD55C1003C7B62 /* zip-in-archive-comment.test */, + 4BD35EE31A33366300256CB7 /* zip64_creation.test */, + 4BD35EE41A33366300256CB7 /* zip64_stored_creation.test */, + ); + name = "test cases"; + sourceTree = ""; + }; + 4BDC71BD15B181DA00236D3C = { + isa = PBXGroup; + children = ( + 4B3FAE832385C9E900192D6A /* README Xcode Project.md */, + 4B28AA2815BAD4F800D0C17D /* info */, + 4BDC71E415B182B200236D3C /* Supporting Files */, + 3D7E353E1B33063600022624 /* examples */, + 4BDC71E315B182B200236D3C /* libzip */, + 4B01D72015B2F54C002D5007 /* src */, + 4BACD57415BC2AA100920691 /* regress */, + 4B28A9EA15BACBE100D0C17D /* man */, + 4BDC71CA15B181DA00236D3C /* Frameworks */, + 4BDC71C915B181DA00236D3C /* Products */, + ); + sourceTree = ""; + tabWidth = 8; + }; + 4BDC71C915B181DA00236D3C /* Products */ = { + isa = PBXGroup; + children = ( + 4B01D68B15B2F3F1002D5007 /* libzip.framework */, + 4B01D6FD15B2F4B1002D5007 /* zipmerge */, + 4B01D71315B2F4EB002D5007 /* zipcmp */, + 4BACD58915BC2CEA00920691 /* ziptool */, + 4BACD5C115BC2DC900920691 /* add_from_filep */, + 4BACD5D015BC2DF200920691 /* fopen_unchanged */, + 4BACD5DF15BC2F3700920691 /* fread */, + 4BACD65015BC301300920691 /* tryopen */, + 4BD6CB6C19E71CD100710654 /* hole */, + 3D7E35371B3305FB00022624 /* in-memory */, + 4B51DDC01FDAE20A00C5CA85 /* ziptool_regress */, + 4BFF2B511FE12FCA006EF3F3 /* can_clone_file */, + ); + name = Products; + sourceTree = ""; + }; + 4BDC71CA15B181DA00236D3C /* Frameworks */ = { + isa = PBXGroup; + children = ( + 4B9E578724C9770C00CEE0D6 /* libzstd.1.4.5.dylib */, + 4B3FAE812385C79200192D6A /* liblzma.5.dylib */, + 4BE92AA820345E5500509BC8 /* libnettle.6.dylib */, + 4BE92AA620345E3800509BC8 /* libbz2.tbd */, + 4BE92AA420345E2E00509BC8 /* libgnutls.30.dylib */, + 3D7E35471B33076C00022624 /* libz.dylib */, + 4B01D70815B2F4CF002D5007 /* libz.dylib */, + ); + name = Frameworks; + sourceTree = ""; + }; + 4BDC71E315B182B200236D3C /* libzip */ = { + isa = PBXGroup; + children = ( + 4B77E61A1FDDCD3A006786BA /* CMakeLists.txt */, + 4BD25DA51CF58790005A9EC4 /* compat.h */, + 4BDC72A015B1B56400236D3C /* config.h */, + 4BDC71F115B1B25E00236D3C /* zip_add_dir.c */, + 4BDC71F215B1B25E00236D3C /* zip_add_entry.c */, + 4BDC71F315B1B25E00236D3C /* zip_add.c */, + 4B0454B41E8E3DF7002FA1F9 /* zip_algorithm_bzip2.c */, + 4B0454B51E8E3DF7002FA1F9 /* zip_algorithm_deflate.c */, + 4B3FAE7F2385C5A300192D6A /* zip_algorithm_xz.c */, + 4B9E577A24C7026B00CEE0D6 /* zip_algorithm_zstd.c */, + 4BCB434119E9347E0067FAA3 /* zip_buffer.c */, + 4BDC71F415B1B25E00236D3C /* zip_close.c */, + 4BE92AB1203597D700509BC8 /* zip_crypto_commoncrypto.c */, + 4BE92AB0203597D700509BC8 /* zip_crypto_commoncrypto.h */, + 4B69E6F020330D460001EEE7 /* zip_crypto_gnutls.c */, + 4B69E6F2203341D50001EEE7 /* zip_crypto_gnutls.h */, + 4B9E578424C9769F00CEE0D6 /* zip_crypto_mbedtls.c */, + 4B9E578624C9769F00CEE0D6 /* zip_crypto_mbedtls.h */, + 4BE92AAB20346B1900509BC8 /* zip_crypto_openssl.c */, + 4BE92AAA20346B1900509BC8 /* zip_crypto_openssl.h */, + 4B9E578324C9769F00CEE0D6 /* zip_crypto_win.c */, + 4B9E578524C9769F00CEE0D6 /* zip_crypto_win.h */, + 4B69E6F3203342E30001EEE7 /* zip_crypto.h */, + 4BDC71F515B1B25E00236D3C /* zip_delete.c */, + 4BDC71F615B1B25E00236D3C /* zip_dir_add.c */, + 4BDC71F715B1B25E00236D3C /* zip_dirent.c */, + 4BDC71F815B1B25E00236D3C /* zip_discard.c */, + 4BDC71F915B1B25E00236D3C /* zip_entry.c */, + 4B9E578924C9779900CEE0D6 /* zip_err_str.c */, + 4BDC71FB15B1B25E00236D3C /* zip_error_clear.c */, + 4BDC71FC15B1B25E00236D3C /* zip_error_get_sys_type.c */, + 4BDC71FD15B1B25E00236D3C /* zip_error_get.c */, + 4BDC71FE15B1B25E00236D3C /* zip_error_strerror.c */, + 4BDC71FF15B1B25E00236D3C /* zip_error_to_str.c */, + 4BDC720015B1B25E00236D3C /* zip_error.c */, + 4BDC720115B1B25E00236D3C /* zip_extra_field_api.c */, + 4BDC720215B1B25E00236D3C /* zip_extra_field.c */, + 4BDC720315B1B25E00236D3C /* zip_fclose.c */, + 4BDC720415B1B25E00236D3C /* zip_fdopen.c */, + 4BDC720515B1B25E00236D3C /* zip_file_add.c */, + 4BDC720615B1B25E00236D3C /* zip_file_error_clear.c */, + 4BDC720715B1B25E00236D3C /* zip_file_error_get.c */, + 4BDC720815B1B25E00236D3C /* zip_file_get_comment.c */, + 4B97204D188EBE85002FAFAD /* zip_file_get_external_attributes.c */, + 4BDC720915B1B25E00236D3C /* zip_file_get_offset.c */, + 4BDC720A15B1B25E00236D3C /* zip_file_rename.c */, + 4BDC720B15B1B25E00236D3C /* zip_file_replace.c */, + 4BDC720C15B1B25E00236D3C /* zip_file_set_comment.c */, + 736ED9B71E3D688C00C36873 /* zip_file_set_encryption.c */, + 4B97204E188EBE85002FAFAD /* zip_file_set_external_attributes.c */, + 4B82CED319915F360097BC18 /* zip_file_set_mtime.c */, + 4BDC720D15B1B25E00236D3C /* zip_file_strerror.c */, + 4BDC720F15B1B25E00236D3C /* zip_fopen_encrypted.c */, + 4BDC721015B1B25E00236D3C /* zip_fopen_index_encrypted.c */, + 4BDC721115B1B25E00236D3C /* zip_fopen_index.c */, + 4BDC721215B1B25E00236D3C /* zip_fopen.c */, + 4BDC721315B1B25E00236D3C /* zip_fread.c */, + 4B3A5F4D1DF96D83005A53A1 /* zip_fseek.c */, + 4B3A5F4E1DF96D83005A53A1 /* zip_ftell.c */, + 4BDC721415B1B25E00236D3C /* zip_get_archive_comment.c */, + 4BDC721515B1B25E00236D3C /* zip_get_archive_flag.c */, + 4BDC721715B1B25E00236D3C /* zip_get_encryption_implementation.c */, + 4BDC721815B1B25E00236D3C /* zip_get_file_comment.c */, + 4BDC721915B1B25E00236D3C /* zip_get_name.c */, + 4BDC721A15B1B25E00236D3C /* zip_get_num_entries.c */, + 4BDC721B15B1B25E00236D3C /* zip_get_num_files.c */, + 3D9284801C309510001EABA7 /* zip_hash.c */, + 4BCF3019199A2F820064207B /* zip_io_util.c */, + 4B908F502385BE6C00886355 /* zip_libzip_version.c */, + 4BDC721C15B1B25E00236D3C /* zip_memdup.c */, + 4B5169A722A7993D00AA4340 /* zip_mkstempm.c */, + 4BDC721D15B1B25E00236D3C /* zip_name_locate.c */, + 4BDC721E15B1B25E00236D3C /* zip_new.c */, + 4BDC721F15B1B25E00236D3C /* zip_open.c */, + 4B00CA22242F59D700E0B71C /* zip_pkware.c */, + 4BD708781EB1CF73003F351F /* zip_progress.c */, + 736ED9B81E3D688C00C36873 /* zip_random_unix.c */, + 4B939967246E842200AEBDA4 /* zip_random_uwp.c */, + 4B939966246E842200AEBDA4 /* zip_random_win32.c */, + 4BDC722015B1B25E00236D3C /* zip_rename.c */, + 4BDC722115B1B25E00236D3C /* zip_replace.c */, + 4BDC722215B1B25E00236D3C /* zip_set_archive_comment.c */, + 4BDC722315B1B25E00236D3C /* zip_set_archive_flag.c */, + 4BDC722415B1B25E00236D3C /* zip_set_default_password.c */, + 4BDC722515B1B25E00236D3C /* zip_set_file_comment.c */, + 4BDC722615B1B25E00236D3C /* zip_set_file_compression.c */, + 4BDC722715B1B25E00236D3C /* zip_set_name.c */, + 4B908F522385BE6D00886355 /* zip_source_accept_empty.c */, + 4BC03FA21FDD6B6F003C7B62 /* zip_source_begin_write_cloning.c */, + 4BCF301A199A2F820064207B /* zip_source_begin_write.c */, + 4BDC722815B1B25E00236D3C /* zip_source_buffer.c */, + 4BD5053219A0116D007DD28A /* zip_source_call.c */, + 4BDC722915B1B25E00236D3C /* zip_source_close.c */, + 4BCF301B199A2F820064207B /* zip_source_commit_write.c */, + 4B0454B61E8E3DF7002FA1F9 /* zip_source_compress.c */, + 4BDC722A15B1B25E00236D3C /* zip_source_crc.c */, + 4BDC722C15B1B25E00236D3C /* zip_source_error.c */, + 4B93995624631B3E00AEBDA4 /* zip_source_file_common.c */, + 4B93995524631B3D00AEBDA4 /* zip_source_file_stdio_named.c */, + 4B93995724631B3E00AEBDA4 /* zip_source_file_stdio.c */, + 4B93995824631B3E00AEBDA4 /* zip_source_file_stdio.h */, + 4B93996124641D5700AEBDA4 /* zip_source_file_win32_ansi.c */, + 4B93996424644E7E00AEBDA4 /* zip_source_file_win32_named.c */, + 4B93996224643F5700AEBDA4 /* zip_source_file_win32_utf8.c */, + 4B9399632464401300AEBDA4 /* zip_source_file_win32_utf16.c */, + 4B93996024640B1700AEBDA4 /* zip_source_file_win32.c */, + 4B93995F24640B1700AEBDA4 /* zip_source_file_win32.h */, + 4B93995924631B3E00AEBDA4 /* zip_source_file.h */, + 4BDC722F15B1B25E00236D3C /* zip_source_free.c */, + 4BDC723015B1B25E00236D3C /* zip_source_function.c */, + 4B5D0CD4244B154E006C2E93 /* zip_source_get_file_attributes.c */, + 4BE402AC19D94AE400298248 /* zip_source_is_deleted.c */, + 4BDC723115B1B25E00236D3C /* zip_source_layered.c */, + 4BDC723215B1B25E00236D3C /* zip_source_open.c */, + 4B00CA21242F59D700E0B71C /* zip_source_pkware_decode.c */, + 4B00CA23242F59D700E0B71C /* zip_source_pkware_encode.c */, + 4BDC723515B1B25E00236D3C /* zip_source_read.c */, + 4BCF3031199ABD3A0064207B /* zip_source_remove.c */, + 4BCF301C199A2F820064207B /* zip_source_rollback_write.c */, + 4BCF3034199ABDDA0064207B /* zip_source_seek_write.c */, + 4BCF301D199A2F820064207B /* zip_source_seek.c */, + 4BDC723615B1B25E00236D3C /* zip_source_stat.c */, + 4BCF301E199A2F820064207B /* zip_source_supports.c */, + 4BCF3035199ABDDA0064207B /* zip_source_tell_write.c */, + 4BCF301F199A2F820064207B /* zip_source_tell.c */, + 4BDC723715B1B25E00236D3C /* zip_source_window.c */, + 736ED9B91E3D688C00C36873 /* zip_source_winzip_aes_decode.c */, + 736ED9BA1E3D688C00C36873 /* zip_source_winzip_aes_encode.c */, + 4BCF3020199A2F820064207B /* zip_source_write.c */, + 4BDC723815B1B25E00236D3C /* zip_source_zip_new.c */, + 4BDC723915B1B25E00236D3C /* zip_source_zip.c */, + 4BDC723A15B1B25E00236D3C /* zip_stat_index.c */, + 4BDC723B15B1B25E00236D3C /* zip_stat_init.c */, + 4BDC723C15B1B25E00236D3C /* zip_stat.c */, + 4BDC723D15B1B25E00236D3C /* zip_strerror.c */, + 4BDC723E15B1B25E00236D3C /* zip_string.c */, + 4BDC723F15B1B25E00236D3C /* zip_unchange_all.c */, + 4BDC724015B1B25E00236D3C /* zip_unchange_archive.c */, + 4BDC724115B1B25E00236D3C /* zip_unchange_data.c */, + 4BDC724215B1B25E00236D3C /* zip_unchange.c */, + 4BDC724315B1B25E00236D3C /* zip_utf-8.c */, + 4B69E6ED2032F1870001EEE7 /* zip_winzip_aes.c */, + 4BDC729815B1B2A600236D3C /* zip.h */, + 4BDC729E15B1B4E900236D3C /* zipconf.h */, + 4BDC729915B1B2A600236D3C /* zipint.h */, + ); + name = libzip; + path = ../lib; + sourceTree = ""; + }; + 4BDC71E415B182B200236D3C /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 3D77B86517009AA1000A5794 /* extract-version.sh */, + 4B01D73D15B2FB6B002D5007 /* Info.plist */, + ); + name = "Supporting Files"; + path = libzip; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 4B01D68815B2F3F1002D5007 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 4BE92AB3203597D700509BC8 /* zip_crypto_commoncrypto.h in Headers */, + 4B93995D24631B3E00AEBDA4 /* zip_source_file_stdio.h in Headers */, + 4BE92AAD20346B1900509BC8 /* zip_crypto_openssl.h in Headers */, + 4B93995E24631B3E00AEBDA4 /* zip_source_file.h in Headers */, + 4B01D73215B2F5EE002D5007 /* zipconf.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 3D7E35361B3305FB00022624 /* in-memory */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3D7E353D1B3305FB00022624 /* Build configuration list for PBXNativeTarget "in-memory" */; + buildPhases = ( + 3D7E35331B3305FB00022624 /* Sources */, + 3D7E35341B3305FB00022624 /* Frameworks */, + 3D7E35351B3305FB00022624 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 3D7E35451B33064500022624 /* PBXTargetDependency */, + ); + name = "in-memory"; + productName = "in-memory-example"; + productReference = 3D7E35371B3305FB00022624 /* in-memory */; + productType = "com.apple.product-type.tool"; + }; + 4B01D68A15B2F3F1002D5007 /* libzip */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4B01D69E15B2F3F1002D5007 /* Build configuration list for PBXNativeTarget "libzip" */; + buildPhases = ( + 4B01D68615B2F3F1002D5007 /* Sources */, + 4B01D68715B2F3F1002D5007 /* Frameworks */, + 4B01D68815B2F3F1002D5007 /* Headers */, + 4B01D68915B2F3F1002D5007 /* Resources */, + 3D77B86617009AC5000A5794 /* Copy Version Info from config.h */, + 4B972053188EBEB8002FAFAD /* Fix zipconf.h include. */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = libzip; + productName = "libzip Mac"; + productReference = 4B01D68B15B2F3F1002D5007 /* libzip.framework */; + productType = "com.apple.product-type.framework"; + }; + 4B01D6FC15B2F4B1002D5007 /* zipmerge */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4B01D70415B2F4B1002D5007 /* Build configuration list for PBXNativeTarget "zipmerge" */; + buildPhases = ( + 4B01D6F915B2F4B1002D5007 /* Sources */, + 4B01D6FA15B2F4B1002D5007 /* Frameworks */, + 4B01D6FB15B2F4B1002D5007 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 4B01D73615B2F639002D5007 /* PBXTargetDependency */, + ); + name = zipmerge; + productName = zipmerge; + productReference = 4B01D6FD15B2F4B1002D5007 /* zipmerge */; + productType = "com.apple.product-type.tool"; + }; + 4B01D70A15B2F4EB002D5007 /* zipcmp */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4B01D71015B2F4EB002D5007 /* Build configuration list for PBXNativeTarget "zipcmp" */; + buildPhases = ( + 4B01D70B15B2F4EB002D5007 /* Sources */, + 4B01D70C15B2F4EB002D5007 /* Frameworks */, + 4B01D70F15B2F4EB002D5007 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 4B01D73815B2F643002D5007 /* PBXTargetDependency */, + ); + name = zipcmp; + productName = zipcmp; + productReference = 4B01D71315B2F4EB002D5007 /* zipcmp */; + productType = "com.apple.product-type.tool"; + }; + 4B51DDB41FDAE20A00C5CA85 /* ziptool_regress */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4B51DDBD1FDAE20A00C5CA85 /* Build configuration list for PBXNativeTarget "ziptool_regress" */; + buildPhases = ( + 4B51DDB71FDAE20A00C5CA85 /* Sources */, + 4B51DDB91FDAE20A00C5CA85 /* Frameworks */, + 4B51DDBC1FDAE20A00C5CA85 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 4B51DDB51FDAE20A00C5CA85 /* PBXTargetDependency */, + ); + name = ziptool_regress; + productName = ziptool; + productReference = 4B51DDC01FDAE20A00C5CA85 /* ziptool_regress */; + productType = "com.apple.product-type.tool"; + }; + 4BACD58815BC2CEA00920691 /* ziptool */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4BACD59015BC2CEA00920691 /* Build configuration list for PBXNativeTarget "ziptool" */; + buildPhases = ( + 4BACD58515BC2CEA00920691 /* Sources */, + 4BACD58615BC2CEA00920691 /* Frameworks */, + 4BACD58715BC2CEA00920691 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 4BACD59715BC2D3800920691 /* PBXTargetDependency */, + ); + name = ziptool; + productName = ziptool; + productReference = 4BACD58915BC2CEA00920691 /* ziptool */; + productType = "com.apple.product-type.tool"; + }; + 4BACD5B515BC2DC900920691 /* add_from_filep */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4BACD5BE15BC2DC900920691 /* Build configuration list for PBXNativeTarget "add_from_filep" */; + buildPhases = ( + 4BACD5B815BC2DC900920691 /* Sources */, + 4BACD5BA15BC2DC900920691 /* Frameworks */, + 4BACD5BD15BC2DC900920691 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 4BACD5B615BC2DC900920691 /* PBXTargetDependency */, + ); + name = add_from_filep; + productName = add_from_filep; + productReference = 4BACD5C115BC2DC900920691 /* add_from_filep */; + productType = "com.apple.product-type.tool"; + }; + 4BACD5C415BC2DF200920691 /* fopen_unchanged */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4BACD5CD15BC2DF200920691 /* Build configuration list for PBXNativeTarget "fopen_unchanged" */; + buildPhases = ( + 4BACD5C715BC2DF200920691 /* Sources */, + 4BACD5C915BC2DF200920691 /* Frameworks */, + 4BACD5CC15BC2DF200920691 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 4BACD5C515BC2DF200920691 /* PBXTargetDependency */, + ); + name = fopen_unchanged; + productName = fopen_unchanged; + productReference = 4BACD5D015BC2DF200920691 /* fopen_unchanged */; + productType = "com.apple.product-type.tool"; + }; + 4BACD5D315BC2F3700920691 /* fread */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4BACD5DC15BC2F3700920691 /* Build configuration list for PBXNativeTarget "fread" */; + buildPhases = ( + 4BACD5D615BC2F3700920691 /* Sources */, + 4BACD5D815BC2F3700920691 /* Frameworks */, + 4BACD5DB15BC2F3700920691 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 4BACD5D415BC2F3700920691 /* PBXTargetDependency */, + ); + name = fread; + productName = fread; + productReference = 4BACD5DF15BC2F3700920691 /* fread */; + productType = "com.apple.product-type.tool"; + }; + 4BACD64515BC301300920691 /* tryopen */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4BACD64D15BC301300920691 /* Build configuration list for PBXNativeTarget "tryopen" */; + buildPhases = ( + 4BACD64815BC301300920691 /* Sources */, + 4BACD64915BC301300920691 /* Frameworks */, + 4BACD64C15BC301300920691 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 4BACD64615BC301300920691 /* PBXTargetDependency */, + ); + name = tryopen; + productName = tryopen; + productReference = 4BACD65015BC301300920691 /* tryopen */; + productType = "com.apple.product-type.tool"; + }; + 4BD6CB5F19E71CD100710654 /* hole */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4BD6CB6919E71CD100710654 /* Build configuration list for PBXNativeTarget "hole" */; + buildPhases = ( + 4BD6CB6219E71CD100710654 /* Sources */, + 4BD6CB6519E71CD100710654 /* Frameworks */, + 4BD6CB6819E71CD100710654 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 4BD6CB6019E71CD100710654 /* PBXTargetDependency */, + ); + name = hole; + productName = hole; + productReference = 4BD6CB6C19E71CD100710654 /* hole */; + productType = "com.apple.product-type.tool"; + }; + 4BFF2B451FE12FCA006EF3F3 /* can_clone_file */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4BFF2B4E1FE12FCA006EF3F3 /* Build configuration list for PBXNativeTarget "can_clone_file" */; + buildPhases = ( + 4BFF2B481FE12FCA006EF3F3 /* Sources */, + 4BFF2B4A1FE12FCA006EF3F3 /* Frameworks */, + 4BFF2B4D1FE12FCA006EF3F3 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = can_clone_file; + productName = tryopen; + productReference = 4BFF2B511FE12FCA006EF3F3 /* can_clone_file */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 4BDC71BF15B181DA00236D3C /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1140; + ORGANIZATIONNAME = NiH; + TargetAttributes = { + 3D7E35361B3305FB00022624 = { + CreatedOnToolsVersion = 6.3.2; + }; + }; + }; + buildConfigurationList = 4BDC71C215B181DA00236D3C /* Build configuration list for PBXProject "libzip" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 4BDC71BD15B181DA00236D3C; + productRefGroup = 4BDC71C915B181DA00236D3C /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 4B54447915C977A20067BA33 /* all */, + 4B01D72815B2F5A2002D5007 /* command line tools */, + 4BCF6A681C3BDDD500F036E9 /* examples */, + 4BACD5A715BC2D8200920691 /* test programs */, + 4B01D68A15B2F3F1002D5007 /* libzip */, + 4B01D6FC15B2F4B1002D5007 /* zipmerge */, + 4B01D70A15B2F4EB002D5007 /* zipcmp */, + 3D7E35361B3305FB00022624 /* in-memory */, + 4BACD5B515BC2DC900920691 /* add_from_filep */, + 4BFF2B451FE12FCA006EF3F3 /* can_clone_file */, + 4BACD5C415BC2DF200920691 /* fopen_unchanged */, + 4BACD5D315BC2F3700920691 /* fread */, + 4BD6CB5F19E71CD100710654 /* hole */, + 4BACD58815BC2CEA00920691 /* ziptool */, + 4BACD64515BC301300920691 /* tryopen */, + 4B51DDB41FDAE20A00C5CA85 /* ziptool_regress */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 4B01D68915B2F3F1002D5007 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4B00CA32242F5C2500E0B71C /* set_compression_xz_to_store.test in Resources */, + 4B00CA2E242F5C2500E0B71C /* cancel_45.test in Resources */, + 4B00CA31242F5C2500E0B71C /* cancel_90.test in Resources */, + 4B00CA2D242F5C2500E0B71C /* set_file_dostime.test in Resources */, + 4B00CA30242F5C2500E0B71C /* encryption-nonrandom-pkware.test in Resources */, + 4B00CA2F242F5C2500E0B71C /* set_compression_store_to_xz.test in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3D77B86617009AC5000A5794 /* Copy Version Info from config.h */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Version Info from config.h"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "./extract-version.sh \"config.h\" \"Info.plist\" "; + }; + 4B972053188EBEB8002FAFAD /* Fix zipconf.h include. */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Fix zipconf.h include."; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "sed \"s,,<$EXECUTABLE_NAME/zipconf.h>,\" ../lib/zip.h > \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Headers/zip.h\""; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 3D7E35331B3305FB00022624 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3D7E35431B33063F00022624 /* in-memory.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4B01D68615B2F3F1002D5007 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3D7E35491B330AD500022624 /* zip_source_is_deleted.c in Sources */, + 4BCF3039199ABDDA0064207B /* zip_source_tell_write.c in Sources */, + 4B01D6A615B2F46B002D5007 /* zip_add_dir.c in Sources */, + 4B972052188EBE85002FAFAD /* zip_file_set_external_attributes.c in Sources */, + 4B0454BA1E8E3E08002FA1F9 /* zip_source_compress.c in Sources */, + 4B3FAE802385C5CC00192D6A /* zip_algorithm_xz.c in Sources */, + 4BCF3024199A2F820064207B /* zip_source_begin_write.c in Sources */, + 4B01D6A715B2F46B002D5007 /* zip_add_entry.c in Sources */, + 4B01D6A815B2F46B002D5007 /* zip_add.c in Sources */, + 4B01D6A915B2F46B002D5007 /* zip_close.c in Sources */, + 4B01D6AA15B2F46B002D5007 /* zip_delete.c in Sources */, + 4B01D6AB15B2F46B002D5007 /* zip_dir_add.c in Sources */, + 4BD7087A1EB1CF73003F351F /* zip_progress.c in Sources */, + 4B01D6AC15B2F46B002D5007 /* zip_dirent.c in Sources */, + 4B00CA24242F59D700E0B71C /* zip_source_pkware_decode.c in Sources */, + 4B93995A24631B3E00AEBDA4 /* zip_source_file_stdio_named.c in Sources */, + 4B01D6AD15B2F46B002D5007 /* zip_discard.c in Sources */, + 4B00CA25242F59D700E0B71C /* zip_pkware.c in Sources */, + 4B01D6AE15B2F46B002D5007 /* zip_entry.c in Sources */, + 4B3A5F521DF96EB4005A53A1 /* zip_fseek.c in Sources */, + 4B01D6B015B2F46B002D5007 /* zip_error_clear.c in Sources */, + 4B01D6B115B2F46B002D5007 /* zip_error_get_sys_type.c in Sources */, + 4B01D6B215B2F46B002D5007 /* zip_error_get.c in Sources */, + 4B01D6B315B2F46B002D5007 /* zip_error_strerror.c in Sources */, + 4B01D6B415B2F46B002D5007 /* zip_error_to_str.c in Sources */, + 4B01D6B515B2F46B002D5007 /* zip_error.c in Sources */, + 736ED9BB1E3D6B6B00C36873 /* zip_source_winzip_aes_decode.c in Sources */, + 4B01D6B615B2F46B002D5007 /* zip_extra_field_api.c in Sources */, + 4B9E578A24C9779900CEE0D6 /* zip_err_str.c in Sources */, + 4B3A5F531DF96EB4005A53A1 /* zip_ftell.c in Sources */, + 4B01D6B715B2F46B002D5007 /* zip_extra_field.c in Sources */, + 4B01D6B815B2F46B002D5007 /* zip_fclose.c in Sources */, + 4B01D6B915B2F46B002D5007 /* zip_fdopen.c in Sources */, + 4B01D6BA15B2F46B002D5007 /* zip_file_add.c in Sources */, + 4B01D6BB15B2F46B002D5007 /* zip_file_error_clear.c in Sources */, + 4BCF3026199A2F820064207B /* zip_source_commit_write.c in Sources */, + 4B93995C24631B3E00AEBDA4 /* zip_source_file_stdio.c in Sources */, + 4B01D6BC15B2F46B002D5007 /* zip_file_error_get.c in Sources */, + 4B01D6BD15B2F46B002D5007 /* zip_file_get_comment.c in Sources */, + 4B01D6BE15B2F46B002D5007 /* zip_file_get_offset.c in Sources */, + 4B01D6BF15B2F46B002D5007 /* zip_file_rename.c in Sources */, + 4B0454BD1E8E3E24002FA1F9 /* zip_algorithm_deflate.c in Sources */, + 4B01D6C015B2F46B002D5007 /* zip_file_replace.c in Sources */, + 4B01D6C115B2F46B002D5007 /* zip_file_set_comment.c in Sources */, + 4BCF3033199ABD3A0064207B /* zip_source_remove.c in Sources */, + 4B01D6C215B2F46B002D5007 /* zip_file_strerror.c in Sources */, + 4B01D6C415B2F46B002D5007 /* zip_fopen_encrypted.c in Sources */, + 4BCF302A199A2F820064207B /* zip_source_seek.c in Sources */, + 4B01D6C515B2F46B002D5007 /* zip_fopen_index_encrypted.c in Sources */, + 4B01D6C615B2F46B002D5007 /* zip_fopen_index.c in Sources */, + 4B5169A822A7993E00AA4340 /* zip_mkstempm.c in Sources */, + 4B69E6EE2032F18B0001EEE7 /* zip_winzip_aes.c in Sources */, + 4B01D6C715B2F46B002D5007 /* zip_fopen.c in Sources */, + 3D9284821C309510001EABA7 /* zip_hash.c in Sources */, + 4B01D6C815B2F46B002D5007 /* zip_fread.c in Sources */, + 736ED9BF1E3D6B7C00C36873 /* zip_file_set_encryption.c in Sources */, + 4B01D6C915B2F46B002D5007 /* zip_get_archive_comment.c in Sources */, + 4B5D0CD5244B154E006C2E93 /* zip_source_get_file_attributes.c in Sources */, + 4B01D6CA15B2F46B002D5007 /* zip_get_archive_flag.c in Sources */, + 4BE92AB5203597D700509BC8 /* zip_crypto_commoncrypto.c in Sources */, + 4B0454BC1E8E3E24002FA1F9 /* zip_algorithm_bzip2.c in Sources */, + 736ED9BC1E3D6B6F00C36873 /* zip_source_winzip_aes_encode.c in Sources */, + 4BD5053419A01BB0007DD28A /* zip_source_call.c in Sources */, + 4B93995B24631B3E00AEBDA4 /* zip_source_file_common.c in Sources */, + 4BCF3030199A2F820064207B /* zip_source_write.c in Sources */, + 4B01D6CC15B2F46B002D5007 /* zip_get_encryption_implementation.c in Sources */, + 4B908F552385BE6D00886355 /* zip_source_accept_empty.c in Sources */, + 4B01D6CD15B2F46B002D5007 /* zip_get_file_comment.c in Sources */, + 4B01D6CE15B2F46B002D5007 /* zip_get_name.c in Sources */, + 4B01D6CF15B2F46B002D5007 /* zip_get_num_entries.c in Sources */, + 4B01D6D015B2F46B002D5007 /* zip_get_num_files.c in Sources */, + 4B01D6D115B2F46B002D5007 /* zip_memdup.c in Sources */, + 4B01D6D215B2F46B002D5007 /* zip_name_locate.c in Sources */, + 4B9E577C24C7202000CEE0D6 /* zip_algorithm_zstd.c in Sources */, + 4B01D6D315B2F46B002D5007 /* zip_new.c in Sources */, + 4B01D6D415B2F46B002D5007 /* zip_open.c in Sources */, + 4B01D6D515B2F46B002D5007 /* zip_rename.c in Sources */, + 4BCF302E199A2F820064207B /* zip_source_tell.c in Sources */, + 4B542C2C22B12E3900960B38 /* zip_random_unix.c in Sources */, + 4B972050188EBE85002FAFAD /* zip_file_get_external_attributes.c in Sources */, + 4B01D6D615B2F46B002D5007 /* zip_replace.c in Sources */, + 4B01D6D715B2F46B002D5007 /* zip_set_archive_comment.c in Sources */, + 4B01D6D815B2F46B002D5007 /* zip_set_archive_flag.c in Sources */, + 4B01D6D915B2F46B002D5007 /* zip_set_default_password.c in Sources */, + 4B01D6DA15B2F46B002D5007 /* zip_set_file_comment.c in Sources */, + 4B01D6DB15B2F46B002D5007 /* zip_set_file_compression.c in Sources */, + 4B01D6DC15B2F46B002D5007 /* zip_set_name.c in Sources */, + 4B01D6DD15B2F46B002D5007 /* zip_source_buffer.c in Sources */, + 4BCB434319E9347E0067FAA3 /* zip_buffer.c in Sources */, + 4B01D6DE15B2F46B002D5007 /* zip_source_close.c in Sources */, + 4B01D6DF15B2F46B002D5007 /* zip_source_crc.c in Sources */, + 4B01D6E115B2F46B002D5007 /* zip_source_error.c in Sources */, + 4B01D6E415B2F46B002D5007 /* zip_source_free.c in Sources */, + 4B01D6E515B2F46B002D5007 /* zip_source_function.c in Sources */, + 4BCF3022199A2F820064207B /* zip_io_util.c in Sources */, + 4B01D6E615B2F46B002D5007 /* zip_source_layered.c in Sources */, + 4B01D6E715B2F46B002D5007 /* zip_source_open.c in Sources */, + 4B908F532385BE6D00886355 /* zip_libzip_version.c in Sources */, + 4B01D6EA15B2F46B002D5007 /* zip_source_read.c in Sources */, + 4BC03FA41FDD6B6F003C7B62 /* zip_source_begin_write_cloning.c in Sources */, + 4B01D6EB15B2F46B002D5007 /* zip_source_stat.c in Sources */, + 4BCF302C199A2F820064207B /* zip_source_supports.c in Sources */, + 4B01D6EC15B2F46B002D5007 /* zip_source_window.c in Sources */, + 4B01D6ED15B2F46B002D5007 /* zip_source_zip_new.c in Sources */, + 4B01D6EE15B2F46B002D5007 /* zip_source_zip.c in Sources */, + 4B01D6EF15B2F46B002D5007 /* zip_stat_index.c in Sources */, + 4B01D6F015B2F46B002D5007 /* zip_stat_init.c in Sources */, + 4B82CED519915F360097BC18 /* zip_file_set_mtime.c in Sources */, + 4B01D6F115B2F46B002D5007 /* zip_stat.c in Sources */, + 4B01D6F215B2F46B002D5007 /* zip_strerror.c in Sources */, + 4B01D6F315B2F46B002D5007 /* zip_string.c in Sources */, + 4B01D6F415B2F46B002D5007 /* zip_unchange_all.c in Sources */, + 4B01D6F515B2F46B002D5007 /* zip_unchange_archive.c in Sources */, + 4BCF3028199A2F820064207B /* zip_source_rollback_write.c in Sources */, + 4BCF3037199ABDDA0064207B /* zip_source_seek_write.c in Sources */, + 4B01D6F615B2F46B002D5007 /* zip_unchange_data.c in Sources */, + 4B01D6F715B2F46B002D5007 /* zip_unchange.c in Sources */, + 4B00CA26242F59D700E0B71C /* zip_source_pkware_encode.c in Sources */, + 4B01D6F815B2F46B002D5007 /* zip_utf-8.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4B01D6F915B2F4B1002D5007 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4B01D72615B2F57F002D5007 /* zipmerge.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4B01D70B15B2F4EB002D5007 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4B01D72515B2F57B002D5007 /* zipcmp.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4B51DDB71FDAE20A00C5CA85 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4B51DDC31FDAE26600C5CA85 /* source_hole.c in Sources */, + 4B51DDC21FDAE25F00C5CA85 /* ziptool_regress.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BACD58515BC2CEA00920691 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4B51DDC11FDAE25B00C5CA85 /* ziptool.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BACD5B815BC2DC900920691 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4BACD5C315BC2DE000920691 /* add_from_filep.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BACD5C715BC2DF200920691 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4BACD5D215BC2EFE00920691 /* fopen_unchanged.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BACD5D615BC2F3700920691 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4BACD5E115BC2F4500920691 /* fread.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BACD64815BC301300920691 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4BACD65315BC302500920691 /* tryopen.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BD6CB6219E71CD100710654 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4BD6CB6F19E71D6900710654 /* hole.c in Sources */, + 4BD6CB6419E71CD100710654 /* source_hole.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4BFF2B481FE12FCA006EF3F3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4BFF2B551FE13033006EF3F3 /* can_clone_file.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 3D7E35451B33064500022624 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4B01D68A15B2F3F1002D5007 /* libzip */; + targetProxy = 3D7E35441B33064500022624 /* PBXContainerItemProxy */; + }; + 4B01D72D15B2F5AC002D5007 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4B01D6FC15B2F4B1002D5007 /* zipmerge */; + targetProxy = 4B01D72C15B2F5AC002D5007 /* PBXContainerItemProxy */; + }; + 4B01D72F15B2F5AC002D5007 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4B01D70A15B2F4EB002D5007 /* zipcmp */; + targetProxy = 4B01D72E15B2F5AC002D5007 /* PBXContainerItemProxy */; + }; + 4B01D73615B2F639002D5007 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4B01D68A15B2F3F1002D5007 /* libzip */; + targetProxy = 4B01D73515B2F639002D5007 /* PBXContainerItemProxy */; + }; + 4B01D73815B2F643002D5007 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4B01D68A15B2F3F1002D5007 /* libzip */; + targetProxy = 4B01D73715B2F643002D5007 /* PBXContainerItemProxy */; + }; + 4B2CADAC1C50D57800291DE6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4BACD58815BC2CEA00920691 /* ziptool */; + targetProxy = 4B2CADAB1C50D57800291DE6 /* PBXContainerItemProxy */; + }; + 4B51DDB51FDAE20A00C5CA85 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4B01D68A15B2F3F1002D5007 /* libzip */; + targetProxy = 4B51DDB61FDAE20A00C5CA85 /* PBXContainerItemProxy */; + }; + 4B51DDC51FDAE2F000C5CA85 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4B51DDB41FDAE20A00C5CA85 /* ziptool_regress */; + targetProxy = 4B51DDC41FDAE2F000C5CA85 /* PBXContainerItemProxy */; + }; + 4B54447F15C977AF0067BA33 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4B01D72815B2F5A2002D5007 /* command line tools */; + targetProxy = 4B54447E15C977AF0067BA33 /* PBXContainerItemProxy */; + }; + 4B54448115C977B10067BA33 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4BACD5A715BC2D8200920691 /* test programs */; + targetProxy = 4B54448015C977B10067BA33 /* PBXContainerItemProxy */; + }; + 4BACD59715BC2D3800920691 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4B01D68A15B2F3F1002D5007 /* libzip */; + targetProxy = 4BACD59615BC2D3800920691 /* PBXContainerItemProxy */; + }; + 4BACD5B615BC2DC900920691 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4B01D68A15B2F3F1002D5007 /* libzip */; + targetProxy = 4BACD5B715BC2DC900920691 /* PBXContainerItemProxy */; + }; + 4BACD5C515BC2DF200920691 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4B01D68A15B2F3F1002D5007 /* libzip */; + targetProxy = 4BACD5C615BC2DF200920691 /* PBXContainerItemProxy */; + }; + 4BACD5D415BC2F3700920691 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4B01D68A15B2F3F1002D5007 /* libzip */; + targetProxy = 4BACD5D515BC2F3700920691 /* PBXContainerItemProxy */; + }; + 4BACD64615BC301300920691 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4B01D68A15B2F3F1002D5007 /* libzip */; + targetProxy = 4BACD64715BC301300920691 /* PBXContainerItemProxy */; + }; + 4BACD65515BC303B00920691 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4BACD5B515BC2DC900920691 /* add_from_filep */; + targetProxy = 4BACD65415BC303B00920691 /* PBXContainerItemProxy */; + }; + 4BACD65715BC303B00920691 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4BACD5C415BC2DF200920691 /* fopen_unchanged */; + targetProxy = 4BACD65615BC303B00920691 /* PBXContainerItemProxy */; + }; + 4BACD65915BC303B00920691 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4BACD5D315BC2F3700920691 /* fread */; + targetProxy = 4BACD65815BC303B00920691 /* PBXContainerItemProxy */; + }; + 4BACD66915BC303B00920691 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4BACD64515BC301300920691 /* tryopen */; + targetProxy = 4BACD66815BC303B00920691 /* PBXContainerItemProxy */; + }; + 4BCF6A791C3BDDF900F036E9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 3D7E35361B3305FB00022624 /* in-memory */; + targetProxy = 4BCF6A781C3BDDF900F036E9 /* PBXContainerItemProxy */; + }; + 4BCF6A7B1C3BDDFF00F036E9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4BCF6A681C3BDDD500F036E9 /* examples */; + targetProxy = 4BCF6A7A1C3BDDFF00F036E9 /* PBXContainerItemProxy */; + }; + 4BD6CB6019E71CD100710654 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4B01D68A15B2F3F1002D5007 /* libzip */; + targetProxy = 4BD6CB6119E71CD100710654 /* PBXContainerItemProxy */; + }; + 4BD6CB6E19E71D0800710654 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4BD6CB5F19E71CD100710654 /* hole */; + targetProxy = 4BD6CB6D19E71D0800710654 /* PBXContainerItemProxy */; + }; + 4BFF2B531FE13002006EF3F3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4BFF2B451FE12FCA006EF3F3 /* can_clone_file */; + targetProxy = 4BFF2B521FE13002006EF3F3 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 3D7E353B1B3305FB00022624 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = dwarf; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 3D7E353C1B3305FB00022624 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4B01D69C15B2F3F1002D5007 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + COMBINE_HIDPI_IMAGES = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_PEDANTIC = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "@rpath"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + /usr/local/Cellar/zstd/1.4.5/lib, + ); + PRODUCT_BUNDLE_IDENTIFIER = "at.nih.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + VERSION_INFO_BUILDER = ""; + VERSION_INFO_FILE = ""; + WRAPPER_EXTENSION = framework; + }; + name = Debug; + }; + 4B01D69D15B2F3F1002D5007 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + COMBINE_HIDPI_IMAGES = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_PEDANTIC = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "@rpath"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + /usr/local/Cellar/zstd/1.4.5/lib, + ); + PRODUCT_BUNDLE_IDENTIFIER = "at.nih.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + VERSION_INFO_BUILDER = ""; + VERSION_INFO_FILE = ""; + WRAPPER_EXTENSION = framework; + }; + name = Release; + }; + 4B01D70515B2F4B1002D5007 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_PEDANTIC = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 4B01D70615B2F4B1002D5007 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_PEDANTIC = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4B01D71115B2F4EB002D5007 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = zipcmp; + }; + name = Debug; + }; + 4B01D71215B2F4EB002D5007 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = zipcmp; + }; + name = Release; + }; + 4B01D72A15B2F5A2002D5007 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 4B01D72B15B2F5A2002D5007 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4B51DDBE1FDAE20A00C5CA85 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 4B51DDBF1FDAE20A00C5CA85 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4B54447A15C977A20067BA33 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 4B54447B15C977A20067BA33 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4BACD59115BC2CEA00920691 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 4BACD59215BC2CEA00920691 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4BACD5AF15BC2D8200920691 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + PRODUCT_NAME = "command line tools copy"; + }; + name = Debug; + }; + 4BACD5B015BC2D8200920691 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + PRODUCT_NAME = "command line tools copy"; + }; + name = Release; + }; + 4BACD5BF15BC2DC900920691 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = add_from_filep; + }; + name = Debug; + }; + 4BACD5C015BC2DC900920691 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = add_from_filep; + }; + name = Release; + }; + 4BACD5CE15BC2DF200920691 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = fopen_unchanged; + }; + name = Debug; + }; + 4BACD5CF15BC2DF200920691 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = fopen_unchanged; + }; + name = Release; + }; + 4BACD5DD15BC2F3700920691 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = fread; + }; + name = Debug; + }; + 4BACD5DE15BC2F3700920691 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = fread; + }; + name = Release; + }; + 4BACD64E15BC301300920691 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = tryopen; + }; + name = Debug; + }; + 4BACD64F15BC301300920691 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = tryopen; + }; + name = Release; + }; + 4BCF6A761C3BDDD500F036E9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 4BCF6A771C3BDDD500F036E9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 4BD6CB6A19E71CD100710654 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = hole; + }; + name = Debug; + }; + 4BD6CB6B19E71CD100710654 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = hole; + }; + name = Release; + }; + 4BDC71D315B181DA00236D3C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = "HAVE_CONFIG_H=1"; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + /usr/local/include, + ../lib, + ., + ../src, + ); + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MACOSX_DEPLOYMENT_TARGET = 10.6; + ONLY_ACTIVE_ARCH = YES; + OTHER_CFLAGS = ""; + SDKROOT = macosx; + USE_HEADERMAP = NO; + WARNING_CFLAGS = "-Wno-nullability-extension"; + }; + name = Debug; + }; + 4BDC71D415B181DA00236D3C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREPROCESSOR_DEFINITIONS = "HAVE_CONFIG_H=1"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + /usr/local/include, + ../lib, + ., + ../src, + ); + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MACOSX_DEPLOYMENT_TARGET = 10.6; + OTHER_CFLAGS = ""; + SDKROOT = macosx; + USE_HEADERMAP = NO; + VALIDATE_PRODUCT = YES; + WARNING_CFLAGS = "-Wno-nullability-extension"; + }; + name = Release; + }; + 4BFF2B4F1FE12FCA006EF3F3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 4BFF2B501FE12FCA006EF3F3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 3D7E353D1B3305FB00022624 /* Build configuration list for PBXNativeTarget "in-memory" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3D7E353B1B3305FB00022624 /* Debug */, + 3D7E353C1B3305FB00022624 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4B01D69E15B2F3F1002D5007 /* Build configuration list for PBXNativeTarget "libzip" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4B01D69C15B2F3F1002D5007 /* Debug */, + 4B01D69D15B2F3F1002D5007 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4B01D70415B2F4B1002D5007 /* Build configuration list for PBXNativeTarget "zipmerge" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4B01D70515B2F4B1002D5007 /* Debug */, + 4B01D70615B2F4B1002D5007 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4B01D71015B2F4EB002D5007 /* Build configuration list for PBXNativeTarget "zipcmp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4B01D71115B2F4EB002D5007 /* Debug */, + 4B01D71215B2F4EB002D5007 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4B01D72915B2F5A2002D5007 /* Build configuration list for PBXAggregateTarget "command line tools" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4B01D72A15B2F5A2002D5007 /* Debug */, + 4B01D72B15B2F5A2002D5007 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4B51DDBD1FDAE20A00C5CA85 /* Build configuration list for PBXNativeTarget "ziptool_regress" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4B51DDBE1FDAE20A00C5CA85 /* Debug */, + 4B51DDBF1FDAE20A00C5CA85 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4B54447C15C977A20067BA33 /* Build configuration list for PBXAggregateTarget "all" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4B54447A15C977A20067BA33 /* Debug */, + 4B54447B15C977A20067BA33 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4BACD59015BC2CEA00920691 /* Build configuration list for PBXNativeTarget "ziptool" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4BACD59115BC2CEA00920691 /* Debug */, + 4BACD59215BC2CEA00920691 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4BACD5AE15BC2D8200920691 /* Build configuration list for PBXAggregateTarget "test programs" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4BACD5AF15BC2D8200920691 /* Debug */, + 4BACD5B015BC2D8200920691 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4BACD5BE15BC2DC900920691 /* Build configuration list for PBXNativeTarget "add_from_filep" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4BACD5BF15BC2DC900920691 /* Debug */, + 4BACD5C015BC2DC900920691 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4BACD5CD15BC2DF200920691 /* Build configuration list for PBXNativeTarget "fopen_unchanged" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4BACD5CE15BC2DF200920691 /* Debug */, + 4BACD5CF15BC2DF200920691 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4BACD5DC15BC2F3700920691 /* Build configuration list for PBXNativeTarget "fread" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4BACD5DD15BC2F3700920691 /* Debug */, + 4BACD5DE15BC2F3700920691 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4BACD64D15BC301300920691 /* Build configuration list for PBXNativeTarget "tryopen" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4BACD64E15BC301300920691 /* Debug */, + 4BACD64F15BC301300920691 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4BCF6A751C3BDDD500F036E9 /* Build configuration list for PBXAggregateTarget "examples" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4BCF6A761C3BDDD500F036E9 /* Debug */, + 4BCF6A771C3BDDD500F036E9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4BD6CB6919E71CD100710654 /* Build configuration list for PBXNativeTarget "hole" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4BD6CB6A19E71CD100710654 /* Debug */, + 4BD6CB6B19E71CD100710654 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4BDC71C215B181DA00236D3C /* Build configuration list for PBXProject "libzip" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4BDC71D315B181DA00236D3C /* Debug */, + 4BDC71D415B181DA00236D3C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4BFF2B4E1FE12FCA006EF3F3 /* Build configuration list for PBXNativeTarget "can_clone_file" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4BFF2B4F1FE12FCA006EF3F3 /* Debug */, + 4BFF2B501FE12FCA006EF3F3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 4BDC71BF15B181DA00236D3C /* Project object */; +} diff --git a/core/deps/libzip/developer-xcode/libzip.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/core/deps/libzip/developer-xcode/libzip.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..a3025873b --- /dev/null +++ b/core/deps/libzip/developer-xcode/libzip.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/core/deps/libzip/developer-xcode/libzip.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/core/deps/libzip/developer-xcode/libzip.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/core/deps/libzip/developer-xcode/libzip.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/core/deps/libzip/developer-xcode/mkconfig-h.sh b/core/deps/libzip/developer-xcode/mkconfig-h.sh new file mode 100644 index 000000000..43199f73b --- /dev/null +++ b/core/deps/libzip/developer-xcode/mkconfig-h.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +DIR=tmp.$$ + +mkdir -p $DIR/32 $DIR/64 + +(cd $DIR/32; ../../../configure CFLAGS=-m32) +(cd $DIR/64; ../../../configure CFLAGS=-m64) + +diff -D __LP64__ $DIR/32/config.h $DIR/64/config.h > config.h + +rm -r $DIR diff --git a/core/deps/libzip/zip_err_str.c b/core/deps/libzip/developer-xcode/zip_err_str.c similarity index 70% rename from core/deps/libzip/zip_err_str.c rename to core/deps/libzip/developer-xcode/zip_err_str.c index 3fcdf1738..c46258b4a 100644 --- a/core/deps/libzip/zip_err_str.c +++ b/core/deps/libzip/developer-xcode/zip_err_str.c @@ -1,12 +1,10 @@ /* - This file was generated automatically by ./make_zip_err_str.sh - from ./zip.h; make changes there. - */ + This file was generated automatically by CMake + from zip.h; make changes there. +*/ #include "zipint.h" - - const char * const _zip_err_str[] = { "No error", "Multi-disk zip archives not supported", @@ -25,13 +23,22 @@ const char * const _zip_err_str[] = { "Malloc failure", "Entry has been changed", "Compression method not supported", - "Premature EOF", + "Premature end of file", "Invalid argument", "Not a zip archive", "Internal error", "Zip archive inconsistent", "Can't remove file", "Entry has been deleted", + "Encryption method not supported", + "Read-only archive", + "No password provided", + "Wrong password provided", + "Operation not supported", + "Resource still in use", + "Tell error", + "Compressed data invalid", + "Operation cancelled", }; const int _zip_nerr_str = sizeof(_zip_err_str)/sizeof(_zip_err_str[0]); @@ -65,4 +72,13 @@ const int _zip_err_type[] = { N, S, N, + N, + N, + N, + N, + N, + N, + S, + N, + N, }; diff --git a/core/deps/libzip/developer-xcode/zipconf.h b/core/deps/libzip/developer-xcode/zipconf.h new file mode 100644 index 000000000..99b3f07c4 --- /dev/null +++ b/core/deps/libzip/developer-xcode/zipconf.h @@ -0,0 +1,47 @@ +#ifndef _HAD_ZIPCONF_H +#define _HAD_ZIPCONF_H + +/* + zipconf.h -- platform specific include file + + This file was generated automatically by CMake + based on ../cmake-zipconf.h.in. + */ + +#define LIBZIP_VERSION "1.5.2a" +#define LIBZIP_VERSION_MAJOR 1 +#define LIBZIP_VERSION_MINOR 5 +#define LIBZIP_VERSION_MICRO 2a + +/* #undef ZIP_STATIC */ + + +#define __STDC_FORMAT_MACROS 1 +#include + +typedef int8_t zip_int8_t; +typedef uint8_t zip_uint8_t; +typedef int16_t zip_int16_t; +typedef uint16_t zip_uint16_t; +typedef int32_t zip_int32_t; +typedef uint32_t zip_uint32_t; +typedef int64_t zip_int64_t; +typedef uint64_t zip_uint64_t; + +#define ZIP_INT8_MIN (-ZIP_INT8_MAX - 1) +#define ZIP_INT8_MAX 0x7f +#define ZIP_UINT8_MAX 0xff + +#define ZIP_INT16_MIN (-ZIP_INT16_MAX - 1) +#define ZIP_INT16_MAX 0x7fff +#define ZIP_UINT16_MAX 0xffff + +#define ZIP_INT32_MIN (-ZIP_INT32_MAX - 1L) +#define ZIP_INT32_MAX 0x7fffffffL +#define ZIP_UINT32_MAX 0xffffffffLU + +#define ZIP_INT64_MIN (-ZIP_INT64_MAX - 1LL) +#define ZIP_INT64_MAX 0x7fffffffffffffffLL +#define ZIP_UINT64_MAX 0xffffffffffffffffULL + +#endif /* zipconf.h */ diff --git a/core/deps/libzip/examples/CMakeLists.txt b/core/deps/libzip/examples/CMakeLists.txt new file mode 100644 index 000000000..9019e0ab6 --- /dev/null +++ b/core/deps/libzip/examples/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable(in-memory in-memory.c) +target_link_libraries(in-memory zip) +target_include_directories(in-memory PRIVATE ${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}) diff --git a/core/deps/libzip/examples/in-memory.c b/core/deps/libzip/examples/in-memory.c new file mode 100644 index 000000000..1a6f9fae6 --- /dev/null +++ b/core/deps/libzip/examples/in-memory.c @@ -0,0 +1,217 @@ +/* + in-memory.c -- modify zip file in memory + Copyright (C) 2014-2019 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include +#include +#include +#include + +#include + +static int +get_data(void **datap, size_t *sizep, const char *archive) { + /* example implementation that reads data from file */ + struct stat st; + FILE *fp; + + if ((fp = fopen(archive, "rb")) == NULL) { + if (errno != ENOENT) { + fprintf(stderr, "can't open %s: %s\n", archive, strerror(errno)); + return -1; + } + + *datap = NULL; + *sizep = 0; + + return 0; + } + + if (fstat(fileno(fp), &st) < 0) { + fprintf(stderr, "can't stat %s: %s\n", archive, strerror(errno)); + fclose(fp); + return -1; + } + + if ((*datap = malloc((size_t)st.st_size)) == NULL) { + fprintf(stderr, "can't allocate buffer\n"); + fclose(fp); + return -1; + } + + if (fread(*datap, 1, (size_t)st.st_size, fp) < (size_t)st.st_size) { + fprintf(stderr, "can't read %s: %s\n", archive, strerror(errno)); + free(*datap); + fclose(fp); + return -1; + } + + fclose(fp); + + *sizep = (size_t)st.st_size; + return 0; +} + +static int +modify_archive(zip_t *za) { + /* modify the archive */ + return 0; +} + + +static int +use_data(void *data, size_t size, const char *archive) { + /* example implementation that writes data to file */ + FILE *fp; + + if (data == NULL) { + if (remove(archive) < 0 && errno != ENOENT) { + fprintf(stderr, "can't remove %s: %s\n", archive, strerror(errno)); + return -1; + } + return 0; + } + + if ((fp = fopen(archive, "wb")) == NULL) { + fprintf(stderr, "can't open %s: %s\n", archive, strerror(errno)); + return -1; + } + if (fwrite(data, 1, size, fp) < size) { + fprintf(stderr, "can't write %s: %s\n", archive, strerror(errno)); + fclose(fp); + return -1; + } + if (fclose(fp) < 0) { + fprintf(stderr, "can't write %s: %s\n", archive, strerror(errno)); + return -1; + } + + return 0; +} + + +int +main(int argc, char *argv[]) { + const char *archive; + zip_source_t *src; + zip_t *za; + zip_error_t error; + void *data; + size_t size; + + if (argc < 2) { + fprintf(stderr, "usage: %s archive\n", argv[0]); + return 1; + } + archive = argv[1]; + + /* get buffer with zip archive inside */ + if (get_data(&data, &size, archive) < 0) { + return 1; + } + + zip_error_init(&error); + /* create source from buffer */ + if ((src = zip_source_buffer_create(data, size, 1, &error)) == NULL) { + fprintf(stderr, "can't create source: %s\n", zip_error_strerror(&error)); + free(data); + zip_error_fini(&error); + return 1; + } + + /* open zip archive from source */ + if ((za = zip_open_from_source(src, 0, &error)) == NULL) { + fprintf(stderr, "can't open zip from source: %s\n", zip_error_strerror(&error)); + zip_source_free(src); + zip_error_fini(&error); + return 1; + } + zip_error_fini(&error); + + /* we'll want to read the data back after zip_close */ + zip_source_keep(src); + + /* modify archive */ + modify_archive(za); + + /* close archive */ + if (zip_close(za) < 0) { + fprintf(stderr, "can't close zip archive '%s': %s\n", archive, zip_strerror(za)); + return 1; + } + + + /* copy new archive to buffer */ + + if (zip_source_is_deleted(src)) { + /* new archive is empty, thus no data */ + data = NULL; + } + else { + zip_stat_t zst; + + if (zip_source_stat(src, &zst) < 0) { + fprintf(stderr, "can't stat source: %s\n", zip_error_strerror(zip_source_error(src))); + return 1; + } + + size = zst.size; + + if (zip_source_open(src) < 0) { + fprintf(stderr, "can't open source: %s\n", zip_error_strerror(zip_source_error(src))); + return 1; + } + if ((data = malloc(size)) == NULL) { + fprintf(stderr, "malloc failed: %s\n", strerror(errno)); + zip_source_close(src); + return 1; + } + if ((zip_uint64_t)zip_source_read(src, data, size) < size) { + fprintf(stderr, "can't read data from source: %s\n", zip_error_strerror(zip_source_error(src))); + zip_source_close(src); + free(data); + return 1; + } + zip_source_close(src); + } + + /* we're done with src */ + zip_source_free(src); + + /* use new data */ + use_data(data, size, archive); + + free(data); + + return 0; +} diff --git a/core/deps/libzip/examples/windows-open.c b/core/deps/libzip/examples/windows-open.c new file mode 100644 index 000000000..31704a661 --- /dev/null +++ b/core/deps/libzip/examples/windows-open.c @@ -0,0 +1,60 @@ +/* + windows-open.c -- open zip archive using Windows UTF-16/Unicode file name + Copyright (C) 2015-2019 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +zip_t * +windows_open(const wchar_t *name, int flags) { + zip_source_t *src; + zip_t *za; + zip_error_t error; + + zip_error_init(&error); + /* create source from buffer */ + if ((src = zip_source_win32w_create(name, 0, -1, &error)) == NULL) { + fprintf(stderr, "can't create source: %s\n", zip_error_strerror(&error)); + zip_error_fini(&error); + return NULL; + } + + /* open zip archive from source */ + if ((za = zip_open_from_source(src, flags, &error)) == NULL) { + fprintf(stderr, "can't open zip from source: %s\n", zip_error_strerror(&error)); + zip_source_free(src); + zip_error_fini(&error); + return NULL; + } + zip_error_fini(&error); + + return za; +} diff --git a/core/deps/libzip/lib/CMakeLists.txt b/core/deps/libzip/lib/CMakeLists.txt new file mode 100644 index 000000000..07fdc7ea7 --- /dev/null +++ b/core/deps/libzip/lib/CMakeLists.txt @@ -0,0 +1,228 @@ +include(CheckFunctionExists) + +set(CMAKE_C_VISIBILITY_PRESET hidden) + +add_library(zip + zip_add.c + zip_add_dir.c + zip_add_entry.c + zip_algorithm_deflate.c + zip_buffer.c + zip_close.c + zip_delete.c + zip_dir_add.c + zip_dirent.c + zip_discard.c + zip_entry.c + zip_error.c + zip_error_clear.c + zip_error_get.c + zip_error_get_sys_type.c + zip_error_strerror.c + zip_error_to_str.c + zip_extra_field.c + zip_extra_field_api.c + zip_fclose.c + zip_fdopen.c + zip_file_add.c + zip_file_error_clear.c + zip_file_error_get.c + zip_file_get_comment.c + zip_file_get_external_attributes.c + zip_file_get_offset.c + zip_file_rename.c + zip_file_replace.c + zip_file_set_comment.c + zip_file_set_encryption.c + zip_file_set_external_attributes.c + zip_file_set_mtime.c + zip_file_strerror.c + zip_fopen.c + zip_fopen_encrypted.c + zip_fopen_index.c + zip_fopen_index_encrypted.c + zip_fread.c + zip_fseek.c + zip_ftell.c + zip_get_archive_comment.c + zip_get_archive_flag.c + zip_get_encryption_implementation.c + zip_get_file_comment.c + zip_get_name.c + zip_get_num_entries.c + zip_get_num_files.c + zip_hash.c + zip_io_util.c + zip_libzip_version.c + zip_memdup.c + zip_name_locate.c + zip_new.c + zip_open.c + zip_pkware.c + zip_progress.c + zip_rename.c + zip_replace.c + zip_set_archive_comment.c + zip_set_archive_flag.c + zip_set_default_password.c + zip_set_file_comment.c + zip_set_file_compression.c + zip_set_name.c + zip_source_accept_empty.c + zip_source_begin_write.c + zip_source_begin_write_cloning.c + zip_source_buffer.c + zip_source_call.c + zip_source_close.c + zip_source_commit_write.c + zip_source_compress.c + zip_source_crc.c + zip_source_error.c + zip_source_file_common.c + zip_source_file_stdio.c + zip_source_free.c + zip_source_function.c + zip_source_get_file_attributes.c + zip_source_is_deleted.c + zip_source_layered.c + zip_source_open.c + zip_source_pkware_decode.c + zip_source_pkware_encode.c + zip_source_read.c + zip_source_remove.c + zip_source_rollback_write.c + zip_source_seek.c + zip_source_seek_write.c + zip_source_stat.c + zip_source_supports.c + zip_source_tell.c + zip_source_tell_write.c + zip_source_window.c + zip_source_write.c + zip_source_zip.c + zip_source_zip_new.c + zip_stat.c + zip_stat_index.c + zip_stat_init.c + zip_strerror.c + zip_string.c + zip_unchange.c + zip_unchange_all.c + zip_unchange_archive.c + zip_unchange_data.c + zip_utf-8.c + ${CMAKE_CURRENT_BINARY_DIR}/zip_err_str.c + ) +add_library(libzip::zip ALIAS zip) + +if(WIN32) + target_sources(zip PRIVATE + zip_source_file_win32.c + zip_source_file_win32_named.c + zip_source_file_win32_utf16.c + zip_source_file_win32_utf8.c + ) + if(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore) + target_sources(zip PRIVATE zip_random_uwp.c) + else() + target_sources(zip PRIVATE zip_source_file_win32_ansi.c zip_random_win32.c) + target_link_libraries(zip PRIVATE advapi32) + endif() +else(WIN32) + target_sources(zip PRIVATE + zip_mkstempm.c + zip_source_file_stdio_named.c + zip_random_unix.c + ) +endif(WIN32) + +if(HAVE_LIBBZ2) + target_sources(zip PRIVATE zip_algorithm_bzip2.c) + target_link_libraries(zip PRIVATE BZip2::BZip2) +endif() + +if(HAVE_LIBLZMA) + target_sources(zip PRIVATE zip_algorithm_xz.c) + target_link_libraries(zip PRIVATE LibLZMA::LibLZMA) +endif() + +if(HAVE_LIBZSTD) + target_sources(zip PRIVATE zip_algorithm_zstd.c) + target_link_libraries(zip PRIVATE Zstd::Zstd) +endif() + +if(HAVE_COMMONCRYPTO) + target_sources(zip PRIVATE zip_crypto_commoncrypto.c) +elseif(HAVE_WINDOWS_CRYPTO) + target_sources(zip PRIVATE zip_crypto_win.c) + target_link_libraries(zip PRIVATE bcrypt) +elseif(HAVE_GNUTLS) + target_sources(zip PRIVATE zip_crypto_gnutls.c) + target_link_libraries(zip PRIVATE GnuTLS::GnuTLS Nettle::Nettle) +elseif(HAVE_OPENSSL) + target_sources(zip PRIVATE zip_crypto_openssl.c) + target_link_libraries(zip PRIVATE OpenSSL::Crypto) +elseif(HAVE_MBEDTLS) + target_sources(zip PRIVATE zip_crypto_mbedtls.c) + target_link_libraries(zip PRIVATE MbedTLS::MbedTLS) +endif() + +if(HAVE_CRYPTO) + target_sources(zip PRIVATE zip_winzip_aes.c zip_source_winzip_aes_decode.c zip_source_winzip_aes_encode.c) +endif() + +if(SHARED_LIB_VERSIONNING) + set_target_properties(zip PROPERTIES VERSION 5.3 SOVERSION 5) +endif() + +target_link_libraries(zip PRIVATE ZLIB::ZLIB) +target_include_directories(zip + PUBLIC + $ + $ + $ + ) + +if(LIBZIP_DO_INSTALL) + install(TARGETS zip + EXPORT ${PROJECT_NAME}-targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(FILES zip.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +endif() + +# create zip_err_str.h from zip.h +file(READ ${PROJECT_SOURCE_DIR}/lib/zip.h zip_h) +string(REGEX MATCHALL "#define ZIP_ER_([A-Z_]+) ([0-9]+)[ \t]+/([-*0-9a-zA-Z ']*)/" zip_h_err ${zip_h}) +set(zip_err_str [=[ +/* + This file was generated automatically by CMake + from zip.h\; make changes there. +*/ + +#include "zipint.h" + +const char * const _zip_err_str[] = { +]=]) +set(zip_err_type) +foreach(errln ${zip_h_err}) + string(REGEX MATCH "#define ZIP_ER_([A-Z_]+) ([0-9]+)[ \t]+/([-*0-9a-zA-Z ']*)/" err_t_tt ${errln}) + string(REGEX MATCH "([N|S|Z]+) ([-0-9a-zA-Z ']*)" err_t_tt "${CMAKE_MATCH_3}") + string(APPEND zip_err_type " ${CMAKE_MATCH_1},\n") + string(STRIP "${CMAKE_MATCH_2}" err_t_tt) + string(APPEND zip_err_str " \"${err_t_tt}\",\n") +endforeach() +string(APPEND zip_err_str [=[}\; + +const int _zip_nerr_str = sizeof(_zip_err_str)/sizeof(_zip_err_str[0])\; + +#define N ZIP_ET_NONE +#define S ZIP_ET_SYS +#define Z ZIP_ET_ZLIB + +const int _zip_err_type[] = { +]=]) +string(APPEND zip_err_str "${zip_err_type}}\;\n") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zip_err_str.c ${zip_err_str}) diff --git a/core/deps/libzip/lib/compat.h b/core/deps/libzip/lib/compat.h new file mode 100644 index 000000000..257e0ab45 --- /dev/null +++ b/core/deps/libzip/lib/compat.h @@ -0,0 +1,194 @@ +#ifndef _HAD_LIBZIP_COMPAT_H +#define _HAD_LIBZIP_COMPAT_H + +/* + compat.h -- compatibility defines. + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zipconf.h" + +#include "config.h" + +/* to have *_MAX definitions for all types when compiling with g++ */ +#define __STDC_LIMIT_MACROS + +#ifdef _WIN32 +#ifndef ZIP_EXTERN +#ifndef ZIP_STATIC +#define ZIP_EXTERN __declspec(dllexport) +#endif +#endif +/* for dup(), close(), etc. */ +#include +#endif + +#ifdef HAVE_STDBOOL_H +#include +#else +typedef char bool; +#define true 1 +#define false 0 +#endif + +#include + +/* at least MinGW does not provide EOPNOTSUPP, see + * http://sourceforge.net/p/mingw/bugs/263/ + */ +#ifndef EOPNOTSUPP +#define EOPNOTSUPP EINVAL +#endif + +/* at least MinGW does not provide EOVERFLOW, see + * http://sourceforge.net/p/mingw/bugs/242/ + */ +#ifndef EOVERFLOW +#define EOVERFLOW EFBIG +#endif + +/* not supported on at least Windows */ +#ifndef O_CLOEXEC +#define O_CLOEXEC 0 +#endif + +#ifdef _WIN32 +#if defined(HAVE__CLOSE) +#define close _close +#endif +#if defined(HAVE__DUP) +#define dup _dup +#endif +/* crashes reported when using fdopen instead of _fdopen on Windows/Visual Studio 10/Win64 */ +#if defined(HAVE__FDOPEN) +#define fdopen _fdopen +#endif +#if !defined(HAVE_FILENO) && defined(HAVE__FILENO) +#define fileno _fileno +#endif +#if defined(HAVE__SNPRINTF) +#define snprintf _snprintf +#endif +#if defined(HAVE__STRDUP) +#if !defined(HAVE_STRDUP) || defined(_WIN32) +#undef strdup +#define strdup _strdup +#endif +#endif +#if !defined(HAVE__SETMODE) && defined(HAVE_SETMODE) +#define _setmode setmode +#endif +#if !defined(HAVE_STRTOLL) && defined(HAVE__STRTOI64) +#define strtoll _strtoi64 +#endif +#if !defined(HAVE_STRTOULL) && defined(HAVE__STRTOUI64) +#define strtoull _strtoui64 +#endif +#if defined(HAVE__UNLINK) +#define unlink _unlink +#endif +#endif + +#ifndef HAVE_FSEEKO +#define fseeko(s, o, w) (fseek((s), (long int)(o), (w))) +#endif + +#ifndef HAVE_FTELLO +#define ftello(s) ((long)ftell((s))) +#endif + +#if !defined(HAVE_STRCASECMP) +#if defined(HAVE__STRICMP) +#define strcasecmp _stricmp +#elif defined(HAVE_STRICMP) +#define strcasecmp stricmp +#endif +#endif + +#if SIZEOF_OFF_T == 8 +#define ZIP_OFF_MAX ZIP_INT64_MAX +#define ZIP_OFF_MIN ZIP_INT64_MIN +#elif SIZEOF_OFF_T == 4 +#define ZIP_OFF_MAX ZIP_INT32_MAX +#define ZIP_OFF_MIN ZIP_INT32_MIN +#elif SIZEOF_OFF_T == 2 +#define ZIP_OFF_MAX ZIP_INT16_MAX +#define ZIP_OFF_MIN ZIP_INT16_MIN +#else +#error unsupported size of off_t +#endif + +#if defined(HAVE_FTELLO) && defined(HAVE_FSEEKO) +#define ZIP_FSEEK_MAX ZIP_OFF_MAX +#define ZIP_FSEEK_MIN ZIP_OFF_MIN +#else +#include +#define ZIP_FSEEK_MAX LONG_MAX +#define ZIP_FSEEK_MIN LONG_MIN +#endif + +#ifndef SIZE_MAX +#if SIZEOF_SIZE_T == 8 +#define SIZE_MAX ZIP_INT64_MAX +#elif SIZEOF_SIZE_T == 4 +#define SIZE_MAX ZIP_INT32_MAX +#elif SIZEOF_SIZE_T == 2 +#define SIZE_MAX ZIP_INT16_MAX +#else +#error unsupported size of size_t +#endif +#endif + +#ifndef PRId64 +#ifdef _MSC_VER +#define PRId64 "I64d" +#else +#define PRId64 "lld" +#endif +#endif + +#ifndef PRIu64 +#ifdef _MSC_VER +#define PRIu64 "I64u" +#else +#define PRIu64 "llu" +#endif +#endif + +#ifndef S_ISDIR +#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR) +#endif + +#ifndef S_ISREG +#define S_ISREG(mode) (((mode)&S_IFMT) == S_IFREG) +#endif + +#endif /* compat.h */ diff --git a/core/deps/libzip/lib/zip.h b/core/deps/libzip/lib/zip.h new file mode 100644 index 000000000..4a1bf8912 --- /dev/null +++ b/core/deps/libzip/lib/zip.h @@ -0,0 +1,481 @@ +#ifndef _HAD_ZIP_H +#define _HAD_ZIP_H + +/* + zip.h -- exported declarations. + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#ifdef __cplusplus +extern "C" { +#if 0 +} /* fix autoindent */ +#endif +#endif + +#include + +#ifndef ZIP_EXTERN +#ifndef ZIP_STATIC +#ifdef _WIN32 +#define ZIP_EXTERN __declspec(dllimport) +#elif defined(__GNUC__) && __GNUC__ >= 4 +#define ZIP_EXTERN __attribute__((visibility("default"))) +#else +#define ZIP_EXTERN +#endif +#else +#define ZIP_EXTERN +#endif +#endif + +#include +#include +#include + +/* flags for zip_open */ + +#define ZIP_CREATE 1 +#define ZIP_EXCL 2 +#define ZIP_CHECKCONS 4 +#define ZIP_TRUNCATE 8 +#define ZIP_RDONLY 16 + + +/* flags for zip_name_locate, zip_fopen, zip_stat, ... */ + +#define ZIP_FL_NOCASE 1u /* ignore case on name lookup */ +#define ZIP_FL_NODIR 2u /* ignore directory component */ +#define ZIP_FL_COMPRESSED 4u /* read compressed data */ +#define ZIP_FL_UNCHANGED 8u /* use original data, ignoring changes */ +#define ZIP_FL_RECOMPRESS 16u /* force recompression of data */ +#define ZIP_FL_ENCRYPTED 32u /* read encrypted data (implies ZIP_FL_COMPRESSED) */ +#define ZIP_FL_ENC_GUESS 0u /* guess string encoding (is default) */ +#define ZIP_FL_ENC_RAW 64u /* get unmodified string */ +#define ZIP_FL_ENC_STRICT 128u /* follow specification strictly */ +#define ZIP_FL_LOCAL 256u /* in local header */ +#define ZIP_FL_CENTRAL 512u /* in central directory */ +/* 1024u reserved for internal use */ +#define ZIP_FL_ENC_UTF_8 2048u /* string is UTF-8 encoded */ +#define ZIP_FL_ENC_CP437 4096u /* string is CP437 encoded */ +#define ZIP_FL_OVERWRITE 8192u /* zip_file_add: if file with name exists, overwrite (replace) it */ + +/* archive global flags flags */ + +#define ZIP_AFL_RDONLY 2u /* read only -- cannot be cleared */ + + +/* create a new extra field */ + +#define ZIP_EXTRA_FIELD_ALL ZIP_UINT16_MAX +#define ZIP_EXTRA_FIELD_NEW ZIP_UINT16_MAX + + +/* libzip error codes */ + +#define ZIP_ER_OK 0 /* N No error */ +#define ZIP_ER_MULTIDISK 1 /* N Multi-disk zip archives not supported */ +#define ZIP_ER_RENAME 2 /* S Renaming temporary file failed */ +#define ZIP_ER_CLOSE 3 /* S Closing zip archive failed */ +#define ZIP_ER_SEEK 4 /* S Seek error */ +#define ZIP_ER_READ 5 /* S Read error */ +#define ZIP_ER_WRITE 6 /* S Write error */ +#define ZIP_ER_CRC 7 /* N CRC error */ +#define ZIP_ER_ZIPCLOSED 8 /* N Containing zip archive was closed */ +#define ZIP_ER_NOENT 9 /* N No such file */ +#define ZIP_ER_EXISTS 10 /* N File already exists */ +#define ZIP_ER_OPEN 11 /* S Can't open file */ +#define ZIP_ER_TMPOPEN 12 /* S Failure to create temporary file */ +#define ZIP_ER_ZLIB 13 /* Z Zlib error */ +#define ZIP_ER_MEMORY 14 /* N Malloc failure */ +#define ZIP_ER_CHANGED 15 /* N Entry has been changed */ +#define ZIP_ER_COMPNOTSUPP 16 /* N Compression method not supported */ +#define ZIP_ER_EOF 17 /* N Premature end of file */ +#define ZIP_ER_INVAL 18 /* N Invalid argument */ +#define ZIP_ER_NOZIP 19 /* N Not a zip archive */ +#define ZIP_ER_INTERNAL 20 /* N Internal error */ +#define ZIP_ER_INCONS 21 /* N Zip archive inconsistent */ +#define ZIP_ER_REMOVE 22 /* S Can't remove file */ +#define ZIP_ER_DELETED 23 /* N Entry has been deleted */ +#define ZIP_ER_ENCRNOTSUPP 24 /* N Encryption method not supported */ +#define ZIP_ER_RDONLY 25 /* N Read-only archive */ +#define ZIP_ER_NOPASSWD 26 /* N No password provided */ +#define ZIP_ER_WRONGPASSWD 27 /* N Wrong password provided */ +#define ZIP_ER_OPNOTSUPP 28 /* N Operation not supported */ +#define ZIP_ER_INUSE 29 /* N Resource still in use */ +#define ZIP_ER_TELL 30 /* S Tell error */ +#define ZIP_ER_COMPRESSED_DATA 31 /* N Compressed data invalid */ +#define ZIP_ER_CANCELLED 32 /* N Operation cancelled */ + +/* type of system error value */ + +#define ZIP_ET_NONE 0 /* sys_err unused */ +#define ZIP_ET_SYS 1 /* sys_err is errno */ +#define ZIP_ET_ZLIB 2 /* sys_err is zlib error code */ + +/* compression methods */ + +#define ZIP_CM_DEFAULT -1 /* better of deflate or store */ +#define ZIP_CM_STORE 0 /* stored (uncompressed) */ +#define ZIP_CM_SHRINK 1 /* shrunk */ +#define ZIP_CM_REDUCE_1 2 /* reduced with factor 1 */ +#define ZIP_CM_REDUCE_2 3 /* reduced with factor 2 */ +#define ZIP_CM_REDUCE_3 4 /* reduced with factor 3 */ +#define ZIP_CM_REDUCE_4 5 /* reduced with factor 4 */ +#define ZIP_CM_IMPLODE 6 /* imploded */ +/* 7 - Reserved for Tokenizing compression algorithm */ +#define ZIP_CM_DEFLATE 8 /* deflated */ +#define ZIP_CM_DEFLATE64 9 /* deflate64 */ +#define ZIP_CM_PKWARE_IMPLODE 10 /* PKWARE imploding */ +/* 11 - Reserved by PKWARE */ +#define ZIP_CM_BZIP2 12 /* compressed using BZIP2 algorithm */ +/* 13 - Reserved by PKWARE */ +#define ZIP_CM_LZMA 14 /* LZMA (EFS) */ +/* 15-17 - Reserved by PKWARE */ +#define ZIP_CM_TERSE 18 /* compressed using IBM TERSE (new) */ +#define ZIP_CM_LZ77 19 /* IBM LZ77 z Architecture (PFS) */ +/* 20 - old value for Zstandard */ +#define ZIP_CM_LZMA2 33 +#define ZIP_CM_ZSTD 93 /* Zstandard compressed data */ +#define ZIP_CM_XZ 95 /* XZ compressed data */ +#define ZIP_CM_JPEG 96 /* Compressed Jpeg data */ +#define ZIP_CM_WAVPACK 97 /* WavPack compressed data */ +#define ZIP_CM_PPMD 98 /* PPMd version I, Rev 1 */ + +/* encryption methods */ + +#define ZIP_EM_NONE 0 /* not encrypted */ +#define ZIP_EM_TRAD_PKWARE 1 /* traditional PKWARE encryption */ +#if 0 /* Strong Encryption Header not parsed yet */ +#define ZIP_EM_DES 0x6601 /* strong encryption: DES */ +#define ZIP_EM_RC2_OLD 0x6602 /* strong encryption: RC2, version < 5.2 */ +#define ZIP_EM_3DES_168 0x6603 +#define ZIP_EM_3DES_112 0x6609 +#define ZIP_EM_PKZIP_AES_128 0x660e +#define ZIP_EM_PKZIP_AES_192 0x660f +#define ZIP_EM_PKZIP_AES_256 0x6610 +#define ZIP_EM_RC2 0x6702 /* strong encryption: RC2, version >= 5.2 */ +#define ZIP_EM_RC4 0x6801 +#endif +#define ZIP_EM_AES_128 0x0101 /* Winzip AES encryption */ +#define ZIP_EM_AES_192 0x0102 +#define ZIP_EM_AES_256 0x0103 +#define ZIP_EM_UNKNOWN 0xffff /* unknown algorithm */ + +#define ZIP_OPSYS_DOS 0x00u +#define ZIP_OPSYS_AMIGA 0x01u +#define ZIP_OPSYS_OPENVMS 0x02u +#define ZIP_OPSYS_UNIX 0x03u +#define ZIP_OPSYS_VM_CMS 0x04u +#define ZIP_OPSYS_ATARI_ST 0x05u +#define ZIP_OPSYS_OS_2 0x06u +#define ZIP_OPSYS_MACINTOSH 0x07u +#define ZIP_OPSYS_Z_SYSTEM 0x08u +#define ZIP_OPSYS_CPM 0x09u +#define ZIP_OPSYS_WINDOWS_NTFS 0x0au +#define ZIP_OPSYS_MVS 0x0bu +#define ZIP_OPSYS_VSE 0x0cu +#define ZIP_OPSYS_ACORN_RISC 0x0du +#define ZIP_OPSYS_VFAT 0x0eu +#define ZIP_OPSYS_ALTERNATE_MVS 0x0fu +#define ZIP_OPSYS_BEOS 0x10u +#define ZIP_OPSYS_TANDEM 0x11u +#define ZIP_OPSYS_OS_400 0x12u +#define ZIP_OPSYS_OS_X 0x13u + +#define ZIP_OPSYS_DEFAULT ZIP_OPSYS_UNIX + + +enum zip_source_cmd { + ZIP_SOURCE_OPEN, /* prepare for reading */ + ZIP_SOURCE_READ, /* read data */ + ZIP_SOURCE_CLOSE, /* reading is done */ + ZIP_SOURCE_STAT, /* get meta information */ + ZIP_SOURCE_ERROR, /* get error information */ + ZIP_SOURCE_FREE, /* cleanup and free resources */ + ZIP_SOURCE_SEEK, /* set position for reading */ + ZIP_SOURCE_TELL, /* get read position */ + ZIP_SOURCE_BEGIN_WRITE, /* prepare for writing */ + ZIP_SOURCE_COMMIT_WRITE, /* writing is done */ + ZIP_SOURCE_ROLLBACK_WRITE, /* discard written changes */ + ZIP_SOURCE_WRITE, /* write data */ + ZIP_SOURCE_SEEK_WRITE, /* set position for writing */ + ZIP_SOURCE_TELL_WRITE, /* get write position */ + ZIP_SOURCE_SUPPORTS, /* check whether source supports command */ + ZIP_SOURCE_REMOVE, /* remove file */ + ZIP_SOURCE_RESERVED_1, /* previously used internally */ + ZIP_SOURCE_BEGIN_WRITE_CLONING, /* like ZIP_SOURCE_BEGIN_WRITE, but keep part of original file */ + ZIP_SOURCE_ACCEPT_EMPTY, /* whether empty files are valid archives */ + ZIP_SOURCE_GET_FILE_ATTRIBUTES /* get additional file attributes */ +}; +typedef enum zip_source_cmd zip_source_cmd_t; + +#define ZIP_SOURCE_MAKE_COMMAND_BITMASK(cmd) (((zip_int64_t)1) << (cmd)) + +/* clang-format off */ + +#define ZIP_SOURCE_SUPPORTS_READABLE (ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_OPEN) \ + | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_READ) \ + | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_CLOSE) \ + | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_STAT) \ + | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_ERROR) \ + | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_FREE)) + +#define ZIP_SOURCE_SUPPORTS_SEEKABLE (ZIP_SOURCE_SUPPORTS_READABLE \ + | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SEEK) \ + | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_TELL) \ + | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SUPPORTS)) + +#define ZIP_SOURCE_SUPPORTS_WRITABLE (ZIP_SOURCE_SUPPORTS_SEEKABLE \ + | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_BEGIN_WRITE) \ + | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_COMMIT_WRITE) \ + | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_ROLLBACK_WRITE) \ + | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_WRITE) \ + | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SEEK_WRITE) \ + | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_TELL_WRITE) \ + | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_REMOVE)) + +/* clang-format on */ + +/* for use by sources */ +struct zip_source_args_seek { + zip_int64_t offset; + int whence; +}; + +typedef struct zip_source_args_seek zip_source_args_seek_t; +#define ZIP_SOURCE_GET_ARGS(type, data, len, error) ((len) < sizeof(type) ? zip_error_set((error), ZIP_ER_INVAL, 0), (type *)NULL : (type *)(data)) + + +/* error information */ +/* use zip_error_*() to access */ +struct zip_error { + int zip_err; /* libzip error code (ZIP_ER_*) */ + int sys_err; /* copy of errno (E*) or zlib error code */ + char *_Nullable str; /* string representation or NULL */ +}; + +#define ZIP_STAT_NAME 0x0001u +#define ZIP_STAT_INDEX 0x0002u +#define ZIP_STAT_SIZE 0x0004u +#define ZIP_STAT_COMP_SIZE 0x0008u +#define ZIP_STAT_MTIME 0x0010u +#define ZIP_STAT_CRC 0x0020u +#define ZIP_STAT_COMP_METHOD 0x0040u +#define ZIP_STAT_ENCRYPTION_METHOD 0x0080u +#define ZIP_STAT_FLAGS 0x0100u + +struct zip_stat { + zip_uint64_t valid; /* which fields have valid values */ + const char *_Nullable name; /* name of the file */ + zip_uint64_t index; /* index within archive */ + zip_uint64_t size; /* size of file (uncompressed) */ + zip_uint64_t comp_size; /* size of file (compressed) */ + time_t mtime; /* modification time */ + zip_uint32_t crc; /* crc of file data */ + zip_uint16_t comp_method; /* compression method used */ + zip_uint16_t encryption_method; /* encryption method used */ + zip_uint32_t flags; /* reserved for future use */ +}; + +struct zip_buffer_fragment { + zip_uint8_t *_Nonnull data; + zip_uint64_t length; +}; + +struct zip_file_attributes { + zip_uint64_t valid; /* which fields have valid values */ + zip_uint8_t version; /* version of this struct, currently 1 */ + zip_uint8_t host_system; /* host system on which file was created */ + zip_uint8_t ascii; /* flag whether file is ASCII text */ + zip_uint8_t version_needed; /* minimum version needed to extract file */ + zip_uint32_t external_file_attributes; /* external file attributes (host-system specific) */ + zip_uint16_t general_purpose_bit_flags; /* general purpose big flags, only some bits are honored */ + zip_uint16_t general_purpose_bit_mask; /* which bits in general_purpose_bit_flags are valid */ +}; + +#define ZIP_FILE_ATTRIBUTES_HOST_SYSTEM 0x0001u +#define ZIP_FILE_ATTRIBUTES_ASCII 0x0002u +#define ZIP_FILE_ATTRIBUTES_VERSION_NEEDED 0x0004u +#define ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES 0x0008u +#define ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS 0x0010u + +struct zip; +struct zip_file; +struct zip_source; + +typedef struct zip zip_t; +typedef struct zip_error zip_error_t; +typedef struct zip_file zip_file_t; +typedef struct zip_file_attributes zip_file_attributes_t; +typedef struct zip_source zip_source_t; +typedef struct zip_stat zip_stat_t; +typedef struct zip_buffer_fragment zip_buffer_fragment_t; + +typedef zip_uint32_t zip_flags_t; + +typedef zip_int64_t (*zip_source_callback)(void *_Nullable, void *_Nullable, zip_uint64_t, zip_source_cmd_t); +typedef void (*zip_progress_callback)(zip_t *_Nonnull, double, void *_Nullable); +typedef int (*zip_cancel_callback)(zip_t *_Nonnull, void *_Nullable); + +#ifndef ZIP_DISABLE_DEPRECATED +typedef void (*zip_progress_callback_t)(double); +ZIP_EXTERN void zip_register_progress_callback(zip_t *_Nonnull, zip_progress_callback_t _Nullable); /* use zip_register_progress_callback_with_state */ + +ZIP_EXTERN zip_int64_t zip_add(zip_t *_Nonnull, const char *_Nonnull, zip_source_t *_Nonnull); /* use zip_file_add */ +ZIP_EXTERN zip_int64_t zip_add_dir(zip_t *_Nonnull, const char *_Nonnull); /* use zip_dir_add */ +ZIP_EXTERN const char *_Nullable zip_get_file_comment(zip_t *_Nonnull, zip_uint64_t, int *_Nullable, int); /* use zip_file_get_comment */ +ZIP_EXTERN int zip_get_num_files(zip_t *_Nonnull); /* use zip_get_num_entries instead */ +ZIP_EXTERN int zip_rename(zip_t *_Nonnull, zip_uint64_t, const char *_Nonnull); /* use zip_file_rename */ +ZIP_EXTERN int zip_replace(zip_t *_Nonnull, zip_uint64_t, zip_source_t *_Nonnull); /* use zip_file_replace */ +ZIP_EXTERN int zip_set_file_comment(zip_t *_Nonnull, zip_uint64_t, const char *_Nullable, int); /* use zip_file_set_comment */ +ZIP_EXTERN int zip_error_get_sys_type(int); /* use zip_error_system_type */ +ZIP_EXTERN void zip_error_get(zip_t *_Nonnull, int *_Nullable, int *_Nullable); /* use zip_get_error, zip_error_code_zip / zip_error_code_system */ +ZIP_EXTERN int zip_error_to_str(char *_Nonnull, zip_uint64_t, int, int); /* use zip_error_init_with_code / zip_error_strerror */ +ZIP_EXTERN void zip_file_error_get(zip_file_t *_Nonnull, int *_Nullable, int *_Nullable); /* use zip_file_get_error, zip_error_code_zip / zip_error_code_system */ +#endif + +ZIP_EXTERN int zip_close(zip_t *_Nonnull); +ZIP_EXTERN int zip_delete(zip_t *_Nonnull, zip_uint64_t); +ZIP_EXTERN zip_int64_t zip_dir_add(zip_t *_Nonnull, const char *_Nonnull, zip_flags_t); +ZIP_EXTERN void zip_discard(zip_t *_Nonnull); + +ZIP_EXTERN zip_error_t *_Nonnull zip_get_error(zip_t *_Nonnull); +ZIP_EXTERN void zip_error_clear(zip_t *_Nonnull); +ZIP_EXTERN int zip_error_code_zip(const zip_error_t *_Nonnull); +ZIP_EXTERN int zip_error_code_system(const zip_error_t *_Nonnull); +ZIP_EXTERN void zip_error_fini(zip_error_t *_Nonnull); +ZIP_EXTERN void zip_error_init(zip_error_t *_Nonnull); +ZIP_EXTERN void zip_error_init_with_code(zip_error_t *_Nonnull, int); +ZIP_EXTERN void zip_error_set(zip_error_t *_Nullable, int, int); +ZIP_EXTERN const char *_Nonnull zip_error_strerror(zip_error_t *_Nonnull); +ZIP_EXTERN int zip_error_system_type(const zip_error_t *_Nonnull); +ZIP_EXTERN zip_int64_t zip_error_to_data(const zip_error_t *_Nonnull, void *_Nonnull, zip_uint64_t); + +ZIP_EXTERN int zip_fclose(zip_file_t *_Nonnull); +ZIP_EXTERN zip_t *_Nullable zip_fdopen(int, int, int *_Nullable); +ZIP_EXTERN zip_int64_t zip_file_add(zip_t *_Nonnull, const char *_Nonnull, zip_source_t *_Nonnull, zip_flags_t); +ZIP_EXTERN void zip_file_attributes_init(zip_file_attributes_t *_Nonnull); +ZIP_EXTERN void zip_file_error_clear(zip_file_t *_Nonnull); +ZIP_EXTERN int zip_file_extra_field_delete(zip_t *_Nonnull, zip_uint64_t, zip_uint16_t, zip_flags_t); +ZIP_EXTERN int zip_file_extra_field_delete_by_id(zip_t *_Nonnull, zip_uint64_t, zip_uint16_t, zip_uint16_t, zip_flags_t); +ZIP_EXTERN int zip_file_extra_field_set(zip_t *_Nonnull, zip_uint64_t, zip_uint16_t, zip_uint16_t, const zip_uint8_t *_Nullable, zip_uint16_t, zip_flags_t); +ZIP_EXTERN zip_int16_t zip_file_extra_fields_count(zip_t *_Nonnull, zip_uint64_t, zip_flags_t); +ZIP_EXTERN zip_int16_t zip_file_extra_fields_count_by_id(zip_t *_Nonnull, zip_uint64_t, zip_uint16_t, zip_flags_t); +ZIP_EXTERN const zip_uint8_t *_Nullable zip_file_extra_field_get(zip_t *_Nonnull, zip_uint64_t, zip_uint16_t, zip_uint16_t *_Nullable, zip_uint16_t *_Nullable, zip_flags_t); +ZIP_EXTERN const zip_uint8_t *_Nullable zip_file_extra_field_get_by_id(zip_t *_Nonnull, zip_uint64_t, zip_uint16_t, zip_uint16_t, zip_uint16_t *_Nullable, zip_flags_t); +ZIP_EXTERN const char *_Nullable zip_file_get_comment(zip_t *_Nonnull, zip_uint64_t, zip_uint32_t *_Nullable, zip_flags_t); +ZIP_EXTERN zip_error_t *_Nonnull zip_file_get_error(zip_file_t *_Nonnull); +ZIP_EXTERN int zip_file_get_external_attributes(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint8_t *_Nullable, zip_uint32_t *_Nullable); +ZIP_EXTERN int zip_file_rename(zip_t *_Nonnull, zip_uint64_t, const char *_Nonnull, zip_flags_t); +ZIP_EXTERN int zip_file_replace(zip_t *_Nonnull, zip_uint64_t, zip_source_t *_Nonnull, zip_flags_t); +ZIP_EXTERN int zip_file_set_comment(zip_t *_Nonnull, zip_uint64_t, const char *_Nullable, zip_uint16_t, zip_flags_t); +ZIP_EXTERN int zip_file_set_dostime(zip_t *_Nonnull, zip_uint64_t, zip_uint16_t, zip_uint16_t, zip_flags_t); +ZIP_EXTERN int zip_file_set_encryption(zip_t *_Nonnull, zip_uint64_t, zip_uint16_t, const char *_Nullable); +ZIP_EXTERN int zip_file_set_external_attributes(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint8_t, zip_uint32_t); +ZIP_EXTERN int zip_file_set_mtime(zip_t *_Nonnull, zip_uint64_t, time_t, zip_flags_t); +ZIP_EXTERN const char *_Nonnull zip_file_strerror(zip_file_t *_Nonnull); +ZIP_EXTERN zip_file_t *_Nullable zip_fopen(zip_t *_Nonnull, const char *_Nonnull, zip_flags_t); +ZIP_EXTERN zip_file_t *_Nullable zip_fopen_encrypted(zip_t *_Nonnull, const char *_Nonnull, zip_flags_t, const char *_Nullable); +ZIP_EXTERN zip_file_t *_Nullable zip_fopen_index(zip_t *_Nonnull, zip_uint64_t, zip_flags_t); +ZIP_EXTERN zip_file_t *_Nullable zip_fopen_index_encrypted(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, const char *_Nullable); +ZIP_EXTERN zip_int64_t zip_fread(zip_file_t *_Nonnull, void *_Nonnull, zip_uint64_t); +ZIP_EXTERN zip_int8_t zip_fseek(zip_file_t *_Nonnull, zip_int64_t, int); +ZIP_EXTERN zip_int64_t zip_ftell(zip_file_t *_Nonnull); +ZIP_EXTERN const char *_Nullable zip_get_archive_comment(zip_t *_Nonnull, int *_Nullable, zip_flags_t); +ZIP_EXTERN int zip_get_archive_flag(zip_t *_Nonnull, zip_flags_t, zip_flags_t); +ZIP_EXTERN const char *_Nullable zip_get_name(zip_t *_Nonnull, zip_uint64_t, zip_flags_t); +ZIP_EXTERN zip_int64_t zip_get_num_entries(zip_t *_Nonnull, zip_flags_t); +ZIP_EXTERN const char *_Nonnull zip_libzip_version(void); +ZIP_EXTERN zip_int64_t zip_name_locate(zip_t *_Nonnull, const char *_Nonnull, zip_flags_t); +ZIP_EXTERN zip_t *_Nullable zip_open(const char *_Nonnull, int, int *_Nullable); +ZIP_EXTERN zip_t *_Nullable zip_open_from_source(zip_source_t *_Nonnull, int, zip_error_t *_Nullable); +ZIP_EXTERN int zip_register_progress_callback_with_state(zip_t *_Nonnull, double, zip_progress_callback _Nullable, void (*_Nullable)(void *_Nullable), void *_Nullable); +ZIP_EXTERN int zip_register_cancel_callback_with_state(zip_t *_Nonnull, zip_cancel_callback _Nullable, void (*_Nullable)(void *_Nullable), void *_Nullable); +ZIP_EXTERN int zip_set_archive_comment(zip_t *_Nonnull, const char *_Nullable, zip_uint16_t); +ZIP_EXTERN int zip_set_archive_flag(zip_t *_Nonnull, zip_flags_t, int); +ZIP_EXTERN int zip_set_default_password(zip_t *_Nonnull, const char *_Nullable); +ZIP_EXTERN int zip_set_file_compression(zip_t *_Nonnull, zip_uint64_t, zip_int32_t, zip_uint32_t); +ZIP_EXTERN int zip_source_begin_write(zip_source_t *_Nonnull); +ZIP_EXTERN int zip_source_begin_write_cloning(zip_source_t *_Nonnull, zip_uint64_t); +ZIP_EXTERN zip_source_t *_Nullable zip_source_buffer(zip_t *_Nonnull, const void *_Nullable, zip_uint64_t, int); +ZIP_EXTERN zip_source_t *_Nullable zip_source_buffer_create(const void *_Nullable, zip_uint64_t, int, zip_error_t *_Nullable); +ZIP_EXTERN zip_source_t *_Nullable zip_source_buffer_fragment(zip_t *_Nonnull, const zip_buffer_fragment_t *_Nonnull, zip_uint64_t, int); +ZIP_EXTERN zip_source_t *_Nullable zip_source_buffer_fragment_create(const zip_buffer_fragment_t *_Nullable, zip_uint64_t, int, zip_error_t *_Nullable); +ZIP_EXTERN int zip_source_close(zip_source_t *_Nonnull); +ZIP_EXTERN int zip_source_commit_write(zip_source_t *_Nonnull); +ZIP_EXTERN zip_error_t *_Nonnull zip_source_error(zip_source_t *_Nonnull); +ZIP_EXTERN zip_source_t *_Nullable zip_source_file(zip_t *_Nonnull, const char *_Nonnull, zip_uint64_t, zip_int64_t); +ZIP_EXTERN zip_source_t *_Nullable zip_source_file_create(const char *_Nonnull, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable); +ZIP_EXTERN zip_source_t *_Nullable zip_source_filep(zip_t *_Nonnull, FILE *_Nonnull, zip_uint64_t, zip_int64_t); +ZIP_EXTERN zip_source_t *_Nullable zip_source_filep_create(FILE *_Nonnull, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable); +ZIP_EXTERN void zip_source_free(zip_source_t *_Nullable); +ZIP_EXTERN zip_source_t *_Nullable zip_source_function(zip_t *_Nonnull, zip_source_callback _Nonnull, void *_Nullable); +ZIP_EXTERN zip_source_t *_Nullable zip_source_function_create(zip_source_callback _Nonnull, void *_Nullable, zip_error_t *_Nullable); +ZIP_EXTERN int zip_source_get_file_attributes(zip_source_t *_Nonnull, zip_file_attributes_t *_Nonnull); +ZIP_EXTERN int zip_source_is_deleted(zip_source_t *_Nonnull); +ZIP_EXTERN void zip_source_keep(zip_source_t *_Nonnull); +ZIP_EXTERN zip_int64_t zip_source_make_command_bitmap(zip_source_cmd_t, ...); +ZIP_EXTERN int zip_source_open(zip_source_t *_Nonnull); +ZIP_EXTERN zip_int64_t zip_source_read(zip_source_t *_Nonnull, void *_Nonnull, zip_uint64_t); +ZIP_EXTERN void zip_source_rollback_write(zip_source_t *_Nonnull); +ZIP_EXTERN int zip_source_seek(zip_source_t *_Nonnull, zip_int64_t, int); +ZIP_EXTERN zip_int64_t zip_source_seek_compute_offset(zip_uint64_t, zip_uint64_t, void *_Nonnull, zip_uint64_t, zip_error_t *_Nullable); +ZIP_EXTERN int zip_source_seek_write(zip_source_t *_Nonnull, zip_int64_t, int); +ZIP_EXTERN int zip_source_stat(zip_source_t *_Nonnull, zip_stat_t *_Nonnull); +ZIP_EXTERN zip_int64_t zip_source_tell(zip_source_t *_Nonnull); +ZIP_EXTERN zip_int64_t zip_source_tell_write(zip_source_t *_Nonnull); +#ifdef _WIN32 +ZIP_EXTERN zip_source_t *zip_source_win32a(zip_t *, const char *, zip_uint64_t, zip_int64_t); +ZIP_EXTERN zip_source_t *zip_source_win32a_create(const char *, zip_uint64_t, zip_int64_t, zip_error_t *); +ZIP_EXTERN zip_source_t *zip_source_win32handle(zip_t *, void *, zip_uint64_t, zip_int64_t); +ZIP_EXTERN zip_source_t *zip_source_win32handle_create(void *, zip_uint64_t, zip_int64_t, zip_error_t *); +ZIP_EXTERN zip_source_t *zip_source_win32w(zip_t *, const wchar_t *, zip_uint64_t, zip_int64_t); +ZIP_EXTERN zip_source_t *zip_source_win32w_create(const wchar_t *, zip_uint64_t, zip_int64_t, zip_error_t *); +#endif +ZIP_EXTERN zip_int64_t zip_source_write(zip_source_t *_Nonnull, const void *_Nullable, zip_uint64_t); +ZIP_EXTERN zip_source_t *_Nullable zip_source_zip(zip_t *_Nonnull, zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint64_t, zip_int64_t); +ZIP_EXTERN int zip_stat(zip_t *_Nonnull, const char *_Nonnull, zip_flags_t, zip_stat_t *_Nonnull); +ZIP_EXTERN int zip_stat_index(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_stat_t *_Nonnull); +ZIP_EXTERN void zip_stat_init(zip_stat_t *_Nonnull); +ZIP_EXTERN const char *_Nonnull zip_strerror(zip_t *_Nonnull); +ZIP_EXTERN int zip_unchange(zip_t *_Nonnull, zip_uint64_t); +ZIP_EXTERN int zip_unchange_all(zip_t *_Nonnull); +ZIP_EXTERN int zip_unchange_archive(zip_t *_Nonnull); +ZIP_EXTERN int zip_compression_method_supported(zip_int32_t method, int compress); +ZIP_EXTERN int zip_encryption_method_supported(zip_uint16_t method, int encode); + +#ifdef __cplusplus +} +#endif + +#endif /* _HAD_ZIP_H */ diff --git a/core/deps/libzip/zip_add.c b/core/deps/libzip/lib/zip_add.c similarity index 76% rename from core/deps/libzip/zip_add.c rename to core/deps/libzip/lib/zip_add.c index f6bdb2ab9..ef04f1e51 100644 --- a/core/deps/libzip/zip_add.c +++ b/core/deps/libzip/lib/zip_add.c @@ -1,6 +1,6 @@ /* zip_add.c -- add file via callback function - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,19 +31,19 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" - -ZIP_EXTERN int -zip_add(struct zip *za, const char *name, struct zip_source *source) -{ - if (name == NULL || source == NULL) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; - } - - return _zip_replace(za, -1, name, source); +/* + NOTE: Return type is signed so we can return -1 on error. + The index can not be larger than ZIP_INT64_MAX since the size + of the central directory cannot be larger than + ZIP_UINT64_MAX, and each entry is larger than 2 bytes. +*/ + +ZIP_EXTERN zip_int64_t +zip_add(zip_t *za, const char *name, zip_source_t *source) { + return zip_file_add(za, name, source, 0); } diff --git a/core/deps/libzip/zip_source_free.c b/core/deps/libzip/lib/zip_add_dir.c similarity index 83% rename from core/deps/libzip/zip_source_free.c rename to core/deps/libzip/lib/zip_add_dir.c index 7a1632fbf..9999c8da2 100644 --- a/core/deps/libzip/zip_source_free.c +++ b/core/deps/libzip/lib/zip_add_dir.c @@ -1,6 +1,6 @@ /* - zip_source_free.c -- free zip data source - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + zip_add_dir.c -- add directory + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,21 +31,14 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - -#include +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" - -ZIP_EXTERN void -zip_source_free(struct zip_source *source) -{ - if (source == NULL) - return; +/* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ - (void)source->f(source->ud, NULL, 0, ZIP_SOURCE_FREE); - - free(source); +ZIP_EXTERN zip_int64_t +zip_add_dir(zip_t *za, const char *name) { + return zip_dir_add(za, name, 0); } diff --git a/core/deps/libzip/lib/zip_add_entry.c b/core/deps/libzip/lib/zip_add_entry.c new file mode 100644 index 000000000..1c9fcff6a --- /dev/null +++ b/core/deps/libzip/lib/zip_add_entry.c @@ -0,0 +1,80 @@ +/* + zip_add_entry.c -- create and init struct zip_entry + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include + +#include "zipint.h" + + +/* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ + +zip_int64_t +_zip_add_entry(zip_t *za) { + zip_uint64_t idx; + + if (za->nentry + 1 >= za->nentry_alloc) { + zip_entry_t *rentries; + zip_uint64_t nalloc = za->nentry_alloc; + zip_uint64_t additional_entries = 2 * nalloc; + zip_uint64_t realloc_size; + + if (additional_entries < 16) { + additional_entries = 16; + } + else if (additional_entries > 1024) { + additional_entries = 1024; + } + /* neither + nor * overflows can happen: nentry_alloc * sizeof(struct zip_entry) < UINT64_MAX */ + nalloc += additional_entries; + realloc_size = sizeof(struct zip_entry) * (size_t)nalloc; + + if (sizeof(struct zip_entry) * (size_t)za->nentry_alloc > realloc_size) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + rentries = (zip_entry_t *)realloc(za->entry, sizeof(struct zip_entry) * (size_t)nalloc); + if (!rentries) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + za->entry = rentries; + za->nentry_alloc = nalloc; + } + + idx = za->nentry++; + + _zip_entry_init(za->entry + idx); + + return (zip_int64_t)idx; +} diff --git a/core/deps/libzip/lib/zip_algorithm_bzip2.c b/core/deps/libzip/lib/zip_algorithm_bzip2.c new file mode 100644 index 000000000..7434e5409 --- /dev/null +++ b/core/deps/libzip/lib/zip_algorithm_bzip2.c @@ -0,0 +1,285 @@ +/* + zip_algorithm_bzip2.c -- bzip2 (de)compression routines + Copyright (C) 2017-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zipint.h" + +#include +#include +#include + +struct ctx { + zip_error_t *error; + bool compress; + int compression_flags; + bool end_of_input; + bz_stream zstr; +}; + + +static zip_uint64_t +maximum_compressed_size(zip_uint64_t uncompressed_size) { + zip_uint64_t compressed_size = (zip_uint64_t)((double)uncompressed_size * 1.006); + + if (compressed_size < uncompressed_size) { + return ZIP_UINT64_MAX; + } + return compressed_size; +} + + +static void * +allocate(bool compress, int compression_flags, zip_error_t *error) { + struct ctx *ctx; + + if ((ctx = (struct ctx *)malloc(sizeof(*ctx))) == NULL) { + return NULL; + } + + ctx->error = error; + ctx->compress = compress; + ctx->compression_flags = compression_flags; + if (ctx->compression_flags < 1 || ctx->compression_flags > 9) { + ctx->compression_flags = 9; + } + ctx->end_of_input = false; + + ctx->zstr.bzalloc = NULL; + ctx->zstr.bzfree = NULL; + ctx->zstr.opaque = NULL; + + return ctx; +} + + +static void * +compress_allocate(zip_uint16_t method, int compression_flags, zip_error_t *error) { + return allocate(true, compression_flags, error); +} + + +static void * +decompress_allocate(zip_uint16_t method, int compression_flags, zip_error_t *error) { + return allocate(false, compression_flags, error); +} + + +static void +deallocate(void *ud) { + struct ctx *ctx = (struct ctx *)ud; + + free(ctx); +} + + +static zip_uint16_t +general_purpose_bit_flags(void *ud) { + return 0; +} + + +static int +map_error(int ret) { + switch (ret) { + case BZ_FINISH_OK: + case BZ_FLUSH_OK: + case BZ_OK: + case BZ_RUN_OK: + case BZ_STREAM_END: + return ZIP_ER_OK; + + case BZ_DATA_ERROR: + case BZ_DATA_ERROR_MAGIC: + case BZ_UNEXPECTED_EOF: + return ZIP_ER_COMPRESSED_DATA; + + case BZ_MEM_ERROR: + return ZIP_ER_MEMORY; + + case BZ_PARAM_ERROR: + return ZIP_ER_INVAL; + + case BZ_CONFIG_ERROR: /* actually, bzip2 miscompiled */ + case BZ_IO_ERROR: + case BZ_OUTBUFF_FULL: + case BZ_SEQUENCE_ERROR: + return ZIP_ER_INTERNAL; + + default: + return ZIP_ER_INTERNAL; + } +} + +static bool +start(void *ud, zip_stat_t *st, zip_file_attributes_t *attributes) { + struct ctx *ctx = (struct ctx *)ud; + int ret; + + ctx->zstr.avail_in = 0; + ctx->zstr.next_in = NULL; + ctx->zstr.avail_out = 0; + ctx->zstr.next_out = NULL; + + if (ctx->compress) { + ret = BZ2_bzCompressInit(&ctx->zstr, ctx->compression_flags, 0, 30); + } + else { + ret = BZ2_bzDecompressInit(&ctx->zstr, 0, 0); + } + + if (ret != BZ_OK) { + zip_error_set(ctx->error, map_error(ret), 0); + return false; + } + + return true; +} + + +static bool +end(void *ud) { + struct ctx *ctx = (struct ctx *)ud; + int err; + + if (ctx->compress) { + err = BZ2_bzCompressEnd(&ctx->zstr); + } + else { + err = BZ2_bzDecompressEnd(&ctx->zstr); + } + + if (err != BZ_OK) { + zip_error_set(ctx->error, map_error(err), 0); + return false; + } + + return true; +} + + +static bool +input(void *ud, zip_uint8_t *data, zip_uint64_t length) { + struct ctx *ctx = (struct ctx *)ud; + + if (length > UINT_MAX || ctx->zstr.avail_in > 0) { + zip_error_set(ctx->error, ZIP_ER_INVAL, 0); + return false; + } + + ctx->zstr.avail_in = (unsigned int)length; + ctx->zstr.next_in = (char *)data; + + return true; +} + + +static void +end_of_input(void *ud) { + struct ctx *ctx = (struct ctx *)ud; + + ctx->end_of_input = true; +} + + +static zip_compression_status_t +process(void *ud, zip_uint8_t *data, zip_uint64_t *length) { + struct ctx *ctx = (struct ctx *)ud; + + int ret; + + if (ctx->zstr.avail_in == 0 && !ctx->end_of_input) { + *length = 0; + return ZIP_COMPRESSION_NEED_DATA; + } + + ctx->zstr.avail_out = (unsigned int)ZIP_MIN(UINT_MAX, *length); + ctx->zstr.next_out = (char *)data; + + if (ctx->compress) { + ret = BZ2_bzCompress(&ctx->zstr, ctx->end_of_input ? BZ_FINISH : BZ_RUN); + } + else { + ret = BZ2_bzDecompress(&ctx->zstr); + } + + *length = *length - ctx->zstr.avail_out; + + switch (ret) { + case BZ_FINISH_OK: /* compression */ + return ZIP_COMPRESSION_OK; + + case BZ_OK: /* decompression */ + case BZ_RUN_OK: /* compression */ + if (ctx->zstr.avail_in == 0) { + return ZIP_COMPRESSION_NEED_DATA; + } + return ZIP_COMPRESSION_OK; + + case BZ_STREAM_END: + return ZIP_COMPRESSION_END; + + default: + zip_error_set(ctx->error, map_error(ret), 0); + return ZIP_COMPRESSION_ERROR; + } +} + +/* clang-format off */ + +zip_compression_algorithm_t zip_algorithm_bzip2_compress = { + maximum_compressed_size, + compress_allocate, + deallocate, + general_purpose_bit_flags, + 46, + start, + end, + input, + end_of_input, + process +}; + + +zip_compression_algorithm_t zip_algorithm_bzip2_decompress = { + maximum_compressed_size, + decompress_allocate, + deallocate, + general_purpose_bit_flags, + 46, + start, + end, + input, + end_of_input, + process +}; + +/* clang-format on */ diff --git a/core/deps/libzip/lib/zip_algorithm_deflate.c b/core/deps/libzip/lib/zip_algorithm_deflate.c new file mode 100644 index 000000000..99d8a597b --- /dev/null +++ b/core/deps/libzip/lib/zip_algorithm_deflate.c @@ -0,0 +1,265 @@ +/* + zip_algorithm_deflate.c -- deflate (de)compression routines + Copyright (C) 2017-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zipint.h" + +#include +#include +#include + +struct ctx { + zip_error_t *error; + bool compress; + int compression_flags; + bool end_of_input; + z_stream zstr; +}; + + +static zip_uint64_t +maximum_compressed_size(zip_uint64_t uncompressed_size) { + /* max deflate size increase: size + ceil(size/16k)*5+6 */ + + zip_uint64_t compressed_size = uncompressed_size + (uncompressed_size + 16383) / 16384 * 5 + 6; + + if (compressed_size < uncompressed_size) { + return ZIP_UINT64_MAX; + } + return compressed_size; +} + + +static void * +allocate(bool compress, int compression_flags, zip_error_t *error) { + struct ctx *ctx; + + if ((ctx = (struct ctx *)malloc(sizeof(*ctx))) == NULL) { + zip_error_set(error, ZIP_ET_SYS, errno); + return NULL; + } + + ctx->error = error; + ctx->compress = compress; + ctx->compression_flags = compression_flags; + if (ctx->compression_flags < 1 || ctx->compression_flags > 9) { + ctx->compression_flags = Z_BEST_COMPRESSION; + } + ctx->end_of_input = false; + + ctx->zstr.zalloc = Z_NULL; + ctx->zstr.zfree = Z_NULL; + ctx->zstr.opaque = NULL; + + return ctx; +} + + +static void * +compress_allocate(zip_uint16_t method, int compression_flags, zip_error_t *error) { + return allocate(true, compression_flags, error); +} + + +static void * +decompress_allocate(zip_uint16_t method, int compression_flags, zip_error_t *error) { + return allocate(false, compression_flags, error); +} + + +static void +deallocate(void *ud) { + struct ctx *ctx = (struct ctx *)ud; + + free(ctx); +} + + +static zip_uint16_t +general_purpose_bit_flags(void *ud) { + struct ctx *ctx = (struct ctx *)ud; + + if (!ctx->compress) { + return 0; + } + + if (ctx->compression_flags < 3) { + return 2 << 1; + } + else if (ctx->compression_flags > 7) { + return 1 << 1; + } + return 0; +} + + +static bool +start(void *ud, zip_stat_t *st, zip_file_attributes_t *attributes) { + struct ctx *ctx = (struct ctx *)ud; + int ret; + + ctx->zstr.avail_in = 0; + ctx->zstr.next_in = NULL; + ctx->zstr.avail_out = 0; + ctx->zstr.next_out = NULL; + + if (ctx->compress) { + /* negative value to tell zlib not to write a header */ + ret = deflateInit2(&ctx->zstr, ctx->compression_flags, Z_DEFLATED, -MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY); + } + else { + ret = inflateInit2(&ctx->zstr, -MAX_WBITS); + } + + if (ret != Z_OK) { + zip_error_set(ctx->error, ZIP_ER_ZLIB, ret); + return false; + } + + + return true; +} + + +static bool +end(void *ud) { + struct ctx *ctx = (struct ctx *)ud; + int err; + + if (ctx->compress) { + err = deflateEnd(&ctx->zstr); + } + else { + err = inflateEnd(&ctx->zstr); + } + + if (err != Z_OK) { + zip_error_set(ctx->error, ZIP_ER_ZLIB, err); + return false; + } + + return true; +} + + +static bool +input(void *ud, zip_uint8_t *data, zip_uint64_t length) { + struct ctx *ctx = (struct ctx *)ud; + + if (length > UINT_MAX || ctx->zstr.avail_in > 0) { + zip_error_set(ctx->error, ZIP_ER_INVAL, 0); + return false; + } + + ctx->zstr.avail_in = (uInt)length; + ctx->zstr.next_in = (Bytef *)data; + + return true; +} + + +static void +end_of_input(void *ud) { + struct ctx *ctx = (struct ctx *)ud; + + ctx->end_of_input = true; +} + + +static zip_compression_status_t +process(void *ud, zip_uint8_t *data, zip_uint64_t *length) { + struct ctx *ctx = (struct ctx *)ud; + + int ret; + + ctx->zstr.avail_out = (uInt)ZIP_MIN(UINT_MAX, *length); + ctx->zstr.next_out = (Bytef *)data; + + if (ctx->compress) { + ret = deflate(&ctx->zstr, ctx->end_of_input ? Z_FINISH : 0); + } + else { + ret = inflate(&ctx->zstr, Z_SYNC_FLUSH); + } + + *length = *length - ctx->zstr.avail_out; + + switch (ret) { + case Z_OK: + return ZIP_COMPRESSION_OK; + + case Z_STREAM_END: + return ZIP_COMPRESSION_END; + + case Z_BUF_ERROR: + if (ctx->zstr.avail_in == 0) { + return ZIP_COMPRESSION_NEED_DATA; + } + + /* fallthrough */ + + default: + zip_error_set(ctx->error, ZIP_ER_ZLIB, ret); + return ZIP_COMPRESSION_ERROR; + } +} + +/* clang-format off */ + +zip_compression_algorithm_t zip_algorithm_deflate_compress = { + maximum_compressed_size, + compress_allocate, + deallocate, + general_purpose_bit_flags, + 20, + start, + end, + input, + end_of_input, + process +}; + + +zip_compression_algorithm_t zip_algorithm_deflate_decompress = { + maximum_compressed_size, + decompress_allocate, + deallocate, + general_purpose_bit_flags, + 20, + start, + end, + input, + end_of_input, + process +}; + +/* clang-format on */ diff --git a/core/deps/libzip/lib/zip_algorithm_xz.c b/core/deps/libzip/lib/zip_algorithm_xz.c new file mode 100644 index 000000000..25abaf2d2 --- /dev/null +++ b/core/deps/libzip/lib/zip_algorithm_xz.c @@ -0,0 +1,407 @@ +/* + zip_algorithm_xz.c -- LZMA/XZ (de)compression routines + Bazed on zip_algorithm_deflate.c -- deflate (de)compression routines + Copyright (C) 2017-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zipint.h" + +#include +#include +#include +#include + +enum header_state { INCOMPLETE, OUTPUT, DONE }; + +#define HEADER_BYTES_ZIP 9 +#define HEADER_MAGIC_LENGTH 4 +#define HEADER_MAGIC1_OFFSET 0 +#define HEADER_MAGIC2_OFFSET 2 +#define HEADER_SIZE_OFFSET 9 +#define HEADER_SIZE_LENGTH 8 +#define HEADER_PARAMETERS_LENGTH 5 +#define HEADER_LZMA_ALONE_LENGTH (HEADER_PARAMETERS_LENGTH + HEADER_SIZE_LENGTH) + +struct ctx { + zip_error_t *error; + bool compress; + zip_uint32_t compression_flags; + bool end_of_input; + lzma_stream zstr; + zip_uint16_t method; + /* header member is used for converting from zip to "lzma alone" + * format + * + * "lzma alone" file format starts with: + * 5 bytes lzma parameters + * 8 bytes uncompressed size + * compressed data + * + * zip archive on-disk format starts with + * 4 bytes magic (first two bytes vary, e.g. 0x0914 or 0x1002, next bytes are 0x0500) + * 5 bytes lzma parameters + * compressed data + * + * we read the data into a header of the form + * 4 bytes magic + * 5 bytes lzma parameters + * 8 bytes uncompressed size + */ + zip_uint8_t header[HEADER_MAGIC_LENGTH + HEADER_LZMA_ALONE_LENGTH]; + zip_uint8_t header_bytes_offset; + enum header_state header_state; + zip_uint64_t uncompresssed_size; +}; + + +static zip_uint64_t +maximum_compressed_size(zip_uint64_t uncompressed_size) { + /* + According to https://sourceforge.net/p/sevenzip/discussion/45797/thread/b6bd62f8/ + + 1) you can use + outSize = 1.10 * originalSize + 64 KB. + in most cases outSize is less then 1.02 from originalSize. + 2) You can try LZMA2, where + outSize can be = 1.001 * originalSize + 1 KB. + */ + /* 13 bytes added for lzma alone header */ + zip_uint64_t compressed_size = (zip_uint64_t)((double)uncompressed_size * 1.1) + 64 * 1024 + 13; + + if (compressed_size < uncompressed_size) { + return ZIP_UINT64_MAX; + } + return compressed_size; +} + + +static void * +allocate(bool compress, int compression_flags, zip_error_t *error, zip_uint16_t method) { + struct ctx *ctx; + + if (compression_flags < 0) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((ctx = (struct ctx *)malloc(sizeof(*ctx))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + ctx->error = error; + ctx->compress = compress; + ctx->compression_flags = (zip_uint32_t)compression_flags; + ctx->compression_flags |= LZMA_PRESET_EXTREME; + ctx->end_of_input = false; + memset(ctx->header, 0, sizeof(ctx->header)); + ctx->header_bytes_offset = 0; + if (ZIP_CM_LZMA) { + ctx->header_state = INCOMPLETE; + } + else { + ctx->header_state = DONE; + } + memset(&ctx->zstr, 0, sizeof(ctx->zstr)); + ctx->method = method; + return ctx; +} + + +static void * +compress_allocate(zip_uint16_t method, int compression_flags, zip_error_t *error) { + return allocate(true, compression_flags, error, method); +} + + +static void * +decompress_allocate(zip_uint16_t method, int compression_flags, zip_error_t *error) { + return allocate(false, compression_flags, error, method); +} + + +static void +deallocate(void *ud) { + struct ctx *ctx = (struct ctx *)ud; + free(ctx); +} + + +static zip_uint16_t +general_purpose_bit_flags(void *ud) { + struct ctx *ctx = (struct ctx *)ud; + + if (!ctx->compress) { + return 0; + } + + if (ctx->method == ZIP_CM_LZMA) { + /* liblzma always returns an EOS/EOPM marker, see + * https://sourceforge.net/p/lzmautils/discussion/708858/thread/84c5dbb9/#a5e4/3764 */ + return 1 << 1; + } + return 0; +} + +static int +map_error(lzma_ret ret) { + switch (ret) { + case LZMA_DATA_ERROR: + case LZMA_UNSUPPORTED_CHECK: + return ZIP_ER_COMPRESSED_DATA; + + case LZMA_MEM_ERROR: + return ZIP_ER_MEMORY; + + case LZMA_OPTIONS_ERROR: + return ZIP_ER_INVAL; + + default: + return ZIP_ER_INTERNAL; + } +} + + +static bool +start(void *ud, zip_stat_t *st, zip_file_attributes_t *attributes) { + struct ctx *ctx = (struct ctx *)ud; + lzma_ret ret; + + lzma_options_lzma opt_lzma; + lzma_lzma_preset(&opt_lzma, ctx->compression_flags); + lzma_filter filters[] = { + {.id = (ctx->method == ZIP_CM_LZMA ? LZMA_FILTER_LZMA1 : LZMA_FILTER_LZMA2), .options = &opt_lzma}, + {.id = LZMA_VLI_UNKNOWN, .options = NULL}, + }; + + ctx->zstr.avail_in = 0; + ctx->zstr.next_in = NULL; + ctx->zstr.avail_out = 0; + ctx->zstr.next_out = NULL; + + if (ctx->compress) { + if (ctx->method == ZIP_CM_LZMA) + ret = lzma_alone_encoder(&ctx->zstr, filters[0].options); + else + ret = lzma_stream_encoder(&ctx->zstr, filters, LZMA_CHECK_CRC64); + } + else { + if (ctx->method == ZIP_CM_LZMA) + ret = lzma_alone_decoder(&ctx->zstr, UINT64_MAX); + else + ret = lzma_stream_decoder(&ctx->zstr, UINT64_MAX, LZMA_CONCATENATED); + } + + if (ret != LZMA_OK) { + zip_error_set(ctx->error, map_error(ret), 0); + return false; + } + + /* If general purpose bits 1 & 2 are both zero, write real uncompressed size in header. */ + if ((attributes->valid & ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS) && (attributes->general_purpose_bit_mask & 0x6) == 0x6 && (attributes->general_purpose_bit_flags & 0x06) == 0 && (st->valid & ZIP_STAT_SIZE)) { + ctx->uncompresssed_size = st->size; + } + else { + ctx->uncompresssed_size = ZIP_UINT64_MAX; + } + + return true; +} + + +static bool +end(void *ud) { + struct ctx *ctx = (struct ctx *)ud; + + lzma_end(&ctx->zstr); + return true; +} + + +static bool +input(void *ud, zip_uint8_t *data, zip_uint64_t length) { + struct ctx *ctx = (struct ctx *)ud; + + if (length > UINT_MAX || ctx->zstr.avail_in > 0) { + zip_error_set(ctx->error, ZIP_ER_INVAL, 0); + return false; + } + + /* For decompression of LZMA1: Have we read the full "lzma alone" header yet? */ + if (ctx->method == ZIP_CM_LZMA && !ctx->compress && ctx->header_state == INCOMPLETE) { + /* if not, get more of the data */ + zip_uint8_t got = ZIP_MIN(HEADER_BYTES_ZIP - ctx->header_bytes_offset, length); + memcpy(ctx->header + ctx->header_bytes_offset, data, got); + ctx->header_bytes_offset += got; + length -= got; + data += got; + /* Do we have a complete header now? */ + if (ctx->header_bytes_offset == HEADER_BYTES_ZIP) { + Bytef empty_buffer[1]; + zip_buffer_t *buffer; + /* check magic */ + if (ctx->header[HEADER_MAGIC2_OFFSET] != 0x05 || ctx->header[HEADER_MAGIC2_OFFSET + 1] != 0x00) { + /* magic does not match */ + zip_error_set(ctx->error, ZIP_ER_COMPRESSED_DATA, 0); + return false; + } + /* set size of uncompressed data in "lzma alone" header to "unknown" */ + if ((buffer = _zip_buffer_new(ctx->header + HEADER_SIZE_OFFSET, HEADER_SIZE_LENGTH)) == NULL) { + zip_error_set(ctx->error, ZIP_ER_MEMORY, 0); + return false; + } + _zip_buffer_put_64(buffer, ctx->uncompresssed_size); + _zip_buffer_free(buffer); + /* Feed header into "lzma alone" decoder, for + * initialization; this should not produce output. */ + ctx->zstr.next_in = (void *)(ctx->header + HEADER_MAGIC_LENGTH); + ctx->zstr.avail_in = HEADER_LZMA_ALONE_LENGTH; + ctx->zstr.total_in = 0; + ctx->zstr.next_out = empty_buffer; + ctx->zstr.avail_out = sizeof(*empty_buffer); + ctx->zstr.total_out = 0; + /* this just initializes the decoder and does not produce output, so it consumes the complete header */ + if (lzma_code(&ctx->zstr, LZMA_RUN) != LZMA_OK || ctx->zstr.total_out > 0) { + zip_error_set(ctx->error, ZIP_ER_COMPRESSED_DATA, 0); + return false; + } + ctx->header_state = DONE; + } + } + ctx->zstr.avail_in = (uInt)length; + ctx->zstr.next_in = (Bytef *)data; + + return true; +} + + +static void +end_of_input(void *ud) { + struct ctx *ctx = (struct ctx *)ud; + + ctx->end_of_input = true; +} + + +static zip_compression_status_t +process(void *ud, zip_uint8_t *data, zip_uint64_t *length) { + struct ctx *ctx = (struct ctx *)ud; + lzma_ret ret; + /* for compression of LZMA1 */ + if (ctx->method == ZIP_CM_LZMA && ctx->compress) { + if (ctx->header_state == INCOMPLETE) { + /* write magic to output buffer */ + ctx->header[0] = 0x09; + ctx->header[1] = 0x14; + ctx->header[2] = 0x05; + ctx->header[3] = 0x00; + /* generate lzma parameters into output buffer */ + ctx->zstr.avail_out = HEADER_LZMA_ALONE_LENGTH; + ctx->zstr.next_out = ctx->header + HEADER_MAGIC_LENGTH; + ret = lzma_code(&ctx->zstr, LZMA_RUN); + if (ret != LZMA_OK || ctx->zstr.avail_out != 0) { + /* assume that the whole header will be provided with the first call to lzma_code */ + return ZIP_COMPRESSION_ERROR; + } + ctx->header_state = OUTPUT; + } + if (ctx->header_state == OUTPUT) { + /* write header */ + zip_uint8_t write_len = ZIP_MIN(HEADER_BYTES_ZIP - ctx->header_bytes_offset, *length); + memcpy(data, ctx->header + ctx->header_bytes_offset, write_len); + ctx->header_bytes_offset += write_len; + *length = write_len; + if (ctx->header_bytes_offset == HEADER_BYTES_ZIP) { + ctx->header_state = DONE; + } + return ZIP_COMPRESSION_OK; + } + } + + ctx->zstr.avail_out = (uInt)ZIP_MIN(UINT_MAX, *length); + ctx->zstr.next_out = (Bytef *)data; + + ret = lzma_code(&ctx->zstr, ctx->end_of_input ? LZMA_FINISH : LZMA_RUN); + *length = *length - ctx->zstr.avail_out; + + switch (ret) { + case LZMA_OK: + return ZIP_COMPRESSION_OK; + + case LZMA_STREAM_END: + return ZIP_COMPRESSION_END; + + case LZMA_BUF_ERROR: + if (ctx->zstr.avail_in == 0) { + return ZIP_COMPRESSION_NEED_DATA; + } + + /* fallthrough */ + default: + zip_error_set(ctx->error, map_error(ret), 0); + return ZIP_COMPRESSION_ERROR; + } +} + +/* Version Required should be set to 63 (6.3) because this compression + method was only defined in appnote.txt version 6.3.8, but Winzip + does not unpack it if the value is not 20. */ + +/* clang-format off */ + +zip_compression_algorithm_t zip_algorithm_xz_compress = { + maximum_compressed_size, + compress_allocate, + deallocate, + general_purpose_bit_flags, + 20, + start, + end, + input, + end_of_input, + process +}; + + +zip_compression_algorithm_t zip_algorithm_xz_decompress = { + maximum_compressed_size, + decompress_allocate, + deallocate, + general_purpose_bit_flags, + 20, + start, + end, + input, + end_of_input, + process +}; + +/* clang-format on */ diff --git a/core/deps/libzip/lib/zip_algorithm_zstd.c b/core/deps/libzip/lib/zip_algorithm_zstd.c new file mode 100644 index 000000000..c27e9fb39 --- /dev/null +++ b/core/deps/libzip/lib/zip_algorithm_zstd.c @@ -0,0 +1,294 @@ +/* + zip_algorithm_zstd.c -- zstd (de)compression routines + Copyright (C) 2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zipint.h" + +#include +#include +#include +#include + +struct ctx { + zip_error_t *error; + bool compress; + int compression_flags; + bool end_of_input; + ZSTD_DStream *zdstream; + ZSTD_CStream *zcstream; + ZSTD_outBuffer out; + ZSTD_inBuffer in; +}; + +static zip_uint64_t +maximum_compressed_size(zip_uint64_t uncompressed_size) { + return ZSTD_compressBound(uncompressed_size); +} + + +static void * +allocate(bool compress, int compression_flags, zip_error_t *error) { + struct ctx *ctx; + + /* 0: let zstd choose */ + if (compression_flags < 0 || compression_flags > 9) { + compression_flags = 0; + } + + if ((ctx = (struct ctx *)malloc(sizeof(*ctx))) == NULL) { + return NULL; + } + + ctx->error = error; + ctx->compress = compress; + ctx->compression_flags = compression_flags; + ctx->end_of_input = false; + + ctx->zdstream = NULL; + ctx->zcstream = NULL; + ctx->in.src = NULL; + ctx->in.pos = 0; + ctx->in.size = 0; + ctx->out.dst = NULL; + ctx->out.pos = 0; + ctx->out.size = 0; + + return ctx; +} + + +static void * +compress_allocate(zip_uint16_t method, int compression_flags, zip_error_t *error) { + return allocate(true, compression_flags, error); +} + + +static void * +decompress_allocate(zip_uint16_t method, int compression_flags, zip_error_t *error) { + return allocate(false, compression_flags, error); +} + + +static void +deallocate(void *ud) { + struct ctx *ctx = (struct ctx *)ud; + free(ctx); +} + + +static zip_uint16_t +general_purpose_bit_flags(void *ud) { + /* struct ctx *ctx = (struct ctx *)ud; */ + return 0; +} + +static int +map_error(size_t ret) { + switch (ret) { + case ZSTD_error_no_error: + return ZIP_ER_OK; + + case ZSTD_error_corruption_detected: + case ZSTD_error_checksum_wrong: + case ZSTD_error_dictionary_corrupted: + case ZSTD_error_dictionary_wrong: + return ZIP_ER_COMPRESSED_DATA; + + case ZSTD_error_memory_allocation: + return ZIP_ER_MEMORY; + + case ZSTD_error_parameter_unsupported: + case ZSTD_error_parameter_outOfBound: + return ZIP_ER_INVAL; + + default: + return ZIP_ER_INTERNAL; + } +} + + +static bool +start(void *ud, zip_stat_t *st, zip_file_attributes_t *attributes) { + struct ctx *ctx = (struct ctx *)ud; + ctx->in.src = NULL; + ctx->in.pos = 0; + ctx->in.size = 0; + ctx->out.dst = NULL; + ctx->out.pos = 0; + ctx->out.size = 0; + if (ctx->compress) { + size_t ret; + ctx->zcstream = ZSTD_createCStream(); + if (ctx->zcstream == NULL) { + zip_error_set(ctx->error, ZIP_ER_MEMORY, 0); + return false; + } + ret = ZSTD_initCStream(ctx->zcstream, ctx->compression_flags); + if (ZSTD_isError(ret)) { + zip_error_set(ctx->error, ZIP_ER_ZLIB, map_error(ret)); + return false; + } + } + else { + ctx->zdstream = ZSTD_createDStream(); + if (ctx->zdstream == NULL) { + zip_error_set(ctx->error, ZIP_ER_MEMORY, 0); + return false; + } + } + + return true; +} + + +static bool +end(void *ud) { + struct ctx *ctx = (struct ctx *)ud; + size_t ret; + + if (ctx->compress) { + ret = ZSTD_freeCStream(ctx->zcstream); + ctx->zcstream = NULL; + } + else { + ret = ZSTD_freeDStream(ctx->zdstream); + ctx->zdstream = NULL; + } + + if (ZSTD_isError(ret)) { + zip_error_set(ctx->error, map_error(ret), 0); + return false; + } + + return true; +} + + +static bool +input(void *ud, zip_uint8_t *data, zip_uint64_t length) { + struct ctx *ctx = (struct ctx *)ud; + if (length > SIZE_MAX || ctx->in.pos != ctx->in.size) { + zip_error_set(ctx->error, ZIP_ER_INVAL, 0); + return false; + } + ctx->in.src = (const void *)data; + ctx->in.size = (size_t)length; + ctx->in.pos = 0; + return true; +} + + +static void +end_of_input(void *ud) { + struct ctx *ctx = (struct ctx *)ud; + + ctx->end_of_input = true; +} + + +static zip_compression_status_t +process(void *ud, zip_uint8_t *data, zip_uint64_t *length) { + struct ctx *ctx = (struct ctx *)ud; + + size_t ret; + + if (ctx->in.pos == ctx->in.size && !ctx->end_of_input) { + *length = 0; + return ZIP_COMPRESSION_NEED_DATA; + } + + ctx->out.dst = data; + ctx->out.pos = 0; + ctx->out.size = ZIP_MIN(SIZE_MAX, *length); + + if (ctx->compress) { + if (ctx->in.pos == ctx->in.size && ctx->end_of_input) { + ret = ZSTD_endStream(ctx->zcstream, &ctx->out); + if (ret == 0) { + *length = ctx->out.pos; + return ZIP_COMPRESSION_END; + } + } + else { + ret = ZSTD_compressStream(ctx->zcstream, &ctx->out, &ctx->in); + } + } + else { + ret = ZSTD_decompressStream(ctx->zdstream, &ctx->out, &ctx->in); + } + if (ZSTD_isError(ret)) { + zip_error_set(ctx->error, map_error(ret), 0); + return ZIP_COMPRESSION_ERROR; + } + + *length = ctx->out.pos; + if (ctx->in.pos == ctx->in.size) { + return ZIP_COMPRESSION_NEED_DATA; + } + + return ZIP_COMPRESSION_OK; +} + +/* Version Required should be set to 63 (6.3) because this compression + method was only defined in appnote.txt version 6.3.7, but Winzip + does not unpack it if the value is not 20. */ + +/* clang-format off */ + +zip_compression_algorithm_t zip_algorithm_zstd_compress = { + maximum_compressed_size, + compress_allocate, + deallocate, + general_purpose_bit_flags, + 20, + start, + end, + input, + end_of_input, + process +}; + + +zip_compression_algorithm_t zip_algorithm_zstd_decompress = { + maximum_compressed_size, + decompress_allocate, + deallocate, + general_purpose_bit_flags, + 20, + start, + end, + input, + end_of_input, + process +}; + +/* clang-format on */ diff --git a/core/deps/libzip/lib/zip_buffer.c b/core/deps/libzip/lib/zip_buffer.c new file mode 100644 index 000000000..3bfcc82c1 --- /dev/null +++ b/core/deps/libzip/lib/zip_buffer.c @@ -0,0 +1,324 @@ +/* + zip_buffer.c -- bounds checked access to memory buffer + Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#include "zipint.h" + +zip_uint8_t * +_zip_buffer_data(zip_buffer_t *buffer) { + return buffer->data; +} + + +void +_zip_buffer_free(zip_buffer_t *buffer) { + if (buffer == NULL) { + return; + } + + if (buffer->free_data) { + free(buffer->data); + } + + free(buffer); +} + + +bool +_zip_buffer_eof(zip_buffer_t *buffer) { + return buffer->ok && buffer->offset == buffer->size; +} + + +zip_uint8_t * +_zip_buffer_get(zip_buffer_t *buffer, zip_uint64_t length) { + zip_uint8_t *data; + + data = _zip_buffer_peek(buffer, length); + + if (data != NULL) { + buffer->offset += length; + } + + return data; +} + + +zip_uint16_t +_zip_buffer_get_16(zip_buffer_t *buffer) { + zip_uint8_t *data = _zip_buffer_get(buffer, 2); + + if (data == NULL) { + return 0; + } + + return (zip_uint16_t)(data[0] + (data[1] << 8)); +} + + +zip_uint32_t +_zip_buffer_get_32(zip_buffer_t *buffer) { + zip_uint8_t *data = _zip_buffer_get(buffer, 4); + + if (data == NULL) { + return 0; + } + + return ((((((zip_uint32_t)data[3] << 8) + data[2]) << 8) + data[1]) << 8) + data[0]; +} + + +zip_uint64_t +_zip_buffer_get_64(zip_buffer_t *buffer) { + zip_uint8_t *data = _zip_buffer_get(buffer, 8); + + if (data == NULL) { + return 0; + } + + return ((zip_uint64_t)data[7] << 56) + ((zip_uint64_t)data[6] << 48) + ((zip_uint64_t)data[5] << 40) + ((zip_uint64_t)data[4] << 32) + ((zip_uint64_t)data[3] << 24) + ((zip_uint64_t)data[2] << 16) + ((zip_uint64_t)data[1] << 8) + (zip_uint64_t)data[0]; +} + + +zip_uint8_t +_zip_buffer_get_8(zip_buffer_t *buffer) { + zip_uint8_t *data = _zip_buffer_get(buffer, 1); + + if (data == NULL) { + return 0; + } + + return data[0]; +} + + +zip_uint64_t +_zip_buffer_left(zip_buffer_t *buffer) { + return buffer->ok ? buffer->size - buffer->offset : 0; +} + + +zip_uint64_t +_zip_buffer_read(zip_buffer_t *buffer, zip_uint8_t *data, zip_uint64_t length) { + if (_zip_buffer_left(buffer) < length) { + length = _zip_buffer_left(buffer); + } + + memcpy(data, _zip_buffer_get(buffer, length), length); + + return length; +} + + +zip_buffer_t * +_zip_buffer_new(zip_uint8_t *data, zip_uint64_t size) { + bool free_data = (data == NULL); + zip_buffer_t *buffer; + + if (data == NULL) { + if ((data = (zip_uint8_t *)malloc(size)) == NULL) { + return NULL; + } + } + + if ((buffer = (zip_buffer_t *)malloc(sizeof(*buffer))) == NULL) { + if (free_data) { + free(data); + } + return NULL; + } + + buffer->ok = true; + buffer->data = data; + buffer->size = size; + buffer->offset = 0; + buffer->free_data = free_data; + + return buffer; +} + + +zip_buffer_t * +_zip_buffer_new_from_source(zip_source_t *src, zip_uint64_t size, zip_uint8_t *buf, zip_error_t *error) { + zip_buffer_t *buffer; + + if ((buffer = _zip_buffer_new(buf, size)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if (_zip_read(src, buffer->data, size, error) < 0) { + _zip_buffer_free(buffer); + return NULL; + } + + return buffer; +} + + +zip_uint64_t +_zip_buffer_offset(zip_buffer_t *buffer) { + return buffer->ok ? buffer->offset : 0; +} + + +bool +_zip_buffer_ok(zip_buffer_t *buffer) { + return buffer->ok; +} + + +zip_uint8_t * +_zip_buffer_peek(zip_buffer_t *buffer, zip_uint64_t length) { + zip_uint8_t *data; + + if (!buffer->ok || buffer->offset + length < length || buffer->offset + length > buffer->size) { + buffer->ok = false; + return NULL; + } + + data = buffer->data + buffer->offset; + return data; +} + +int +_zip_buffer_put(zip_buffer_t *buffer, const void *src, size_t length) { + zip_uint8_t *dst = _zip_buffer_get(buffer, length); + + if (dst == NULL) { + return -1; + } + + memcpy(dst, src, length); + return 0; +} + + +int +_zip_buffer_put_16(zip_buffer_t *buffer, zip_uint16_t i) { + zip_uint8_t *data = _zip_buffer_get(buffer, 2); + + if (data == NULL) { + return -1; + } + + data[0] = (zip_uint8_t)(i & 0xff); + data[1] = (zip_uint8_t)((i >> 8) & 0xff); + + return 0; +} + + +int +_zip_buffer_put_32(zip_buffer_t *buffer, zip_uint32_t i) { + zip_uint8_t *data = _zip_buffer_get(buffer, 4); + + if (data == NULL) { + return -1; + } + + data[0] = (zip_uint8_t)(i & 0xff); + data[1] = (zip_uint8_t)((i >> 8) & 0xff); + data[2] = (zip_uint8_t)((i >> 16) & 0xff); + data[3] = (zip_uint8_t)((i >> 24) & 0xff); + + return 0; +} + + +int +_zip_buffer_put_64(zip_buffer_t *buffer, zip_uint64_t i) { + zip_uint8_t *data = _zip_buffer_get(buffer, 8); + + if (data == NULL) { + return -1; + } + + data[0] = (zip_uint8_t)(i & 0xff); + data[1] = (zip_uint8_t)((i >> 8) & 0xff); + data[2] = (zip_uint8_t)((i >> 16) & 0xff); + data[3] = (zip_uint8_t)((i >> 24) & 0xff); + data[4] = (zip_uint8_t)((i >> 32) & 0xff); + data[5] = (zip_uint8_t)((i >> 40) & 0xff); + data[6] = (zip_uint8_t)((i >> 48) & 0xff); + data[7] = (zip_uint8_t)((i >> 56) & 0xff); + + return 0; +} + + +int +_zip_buffer_put_8(zip_buffer_t *buffer, zip_uint8_t i) { + zip_uint8_t *data = _zip_buffer_get(buffer, 1); + + if (data == NULL) { + return -1; + } + + data[0] = i; + + return 0; +} + + +int +_zip_buffer_set_offset(zip_buffer_t *buffer, zip_uint64_t offset) { + if (offset > buffer->size) { + buffer->ok = false; + return -1; + } + + buffer->ok = true; + buffer->offset = offset; + + return 0; +} + + +int +_zip_buffer_skip(zip_buffer_t *buffer, zip_uint64_t length) { + zip_uint64_t offset = buffer->offset + length; + + if (offset < buffer->offset) { + buffer->ok = false; + return -1; + } + return _zip_buffer_set_offset(buffer, offset); +} + +zip_uint64_t +_zip_buffer_size(zip_buffer_t *buffer) { + return buffer->size; +} diff --git a/core/deps/libzip/lib/zip_close.c b/core/deps/libzip/lib/zip_close.c new file mode 100644 index 000000000..5bd327b2e --- /dev/null +++ b/core/deps/libzip/lib/zip_close.c @@ -0,0 +1,700 @@ +/* + zip_close.c -- close zip archive and update changes + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + +#include +#include +#ifdef _WIN32 +#include +#include +#endif + + +static int add_data(zip_t *, zip_source_t *, zip_dirent_t *, zip_uint32_t); +static int copy_data(zip_t *, zip_uint64_t); +static int copy_source(zip_t *, zip_source_t *, zip_int64_t); +static int write_cdir(zip_t *, const zip_filelist_t *, zip_uint64_t); +static int write_data_descriptor(zip_t *za, const zip_dirent_t *dirent, int is_zip64); + +ZIP_EXTERN int +zip_close(zip_t *za) { + zip_uint64_t i, j, survivors, unchanged_offset; + zip_int64_t off; + int error; + zip_filelist_t *filelist; + int changed; + + if (za == NULL) + return -1; + + changed = _zip_changed(za, &survivors); + + /* don't create zip files with no entries */ + if (survivors == 0) { + if ((za->open_flags & ZIP_TRUNCATE) || changed) { + if (zip_source_remove(za->src) < 0) { + if (!((zip_error_code_zip(zip_source_error(za->src)) == ZIP_ER_REMOVE) && (zip_error_code_system(zip_source_error(za->src)) == ENOENT))) { + _zip_error_set_from_source(&za->error, za->src); + return -1; + } + } + } + zip_discard(za); + return 0; + } + + if (!changed) { + zip_discard(za); + return 0; + } + + if (survivors > za->nentry) { + zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + return -1; + } + + if ((filelist = (zip_filelist_t *)malloc(sizeof(filelist[0]) * (size_t)survivors)) == NULL) + return -1; + + unchanged_offset = ZIP_UINT64_MAX; + /* create list of files with index into original archive */ + for (i = j = 0; i < za->nentry; i++) { + if (za->entry[i].orig != NULL && ZIP_ENTRY_HAS_CHANGES(&za->entry[i])) { + unchanged_offset = ZIP_MIN(unchanged_offset, za->entry[i].orig->offset); + } + if (za->entry[i].deleted) { + continue; + } + + if (j >= survivors) { + free(filelist); + zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + return -1; + } + + filelist[j].idx = i; + j++; + } + if (j < survivors) { + free(filelist); + zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + return -1; + } + + if ((zip_source_supports(za->src) & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_BEGIN_WRITE_CLONING)) == 0) { + unchanged_offset = 0; + } + else { + if (unchanged_offset == ZIP_UINT64_MAX) { + /* we're keeping all file data, find the end of the last one */ + zip_uint64_t last_index = ZIP_UINT64_MAX; + unchanged_offset = 0; + + for (i = 0; i < za->nentry; i++) { + if (za->entry[i].orig != NULL) { + if (za->entry[i].orig->offset >= unchanged_offset) { + unchanged_offset = za->entry[i].orig->offset; + last_index = i; + } + } + } + if (last_index != ZIP_UINT64_MAX) { + if ((unchanged_offset = _zip_file_get_end(za, last_index, &za->error)) == 0) { + free(filelist); + return -1; + } + } + } + if (unchanged_offset > 0) { + if (zip_source_begin_write_cloning(za->src, unchanged_offset) < 0) { + /* cloning not supported, need to copy everything */ + unchanged_offset = 0; + } + } + } + if (unchanged_offset == 0) { + if (zip_source_begin_write(za->src) < 0) { + _zip_error_set_from_source(&za->error, za->src); + free(filelist); + return -1; + } + } + + if (_zip_progress_start(za->progress) != 0) { + zip_error_set(&za->error, ZIP_ER_CANCELLED, 0); + zip_source_rollback_write(za->src); + free(filelist); + return -1; + } + error = 0; + for (j = 0; j < survivors; j++) { + int new_data; + zip_entry_t *entry; + zip_dirent_t *de; + + if (_zip_progress_subrange(za->progress, (double)j / (double)survivors, (double)(j + 1) / (double)survivors) != 0) { + zip_error_set(&za->error, ZIP_ER_CANCELLED, 0); + error = 1; + break; + } + + i = filelist[j].idx; + entry = za->entry + i; + + if (entry->orig != NULL && entry->orig->offset < unchanged_offset) { + /* already implicitly copied by cloning */ + continue; + } + + new_data = (ZIP_ENTRY_DATA_CHANGED(entry) || ZIP_ENTRY_CHANGED(entry, ZIP_DIRENT_COMP_METHOD) || ZIP_ENTRY_CHANGED(entry, ZIP_DIRENT_ENCRYPTION_METHOD)); + + /* create new local directory entry */ + if (entry->changes == NULL) { + if ((entry->changes = _zip_dirent_clone(entry->orig)) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + error = 1; + break; + } + } + de = entry->changes; + + if (_zip_read_local_ef(za, i) < 0) { + error = 1; + break; + } + + if ((off = zip_source_tell_write(za->src)) < 0) { + _zip_error_set_from_source(&za->error, za->src); + error = 1; + break; + } + de->offset = (zip_uint64_t)off; + + if (new_data) { + zip_source_t *zs; + + zs = NULL; + if (!ZIP_ENTRY_DATA_CHANGED(entry)) { + if ((zs = _zip_source_zip_new(za, za, i, ZIP_FL_UNCHANGED, 0, 0, NULL)) == NULL) { + error = 1; + break; + } + } + + /* add_data writes dirent */ + if (add_data(za, zs ? zs : entry->source, de, entry->changes ? entry->changes->changed : 0) < 0) { + error = 1; + if (zs) + zip_source_free(zs); + break; + } + if (zs) + zip_source_free(zs); + } + else { + zip_uint64_t offset; + + if (de->encryption_method != ZIP_EM_TRAD_PKWARE) { + /* when copying data, all sizes are known -> no data descriptor needed */ + /* except for PKWare encryption, where removing the data descriptor breaks password validation */ + de->bitflags &= (zip_uint16_t)~ZIP_GPBF_DATA_DESCRIPTOR; + } + if (_zip_dirent_write(za, de, ZIP_FL_LOCAL) < 0) { + error = 1; + break; + } + if ((offset = _zip_file_get_offset(za, i, &za->error)) == 0) { + error = 1; + break; + } + if (zip_source_seek(za->src, (zip_int64_t)offset, SEEK_SET) < 0) { + _zip_error_set_from_source(&za->error, za->src); + error = 1; + break; + } + if (copy_data(za, de->comp_size) < 0) { + error = 1; + break; + } + + if (de->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) { + if (write_data_descriptor(za, de, _zip_dirent_needs_zip64(de, 0)) < 0) { + error = 1; + break; + } + } + } + } + + if (!error) { + if (write_cdir(za, filelist, survivors) < 0) + error = 1; + } + + free(filelist); + + if (!error) { + if (zip_source_commit_write(za->src) != 0) { + _zip_error_set_from_source(&za->error, za->src); + error = 1; + } + _zip_progress_end(za->progress); + } + + if (error) { + zip_source_rollback_write(za->src); + return -1; + } + + zip_discard(za); + + return 0; +} + + +static int +add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de, zip_uint32_t changed) { + zip_int64_t offstart, offdata, offend, data_length; + zip_stat_t st; + zip_file_attributes_t attributes; + zip_source_t *src_final, *src_tmp; + int ret; + int is_zip64; + zip_flags_t flags; + bool needs_recompress, needs_decompress, needs_crc, needs_compress, needs_reencrypt, needs_decrypt, needs_encrypt; + + if (zip_source_stat(src, &st) < 0) { + _zip_error_set_from_source(&za->error, src); + return -1; + } + + if ((st.valid & ZIP_STAT_COMP_METHOD) == 0) { + st.valid |= ZIP_STAT_COMP_METHOD; + st.comp_method = ZIP_CM_STORE; + } + + if (ZIP_CM_IS_DEFAULT(de->comp_method) && st.comp_method != ZIP_CM_STORE) + de->comp_method = st.comp_method; + else if (de->comp_method == ZIP_CM_STORE && (st.valid & ZIP_STAT_SIZE)) { + st.valid |= ZIP_STAT_COMP_SIZE; + st.comp_size = st.size; + } + else { + /* we'll recompress */ + st.valid &= ~ZIP_STAT_COMP_SIZE; + } + + if ((st.valid & ZIP_STAT_ENCRYPTION_METHOD) == 0) { + st.valid |= ZIP_STAT_ENCRYPTION_METHOD; + st.encryption_method = ZIP_EM_NONE; + } + + flags = ZIP_EF_LOCAL; + + if ((st.valid & ZIP_STAT_SIZE) == 0) { + flags |= ZIP_FL_FORCE_ZIP64; + data_length = -1; + } + else { + de->uncomp_size = st.size; + /* this is technically incorrect (copy_source counts compressed data), but it's the best we have */ + data_length = (zip_int64_t)st.size; + + if ((st.valid & ZIP_STAT_COMP_SIZE) == 0) { + zip_uint64_t max_compressed_size; + zip_uint16_t compression_method = ZIP_CM_ACTUAL(de->comp_method); + + if (compression_method == ZIP_CM_STORE) { + max_compressed_size = st.size; + } + else { + zip_compression_algorithm_t *algorithm = _zip_get_compression_algorithm(compression_method, true); + if (algorithm == NULL) { + max_compressed_size = ZIP_UINT64_MAX; + } + else { + max_compressed_size = algorithm->maximum_compressed_size(st.size); + } + } + + if (max_compressed_size > 0xffffffffu) { + flags |= ZIP_FL_FORCE_ZIP64; + } + } + else { + de->comp_size = st.comp_size; + data_length = (zip_int64_t)st.comp_size; + } + } + + if ((offstart = zip_source_tell_write(za->src)) < 0) { + _zip_error_set_from_source(&za->error, za->src); + return -1; + } + + /* as long as we don't support non-seekable output, clear data descriptor bit */ + de->bitflags &= (zip_uint16_t)~ZIP_GPBF_DATA_DESCRIPTOR; + if ((is_zip64 = _zip_dirent_write(za, de, flags)) < 0) { + return -1; + } + + needs_recompress = st.comp_method != ZIP_CM_ACTUAL(de->comp_method); + needs_decompress = needs_recompress && (st.comp_method != ZIP_CM_STORE); + /* in these cases we can compute the CRC ourselves, so we do */ + needs_crc = (st.comp_method == ZIP_CM_STORE) || needs_decompress; + needs_compress = needs_recompress && (de->comp_method != ZIP_CM_STORE); + + needs_reencrypt = needs_recompress || (de->changed & ZIP_DIRENT_PASSWORD) || (de->encryption_method != st.encryption_method); + needs_decrypt = needs_reencrypt && (st.encryption_method != ZIP_EM_NONE); + needs_encrypt = needs_reencrypt && (de->encryption_method != ZIP_EM_NONE); + + src_final = src; + zip_source_keep(src_final); + + if (needs_decrypt) { + zip_encryption_implementation impl; + + if ((impl = _zip_get_encryption_implementation(st.encryption_method, ZIP_CODEC_DECODE)) == NULL) { + zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0); + zip_source_free(src_final); + return -1; + } + if ((src_tmp = impl(za, src_final, st.encryption_method, ZIP_CODEC_DECODE, za->default_password)) == NULL) { + /* error set by impl */ + zip_source_free(src_final); + return -1; + } + + zip_source_free(src_final); + src_final = src_tmp; + } + + if (needs_decompress) { + if ((src_tmp = zip_source_decompress(za, src_final, st.comp_method)) == NULL) { + zip_source_free(src_final); + return -1; + } + + zip_source_free(src_final); + src_final = src_tmp; + } + + if (needs_crc) { + if ((src_tmp = zip_source_crc(za, src_final, 0)) == NULL) { + zip_source_free(src_final); + return -1; + } + + zip_source_free(src_final); + src_final = src_tmp; + } + + if (needs_compress) { + if ((src_tmp = zip_source_compress(za, src_final, de->comp_method, de->compression_level)) == NULL) { + zip_source_free(src_final); + return -1; + } + + zip_source_free(src_final); + src_final = src_tmp; + } + + + if (needs_encrypt) { + zip_encryption_implementation impl; + const char *password = NULL; + + if (de->password) { + password = de->password; + } + else if (za->default_password) { + password = za->default_password; + } + + if ((impl = _zip_get_encryption_implementation(de->encryption_method, ZIP_CODEC_ENCODE)) == NULL) { + zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0); + zip_source_free(src_final); + return -1; + } + if ((src_tmp = impl(za, src_final, de->encryption_method, ZIP_CODEC_ENCODE, password)) == NULL) { + /* error set by impl */ + zip_source_free(src_final); + return -1; + } + if (de->encryption_method == ZIP_EM_TRAD_PKWARE) { + de->bitflags |= ZIP_GPBF_DATA_DESCRIPTOR; + } + + zip_source_free(src_final); + src_final = src_tmp; + } + + + if ((offdata = zip_source_tell_write(za->src)) < 0) { + _zip_error_set_from_source(&za->error, za->src); + return -1; + } + + ret = copy_source(za, src_final, data_length); + + if (zip_source_stat(src_final, &st) < 0) { + _zip_error_set_from_source(&za->error, src_final); + ret = -1; + } + + if (zip_source_get_file_attributes(src_final, &attributes) != 0) { + _zip_error_set_from_source(&za->error, src_final); + ret = -1; + } + + zip_source_free(src_final); + + if (ret < 0) { + return -1; + } + + if ((offend = zip_source_tell_write(za->src)) < 0) { + _zip_error_set_from_source(&za->error, za->src); + return -1; + } + + if (zip_source_seek_write(za->src, offstart, SEEK_SET) < 0) { + _zip_error_set_from_source(&za->error, za->src); + return -1; + } + + if ((st.valid & (ZIP_STAT_COMP_METHOD | ZIP_STAT_CRC | ZIP_STAT_SIZE)) != (ZIP_STAT_COMP_METHOD | ZIP_STAT_CRC | ZIP_STAT_SIZE)) { + zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + return -1; + } + + if ((de->changed & ZIP_DIRENT_LAST_MOD) == 0) { + if (st.valid & ZIP_STAT_MTIME) + de->last_mod = st.mtime; + else + time(&de->last_mod); + } + de->comp_method = st.comp_method; + de->crc = st.crc; + de->uncomp_size = st.size; + de->comp_size = (zip_uint64_t)(offend - offdata); + _zip_dirent_apply_attributes(de, &attributes, (flags & ZIP_FL_FORCE_ZIP64) != 0, changed); + + if ((ret = _zip_dirent_write(za, de, flags)) < 0) + return -1; + + if (is_zip64 != ret) { + /* Zip64 mismatch between preliminary file header written before data and final file header written afterwards */ + zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + return -1; + } + + if (zip_source_seek_write(za->src, offend, SEEK_SET) < 0) { + _zip_error_set_from_source(&za->error, za->src); + return -1; + } + + if (de->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) { + if (write_data_descriptor(za, de, is_zip64) < 0) { + return -1; + } + } + + return 0; +} + + +static int +copy_data(zip_t *za, zip_uint64_t len) { + DEFINE_BYTE_ARRAY(buf, BUFSIZE); + size_t n; + double total = (double)len; + + if (!byte_array_init(buf, BUFSIZE)) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + + while (len > 0) { + n = len > BUFSIZE ? BUFSIZE : len; + if (_zip_read(za->src, buf, n, &za->error) < 0) { + byte_array_fini(buf); + return -1; + } + + if (_zip_write(za, buf, n) < 0) { + byte_array_fini(buf); + return -1; + } + + len -= n; + + if (_zip_progress_update(za->progress, (total - (double)len) / total) != 0) { + zip_error_set(&za->error, ZIP_ER_CANCELLED, 0); + return -1; + } + } + + byte_array_fini(buf); + return 0; +} + + +static int +copy_source(zip_t *za, zip_source_t *src, zip_int64_t data_length) { + DEFINE_BYTE_ARRAY(buf, BUFSIZE); + zip_int64_t n, current; + int ret; + + if (zip_source_open(src) < 0) { + _zip_error_set_from_source(&za->error, src); + return -1; + } + + if (!byte_array_init(buf, BUFSIZE)) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + + ret = 0; + current = 0; + while ((n = zip_source_read(src, buf, BUFSIZE)) > 0) { + if (_zip_write(za, buf, (zip_uint64_t)n) < 0) { + ret = -1; + break; + } + if (n == BUFSIZE && za->progress && data_length > 0) { + current += n; + if (_zip_progress_update(za->progress, (double)current / (double)data_length) != 0) { + zip_error_set(&za->error, ZIP_ER_CANCELLED, 0); + ret = -1; + break; + } + } + } + + if (n < 0) { + _zip_error_set_from_source(&za->error, src); + ret = -1; + } + + byte_array_fini(buf); + + zip_source_close(src); + + return ret; +} + +static int +write_cdir(zip_t *za, const zip_filelist_t *filelist, zip_uint64_t survivors) { + zip_int64_t cd_start, end, size; + + if ((cd_start = zip_source_tell_write(za->src)) < 0) { + return -1; + } + + if ((size = _zip_cdir_write(za, filelist, survivors)) < 0) { + return -1; + } + + if ((end = zip_source_tell_write(za->src)) < 0) { + return -1; + } + + return 0; +} + + +int +_zip_changed(const zip_t *za, zip_uint64_t *survivorsp) { + int changed; + zip_uint64_t i, survivors; + + changed = 0; + survivors = 0; + + if (za->comment_changed || za->ch_flags != za->flags) { + changed = 1; + } + + for (i = 0; i < za->nentry; i++) { + if (ZIP_ENTRY_HAS_CHANGES(&za->entry[i])) { + changed = 1; + } + if (!za->entry[i].deleted) { + survivors++; + } + } + + if (survivorsp) { + *survivorsp = survivors; + } + + return changed; +} + +static int +write_data_descriptor(zip_t *za, const zip_dirent_t *de, int is_zip64) { + zip_buffer_t *buffer = _zip_buffer_new(NULL, MAX_DATA_DESCRIPTOR_LENGTH); + int ret = 0; + + if (buffer == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + + _zip_buffer_put(buffer, DATADES_MAGIC, 4); + _zip_buffer_put_32(buffer, de->crc); + if (is_zip64) { + _zip_buffer_put_64(buffer, de->comp_size); + _zip_buffer_put_64(buffer, de->uncomp_size); + } + else { + _zip_buffer_put_32(buffer, (zip_uint32_t)de->comp_size); + _zip_buffer_put_32(buffer, (zip_uint32_t)de->uncomp_size); + } + + if (!_zip_buffer_ok(buffer)) { + zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + ret = -1; + } + else { + ret = _zip_write(za, _zip_buffer_data(buffer), _zip_buffer_offset(buffer)); + } + + _zip_buffer_free(buffer); + + return ret; +} diff --git a/core/deps/libzip/lib/zip_crypto.h b/core/deps/libzip/lib/zip_crypto.h new file mode 100644 index 000000000..c42bc7b04 --- /dev/null +++ b/core/deps/libzip/lib/zip_crypto.h @@ -0,0 +1,54 @@ +/* + zip_crypto.h -- crypto definitions + Copyright (C) 2017-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef HAD_ZIP_CRYPTO_H +#define HAD_ZIP_CRYPTO_H + +#define ZIP_CRYPTO_SHA1_LENGTH 20 +#define ZIP_CRYPTO_AES_BLOCK_LENGTH 16 + +#if defined(HAVE_WINDOWS_CRYPTO) +#include "zip_crypto_win.h" +#elif defined(HAVE_COMMONCRYPTO) +#include "zip_crypto_commoncrypto.h" +#elif defined(HAVE_GNUTLS) +#include "zip_crypto_gnutls.h" +#elif defined(HAVE_OPENSSL) +#include "zip_crypto_openssl.h" +#elif defined(HAVE_MBEDTLS) +#include "zip_crypto_mbedtls.h" +#else +#error "no crypto backend found" +#endif + +#endif /* HAD_ZIP_CRYPTO_H */ diff --git a/core/deps/libzip/lib/zip_crypto_commoncrypto.c b/core/deps/libzip/lib/zip_crypto_commoncrypto.c new file mode 100644 index 000000000..f4c37d96b --- /dev/null +++ b/core/deps/libzip/lib/zip_crypto_commoncrypto.c @@ -0,0 +1,110 @@ +/* + zip_crypto_commoncrypto.c -- CommonCrypto wrapper. + Copyright (C) 2018-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include "zipint.h" + +#include "zip_crypto.h" + +#include +#include + +void +_zip_crypto_aes_free(_zip_crypto_aes_t *aes) { + if (aes == NULL) { + return; + } + + CCCryptorRelease(aes); +} + + +bool +_zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out) { + size_t len; + CCCryptorUpdate(aes, in, ZIP_CRYPTO_AES_BLOCK_LENGTH, out, ZIP_CRYPTO_AES_BLOCK_LENGTH, &len); + return true; +} + + +_zip_crypto_aes_t * +_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error) { + _zip_crypto_aes_t *aes; + CCCryptorStatus ret; + + ret = CCCryptorCreate(kCCEncrypt, kCCAlgorithmAES, kCCOptionECBMode, key, key_size / 8, NULL, &aes); + + switch (ret) { + case kCCSuccess: + return aes; + + case kCCMemoryFailure: + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + + case kCCParamError: + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + + default: + zip_error_set(error, ZIP_ER_INTERNAL, 0); + return NULL; + } +} + + +void +_zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac) { + if (hmac == NULL) { + return; + } + + _zip_crypto_clear(hmac, sizeof(*hmac)); + free(hmac); +} + + +_zip_crypto_hmac_t * +_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error) { + _zip_crypto_hmac_t *hmac; + + if ((hmac = (_zip_crypto_hmac_t *)malloc(sizeof(*hmac))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + CCHmacInit(hmac, kCCHmacAlgSHA1, secret, secret_length); + + return hmac; +} diff --git a/core/deps/libzip/lib/zip_crypto_commoncrypto.h b/core/deps/libzip/lib/zip_crypto_commoncrypto.h new file mode 100644 index 000000000..1eae1b707 --- /dev/null +++ b/core/deps/libzip/lib/zip_crypto_commoncrypto.h @@ -0,0 +1,53 @@ +/* + zip_crypto_commoncrypto.h -- definitions for CommonCrypto wrapper. + Copyright (C) 2018 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef HAD_ZIP_CRYPTO_COMMONCRYPTO_H +#define HAD_ZIP_CRYPTO_COMMONCRYPTO_H + +#include + +#define _zip_crypto_aes_t struct _CCCryptor +#define _zip_crypto_hmac_t CCHmacContext + +void _zip_crypto_aes_free(_zip_crypto_aes_t *aes); +bool _zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out); +_zip_crypto_aes_t *_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error); + +#define _zip_crypto_hmac(hmac, data, length) (CCHmacUpdate((hmac), (data), (length)), true) +void _zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac); +_zip_crypto_hmac_t *_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error); +#define _zip_crypto_hmac_output(hmac, data) (CCHmacFinal((hmac), (data)), true) + +#define _zip_crypto_pbkdf2(key, key_length, salt, salt_length, iterations, output, output_length) (CCKeyDerivationPBKDF(kCCPBKDF2, (const char *)(key), (key_length), (salt), (salt_length), kCCPRFHmacAlgSHA1, (iterations), (output), (output_length)) == kCCSuccess) + +#endif /* HAD_ZIP_CRYPTO_COMMONCRYPTO_H */ diff --git a/core/deps/libzip/lib/zip_crypto_gnutls.c b/core/deps/libzip/lib/zip_crypto_gnutls.c new file mode 100644 index 000000000..a74bde8f6 --- /dev/null +++ b/core/deps/libzip/lib/zip_crypto_gnutls.c @@ -0,0 +1,135 @@ +/* + zip_crypto_gnutls.c -- GnuTLS wrapper. + Copyright (C) 2018-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include "zipint.h" + +#include "zip_crypto.h" + +_zip_crypto_aes_t * +_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error) { + _zip_crypto_aes_t *aes; + + if ((aes = (_zip_crypto_aes_t *)malloc(sizeof(*aes))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + aes->key_size = key_size; + + switch (aes->key_size) { + case 128: + nettle_aes128_set_encrypt_key(&aes->ctx.ctx_128, key); + break; + case 192: + nettle_aes192_set_encrypt_key(&aes->ctx.ctx_192, key); + break; + case 256: + nettle_aes256_set_encrypt_key(&aes->ctx.ctx_256, key); + break; + default: + zip_error_set(error, ZIP_ER_INVAL, 0); + free(aes); + return NULL; + } + + return aes; +} + +bool +_zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out) { + switch (aes->key_size) { + case 128: + nettle_aes128_encrypt(&aes->ctx.ctx_128, ZIP_CRYPTO_AES_BLOCK_LENGTH, out, in); + break; + case 192: + nettle_aes192_encrypt(&aes->ctx.ctx_192, ZIP_CRYPTO_AES_BLOCK_LENGTH, out, in); + break; + case 256: + nettle_aes256_encrypt(&aes->ctx.ctx_256, ZIP_CRYPTO_AES_BLOCK_LENGTH, out, in); + break; + } + + return true; +} + +void +_zip_crypto_aes_free(_zip_crypto_aes_t *aes) { + if (aes == NULL) { + return; + } + + _zip_crypto_clear(aes, sizeof(*aes)); + free(aes); +} + + +_zip_crypto_hmac_t * +_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error) { + _zip_crypto_hmac_t *hmac; + int ret; + + if ((hmac = (_zip_crypto_hmac_t *)malloc(sizeof(*hmac))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if ((ret = gnutls_hmac_init(hmac, GNUTLS_MAC_SHA1, secret, secret_length)) < 0) { + /* TODO: set error */ + free(hmac); + return NULL; + } + + return hmac; +} + + +void +_zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac) { + zip_uint8_t buf[ZIP_CRYPTO_SHA1_LENGTH]; + + if (hmac == NULL) { + return; + } + + gnutls_hmac_deinit(*hmac, buf); + _zip_crypto_clear(hmac, sizeof(*hmac)); + free(hmac); +} + + +ZIP_EXTERN bool +zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) { + return gnutls_rnd(GNUTLS_RND_KEY, buffer, length) == 0; +} diff --git a/core/deps/libzip/lib/zip_crypto_gnutls.h b/core/deps/libzip/lib/zip_crypto_gnutls.h new file mode 100644 index 000000000..65cf62ecc --- /dev/null +++ b/core/deps/libzip/lib/zip_crypto_gnutls.h @@ -0,0 +1,68 @@ +/* + zip_crypto_gnutls.h -- definitions for GnuTLS wrapper. + Copyright (C) 2018-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef HAD_ZIP_CRYPTO_GNUTLS_H +#define HAD_ZIP_CRYPTO_GNUTLS_H + +#define HAVE_SECURE_RANDOM + +#include +#include + +#include + +#include + +typedef struct { + union { + struct aes128_ctx ctx_128; + struct aes192_ctx ctx_192; + struct aes256_ctx ctx_256; + } ctx; + zip_uint16_t key_size; +} _zip_crypto_aes_t; + +#define _zip_crypto_hmac_t gnutls_hmac_hd_t + +void _zip_crypto_aes_free(_zip_crypto_aes_t *aes); +bool _zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out); +_zip_crypto_aes_t *_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error); + +#define _zip_crypto_hmac(hmac, data, length) (gnutls_hmac(*(hmac), (data), (length)) == 0) +void _zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac); +_zip_crypto_hmac_t *_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error); +#define _zip_crypto_hmac_output(hmac, data) (gnutls_hmac_output(*(hmac), (data)), true) + +#define _zip_crypto_pbkdf2(key, key_length, salt, salt_length, iterations, output, output_length) (pbkdf2_hmac_sha1((key_length), (key), (iterations), (salt_length), (salt), (output_length), (output)), true) + +#endif /* HAD_ZIP_CRYPTO_GNUTLS_H */ diff --git a/core/deps/libzip/lib/zip_crypto_mbedtls.c b/core/deps/libzip/lib/zip_crypto_mbedtls.c new file mode 100644 index 000000000..6aeb020c0 --- /dev/null +++ b/core/deps/libzip/lib/zip_crypto_mbedtls.c @@ -0,0 +1,162 @@ +/* + zip_crypto_mbedtls.c -- mbed TLS wrapper + Copyright (C) 2018-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include "zipint.h" + +#include "zip_crypto.h" + +#include +#include +#include + +#include + +_zip_crypto_aes_t * +_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error) { + _zip_crypto_aes_t *aes; + + if ((aes = (_zip_crypto_aes_t *)malloc(sizeof(*aes))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + mbedtls_aes_init(aes); + mbedtls_aes_setkey_enc(aes, (const unsigned char *)key, (unsigned int)key_size); + + return aes; +} + +void +_zip_crypto_aes_free(_zip_crypto_aes_t *aes) { + if (aes == NULL) { + return; + } + + mbedtls_aes_free(aes); + free(aes); +} + + +_zip_crypto_hmac_t * +_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error) { + _zip_crypto_hmac_t *hmac; + + if (secret_length > INT_MAX) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((hmac = (_zip_crypto_hmac_t *)malloc(sizeof(*hmac))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + mbedtls_md_init(hmac); + + if (mbedtls_md_setup(hmac, mbedtls_md_info_from_type(MBEDTLS_MD_SHA1), 1) != 0) { + zip_error_set(error, ZIP_ER_INTERNAL, 0); + free(hmac); + return NULL; + } + + if (mbedtls_md_hmac_starts(hmac, (const unsigned char *)secret, (size_t)secret_length) != 0) { + zip_error_set(error, ZIP_ER_INTERNAL, 0); + free(hmac); + return NULL; + } + + return hmac; +} + + +void +_zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac) { + if (hmac == NULL) { + return; + } + + mbedtls_md_free(hmac); + free(hmac); +} + + +bool +_zip_crypto_pbkdf2(const zip_uint8_t *key, zip_uint64_t key_length, const zip_uint8_t *salt, zip_uint16_t salt_length, int iterations, zip_uint8_t *output, zip_uint64_t output_length) { + mbedtls_md_context_t sha1_ctx; + bool ok = true; + + mbedtls_md_init(&sha1_ctx); + + if (mbedtls_md_setup(&sha1_ctx, mbedtls_md_info_from_type(MBEDTLS_MD_SHA1), 1) != 0) { + ok = false; + } + + if (ok && mbedtls_pkcs5_pbkdf2_hmac(&sha1_ctx, (const unsigned char *)key, (size_t)key_length, (const unsigned char *)salt, (size_t)salt_length, (unsigned int)iterations, (uint32_t)output_length, (unsigned char *)output) != 0) { + ok = false; + } + + mbedtls_md_free(&sha1_ctx); + return ok; +} + + +typedef struct { + mbedtls_entropy_context entropy; + mbedtls_ctr_drbg_context ctr_drbg; +} zip_random_context_t; + +ZIP_EXTERN bool +zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) { + static zip_random_context_t *ctx = NULL; + const unsigned char *pers = "zip_crypto_mbedtls"; + + if (!ctx) { + ctx = (zip_random_context_t *)malloc(sizeof(zip_random_context_t)); + if (!ctx) { + return false; + } + mbedtls_entropy_init(&ctx->entropy); + mbedtls_ctr_drbg_init(&ctx->ctr_drbg); + if (mbedtls_ctr_drbg_seed(&ctx->ctr_drbg, mbedtls_entropy_func, &ctx->entropy, pers, strlen(pers)) != 0) { + mbedtls_ctr_drbg_free(&ctx->ctr_drbg); + mbedtls_entropy_free(&ctx->entropy); + free(ctx); + ctx = NULL; + return false; + } + } + + return mbedtls_ctr_drbg_random(&ctx->ctr_drbg, (unsigned char *)buffer, (size_t)length) == 0; +} diff --git a/core/deps/libzip/lib/zip_crypto_mbedtls.h b/core/deps/libzip/lib/zip_crypto_mbedtls.h new file mode 100644 index 000000000..0b06e99da --- /dev/null +++ b/core/deps/libzip/lib/zip_crypto_mbedtls.h @@ -0,0 +1,56 @@ +/* + zip_crypto_mbedtls.h -- definitions for mbedtls wrapper + Copyright (C) 2018-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef HAD_ZIP_CRYPTO_MBEDTLS_H +#define HAD_ZIP_CRYPTO_MBEDTLS_H + +#define HAVE_SECURE_RANDOM + +#include +#include + +#define _zip_crypto_aes_t mbedtls_aes_context +#define _zip_crypto_hmac_t mbedtls_md_context_t + +_zip_crypto_aes_t *_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error); +#define _zip_crypto_aes_encrypt_block(aes, in, out) (mbedtls_aes_crypt_ecb((aes), MBEDTLS_AES_ENCRYPT, (in), (out)) == 0) +void _zip_crypto_aes_free(_zip_crypto_aes_t *aes); + +_zip_crypto_hmac_t *_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error); +#define _zip_crypto_hmac(hmac, data, length) (mbedtls_md_hmac_update((hmac), (data), (length)) == 0) +#define _zip_crypto_hmac_output(hmac, data) (mbedtls_md_hmac_finish((hmac), (data)) == 0) +void _zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac); + +bool _zip_crypto_pbkdf2(const zip_uint8_t *key, zip_uint64_t key_length, const zip_uint8_t *salt, zip_uint16_t salt_length, int iterations, zip_uint8_t *output, zip_uint64_t output_length); + +#endif /* HAD_ZIP_CRYPTO_MBEDTLS_H */ diff --git a/core/deps/libzip/lib/zip_crypto_openssl.c b/core/deps/libzip/lib/zip_crypto_openssl.c new file mode 100644 index 000000000..5cbc5ce2c --- /dev/null +++ b/core/deps/libzip/lib/zip_crypto_openssl.c @@ -0,0 +1,137 @@ +/* + zip_crypto_openssl.c -- OpenSSL wrapper. + Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include "zipint.h" + +#include "zip_crypto.h" + +#include +#include + +#if OPENSSL_VERSION_NUMBER < 0x1010000fL || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x02070000fL) +#define USE_OPENSSL_1_0_API +#endif + + +_zip_crypto_aes_t * +_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error) { + _zip_crypto_aes_t *aes; + + if ((aes = (_zip_crypto_aes_t *)malloc(sizeof(*aes))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + AES_set_encrypt_key(key, key_size, aes); + + return aes; +} + +void +_zip_crypto_aes_free(_zip_crypto_aes_t *aes) { + if (aes == NULL) { + return; + } + + _zip_crypto_clear(aes, sizeof(*aes)); + free(aes); +} + + +_zip_crypto_hmac_t * +_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error) { + _zip_crypto_hmac_t *hmac; + + if (secret_length > INT_MAX) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + +#ifdef USE_OPENSSL_1_0_API + if ((hmac = (_zip_crypto_hmac_t *)malloc(sizeof(*hmac))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + HMAC_CTX_init(hmac); +#else + if ((hmac = HMAC_CTX_new()) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } +#endif + + if (HMAC_Init_ex(hmac, secret, (int)secret_length, EVP_sha1(), NULL) != 1) { + zip_error_set(error, ZIP_ER_INTERNAL, 0); +#ifdef USE_OPENSSL_1_0_API + free(hmac); +#else + HMAC_CTX_free(hmac); +#endif + return NULL; + } + + return hmac; +} + + +void +_zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac) { + if (hmac == NULL) { + return; + } + +#ifdef USE_OPENSSL_1_0_API + HMAC_CTX_cleanup(hmac); + _zip_crypto_clear(hmac, sizeof(*hmac)); + free(hmac); +#else + HMAC_CTX_free(hmac); +#endif +} + + +bool +_zip_crypto_hmac_output(_zip_crypto_hmac_t *hmac, zip_uint8_t *data) { + unsigned int length; + + return HMAC_Final(hmac, data, &length) == 1; +} + + +ZIP_EXTERN bool +zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) { + return RAND_bytes(buffer, length) == 1; +} diff --git a/core/deps/libzip/lib/zip_crypto_openssl.h b/core/deps/libzip/lib/zip_crypto_openssl.h new file mode 100644 index 000000000..be0a8ca9f --- /dev/null +++ b/core/deps/libzip/lib/zip_crypto_openssl.h @@ -0,0 +1,56 @@ +/* + zip_crypto_openssl.h -- definitions for OpenSSL wrapper. + Copyright (C) 2018-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef HAD_ZIP_CRYPTO_OPENSSL_H +#define HAD_ZIP_CRYPTO_OPENSSL_H + +#define HAVE_SECURE_RANDOM + +#include +#include + +#define _zip_crypto_aes_t AES_KEY +#define _zip_crypto_hmac_t HMAC_CTX + +void _zip_crypto_aes_free(_zip_crypto_aes_t *aes); +#define _zip_crypto_aes_encrypt_block(aes, in, out) (AES_encrypt((in), (out), (aes)), true) +_zip_crypto_aes_t *_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error); + +#define _zip_crypto_hmac(hmac, data, length) (HMAC_Update((hmac), (data), (length)) == 1) +void _zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac); +_zip_crypto_hmac_t *_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error); +bool _zip_crypto_hmac_output(_zip_crypto_hmac_t *hmac, zip_uint8_t *data); + +#define _zip_crypto_pbkdf2(key, key_length, salt, salt_length, iterations, output, output_length) (PKCS5_PBKDF2_HMAC_SHA1((const char *)(key), (key_length), (salt), (salt_length), (iterations), (output_length), (output))) + +#endif /* HAD_ZIP_CRYPTO_OPENSSL_H */ diff --git a/core/deps/libzip/lib/zip_crypto_win.c b/core/deps/libzip/lib/zip_crypto_win.c new file mode 100644 index 000000000..6f9a59630 --- /dev/null +++ b/core/deps/libzip/lib/zip_crypto_win.c @@ -0,0 +1,495 @@ +/* + zip_crypto_win.c -- Windows Crypto API wrapper. + Copyright (C) 2018-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#include +#include + +#include "zipint.h" + +#include "zip_crypto.h" + +#define WIN32_LEAN_AND_MEAN +#define NOCRYPT + +#include + +#include + +#pragma comment(lib, "bcrypt.lib") + +/* + +This code is using the Cryptography API: Next Generation (CNG) +https://docs.microsoft.com/en-us/windows/desktop/seccng/cng-portal + +This API is supported on + - Windows Vista or later (client OS) + - Windows Server 2008 (server OS) + - Windows Embedded Compact 2013 (don't know about Windows Embedded Compact 7) + +The code was developed for Windows Embedded Compact 2013 (WEC2013), +but should be working for all of the above mentioned OSes. + +There are 2 restrictions for WEC2013, Windows Vista and Windows Server 2008: + +1.) The function "BCryptDeriveKeyPBKDF2" is not available + +I found some code which is implementing this function using the deprecated Crypto API here: +https://www.idrix.fr/Root/content/view/37/54/ + +I took this code and converted it to the newer CNG API. The original code was more +flexible, but this is not needed here so i refactored it a bit and just kept what is needed. + +The define "HAS_BCRYPTDERIVEKEYPBKDF2" controls whether "BCryptDeriveKeyPBKDF2" +of the CNG API is used or not. This define must not be set if you are compiling for WEC2013 or Windows Vista. + + +2.) "BCryptCreateHash" can't manage the memory needed for the hash object internally + +On Windows 7 or later it is possible to pass NULL for the hash object buffer. +This is not supported on WEC2013, so we have to handle the memory allocation/deallocation ourselves. +There is no #ifdef to control that, because this is working for all supported OSes. + +*/ + +#if !defined(WINCE) && !defined(__MINGW32__) +#define HAS_BCRYPTDERIVEKEYPBKDF2 +#endif + +#ifdef HAS_BCRYPTDERIVEKEYPBKDF2 + +bool +_zip_crypto_pbkdf2(const zip_uint8_t *key, zip_uint64_t key_length, const zip_uint8_t *salt, zip_uint16_t salt_length, zip_uint16_t iterations, zip_uint8_t *output, zip_uint16_t output_length) { + BCRYPT_ALG_HANDLE hAlgorithm = NULL; + bool result; + + if (!BCRYPT_SUCCESS(BCryptOpenAlgorithmProvider(&hAlgorithm, BCRYPT_SHA1_ALGORITHM, NULL, BCRYPT_ALG_HANDLE_HMAC_FLAG))) { + return false; + } + + result = BCRYPT_SUCCESS(BCryptDeriveKeyPBKDF2(hAlgorithm, (PUCHAR)key, (ULONG)key_length, (PUCHAR)salt, salt_length, iterations, output, output_length, 0)); + + BCryptCloseAlgorithmProvider(hAlgorithm, 0); + + return result; +} + +#else + +#include + +#define DIGEST_SIZE 20 +#define BLOCK_SIZE 64 + +typedef struct { + BCRYPT_ALG_HANDLE hAlgorithm; + BCRYPT_HASH_HANDLE hInnerHash; + BCRYPT_HASH_HANDLE hOuterHash; + ULONG cbHashObject; + PUCHAR pbInnerHash; + PUCHAR pbOuterHash; +} PRF_CTX; + +static void +hmacFree(PRF_CTX *pContext) { + if (pContext->hOuterHash) + BCryptDestroyHash(pContext->hOuterHash); + if (pContext->hInnerHash) + BCryptDestroyHash(pContext->hInnerHash); + free(pContext->pbOuterHash); + free(pContext->pbInnerHash); + if (pContext->hAlgorithm) + BCryptCloseAlgorithmProvider(pContext->hAlgorithm, 0); +} + +static BOOL +hmacPrecomputeDigest(BCRYPT_HASH_HANDLE hHash, PUCHAR pbPassword, DWORD cbPassword, BYTE mask) { + BYTE buffer[BLOCK_SIZE]; + DWORD i; + + if (cbPassword > BLOCK_SIZE) { + return FALSE; + } + + memset(buffer, mask, sizeof(buffer)); + + for (i = 0; i < cbPassword; ++i) { + buffer[i] = (char)(pbPassword[i] ^ mask); + } + + return BCRYPT_SUCCESS(BCryptHashData(hHash, buffer, sizeof(buffer), 0)); +} + +static BOOL +hmacInit(PRF_CTX *pContext, PUCHAR pbPassword, DWORD cbPassword) { + BOOL bStatus = FALSE; + ULONG cbResult; + BYTE key[DIGEST_SIZE]; + + if (!BCRYPT_SUCCESS(BCryptOpenAlgorithmProvider(&pContext->hAlgorithm, BCRYPT_SHA1_ALGORITHM, NULL, 0)) || !BCRYPT_SUCCESS(BCryptGetProperty(pContext->hAlgorithm, BCRYPT_OBJECT_LENGTH, (PUCHAR)&pContext->cbHashObject, sizeof(pContext->cbHashObject), &cbResult, 0)) || ((pContext->pbInnerHash = malloc(pContext->cbHashObject)) == NULL) || ((pContext->pbOuterHash = malloc(pContext->cbHashObject)) == NULL) || !BCRYPT_SUCCESS(BCryptCreateHash(pContext->hAlgorithm, &pContext->hInnerHash, pContext->pbInnerHash, pContext->cbHashObject, NULL, 0, 0)) || !BCRYPT_SUCCESS(BCryptCreateHash(pContext->hAlgorithm, &pContext->hOuterHash, pContext->pbOuterHash, pContext->cbHashObject, NULL, 0, 0))) { + goto hmacInit_end; + } + + if (cbPassword > BLOCK_SIZE) { + BCRYPT_HASH_HANDLE hHash = NULL; + PUCHAR pbHashObject = malloc(pContext->cbHashObject); + if (pbHashObject == NULL) { + goto hmacInit_end; + } + + bStatus = BCRYPT_SUCCESS(BCryptCreateHash(pContext->hAlgorithm, &hHash, pbHashObject, pContext->cbHashObject, NULL, 0, 0)) && BCRYPT_SUCCESS(BCryptHashData(hHash, pbPassword, cbPassword, 0)) && BCRYPT_SUCCESS(BCryptGetProperty(hHash, BCRYPT_HASH_LENGTH, (PUCHAR)&cbPassword, sizeof(cbPassword), &cbResult, 0)) && BCRYPT_SUCCESS(BCryptFinishHash(hHash, key, cbPassword, 0)); + + if (hHash) + BCryptDestroyHash(hHash); + free(pbHashObject); + + if (!bStatus) { + goto hmacInit_end; + } + + pbPassword = key; + } + + bStatus = hmacPrecomputeDigest(pContext->hInnerHash, pbPassword, cbPassword, 0x36) && hmacPrecomputeDigest(pContext->hOuterHash, pbPassword, cbPassword, 0x5C); + +hmacInit_end: + + if (bStatus == FALSE) + hmacFree(pContext); + + return bStatus; +} + +static BOOL +hmacCalculateInternal(BCRYPT_HASH_HANDLE hHashTemplate, PUCHAR pbData, DWORD cbData, PUCHAR pbOutput, DWORD cbOutput, DWORD cbHashObject) { + BOOL success = FALSE; + BCRYPT_HASH_HANDLE hHash = NULL; + PUCHAR pbHashObject = malloc(cbHashObject); + + if (pbHashObject == NULL) { + return FALSE; + } + + if (BCRYPT_SUCCESS(BCryptDuplicateHash(hHashTemplate, &hHash, pbHashObject, cbHashObject, 0))) { + success = BCRYPT_SUCCESS(BCryptHashData(hHash, pbData, cbData, 0)) && BCRYPT_SUCCESS(BCryptFinishHash(hHash, pbOutput, cbOutput, 0)); + + BCryptDestroyHash(hHash); + } + + free(pbHashObject); + + return success; +} + +static BOOL +hmacCalculate(PRF_CTX *pContext, PUCHAR pbData, DWORD cbData, PUCHAR pbDigest) { + DWORD cbResult; + DWORD cbHashObject; + + return BCRYPT_SUCCESS(BCryptGetProperty(pContext->hAlgorithm, BCRYPT_OBJECT_LENGTH, (PUCHAR)&cbHashObject, sizeof(cbHashObject), &cbResult, 0)) && hmacCalculateInternal(pContext->hInnerHash, pbData, cbData, pbDigest, DIGEST_SIZE, cbHashObject) && hmacCalculateInternal(pContext->hOuterHash, pbDigest, DIGEST_SIZE, pbDigest, DIGEST_SIZE, cbHashObject); +} + +static void +myxor(LPBYTE ptr1, LPBYTE ptr2, DWORD dwLen) { + while (dwLen--) + *ptr1++ ^= *ptr2++; +} + +BOOL +pbkdf2(PUCHAR pbPassword, ULONG cbPassword, PUCHAR pbSalt, ULONG cbSalt, DWORD cIterations, PUCHAR pbDerivedKey, ULONG cbDerivedKey) { + BOOL bStatus = FALSE; + DWORD l, r, dwULen, i, j; + BYTE Ti[DIGEST_SIZE]; + BYTE V[DIGEST_SIZE]; + LPBYTE U = malloc(max((cbSalt + 4), DIGEST_SIZE)); + PRF_CTX prfCtx = {0}; + + if (U == NULL) { + return FALSE; + } + + if (pbPassword == NULL || cbPassword == 0 || pbSalt == NULL || cbSalt == 0 || cIterations == 0 || pbDerivedKey == NULL || cbDerivedKey == 0) { + free(U); + return FALSE; + } + + if (!hmacInit(&prfCtx, pbPassword, cbPassword)) { + goto PBKDF2_end; + } + + l = (DWORD)ceil((double)cbDerivedKey / (double)DIGEST_SIZE); + r = cbDerivedKey - (l - 1) * DIGEST_SIZE; + + for (i = 1; i <= l; i++) { + ZeroMemory(Ti, DIGEST_SIZE); + for (j = 0; j < cIterations; j++) { + if (j == 0) { + /* construct first input for PRF */ + memcpy(U, pbSalt, cbSalt); + U[cbSalt] = (BYTE)((i & 0xFF000000) >> 24); + U[cbSalt + 1] = (BYTE)((i & 0x00FF0000) >> 16); + U[cbSalt + 2] = (BYTE)((i & 0x0000FF00) >> 8); + U[cbSalt + 3] = (BYTE)((i & 0x000000FF)); + dwULen = cbSalt + 4; + } + else { + memcpy(U, V, DIGEST_SIZE); + dwULen = DIGEST_SIZE; + } + + if (!hmacCalculate(&prfCtx, U, dwULen, V)) { + goto PBKDF2_end; + } + + myxor(Ti, V, DIGEST_SIZE); + } + + if (i != l) { + memcpy(&pbDerivedKey[(i - 1) * DIGEST_SIZE], Ti, DIGEST_SIZE); + } + else { + /* Take only the first r bytes */ + memcpy(&pbDerivedKey[(i - 1) * DIGEST_SIZE], Ti, r); + } + } + + bStatus = TRUE; + +PBKDF2_end: + + hmacFree(&prfCtx); + free(U); + return bStatus; +} + +bool +_zip_crypto_pbkdf2(const zip_uint8_t *key, zip_uint64_t key_length, const zip_uint8_t *salt, zip_uint16_t salt_length, zip_uint16_t iterations, zip_uint8_t *output, zip_uint16_t output_length) { + return (key_length <= ZIP_UINT32_MAX) && pbkdf2((PUCHAR)key, (ULONG)key_length, (PUCHAR)salt, salt_length, iterations, output, output_length); +} + +#endif + + +struct _zip_crypto_aes_s { + BCRYPT_ALG_HANDLE hAlgorithm; + BCRYPT_KEY_HANDLE hKey; + ULONG cbKeyObject; + PUCHAR pbKeyObject; +}; + +_zip_crypto_aes_t * +_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error) { + _zip_crypto_aes_t *aes = (_zip_crypto_aes_t *)calloc(1, sizeof(*aes)); + + ULONG cbResult; + ULONG key_length = key_size / 8; + + if (aes == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if (!BCRYPT_SUCCESS(BCryptOpenAlgorithmProvider(&aes->hAlgorithm, BCRYPT_AES_ALGORITHM, NULL, 0))) { + _zip_crypto_aes_free(aes); + return NULL; + } + + if (!BCRYPT_SUCCESS(BCryptSetProperty(aes->hAlgorithm, BCRYPT_CHAINING_MODE, (PUCHAR)BCRYPT_CHAIN_MODE_ECB, sizeof(BCRYPT_CHAIN_MODE_ECB), 0))) { + _zip_crypto_aes_free(aes); + return NULL; + } + + if (!BCRYPT_SUCCESS(BCryptGetProperty(aes->hAlgorithm, BCRYPT_OBJECT_LENGTH, (PUCHAR)&aes->cbKeyObject, sizeof(aes->cbKeyObject), &cbResult, 0))) { + _zip_crypto_aes_free(aes); + return NULL; + } + + aes->pbKeyObject = malloc(aes->cbKeyObject); + if (aes->pbKeyObject == NULL) { + _zip_crypto_aes_free(aes); + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if (!BCRYPT_SUCCESS(BCryptGenerateSymmetricKey(aes->hAlgorithm, &aes->hKey, aes->pbKeyObject, aes->cbKeyObject, (PUCHAR)key, key_length, 0))) { + _zip_crypto_aes_free(aes); + return NULL; + } + + return aes; +} + +void +_zip_crypto_aes_free(_zip_crypto_aes_t *aes) { + if (aes == NULL) { + return; + } + + if (aes->hKey != NULL) { + BCryptDestroyKey(aes->hKey); + } + + if (aes->pbKeyObject != NULL) { + free(aes->pbKeyObject); + } + + if (aes->hAlgorithm != NULL) { + BCryptCloseAlgorithmProvider(aes->hAlgorithm, 0); + } + + free(aes); +} + +bool +_zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out) { + ULONG cbResult; + NTSTATUS status = BCryptEncrypt(aes->hKey, (PUCHAR)in, ZIP_CRYPTO_AES_BLOCK_LENGTH, NULL, NULL, 0, (PUCHAR)out, ZIP_CRYPTO_AES_BLOCK_LENGTH, &cbResult, 0); + return BCRYPT_SUCCESS(status); +} + +struct _zip_crypto_hmac_s { + BCRYPT_ALG_HANDLE hAlgorithm; + BCRYPT_HASH_HANDLE hHash; + DWORD cbHashObject; + PUCHAR pbHashObject; + DWORD cbHash; + PUCHAR pbHash; +}; + +/* https://code.msdn.microsoft.com/windowsdesktop/Hmac-Computation-Sample-11fe8ec1/sourcecode?fileId=42820&pathId=283874677 */ + +_zip_crypto_hmac_t * +_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error) { + NTSTATUS status; + ULONG cbResult; + _zip_crypto_hmac_t *hmac; + + if (secret_length > INT_MAX) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + hmac = (_zip_crypto_hmac_t *)calloc(1, sizeof(*hmac)); + + if (hmac == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + status = BCryptOpenAlgorithmProvider(&hmac->hAlgorithm, BCRYPT_SHA1_ALGORITHM, NULL, BCRYPT_ALG_HANDLE_HMAC_FLAG); + if (!BCRYPT_SUCCESS(status)) { + _zip_crypto_hmac_free(hmac); + return NULL; + } + + status = BCryptGetProperty(hmac->hAlgorithm, BCRYPT_OBJECT_LENGTH, (PUCHAR)&hmac->cbHashObject, sizeof(hmac->cbHashObject), &cbResult, 0); + if (!BCRYPT_SUCCESS(status)) { + _zip_crypto_hmac_free(hmac); + return NULL; + } + + hmac->pbHashObject = malloc(hmac->cbHashObject); + if (hmac->pbHashObject == NULL) { + _zip_crypto_hmac_free(hmac); + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + status = BCryptGetProperty(hmac->hAlgorithm, BCRYPT_HASH_LENGTH, (PUCHAR)&hmac->cbHash, sizeof(hmac->cbHash), &cbResult, 0); + if (!BCRYPT_SUCCESS(status)) { + _zip_crypto_hmac_free(hmac); + return NULL; + } + + hmac->pbHash = malloc(hmac->cbHash); + if (hmac->pbHash == NULL) { + _zip_crypto_hmac_free(hmac); + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + status = BCryptCreateHash(hmac->hAlgorithm, &hmac->hHash, hmac->pbHashObject, hmac->cbHashObject, (PUCHAR)secret, (ULONG)secret_length, 0); + if (!BCRYPT_SUCCESS(status)) { + _zip_crypto_hmac_free(hmac); + return NULL; + } + + return hmac; +} + +void +_zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac) { + if (hmac == NULL) { + return; + } + + if (hmac->hHash != NULL) { + BCryptDestroyHash(hmac->hHash); + } + + if (hmac->pbHash != NULL) { + free(hmac->pbHash); + } + + if (hmac->pbHashObject != NULL) { + free(hmac->pbHashObject); + } + + if (hmac->hAlgorithm) { + BCryptCloseAlgorithmProvider(hmac->hAlgorithm, 0); + } + + free(hmac); +} + +bool +_zip_crypto_hmac(_zip_crypto_hmac_t *hmac, zip_uint8_t *data, zip_uint64_t length) { + if (hmac == NULL || length > ULONG_MAX) { + return false; + } + + return BCRYPT_SUCCESS(BCryptHashData(hmac->hHash, data, (ULONG)length, 0)); +} + +bool +_zip_crypto_hmac_output(_zip_crypto_hmac_t *hmac, zip_uint8_t *data) { + if (hmac == NULL) { + return false; + } + + return BCRYPT_SUCCESS(BCryptFinishHash(hmac->hHash, data, hmac->cbHash, 0)); +} + +ZIP_EXTERN bool +zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) { + return BCRYPT_SUCCESS(BCryptGenRandom(NULL, buffer, length, BCRYPT_USE_SYSTEM_PREFERRED_RNG)); +} diff --git a/core/deps/libzip/lib/zip_crypto_win.h b/core/deps/libzip/lib/zip_crypto_win.h new file mode 100644 index 000000000..9d3689152 --- /dev/null +++ b/core/deps/libzip/lib/zip_crypto_win.h @@ -0,0 +1,53 @@ +/* + zip_crypto_win.h -- Windows Crypto API wrapper. + Copyright (C) 2018-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef HAD_ZIP_CRYPTO_WIN_H +#define HAD_ZIP_CRYPTO_WIN_H + +#define HAVE_SECURE_RANDOM + +typedef struct _zip_crypto_aes_s _zip_crypto_aes_t; +typedef struct _zip_crypto_hmac_s _zip_crypto_hmac_t; + +void _zip_crypto_aes_free(_zip_crypto_aes_t *aes); +_zip_crypto_aes_t *_zip_crypto_aes_new(const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error); +bool _zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out); + +bool _zip_crypto_pbkdf2(const zip_uint8_t *key, zip_uint64_t key_length, const zip_uint8_t *salt, zip_uint16_t salt_length, zip_uint16_t iterations, zip_uint8_t *output, zip_uint16_t output_length); + +_zip_crypto_hmac_t *_zip_crypto_hmac_new(const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error); +void _zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac); +bool _zip_crypto_hmac(_zip_crypto_hmac_t *hmac, zip_uint8_t *data, zip_uint64_t length); +bool _zip_crypto_hmac_output(_zip_crypto_hmac_t *hmac, zip_uint8_t *data); + +#endif /* HAD_ZIP_CRYPTO_WIN_H */ diff --git a/core/deps/libzip/zip_delete.c b/core/deps/libzip/lib/zip_delete.c similarity index 75% rename from core/deps/libzip/zip_delete.c rename to core/deps/libzip/lib/zip_delete.c index a0545e4b9..4ff4c1abe 100644 --- a/core/deps/libzip/zip_delete.c +++ b/core/deps/libzip/lib/zip_delete.c @@ -1,6 +1,6 @@ /* zip_delete.c -- delete file from zip archive - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,28 +31,38 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include "zipint.h" - ZIP_EXTERN int -zip_delete(struct zip *za, int idx) -{ - if (idx < 0 || idx >= za->nentry) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; +zip_delete(zip_t *za, zip_uint64_t idx) { + const char *name; + + if (idx >= za->nentry) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (ZIP_IS_RDONLY(za)) { + zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if ((name = _zip_get_name(za, idx, 0, &za->error)) == NULL) { + return -1; + } + + if (!_zip_hash_delete(za->names, (const zip_uint8_t *)name, &za->error)) { + return -1; } /* allow duplicate file names, because the file will * be removed directly afterwards */ if (_zip_unchange(za, idx, 1) != 0) - return -1; + return -1; - za->entry[idx].state = ZIP_ST_DELETED; + za->entry[idx].deleted = 1; return 0; } - - diff --git a/core/deps/libzip/lib/zip_dir_add.c b/core/deps/libzip/lib/zip_dir_add.c new file mode 100644 index 000000000..da1e4a422 --- /dev/null +++ b/core/deps/libzip/lib/zip_dir_add.c @@ -0,0 +1,92 @@ +/* + zip_dir_add.c -- add directory + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include +#include + +#include "zipint.h" + + +/* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ + +ZIP_EXTERN zip_int64_t +zip_dir_add(zip_t *za, const char *name, zip_flags_t flags) { + size_t len; + zip_int64_t idx; + char *s; + zip_source_t *source; + + if (ZIP_IS_RDONLY(za)) { + zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (name == NULL) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + s = NULL; + len = strlen(name); + + if (name[len - 1] != '/') { + if ((s = (char *)malloc(len + 2)) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + strcpy(s, name); + s[len] = '/'; + s[len + 1] = '\0'; + } + + if ((source = zip_source_buffer(za, NULL, 0, 0)) == NULL) { + free(s); + return -1; + } + + idx = _zip_file_replace(za, ZIP_UINT64_MAX, s ? s : name, source, flags); + + free(s); + + if (idx < 0) + zip_source_free(source); + else { + if (zip_file_set_external_attributes(za, (zip_uint64_t)idx, 0, ZIP_OPSYS_DEFAULT, ZIP_EXT_ATTRIB_DEFAULT_DIR) < 0) { + zip_delete(za, (zip_uint64_t)idx); + return -1; + } + } + + return idx; +} diff --git a/core/deps/libzip/lib/zip_dirent.c b/core/deps/libzip/lib/zip_dirent.c new file mode 100644 index 000000000..5226a6e1f --- /dev/null +++ b/core/deps/libzip/lib/zip_dirent.c @@ -0,0 +1,1163 @@ +/* + zip_dirent.c -- read directory entry (local or central), clean dirent + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include +#include +#include +#include +#include + +#include "zipint.h" + +static zip_string_t *_zip_dirent_process_ef_utf_8(const zip_dirent_t *de, zip_uint16_t id, zip_string_t *str); +static zip_extra_field_t *_zip_ef_utf8(zip_uint16_t, zip_string_t *, zip_error_t *); +static bool _zip_dirent_process_winzip_aes(zip_dirent_t *de, zip_error_t *error); + + +void +_zip_cdir_free(zip_cdir_t *cd) { + zip_uint64_t i; + + if (!cd) + return; + + for (i = 0; i < cd->nentry; i++) + _zip_entry_finalize(cd->entry + i); + free(cd->entry); + _zip_string_free(cd->comment); + free(cd); +} + + +zip_cdir_t * +_zip_cdir_new(zip_uint64_t nentry, zip_error_t *error) { + zip_cdir_t *cd; + + if ((cd = (zip_cdir_t *)malloc(sizeof(*cd))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + cd->entry = NULL; + cd->nentry = cd->nentry_alloc = 0; + cd->size = cd->offset = 0; + cd->comment = NULL; + cd->is_zip64 = false; + + if (!_zip_cdir_grow(cd, nentry, error)) { + _zip_cdir_free(cd); + return NULL; + } + + return cd; +} + + +bool +_zip_cdir_grow(zip_cdir_t *cd, zip_uint64_t additional_entries, zip_error_t *error) { + zip_uint64_t i, new_alloc; + zip_entry_t *new_entry; + + if (additional_entries == 0) { + return true; + } + + new_alloc = cd->nentry_alloc + additional_entries; + + if (new_alloc < additional_entries || new_alloc > SIZE_MAX / sizeof(*(cd->entry))) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return false; + } + + if ((new_entry = (zip_entry_t *)realloc(cd->entry, sizeof(*(cd->entry)) * (size_t)new_alloc)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return false; + } + + cd->entry = new_entry; + + for (i = cd->nentry; i < new_alloc; i++) { + _zip_entry_init(cd->entry + i); + } + + cd->nentry = cd->nentry_alloc = new_alloc; + + return true; +} + + +zip_int64_t +_zip_cdir_write(zip_t *za, const zip_filelist_t *filelist, zip_uint64_t survivors) { + zip_uint64_t offset, size; + zip_string_t *comment; + zip_uint8_t buf[EOCDLEN + EOCD64LEN + EOCD64LOCLEN]; + zip_buffer_t *buffer; + zip_int64_t off; + zip_uint64_t i; + bool is_zip64; + int ret; + + if ((off = zip_source_tell_write(za->src)) < 0) { + _zip_error_set_from_source(&za->error, za->src); + return -1; + } + offset = (zip_uint64_t)off; + + is_zip64 = false; + + for (i = 0; i < survivors; i++) { + zip_entry_t *entry = za->entry + filelist[i].idx; + + if ((ret = _zip_dirent_write(za, entry->changes ? entry->changes : entry->orig, ZIP_FL_CENTRAL)) < 0) + return -1; + if (ret) + is_zip64 = true; + } + + if ((off = zip_source_tell_write(za->src)) < 0) { + _zip_error_set_from_source(&za->error, za->src); + return -1; + } + size = (zip_uint64_t)off - offset; + + if (offset > ZIP_UINT32_MAX || survivors > ZIP_UINT16_MAX) + is_zip64 = true; + + + if ((buffer = _zip_buffer_new(buf, sizeof(buf))) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + + if (is_zip64) { + _zip_buffer_put(buffer, EOCD64_MAGIC, 4); + _zip_buffer_put_64(buffer, EOCD64LEN - 12); + _zip_buffer_put_16(buffer, 45); + _zip_buffer_put_16(buffer, 45); + _zip_buffer_put_32(buffer, 0); + _zip_buffer_put_32(buffer, 0); + _zip_buffer_put_64(buffer, survivors); + _zip_buffer_put_64(buffer, survivors); + _zip_buffer_put_64(buffer, size); + _zip_buffer_put_64(buffer, offset); + _zip_buffer_put(buffer, EOCD64LOC_MAGIC, 4); + _zip_buffer_put_32(buffer, 0); + _zip_buffer_put_64(buffer, offset + size); + _zip_buffer_put_32(buffer, 1); + } + + _zip_buffer_put(buffer, EOCD_MAGIC, 4); + _zip_buffer_put_32(buffer, 0); + _zip_buffer_put_16(buffer, (zip_uint16_t)(survivors >= ZIP_UINT16_MAX ? ZIP_UINT16_MAX : survivors)); + _zip_buffer_put_16(buffer, (zip_uint16_t)(survivors >= ZIP_UINT16_MAX ? ZIP_UINT16_MAX : survivors)); + _zip_buffer_put_32(buffer, size >= ZIP_UINT32_MAX ? ZIP_UINT32_MAX : (zip_uint32_t)size); + _zip_buffer_put_32(buffer, offset >= ZIP_UINT32_MAX ? ZIP_UINT32_MAX : (zip_uint32_t)offset); + + comment = za->comment_changed ? za->comment_changes : za->comment_orig; + + _zip_buffer_put_16(buffer, (zip_uint16_t)(comment ? comment->length : 0)); + + if (!_zip_buffer_ok(buffer)) { + zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + _zip_buffer_free(buffer); + return -1; + } + + if (_zip_write(za, _zip_buffer_data(buffer), _zip_buffer_offset(buffer)) < 0) { + _zip_buffer_free(buffer); + return -1; + } + + _zip_buffer_free(buffer); + + if (comment) { + if (_zip_write(za, comment->raw, comment->length) < 0) { + return -1; + } + } + + return (zip_int64_t)size; +} + + +zip_dirent_t * +_zip_dirent_clone(const zip_dirent_t *sde) { + zip_dirent_t *tde; + + if ((tde = (zip_dirent_t *)malloc(sizeof(*tde))) == NULL) + return NULL; + + if (sde) + memcpy(tde, sde, sizeof(*sde)); + else + _zip_dirent_init(tde); + + tde->changed = 0; + tde->cloned = 1; + + return tde; +} + + +void +_zip_dirent_finalize(zip_dirent_t *zde) { + if (!zde->cloned || zde->changed & ZIP_DIRENT_FILENAME) { + _zip_string_free(zde->filename); + zde->filename = NULL; + } + if (!zde->cloned || zde->changed & ZIP_DIRENT_EXTRA_FIELD) { + _zip_ef_free(zde->extra_fields); + zde->extra_fields = NULL; + } + if (!zde->cloned || zde->changed & ZIP_DIRENT_COMMENT) { + _zip_string_free(zde->comment); + zde->comment = NULL; + } + if (!zde->cloned || zde->changed & ZIP_DIRENT_PASSWORD) { + if (zde->password) { + _zip_crypto_clear(zde->password, strlen(zde->password)); + } + free(zde->password); + zde->password = NULL; + } +} + + +void +_zip_dirent_free(zip_dirent_t *zde) { + if (zde == NULL) + return; + + _zip_dirent_finalize(zde); + free(zde); +} + + +void +_zip_dirent_init(zip_dirent_t *de) { + de->changed = 0; + de->local_extra_fields_read = 0; + de->cloned = 0; + + de->crc_valid = true; + de->version_madeby = 63 | (ZIP_OPSYS_DEFAULT << 8); + de->version_needed = 10; /* 1.0 */ + de->bitflags = 0; + de->comp_method = ZIP_CM_DEFAULT; + de->last_mod = 0; + de->crc = 0; + de->comp_size = 0; + de->uncomp_size = 0; + de->filename = NULL; + de->extra_fields = NULL; + de->comment = NULL; + de->disk_number = 0; + de->int_attrib = 0; + de->ext_attrib = ZIP_EXT_ATTRIB_DEFAULT; + de->offset = 0; + de->compression_level = 0; + de->encryption_method = ZIP_EM_NONE; + de->password = NULL; +} + + +bool +_zip_dirent_needs_zip64(const zip_dirent_t *de, zip_flags_t flags) { + if (de->uncomp_size >= ZIP_UINT32_MAX || de->comp_size >= ZIP_UINT32_MAX || ((flags & ZIP_FL_CENTRAL) && de->offset >= ZIP_UINT32_MAX)) + return true; + + return false; +} + + +zip_dirent_t * +_zip_dirent_new(void) { + zip_dirent_t *de; + + if ((de = (zip_dirent_t *)malloc(sizeof(*de))) == NULL) + return NULL; + + _zip_dirent_init(de); + return de; +} + + +/* _zip_dirent_read(zde, fp, bufp, left, localp, error): + Fills the zip directory entry zde. + + If buffer is non-NULL, data is taken from there; otherwise data is read from fp as needed. + + If local is true, it reads a local header instead of a central directory entry. + + Returns size of dirent read if successful. On error, error is filled in and -1 is returned. +*/ + +zip_int64_t +_zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, bool local, zip_error_t *error) { + zip_uint8_t buf[CDENTRYSIZE]; + zip_uint16_t dostime, dosdate; + zip_uint32_t size, variable_size; + zip_uint16_t filename_len, comment_len, ef_len; + + bool from_buffer = (buffer != NULL); + + size = local ? LENTRYSIZE : CDENTRYSIZE; + + if (buffer) { + if (_zip_buffer_left(buffer) < size) { + zip_error_set(error, ZIP_ER_NOZIP, 0); + return -1; + } + } + else { + if ((buffer = _zip_buffer_new_from_source(src, size, buf, error)) == NULL) { + return -1; + } + } + + if (memcmp(_zip_buffer_get(buffer, 4), (local ? LOCAL_MAGIC : CENTRAL_MAGIC), 4) != 0) { + zip_error_set(error, ZIP_ER_NOZIP, 0); + if (!from_buffer) { + _zip_buffer_free(buffer); + } + return -1; + } + + /* convert buffercontents to zip_dirent */ + + _zip_dirent_init(zde); + if (!local) + zde->version_madeby = _zip_buffer_get_16(buffer); + else + zde->version_madeby = 0; + zde->version_needed = _zip_buffer_get_16(buffer); + zde->bitflags = _zip_buffer_get_16(buffer); + zde->comp_method = _zip_buffer_get_16(buffer); + + /* convert to time_t */ + dostime = _zip_buffer_get_16(buffer); + dosdate = _zip_buffer_get_16(buffer); + zde->last_mod = _zip_d2u_time(dostime, dosdate); + + zde->crc = _zip_buffer_get_32(buffer); + zde->comp_size = _zip_buffer_get_32(buffer); + zde->uncomp_size = _zip_buffer_get_32(buffer); + + filename_len = _zip_buffer_get_16(buffer); + ef_len = _zip_buffer_get_16(buffer); + + if (local) { + comment_len = 0; + zde->disk_number = 0; + zde->int_attrib = 0; + zde->ext_attrib = 0; + zde->offset = 0; + } + else { + comment_len = _zip_buffer_get_16(buffer); + zde->disk_number = _zip_buffer_get_16(buffer); + zde->int_attrib = _zip_buffer_get_16(buffer); + zde->ext_attrib = _zip_buffer_get_32(buffer); + zde->offset = _zip_buffer_get_32(buffer); + } + + if (!_zip_buffer_ok(buffer)) { + zip_error_set(error, ZIP_ER_INTERNAL, 0); + if (!from_buffer) { + _zip_buffer_free(buffer); + } + return -1; + } + + if (zde->bitflags & ZIP_GPBF_ENCRYPTED) { + if (zde->bitflags & ZIP_GPBF_STRONG_ENCRYPTION) { + /* TODO */ + zde->encryption_method = ZIP_EM_UNKNOWN; + } + else { + zde->encryption_method = ZIP_EM_TRAD_PKWARE; + } + } + else { + zde->encryption_method = ZIP_EM_NONE; + } + + zde->filename = NULL; + zde->extra_fields = NULL; + zde->comment = NULL; + + variable_size = (zip_uint32_t)filename_len + (zip_uint32_t)ef_len + (zip_uint32_t)comment_len; + + if (from_buffer) { + if (_zip_buffer_left(buffer) < variable_size) { + zip_error_set(error, ZIP_ER_INCONS, 0); + return -1; + } + } + else { + _zip_buffer_free(buffer); + + if ((buffer = _zip_buffer_new_from_source(src, variable_size, NULL, error)) == NULL) { + return -1; + } + } + + if (filename_len) { + zde->filename = _zip_read_string(buffer, src, filename_len, 1, error); + if (!zde->filename) { + if (zip_error_code_zip(error) == ZIP_ER_EOF) { + zip_error_set(error, ZIP_ER_INCONS, 0); + } + if (!from_buffer) { + _zip_buffer_free(buffer); + } + return -1; + } + + if (zde->bitflags & ZIP_GPBF_ENCODING_UTF_8) { + if (_zip_guess_encoding(zde->filename, ZIP_ENCODING_UTF8_KNOWN) == ZIP_ENCODING_ERROR) { + zip_error_set(error, ZIP_ER_INCONS, 0); + if (!from_buffer) { + _zip_buffer_free(buffer); + } + return -1; + } + } + } + + if (ef_len) { + zip_uint8_t *ef = _zip_read_data(buffer, src, ef_len, 0, error); + + if (ef == NULL) { + if (!from_buffer) { + _zip_buffer_free(buffer); + } + return -1; + } + if (!_zip_ef_parse(ef, ef_len, local ? ZIP_EF_LOCAL : ZIP_EF_CENTRAL, &zde->extra_fields, error)) { + free(ef); + if (!from_buffer) { + _zip_buffer_free(buffer); + } + return -1; + } + free(ef); + if (local) + zde->local_extra_fields_read = 1; + } + + if (comment_len) { + zde->comment = _zip_read_string(buffer, src, comment_len, 0, error); + if (!zde->comment) { + if (!from_buffer) { + _zip_buffer_free(buffer); + } + return -1; + } + if (zde->bitflags & ZIP_GPBF_ENCODING_UTF_8) { + if (_zip_guess_encoding(zde->comment, ZIP_ENCODING_UTF8_KNOWN) == ZIP_ENCODING_ERROR) { + zip_error_set(error, ZIP_ER_INCONS, 0); + if (!from_buffer) { + _zip_buffer_free(buffer); + } + return -1; + } + } + } + + zde->filename = _zip_dirent_process_ef_utf_8(zde, ZIP_EF_UTF_8_NAME, zde->filename); + zde->comment = _zip_dirent_process_ef_utf_8(zde, ZIP_EF_UTF_8_COMMENT, zde->comment); + + /* Zip64 */ + + if (zde->uncomp_size == ZIP_UINT32_MAX || zde->comp_size == ZIP_UINT32_MAX || zde->offset == ZIP_UINT32_MAX) { + zip_uint16_t got_len; + zip_buffer_t *ef_buffer; + const zip_uint8_t *ef = _zip_ef_get_by_id(zde->extra_fields, &got_len, ZIP_EF_ZIP64, 0, local ? ZIP_EF_LOCAL : ZIP_EF_CENTRAL, error); + /* TODO: if got_len == 0 && !ZIP64_EOCD: no error, 0xffffffff is valid value */ + if (ef == NULL) { + if (!from_buffer) { + _zip_buffer_free(buffer); + } + return -1; + } + + if ((ef_buffer = _zip_buffer_new((zip_uint8_t *)ef, got_len)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + if (!from_buffer) { + _zip_buffer_free(buffer); + } + return -1; + } + + if (zde->uncomp_size == ZIP_UINT32_MAX) { + zde->uncomp_size = _zip_buffer_get_64(ef_buffer); + } + else if (local) { + /* From appnote.txt: This entry in the Local header MUST + include BOTH original and compressed file size fields. */ + (void)_zip_buffer_skip(ef_buffer, 8); /* error is caught by _zip_buffer_eof() call */ + } + if (zde->comp_size == ZIP_UINT32_MAX) { + zde->comp_size = _zip_buffer_get_64(ef_buffer); + } + if (!local) { + if (zde->offset == ZIP_UINT32_MAX) { + zde->offset = _zip_buffer_get_64(ef_buffer); + } + if (zde->disk_number == ZIP_UINT16_MAX) { + zde->disk_number = _zip_buffer_get_32(ef_buffer); + } + } + + if (!_zip_buffer_eof(ef_buffer)) { + /* accept additional fields if values match */ + bool ok = true; + switch (got_len) { + case 28: + _zip_buffer_set_offset(ef_buffer, 24); + if (zde->disk_number != _zip_buffer_get_32(ef_buffer)) { + ok = false; + } + /* fallthrough */ + case 24: + _zip_buffer_set_offset(ef_buffer, 0); + if ((zde->uncomp_size != _zip_buffer_get_64(ef_buffer)) || (zde->comp_size != _zip_buffer_get_64(ef_buffer)) || (zde->offset != _zip_buffer_get_64(ef_buffer))) { + ok = false; + } + break; + + default: + ok = false; + } + if (!ok) { + zip_error_set(error, ZIP_ER_INCONS, 0); + _zip_buffer_free(ef_buffer); + if (!from_buffer) { + _zip_buffer_free(buffer); + } + return -1; + } + } + _zip_buffer_free(ef_buffer); + } + + if (!_zip_buffer_ok(buffer)) { + zip_error_set(error, ZIP_ER_INTERNAL, 0); + if (!from_buffer) { + _zip_buffer_free(buffer); + } + return -1; + } + if (!from_buffer) { + _zip_buffer_free(buffer); + } + + /* zip_source_seek / zip_source_tell don't support values > ZIP_INT64_MAX */ + if (zde->offset > ZIP_INT64_MAX) { + zip_error_set(error, ZIP_ER_SEEK, EFBIG); + return -1; + } + + if (!_zip_dirent_process_winzip_aes(zde, error)) { + return -1; + } + + zde->extra_fields = _zip_ef_remove_internal(zde->extra_fields); + + return (zip_int64_t)size + (zip_int64_t)variable_size; +} + + +static zip_string_t * +_zip_dirent_process_ef_utf_8(const zip_dirent_t *de, zip_uint16_t id, zip_string_t *str) { + zip_uint16_t ef_len; + zip_uint32_t ef_crc; + zip_buffer_t *buffer; + + const zip_uint8_t *ef = _zip_ef_get_by_id(de->extra_fields, &ef_len, id, 0, ZIP_EF_BOTH, NULL); + + if (ef == NULL || ef_len < 5 || ef[0] != 1) { + return str; + } + + if ((buffer = _zip_buffer_new((zip_uint8_t *)ef, ef_len)) == NULL) { + return str; + } + + _zip_buffer_get_8(buffer); + ef_crc = _zip_buffer_get_32(buffer); + + if (_zip_string_crc32(str) == ef_crc) { + zip_uint16_t len = (zip_uint16_t)_zip_buffer_left(buffer); + zip_string_t *ef_str = _zip_string_new(_zip_buffer_get(buffer, len), len, ZIP_FL_ENC_UTF_8, NULL); + + if (ef_str != NULL) { + _zip_string_free(str); + str = ef_str; + } + } + + _zip_buffer_free(buffer); + + return str; +} + + +static bool +_zip_dirent_process_winzip_aes(zip_dirent_t *de, zip_error_t *error) { + zip_uint16_t ef_len; + zip_buffer_t *buffer; + const zip_uint8_t *ef; + bool crc_valid; + zip_uint16_t enc_method; + + + if (de->comp_method != ZIP_CM_WINZIP_AES) { + return true; + } + + ef = _zip_ef_get_by_id(de->extra_fields, &ef_len, ZIP_EF_WINZIP_AES, 0, ZIP_EF_BOTH, NULL); + + if (ef == NULL || ef_len < 7) { + zip_error_set(error, ZIP_ER_INCONS, 0); + return false; + } + + if ((buffer = _zip_buffer_new((zip_uint8_t *)ef, ef_len)) == NULL) { + zip_error_set(error, ZIP_ER_INTERNAL, 0); + return false; + } + + /* version */ + + crc_valid = true; + switch (_zip_buffer_get_16(buffer)) { + case 1: + break; + + case 2: + if (de->uncomp_size < 20 /* TODO: constant */) { + crc_valid = false; + } + break; + + default: + zip_error_set(error, ZIP_ER_ENCRNOTSUPP, 0); + _zip_buffer_free(buffer); + return false; + } + + /* vendor */ + if (memcmp(_zip_buffer_get(buffer, 2), "AE", 2) != 0) { + zip_error_set(error, ZIP_ER_ENCRNOTSUPP, 0); + _zip_buffer_free(buffer); + return false; + } + + /* mode */ + switch (_zip_buffer_get_8(buffer)) { + case 1: + enc_method = ZIP_EM_AES_128; + break; + case 2: + enc_method = ZIP_EM_AES_192; + break; + case 3: + enc_method = ZIP_EM_AES_256; + break; + default: + zip_error_set(error, ZIP_ER_ENCRNOTSUPP, 0); + _zip_buffer_free(buffer); + return false; + } + + if (ef_len != 7) { + zip_error_set(error, ZIP_ER_INCONS, 0); + _zip_buffer_free(buffer); + return false; + } + + de->crc_valid = crc_valid; + de->encryption_method = enc_method; + de->comp_method = _zip_buffer_get_16(buffer); + + _zip_buffer_free(buffer); + return true; +} + + +zip_int32_t +_zip_dirent_size(zip_source_t *src, zip_uint16_t flags, zip_error_t *error) { + zip_int32_t size; + bool local = (flags & ZIP_EF_LOCAL) != 0; + int i; + zip_uint8_t b[6]; + zip_buffer_t *buffer; + + size = local ? LENTRYSIZE : CDENTRYSIZE; + + if (zip_source_seek(src, local ? 26 : 28, SEEK_CUR) < 0) { + _zip_error_set_from_source(error, src); + return -1; + } + + if ((buffer = _zip_buffer_new_from_source(src, local ? 4 : 6, b, error)) == NULL) { + return -1; + } + + for (i = 0; i < (local ? 2 : 3); i++) { + size += _zip_buffer_get_16(buffer); + } + + if (!_zip_buffer_eof(buffer)) { + zip_error_set(error, ZIP_ER_INTERNAL, 0); + _zip_buffer_free(buffer); + return -1; + } + + _zip_buffer_free(buffer); + return size; +} + + +/* _zip_dirent_write + Writes zip directory entry. + + If flags & ZIP_EF_LOCAL, it writes a local header instead of a central + directory entry. If flags & ZIP_EF_FORCE_ZIP64, a ZIP64 extra field is written, even if not needed. + + Returns 0 if successful, 1 if successful and wrote ZIP64 extra field. On error, error is filled in and -1 is + returned. +*/ + +int +_zip_dirent_write(zip_t *za, zip_dirent_t *de, zip_flags_t flags) { + zip_uint16_t dostime, dosdate; + zip_encoding_type_t com_enc, name_enc; + zip_extra_field_t *ef; + zip_extra_field_t *ef64; + zip_uint32_t ef_total_size; + bool is_zip64; + bool is_really_zip64; + bool is_winzip_aes; + zip_uint8_t buf[CDENTRYSIZE]; + zip_buffer_t *buffer; + + ef = NULL; + + name_enc = _zip_guess_encoding(de->filename, ZIP_ENCODING_UNKNOWN); + com_enc = _zip_guess_encoding(de->comment, ZIP_ENCODING_UNKNOWN); + + if ((name_enc == ZIP_ENCODING_UTF8_KNOWN && com_enc == ZIP_ENCODING_ASCII) || (name_enc == ZIP_ENCODING_ASCII && com_enc == ZIP_ENCODING_UTF8_KNOWN) || (name_enc == ZIP_ENCODING_UTF8_KNOWN && com_enc == ZIP_ENCODING_UTF8_KNOWN)) + de->bitflags |= ZIP_GPBF_ENCODING_UTF_8; + else { + de->bitflags &= (zip_uint16_t)~ZIP_GPBF_ENCODING_UTF_8; + if (name_enc == ZIP_ENCODING_UTF8_KNOWN) { + ef = _zip_ef_utf8(ZIP_EF_UTF_8_NAME, de->filename, &za->error); + if (ef == NULL) + return -1; + } + if ((flags & ZIP_FL_LOCAL) == 0 && com_enc == ZIP_ENCODING_UTF8_KNOWN) { + zip_extra_field_t *ef2 = _zip_ef_utf8(ZIP_EF_UTF_8_COMMENT, de->comment, &za->error); + if (ef2 == NULL) { + _zip_ef_free(ef); + return -1; + } + ef2->next = ef; + ef = ef2; + } + } + + if (de->encryption_method == ZIP_EM_NONE) { + de->bitflags &= (zip_uint16_t)~ZIP_GPBF_ENCRYPTED; + } + else { + de->bitflags |= (zip_uint16_t)ZIP_GPBF_ENCRYPTED; + } + + is_really_zip64 = _zip_dirent_needs_zip64(de, flags); + is_zip64 = (flags & (ZIP_FL_LOCAL | ZIP_FL_FORCE_ZIP64)) == (ZIP_FL_LOCAL | ZIP_FL_FORCE_ZIP64) || is_really_zip64; + is_winzip_aes = de->encryption_method == ZIP_EM_AES_128 || de->encryption_method == ZIP_EM_AES_192 || de->encryption_method == ZIP_EM_AES_256; + + if (is_zip64) { + zip_uint8_t ef_zip64[EFZIP64SIZE]; + zip_buffer_t *ef_buffer = _zip_buffer_new(ef_zip64, sizeof(ef_zip64)); + if (ef_buffer == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + _zip_ef_free(ef); + return -1; + } + + if (flags & ZIP_FL_LOCAL) { + if ((flags & ZIP_FL_FORCE_ZIP64) || de->comp_size > ZIP_UINT32_MAX || de->uncomp_size > ZIP_UINT32_MAX) { + _zip_buffer_put_64(ef_buffer, de->uncomp_size); + _zip_buffer_put_64(ef_buffer, de->comp_size); + } + } + else { + if ((flags & ZIP_FL_FORCE_ZIP64) || de->comp_size > ZIP_UINT32_MAX || de->uncomp_size > ZIP_UINT32_MAX || de->offset > ZIP_UINT32_MAX) { + if (de->uncomp_size >= ZIP_UINT32_MAX) { + _zip_buffer_put_64(ef_buffer, de->uncomp_size); + } + if (de->comp_size >= ZIP_UINT32_MAX) { + _zip_buffer_put_64(ef_buffer, de->comp_size); + } + if (de->offset >= ZIP_UINT32_MAX) { + _zip_buffer_put_64(ef_buffer, de->offset); + } + } + } + + if (!_zip_buffer_ok(ef_buffer)) { + zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + _zip_buffer_free(ef_buffer); + _zip_ef_free(ef); + return -1; + } + + ef64 = _zip_ef_new(ZIP_EF_ZIP64, (zip_uint16_t)(_zip_buffer_offset(ef_buffer)), ef_zip64, ZIP_EF_BOTH); + _zip_buffer_free(ef_buffer); + ef64->next = ef; + ef = ef64; + } + + if (is_winzip_aes) { + zip_uint8_t data[EF_WINZIP_AES_SIZE]; + zip_buffer_t *ef_buffer = _zip_buffer_new(data, sizeof(data)); + zip_extra_field_t *ef_winzip; + + if (ef_buffer == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + _zip_ef_free(ef); + return -1; + } + + _zip_buffer_put_16(ef_buffer, 2); + _zip_buffer_put(ef_buffer, "AE", 2); + _zip_buffer_put_8(ef_buffer, (zip_uint8_t)(de->encryption_method & 0xff)); + _zip_buffer_put_16(ef_buffer, (zip_uint16_t)de->comp_method); + + if (!_zip_buffer_ok(ef_buffer)) { + zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + _zip_buffer_free(ef_buffer); + _zip_ef_free(ef); + return -1; + } + + ef_winzip = _zip_ef_new(ZIP_EF_WINZIP_AES, EF_WINZIP_AES_SIZE, data, ZIP_EF_BOTH); + _zip_buffer_free(ef_buffer); + ef_winzip->next = ef; + ef = ef_winzip; + } + + if ((buffer = _zip_buffer_new(buf, sizeof(buf))) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + _zip_ef_free(ef); + return -1; + } + + _zip_buffer_put(buffer, (flags & ZIP_FL_LOCAL) ? LOCAL_MAGIC : CENTRAL_MAGIC, 4); + + if ((flags & ZIP_FL_LOCAL) == 0) { + _zip_buffer_put_16(buffer, de->version_madeby); + } + _zip_buffer_put_16(buffer, ZIP_MAX(is_really_zip64 ? 45 : 0, de->version_needed)); + _zip_buffer_put_16(buffer, de->bitflags); + if (is_winzip_aes) { + _zip_buffer_put_16(buffer, ZIP_CM_WINZIP_AES); + } + else { + _zip_buffer_put_16(buffer, (zip_uint16_t)de->comp_method); + } + + _zip_u2d_time(de->last_mod, &dostime, &dosdate); + _zip_buffer_put_16(buffer, dostime); + _zip_buffer_put_16(buffer, dosdate); + + if (is_winzip_aes && de->uncomp_size < 20) { + _zip_buffer_put_32(buffer, 0); + } + else { + _zip_buffer_put_32(buffer, de->crc); + } + + if (((flags & ZIP_FL_LOCAL) == ZIP_FL_LOCAL) && ((de->comp_size >= ZIP_UINT32_MAX) || (de->uncomp_size >= ZIP_UINT32_MAX))) { + /* In local headers, if a ZIP64 EF is written, it MUST contain + * both compressed and uncompressed sizes (even if one of the + * two is smaller than 0xFFFFFFFF); on the other hand, those + * may only appear when the corresponding standard entry is + * 0xFFFFFFFF. (appnote.txt 4.5.3) */ + _zip_buffer_put_32(buffer, ZIP_UINT32_MAX); + _zip_buffer_put_32(buffer, ZIP_UINT32_MAX); + } + else { + if (de->comp_size < ZIP_UINT32_MAX) { + _zip_buffer_put_32(buffer, (zip_uint32_t)de->comp_size); + } + else { + _zip_buffer_put_32(buffer, ZIP_UINT32_MAX); + } + if (de->uncomp_size < ZIP_UINT32_MAX) { + _zip_buffer_put_32(buffer, (zip_uint32_t)de->uncomp_size); + } + else { + _zip_buffer_put_32(buffer, ZIP_UINT32_MAX); + } + } + + _zip_buffer_put_16(buffer, _zip_string_length(de->filename)); + /* TODO: check for overflow */ + ef_total_size = (zip_uint32_t)_zip_ef_size(de->extra_fields, flags) + (zip_uint32_t)_zip_ef_size(ef, ZIP_EF_BOTH); + _zip_buffer_put_16(buffer, (zip_uint16_t)ef_total_size); + + if ((flags & ZIP_FL_LOCAL) == 0) { + _zip_buffer_put_16(buffer, _zip_string_length(de->comment)); + _zip_buffer_put_16(buffer, (zip_uint16_t)de->disk_number); + _zip_buffer_put_16(buffer, de->int_attrib); + _zip_buffer_put_32(buffer, de->ext_attrib); + if (de->offset < ZIP_UINT32_MAX) + _zip_buffer_put_32(buffer, (zip_uint32_t)de->offset); + else + _zip_buffer_put_32(buffer, ZIP_UINT32_MAX); + } + + if (!_zip_buffer_ok(buffer)) { + zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + _zip_buffer_free(buffer); + _zip_ef_free(ef); + return -1; + } + + if (_zip_write(za, buf, _zip_buffer_offset(buffer)) < 0) { + _zip_buffer_free(buffer); + _zip_ef_free(ef); + return -1; + } + + _zip_buffer_free(buffer); + + if (de->filename) { + if (_zip_string_write(za, de->filename) < 0) { + _zip_ef_free(ef); + return -1; + } + } + + if (ef) { + if (_zip_ef_write(za, ef, ZIP_EF_BOTH) < 0) { + _zip_ef_free(ef); + return -1; + } + } + _zip_ef_free(ef); + if (de->extra_fields) { + if (_zip_ef_write(za, de->extra_fields, flags) < 0) { + return -1; + } + } + + if ((flags & ZIP_FL_LOCAL) == 0) { + if (de->comment) { + if (_zip_string_write(za, de->comment) < 0) { + return -1; + } + } + } + + + return is_zip64; +} + + +time_t +_zip_d2u_time(zip_uint16_t dtime, zip_uint16_t ddate) { + struct tm tm; + + memset(&tm, 0, sizeof(tm)); + + /* let mktime decide if DST is in effect */ + tm.tm_isdst = -1; + + tm.tm_year = ((ddate >> 9) & 127) + 1980 - 1900; + tm.tm_mon = ((ddate >> 5) & 15) - 1; + tm.tm_mday = ddate & 31; + + tm.tm_hour = (dtime >> 11) & 31; + tm.tm_min = (dtime >> 5) & 63; + tm.tm_sec = (dtime << 1) & 62; + + return mktime(&tm); +} + + +static zip_extra_field_t * +_zip_ef_utf8(zip_uint16_t id, zip_string_t *str, zip_error_t *error) { + const zip_uint8_t *raw; + zip_uint32_t len; + zip_buffer_t *buffer; + zip_extra_field_t *ef; + + if ((raw = _zip_string_get(str, &len, ZIP_FL_ENC_RAW, NULL)) == NULL) { + /* error already set */ + return NULL; + } + + if (len + 5 > ZIP_UINT16_MAX) { + zip_error_set(error, ZIP_ER_INVAL, 0); /* TODO: better error code? */ + return NULL; + } + + if ((buffer = _zip_buffer_new(NULL, len + 5)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + _zip_buffer_put_8(buffer, 1); + _zip_buffer_put_32(buffer, _zip_string_crc32(str)); + _zip_buffer_put(buffer, raw, len); + + if (!_zip_buffer_ok(buffer)) { + zip_error_set(error, ZIP_ER_INTERNAL, 0); + _zip_buffer_free(buffer); + return NULL; + } + + ef = _zip_ef_new(id, (zip_uint16_t)(_zip_buffer_offset(buffer)), _zip_buffer_data(buffer), ZIP_EF_BOTH); + _zip_buffer_free(buffer); + + return ef; +} + + +zip_dirent_t * +_zip_get_dirent(zip_t *za, zip_uint64_t idx, zip_flags_t flags, zip_error_t *error) { + if (error == NULL) + error = &za->error; + + if (idx >= za->nentry) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((flags & ZIP_FL_UNCHANGED) || za->entry[idx].changes == NULL) { + if (za->entry[idx].orig == NULL) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + if (za->entry[idx].deleted && (flags & ZIP_FL_UNCHANGED) == 0) { + zip_error_set(error, ZIP_ER_DELETED, 0); + return NULL; + } + return za->entry[idx].orig; + } + else + return za->entry[idx].changes; +} + + +void +_zip_u2d_time(time_t intime, zip_uint16_t *dtime, zip_uint16_t *ddate) { + struct tm *tpm; + +#ifdef HAVE_LOCALTIME_R + struct tm tm; + tpm = localtime_r(&intime, &tm); +#else + tpm = localtime(&intime); +#endif + if (tpm == NULL) { + /* if localtime() fails, return an arbitrary date (1980-01-01 00:00:00) */ + *ddate = (1 << 5) + 1; + *dtime = 0; + return; + } + if (tpm->tm_year < 80) { + tpm->tm_year = 80; + } + + *ddate = (zip_uint16_t)(((tpm->tm_year + 1900 - 1980) << 9) + ((tpm->tm_mon + 1) << 5) + tpm->tm_mday); + *dtime = (zip_uint16_t)(((tpm->tm_hour) << 11) + ((tpm->tm_min) << 5) + ((tpm->tm_sec) >> 1)); + + return; +} + + +void +_zip_dirent_apply_attributes(zip_dirent_t *de, zip_file_attributes_t *attributes, bool force_zip64, zip_uint32_t changed) { + zip_uint16_t length; + + if (attributes->valid & ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS) { + zip_uint16_t mask = attributes->general_purpose_bit_mask & ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS_ALLOWED_MASK; + de->bitflags = (de->bitflags & ~mask) | (attributes->general_purpose_bit_flags & mask); + } + if (attributes->valid & ZIP_FILE_ATTRIBUTES_ASCII) { + de->int_attrib = (de->int_attrib & ~0x1) | (attributes->ascii ? 1 : 0); + } + /* manually set attributes are preferred over attributes provided by source */ + if ((changed & ZIP_DIRENT_ATTRIBUTES) == 0 && (attributes->valid & ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES)) { + de->ext_attrib = attributes->external_file_attributes; + } + + if (de->comp_method == ZIP_CM_LZMA) { + de->version_needed = 63; + } + else if (de->encryption_method == ZIP_EM_AES_128 || de->encryption_method == ZIP_EM_AES_192 || de->encryption_method == ZIP_EM_AES_256) { + de->version_needed = 51; + } + else if (de->comp_method == ZIP_CM_BZIP2) { + de->version_needed = 46; + } + else if (force_zip64 || _zip_dirent_needs_zip64(de, 0)) { + de->version_needed = 45; + } + else if (de->comp_method == ZIP_CM_DEFLATE || de->encryption_method == ZIP_EM_TRAD_PKWARE) { + de->version_needed = 20; + } + else if ((length = _zip_string_length(de->filename)) > 0 && de->filename->raw[length - 1] == '/') { + de->version_needed = 20; + } + else { + de->version_needed = 10; + } + + if (attributes->valid & ZIP_FILE_ATTRIBUTES_VERSION_NEEDED) { + de->version_needed = ZIP_MAX(de->version_needed, attributes->version_needed); + } + + de->version_madeby = 63 | (de->version_madeby & 0xff00); + if ((changed & ZIP_DIRENT_ATTRIBUTES) == 0 && (attributes->valid & ZIP_FILE_ATTRIBUTES_HOST_SYSTEM)) { + de->version_madeby = (de->version_madeby & 0xff) | (zip_uint16_t)(attributes->host_system << 8); + } +} diff --git a/core/deps/libzip/zip_free.c b/core/deps/libzip/lib/zip_discard.c similarity index 70% rename from core/deps/libzip/zip_free.c rename to core/deps/libzip/lib/zip_discard.c index 76c3a9673..a29a2884b 100644 --- a/core/deps/libzip/zip_free.c +++ b/core/deps/libzip/lib/zip_discard.c @@ -1,6 +1,6 @@ /* - zip_free.c -- free struct zip - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + zip_discard.c -- discard and free struct zip + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,50 +31,49 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include #include "zipint.h" - -/* _zip_free: +/* zip_discard: frees the space allocated to a zipfile struct, and closes the corresponding file. */ void -_zip_free(struct zip *za) -{ - int i; +zip_discard(zip_t *za) { + zip_uint64_t i; if (za == NULL) - return; + return; - if (za->zn) - free(za->zn); + if (za->src) { + zip_source_close(za->src); + zip_source_free(za->src); + } - if (za->zp) - fclose(za->zp); + free(za->default_password); + _zip_string_free(za->comment_orig); + _zip_string_free(za->comment_changes); - _zip_cdir_free(za->cdir); + _zip_hash_free(za->names); if (za->entry) { - for (i=0; inentry; i++) { - _zip_entry_free(za->entry+i); - } - free(za->entry); + for (i = 0; i < za->nentry; i++) + _zip_entry_finalize(za->entry + i); + free(za->entry); } - for (i=0; infile; i++) { - if (za->file[i]->error.zip_err == ZIP_ER_OK) { - _zip_error_set(&za->file[i]->error, ZIP_ER_ZIPCLOSED, 0); - za->file[i]->za = NULL; - } + for (i = 0; i < za->nopen_source; i++) { + _zip_source_invalidate(za->open_source[i]); } + free(za->open_source); + + _zip_progress_free(za->progress); + + zip_error_fini(&za->error); - free(za->file); - free(za); return; diff --git a/core/deps/libzip/zip_stat_init.c b/core/deps/libzip/lib/zip_entry.c similarity index 80% rename from core/deps/libzip/zip_stat_init.c rename to core/deps/libzip/lib/zip_entry.c index 133ad304a..837b59c13 100644 --- a/core/deps/libzip/zip_stat_init.c +++ b/core/deps/libzip/lib/zip_entry.c @@ -1,6 +1,6 @@ /* - zip_stat_init.c -- initialize struct zip_stat. - Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner + zip_entry.c -- struct zip_entry helper functions + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,21 +31,21 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include "zipint.h" - - -ZIP_EXTERN void -zip_stat_init(struct zip_stat *st) -{ - st->name = NULL; - st->index = -1; - st->crc = 0; - st->mtime = (time_t)-1; - st->size = -1; - st->comp_size = -1; - st->comp_method = ZIP_CM_STORE; - st->encryption_method = ZIP_EM_NONE; +void +_zip_entry_finalize(zip_entry_t *e) { + _zip_unchange_data(e); + _zip_dirent_free(e->orig); + _zip_dirent_free(e->changes); +} + + +void +_zip_entry_init(zip_entry_t *e) { + e->orig = NULL; + e->changes = NULL; + e->source = NULL; + e->deleted = 0; } diff --git a/core/deps/libzip/lib/zip_err_str.c b/core/deps/libzip/lib/zip_err_str.c new file mode 100644 index 000000000..de141ffe7 --- /dev/null +++ b/core/deps/libzip/lib/zip_err_str.c @@ -0,0 +1,84 @@ +/* + This file was generated automatically by CMake + from zip.h; make changes there. +*/ + +#include "zipint.h" + +const char * const _zip_err_str[] = { + "No error", + "Multi-disk zip archives not supported", + "Renaming temporary file failed", + "Closing zip archive failed", + "Seek error", + "Read error", + "Write error", + "CRC error", + "Containing zip archive was closed", + "No such file", + "File already exists", + "Can't open file", + "Failure to create temporary file", + "Zlib error", + "Malloc failure", + "Entry has been changed", + "Compression method not supported", + "Premature end of file", + "Invalid argument", + "Not a zip archive", + "Internal error", + "Zip archive inconsistent", + "Can't remove file", + "Entry has been deleted", + "Encryption method not supported", + "Read-only archive", + "No password provided", + "Wrong password provided", + "Operation not supported", + "Resource still in use", + "Tell error", + "Compressed data invalid", + "Operation cancelled", +}; + +const int _zip_nerr_str = sizeof(_zip_err_str)/sizeof(_zip_err_str[0]); + +#define N ZIP_ET_NONE +#define S ZIP_ET_SYS +#define Z ZIP_ET_ZLIB + +const int _zip_err_type[] = { + N, + N, + S, + S, + S, + S, + S, + N, + N, + N, + N, + S, + S, + Z, + N, + N, + N, + N, + N, + N, + N, + N, + S, + N, + N, + N, + N, + N, + N, + N, + S, + N, + N, +}; diff --git a/core/deps/libzip/lib/zip_error.c b/core/deps/libzip/lib/zip_error.c new file mode 100644 index 000000000..9381d5bf8 --- /dev/null +++ b/core/deps/libzip/lib/zip_error.c @@ -0,0 +1,150 @@ +/* + zip_error.c -- zip_error_t helper functions + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include "zipint.h" + + +ZIP_EXTERN int +zip_error_code_system(const zip_error_t *error) { + return error->sys_err; +} + + +ZIP_EXTERN int +zip_error_code_zip(const zip_error_t *error) { + return error->zip_err; +} + + +ZIP_EXTERN void +zip_error_fini(zip_error_t *err) { + free(err->str); + err->str = NULL; +} + + +ZIP_EXTERN void +zip_error_init(zip_error_t *err) { + err->zip_err = ZIP_ER_OK; + err->sys_err = 0; + err->str = NULL; +} + +ZIP_EXTERN void +zip_error_init_with_code(zip_error_t *error, int ze) { + zip_error_init(error); + error->zip_err = ze; + switch (zip_error_system_type(error)) { + case ZIP_ET_SYS: + error->sys_err = errno; + break; + + default: + error->sys_err = 0; + break; + } +} + + +ZIP_EXTERN int +zip_error_system_type(const zip_error_t *error) { + if (error->zip_err < 0 || error->zip_err >= _zip_nerr_str) + return ZIP_ET_NONE; + + return _zip_err_type[error->zip_err]; +} + + +void +_zip_error_clear(zip_error_t *err) { + if (err == NULL) + return; + + err->zip_err = ZIP_ER_OK; + err->sys_err = 0; +} + + +void +_zip_error_copy(zip_error_t *dst, const zip_error_t *src) { + if (dst == NULL) { + return; + } + + dst->zip_err = src->zip_err; + dst->sys_err = src->sys_err; +} + + +void +_zip_error_get(const zip_error_t *err, int *zep, int *sep) { + if (zep) + *zep = err->zip_err; + if (sep) { + if (zip_error_system_type(err) != ZIP_ET_NONE) + *sep = err->sys_err; + else + *sep = 0; + } +} + + +void +zip_error_set(zip_error_t *err, int ze, int se) { + if (err) { + err->zip_err = ze; + err->sys_err = se; + } +} + + +void +_zip_error_set_from_source(zip_error_t *err, zip_source_t *src) { + _zip_error_copy(err, zip_source_error(src)); +} + + +zip_int64_t +zip_error_to_data(const zip_error_t *error, void *data, zip_uint64_t length) { + int *e = (int *)data; + + if (length < sizeof(int) * 2) { + return -1; + } + + e[0] = zip_error_code_zip(error); + e[1] = zip_error_code_system(error); + return sizeof(int) * 2; +} diff --git a/core/deps/libzip/zip_error_clear.c b/core/deps/libzip/lib/zip_error_clear.c similarity index 92% rename from core/deps/libzip/zip_error_clear.c rename to core/deps/libzip/lib/zip_error_clear.c index 364383ebe..9bcd506ec 100644 --- a/core/deps/libzip/zip_error_clear.c +++ b/core/deps/libzip/lib/zip_error_clear.c @@ -1,6 +1,6 @@ /* zip_error_clear.c -- clear zip error - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,14 +31,14 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include "zipint.h" - ZIP_EXTERN void -zip_error_clear(struct zip *za) -{ +zip_error_clear(zip_t *za) { + if (za == NULL) + return; + _zip_error_clear(&za->error); } diff --git a/core/deps/libzip/zip_error_get.c b/core/deps/libzip/lib/zip_error_get.c similarity index 84% rename from core/deps/libzip/zip_error_get.c rename to core/deps/libzip/lib/zip_error_get.c index 6d1c958c1..9d0ec03ff 100644 --- a/core/deps/libzip/zip_error_get.c +++ b/core/deps/libzip/lib/zip_error_get.c @@ -1,6 +1,6 @@ /* zip_error_get.c -- get zip error - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,14 +31,24 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" - ZIP_EXTERN void -zip_error_get(struct zip *za, int *zep, int *sep) -{ +zip_error_get(zip_t *za, int *zep, int *sep) { _zip_error_get(&za->error, zep, sep); } + + +ZIP_EXTERN zip_error_t * +zip_get_error(zip_t *za) { + return &za->error; +} + + +ZIP_EXTERN zip_error_t * +zip_file_get_error(zip_file_t *f) { + return &f->error; +} diff --git a/core/deps/libzip/zip_error_get_sys_type.c b/core/deps/libzip/lib/zip_error_get_sys_type.c similarity index 92% rename from core/deps/libzip/zip_error_get_sys_type.c rename to core/deps/libzip/lib/zip_error_get_sys_type.c index 6c6f38074..3c9998c57 100644 --- a/core/deps/libzip/zip_error_get_sys_type.c +++ b/core/deps/libzip/lib/zip_error_get_sys_type.c @@ -1,6 +1,6 @@ /* zip_error_get_sys_type.c -- return type of system error code - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,17 +31,14 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" - ZIP_EXTERN int -zip_error_get_sys_type(int ze) -{ +zip_error_get_sys_type(int ze) { if (ze < 0 || ze >= _zip_nerr_str) - return 0; + return 0; return _zip_err_type[ze]; } diff --git a/core/deps/libzip/zip_error_strerror.c b/core/deps/libzip/lib/zip_error_strerror.c similarity index 69% rename from core/deps/libzip/zip_error_strerror.c rename to core/deps/libzip/lib/zip_error_strerror.c index 3d0951cfb..d20b3b2fa 100644 --- a/core/deps/libzip/zip_error_strerror.c +++ b/core/deps/libzip/lib/zip_error_strerror.c @@ -1,6 +1,6 @@ /* zip_error_sterror.c -- get string representation of struct zip_error - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,60 +31,53 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -#include #include #include #include +#include #include "zipint.h" - -const char * -_zip_error_strerror(struct zip_error *err) -{ +ZIP_EXTERN const char * +zip_error_strerror(zip_error_t *err) { const char *zs, *ss; char buf[128], *s; - _zip_error_fini(err); + zip_error_fini(err); if (err->zip_err < 0 || err->zip_err >= _zip_nerr_str) { - sprintf(buf, "Unknown error %d", err->zip_err); - zs = NULL; - ss = buf; + sprintf(buf, "Unknown error %d", err->zip_err); + zs = NULL; + ss = buf; } else { - zs = _zip_err_str[err->zip_err]; - - switch (_zip_err_type[err->zip_err]) { - case ZIP_ET_SYS: - ss = strerror(err->sys_err); - break; + zs = _zip_err_str[err->zip_err]; - case ZIP_ET_ZLIB: - ss = zError(err->sys_err); - break; + switch (_zip_err_type[err->zip_err]) { + case ZIP_ET_SYS: + ss = strerror(err->sys_err); + break; - default: - ss = NULL; - } + case ZIP_ET_ZLIB: + ss = zError(err->sys_err); + break; + + default: + ss = NULL; + } } if (ss == NULL) - return zs; + return zs; else { - if ((s=(char *)malloc(strlen(ss) - + (zs ? strlen(zs)+2 : 0) + 1)) == NULL) - return _zip_err_str[ZIP_ER_MEMORY]; - - sprintf(s, "%s%s%s", - (zs ? zs : ""), - (zs ? ": " : ""), - ss); - err->str = s; + if ((s = (char *)malloc(strlen(ss) + (zs ? strlen(zs) + 2 : 0) + 1)) == NULL) + return _zip_err_str[ZIP_ER_MEMORY]; - return s; + sprintf(s, "%s%s%s", (zs ? zs : ""), (zs ? ": " : ""), ss); + err->str = s; + + return s; } } diff --git a/core/deps/libzip/zip_error_to_str.c b/core/deps/libzip/lib/zip_error_to_str.c similarity index 81% rename from core/deps/libzip/zip_error_to_str.c rename to core/deps/libzip/lib/zip_error_to_str.c index bdba41a6c..d315b1901 100644 --- a/core/deps/libzip/zip_error_to_str.c +++ b/core/deps/libzip/lib/zip_error_to_str.c @@ -1,6 +1,6 @@ /* zip_error_to_str.c -- get string representation of zip error code - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,40 +31,36 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -#include #include -#include #include +#include +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" - ZIP_EXTERN int -zip_error_to_str(char *buf, size_t len, int ze, int se) -{ +zip_error_to_str(char *buf, zip_uint64_t len, int ze, int se) { const char *zs, *ss; if (ze < 0 || ze >= _zip_nerr_str) - return snprintf(buf, len, "Unknown error %d", ze); + return snprintf(buf, len, "Unknown error %d", ze); zs = _zip_err_str[ze]; - + switch (_zip_err_type[ze]) { case ZIP_ET_SYS: - ss = strerror(se); - break; - + ss = strerror(se); + break; + case ZIP_ET_ZLIB: - ss = zError(se); - break; - + ss = zError(se); + break; + default: - ss = NULL; + ss = NULL; } - return snprintf(buf, len, "%s%s%s", - zs, (ss ? ": " : ""), (ss ? ss : "")); + return snprintf(buf, len, "%s%s%s", zs, (ss ? ": " : ""), (ss ? ss : "")); } diff --git a/core/deps/libzip/lib/zip_extra_field.c b/core/deps/libzip/lib/zip_extra_field.c new file mode 100644 index 000000000..7424d8831 --- /dev/null +++ b/core/deps/libzip/lib/zip_extra_field.c @@ -0,0 +1,426 @@ +/* + zip_extra_field.c -- manipulate extra fields + Copyright (C) 2012-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include + +#include "zipint.h" + + +zip_extra_field_t * +_zip_ef_clone(const zip_extra_field_t *ef, zip_error_t *error) { + zip_extra_field_t *head, *prev, *def; + + head = prev = NULL; + + while (ef) { + if ((def = _zip_ef_new(ef->id, ef->size, ef->data, ef->flags)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + _zip_ef_free(head); + return NULL; + } + + if (head == NULL) + head = def; + if (prev) + prev->next = def; + prev = def; + + ef = ef->next; + } + + return head; +} + + +zip_extra_field_t * +_zip_ef_delete_by_id(zip_extra_field_t *ef, zip_uint16_t id, zip_uint16_t id_idx, zip_flags_t flags) { + zip_extra_field_t *head, *prev; + int i; + + i = 0; + head = ef; + prev = NULL; + for (; ef; ef = (prev ? prev->next : head)) { + if ((ef->flags & flags & ZIP_EF_BOTH) && ((ef->id == id) || (id == ZIP_EXTRA_FIELD_ALL))) { + if (id_idx == ZIP_EXTRA_FIELD_ALL || i == id_idx) { + ef->flags &= ~(flags & ZIP_EF_BOTH); + if ((ef->flags & ZIP_EF_BOTH) == 0) { + if (prev) + prev->next = ef->next; + else + head = ef->next; + ef->next = NULL; + _zip_ef_free(ef); + + if (id_idx == ZIP_EXTRA_FIELD_ALL) + continue; + } + } + + i++; + if (i > id_idx) + break; + } + prev = ef; + } + + return head; +} + + +void +_zip_ef_free(zip_extra_field_t *ef) { + zip_extra_field_t *ef2; + + while (ef) { + ef2 = ef->next; + free(ef->data); + free(ef); + ef = ef2; + } +} + + +const zip_uint8_t * +_zip_ef_get_by_id(const zip_extra_field_t *ef, zip_uint16_t *lenp, zip_uint16_t id, zip_uint16_t id_idx, zip_flags_t flags, zip_error_t *error) { + static const zip_uint8_t empty[1] = {'\0'}; + + int i; + + i = 0; + for (; ef; ef = ef->next) { + if (ef->id == id && (ef->flags & flags & ZIP_EF_BOTH)) { + if (i < id_idx) { + i++; + continue; + } + + if (lenp) + *lenp = ef->size; + if (ef->size > 0) + return ef->data; + else + return empty; + } + } + + zip_error_set(error, ZIP_ER_NOENT, 0); + return NULL; +} + + +zip_extra_field_t * +_zip_ef_merge(zip_extra_field_t *to, zip_extra_field_t *from) { + zip_extra_field_t *ef2, *tt, *tail; + int duplicate; + + if (to == NULL) + return from; + + for (tail = to; tail->next; tail = tail->next) + ; + + for (; from; from = ef2) { + ef2 = from->next; + + duplicate = 0; + for (tt = to; tt; tt = tt->next) { + if (tt->id == from->id && tt->size == from->size && (tt->size == 0 || memcmp(tt->data, from->data, tt->size) == 0)) { + tt->flags |= (from->flags & ZIP_EF_BOTH); + duplicate = 1; + break; + } + } + + from->next = NULL; + if (duplicate) + _zip_ef_free(from); + else + tail = tail->next = from; + } + + return to; +} + + +zip_extra_field_t * +_zip_ef_new(zip_uint16_t id, zip_uint16_t size, const zip_uint8_t *data, zip_flags_t flags) { + zip_extra_field_t *ef; + + if ((ef = (zip_extra_field_t *)malloc(sizeof(*ef))) == NULL) + return NULL; + + ef->next = NULL; + ef->flags = flags; + ef->id = id; + ef->size = size; + if (size > 0) { + if ((ef->data = (zip_uint8_t *)_zip_memdup(data, size, NULL)) == NULL) { + free(ef); + return NULL; + } + } + else + ef->data = NULL; + + return ef; +} + + +bool +_zip_ef_parse(const zip_uint8_t *data, zip_uint16_t len, zip_flags_t flags, zip_extra_field_t **ef_head_p, zip_error_t *error) { + zip_buffer_t *buffer; + zip_extra_field_t *ef, *ef2, *ef_head; + + if ((buffer = _zip_buffer_new((zip_uint8_t *)data, len)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return false; + } + + ef_head = ef = NULL; + + while (_zip_buffer_ok(buffer) && _zip_buffer_left(buffer) >= 4) { + zip_uint16_t fid, flen; + zip_uint8_t *ef_data; + + fid = _zip_buffer_get_16(buffer); + flen = _zip_buffer_get_16(buffer); + ef_data = _zip_buffer_get(buffer, flen); + + if (ef_data == NULL) { + zip_error_set(error, ZIP_ER_INCONS, 0); + _zip_buffer_free(buffer); + _zip_ef_free(ef_head); + return false; + } + + if ((ef2 = _zip_ef_new(fid, flen, ef_data, flags)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + _zip_buffer_free(buffer); + _zip_ef_free(ef_head); + return false; + } + + if (ef_head) { + ef->next = ef2; + ef = ef2; + } + else + ef_head = ef = ef2; + } + + if (!_zip_buffer_eof(buffer)) { + /* Android APK files align stored file data with padding in extra fields; ignore. */ + /* see https://android.googlesource.com/platform/build/+/master/tools/zipalign/ZipAlign.cpp */ + size_t glen = _zip_buffer_left(buffer); + zip_uint8_t *garbage; + garbage = _zip_buffer_get(buffer, glen); + if (glen >= 4 || garbage == NULL || memcmp(garbage, "\0\0\0", glen) != 0) { + zip_error_set(error, ZIP_ER_INCONS, 0); + _zip_buffer_free(buffer); + _zip_ef_free(ef_head); + return false; + } + } + + _zip_buffer_free(buffer); + + if (ef_head_p) { + *ef_head_p = ef_head; + } + else { + _zip_ef_free(ef_head); + } + + return true; +} + + +zip_extra_field_t * +_zip_ef_remove_internal(zip_extra_field_t *ef) { + zip_extra_field_t *ef_head; + zip_extra_field_t *prev, *next; + + ef_head = ef; + prev = NULL; + + while (ef) { + if (ZIP_EF_IS_INTERNAL(ef->id)) { + next = ef->next; + if (ef_head == ef) + ef_head = next; + ef->next = NULL; + _zip_ef_free(ef); + if (prev) + prev->next = next; + ef = next; + } + else { + prev = ef; + ef = ef->next; + } + } + + return ef_head; +} + + +zip_uint16_t +_zip_ef_size(const zip_extra_field_t *ef, zip_flags_t flags) { + zip_uint16_t size; + + size = 0; + for (; ef; ef = ef->next) { + if (ef->flags & flags & ZIP_EF_BOTH) + size = (zip_uint16_t)(size + 4 + ef->size); + } + + return size; +} + + +int +_zip_ef_write(zip_t *za, const zip_extra_field_t *ef, zip_flags_t flags) { + zip_uint8_t b[4]; + zip_buffer_t *buffer = _zip_buffer_new(b, sizeof(b)); + + if (buffer == NULL) { + return -1; + } + + for (; ef; ef = ef->next) { + if (ef->flags & flags & ZIP_EF_BOTH) { + _zip_buffer_set_offset(buffer, 0); + _zip_buffer_put_16(buffer, ef->id); + _zip_buffer_put_16(buffer, ef->size); + if (!_zip_buffer_ok(buffer)) { + zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + _zip_buffer_free(buffer); + return -1; + } + if (_zip_write(za, b, 4) < 0) { + _zip_buffer_free(buffer); + return -1; + } + if (ef->size > 0) { + if (_zip_write(za, ef->data, ef->size) < 0) { + _zip_buffer_free(buffer); + return -1; + } + } + } + } + + _zip_buffer_free(buffer); + return 0; +} + + +int +_zip_read_local_ef(zip_t *za, zip_uint64_t idx) { + zip_entry_t *e; + unsigned char b[4]; + zip_buffer_t *buffer; + zip_uint16_t fname_len, ef_len; + + if (idx >= za->nentry) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + e = za->entry + idx; + + if (e->orig == NULL || e->orig->local_extra_fields_read) + return 0; + + if (e->orig->offset + 26 > ZIP_INT64_MAX) { + zip_error_set(&za->error, ZIP_ER_SEEK, EFBIG); + return -1; + } + + if (zip_source_seek(za->src, (zip_int64_t)(e->orig->offset + 26), SEEK_SET) < 0) { + _zip_error_set_from_source(&za->error, za->src); + return -1; + } + + if ((buffer = _zip_buffer_new_from_source(za->src, sizeof(b), b, &za->error)) == NULL) { + return -1; + } + + fname_len = _zip_buffer_get_16(buffer); + ef_len = _zip_buffer_get_16(buffer); + + if (!_zip_buffer_eof(buffer)) { + _zip_buffer_free(buffer); + zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + return -1; + } + + _zip_buffer_free(buffer); + + if (ef_len > 0) { + zip_extra_field_t *ef; + zip_uint8_t *ef_raw; + + if (zip_source_seek(za->src, fname_len, SEEK_CUR) < 0) { + zip_error_set(&za->error, ZIP_ER_SEEK, errno); + return -1; + } + + ef_raw = _zip_read_data(NULL, za->src, ef_len, 0, &za->error); + + if (ef_raw == NULL) + return -1; + + if (!_zip_ef_parse(ef_raw, ef_len, ZIP_EF_LOCAL, &ef, &za->error)) { + free(ef_raw); + return -1; + } + free(ef_raw); + + if (ef) { + ef = _zip_ef_remove_internal(ef); + e->orig->extra_fields = _zip_ef_merge(e->orig->extra_fields, ef); + } + } + + e->orig->local_extra_fields_read = 1; + + if (e->changes && e->changes->local_extra_fields_read == 0) { + e->changes->extra_fields = e->orig->extra_fields; + e->changes->local_extra_fields_read = 1; + } + + return 0; +} diff --git a/core/deps/libzip/lib/zip_extra_field_api.c b/core/deps/libzip/lib/zip_extra_field_api.c new file mode 100644 index 000000000..cf2b0e7f1 --- /dev/null +++ b/core/deps/libzip/lib/zip_extra_field_api.c @@ -0,0 +1,355 @@ +/* + zip_extra_field_api.c -- public extra fields API functions + Copyright (C) 2012-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +ZIP_EXTERN int +zip_file_extra_field_delete(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_idx, zip_flags_t flags) { + zip_dirent_t *de; + + if ((flags & ZIP_EF_BOTH) == 0) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (((flags & ZIP_EF_BOTH) == ZIP_EF_BOTH) && (ef_idx != ZIP_EXTRA_FIELD_ALL)) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (_zip_get_dirent(za, idx, 0, NULL) == NULL) + return -1; + + if (ZIP_IS_RDONLY(za)) { + zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (_zip_file_extra_field_prepare_for_change(za, idx) < 0) + return -1; + + de = za->entry[idx].changes; + + de->extra_fields = _zip_ef_delete_by_id(de->extra_fields, ZIP_EXTRA_FIELD_ALL, ef_idx, flags); + return 0; +} + + +ZIP_EXTERN int +zip_file_extra_field_delete_by_id(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_uint16_t ef_idx, zip_flags_t flags) { + zip_dirent_t *de; + + if ((flags & ZIP_EF_BOTH) == 0) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (((flags & ZIP_EF_BOTH) == ZIP_EF_BOTH) && (ef_idx != ZIP_EXTRA_FIELD_ALL)) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (_zip_get_dirent(za, idx, 0, NULL) == NULL) + return -1; + + if (ZIP_IS_RDONLY(za)) { + zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (_zip_file_extra_field_prepare_for_change(za, idx) < 0) + return -1; + + de = za->entry[idx].changes; + + de->extra_fields = _zip_ef_delete_by_id(de->extra_fields, ef_id, ef_idx, flags); + return 0; +} + + +ZIP_EXTERN const zip_uint8_t * +zip_file_extra_field_get(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_idx, zip_uint16_t *idp, zip_uint16_t *lenp, zip_flags_t flags) { + static const zip_uint8_t empty[1] = {'\0'}; + + zip_dirent_t *de; + zip_extra_field_t *ef; + int i; + + if ((flags & ZIP_EF_BOTH) == 0) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((de = _zip_get_dirent(za, idx, flags, &za->error)) == NULL) + return NULL; + + if (flags & ZIP_FL_LOCAL) + if (_zip_read_local_ef(za, idx) < 0) + return NULL; + + i = 0; + for (ef = de->extra_fields; ef; ef = ef->next) { + if (ef->flags & flags & ZIP_EF_BOTH) { + if (i < ef_idx) { + i++; + continue; + } + + if (idp) + *idp = ef->id; + if (lenp) + *lenp = ef->size; + if (ef->size > 0) + return ef->data; + else + return empty; + } + } + + zip_error_set(&za->error, ZIP_ER_NOENT, 0); + return NULL; +} + + +ZIP_EXTERN const zip_uint8_t * +zip_file_extra_field_get_by_id(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_uint16_t ef_idx, zip_uint16_t *lenp, zip_flags_t flags) { + zip_dirent_t *de; + + if ((flags & ZIP_EF_BOTH) == 0) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((de = _zip_get_dirent(za, idx, flags, &za->error)) == NULL) + return NULL; + + if (flags & ZIP_FL_LOCAL) + if (_zip_read_local_ef(za, idx) < 0) + return NULL; + + return _zip_ef_get_by_id(de->extra_fields, lenp, ef_id, ef_idx, flags, &za->error); +} + + +ZIP_EXTERN zip_int16_t +zip_file_extra_fields_count(zip_t *za, zip_uint64_t idx, zip_flags_t flags) { + zip_dirent_t *de; + zip_extra_field_t *ef; + zip_uint16_t n; + + if ((flags & ZIP_EF_BOTH) == 0) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if ((de = _zip_get_dirent(za, idx, flags, &za->error)) == NULL) + return -1; + + if (flags & ZIP_FL_LOCAL) + if (_zip_read_local_ef(za, idx) < 0) + return -1; + + n = 0; + for (ef = de->extra_fields; ef; ef = ef->next) + if (ef->flags & flags & ZIP_EF_BOTH) + n++; + + return (zip_int16_t)n; +} + + +ZIP_EXTERN zip_int16_t +zip_file_extra_fields_count_by_id(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_flags_t flags) { + zip_dirent_t *de; + zip_extra_field_t *ef; + zip_uint16_t n; + + if ((flags & ZIP_EF_BOTH) == 0) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if ((de = _zip_get_dirent(za, idx, flags, &za->error)) == NULL) + return -1; + + if (flags & ZIP_FL_LOCAL) + if (_zip_read_local_ef(za, idx) < 0) + return -1; + + n = 0; + for (ef = de->extra_fields; ef; ef = ef->next) + if (ef->id == ef_id && (ef->flags & flags & ZIP_EF_BOTH)) + n++; + + return (zip_int16_t)n; +} + + +ZIP_EXTERN int +zip_file_extra_field_set(zip_t *za, zip_uint64_t idx, zip_uint16_t ef_id, zip_uint16_t ef_idx, const zip_uint8_t *data, zip_uint16_t len, zip_flags_t flags) { + zip_dirent_t *de; + zip_uint16_t ls, cs; + zip_extra_field_t *ef, *ef_prev, *ef_new; + int i, found, new_len; + + if ((flags & ZIP_EF_BOTH) == 0) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (_zip_get_dirent(za, idx, 0, NULL) == NULL) + return -1; + + if (ZIP_IS_RDONLY(za)) { + zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (ZIP_EF_IS_INTERNAL(ef_id)) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (_zip_file_extra_field_prepare_for_change(za, idx) < 0) + return -1; + + de = za->entry[idx].changes; + + ef = de->extra_fields; + ef_prev = NULL; + i = 0; + found = 0; + + for (; ef; ef = ef->next) { + if (ef->id == ef_id && (ef->flags & flags & ZIP_EF_BOTH)) { + if (i == ef_idx) { + found = 1; + break; + } + i++; + } + ef_prev = ef; + } + + if (i < ef_idx && ef_idx != ZIP_EXTRA_FIELD_NEW) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (flags & ZIP_EF_LOCAL) + ls = _zip_ef_size(de->extra_fields, ZIP_EF_LOCAL); + else + ls = 0; + if (flags & ZIP_EF_CENTRAL) + cs = _zip_ef_size(de->extra_fields, ZIP_EF_CENTRAL); + else + cs = 0; + + new_len = ls > cs ? ls : cs; + if (found) + new_len -= ef->size + 4; + new_len += len + 4; + + if (new_len > ZIP_UINT16_MAX) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if ((ef_new = _zip_ef_new(ef_id, len, data, flags)) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + + if (found) { + if ((ef->flags & ZIP_EF_BOTH) == (flags & ZIP_EF_BOTH)) { + ef_new->next = ef->next; + ef->next = NULL; + _zip_ef_free(ef); + if (ef_prev) + ef_prev->next = ef_new; + else + de->extra_fields = ef_new; + } + else { + ef->flags &= ~(flags & ZIP_EF_BOTH); + ef_new->next = ef->next; + ef->next = ef_new; + } + } + else if (ef_prev) { + ef_new->next = ef_prev->next; + ef_prev->next = ef_new; + } + else + de->extra_fields = ef_new; + + return 0; +} + + +int +_zip_file_extra_field_prepare_for_change(zip_t *za, zip_uint64_t idx) { + zip_entry_t *e; + + if (idx >= za->nentry) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + e = za->entry + idx; + + if (e->changes && (e->changes->changed & ZIP_DIRENT_EXTRA_FIELD)) + return 0; + + if (e->orig) { + if (_zip_read_local_ef(za, idx) < 0) + return -1; + } + + if (e->changes == NULL) { + if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + } + + if (e->orig && e->orig->extra_fields) { + if ((e->changes->extra_fields = _zip_ef_clone(e->orig->extra_fields, &za->error)) == NULL) + return -1; + } + e->changes->changed |= ZIP_DIRENT_EXTRA_FIELD; + + return 0; +} diff --git a/core/deps/libzip/zip_fclose.c b/core/deps/libzip/lib/zip_fclose.c similarity index 75% rename from core/deps/libzip/zip_fclose.c rename to core/deps/libzip/lib/zip_fclose.c index 8709362d6..4d6fc59ce 100644 --- a/core/deps/libzip/zip_fclose.c +++ b/core/deps/libzip/lib/zip_fclose.c @@ -1,6 +1,6 @@ /* zip_fclose.c -- close file in zip archive - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,41 +31,24 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include #include "zipint.h" - ZIP_EXTERN int -zip_fclose(struct zip_file *zf) -{ - int i, ret; - - if (zf->zstr) - inflateEnd(zf->zstr); - free(zf->buffer); - free(zf->zstr); +zip_fclose(zip_file_t *zf) { + int ret; - for (i=0; iza->nfile; i++) { - if (zf->za->file[i] == zf) { - zf->za->file[i] = zf->za->file[zf->za->nfile-1]; - zf->za->nfile--; - break; - } - } + if (zf->src) + zip_source_free(zf->src); ret = 0; if (zf->error.zip_err) - ret = zf->error.zip_err; - else if ((zf->flags & ZIP_ZF_CRC) && (zf->flags & ZIP_ZF_EOF)) { - /* if EOF, compare CRC */ - if (zf->crc_orig != zf->crc) - ret = ZIP_ER_CRC; - } + ret = zf->error.zip_err; + zip_error_fini(&zf->error); free(zf); return ret; } diff --git a/core/deps/libzip/zip_entry_new.c b/core/deps/libzip/lib/zip_fdopen.c similarity index 54% rename from core/deps/libzip/zip_entry_new.c rename to core/deps/libzip/lib/zip_fdopen.c index 7059b1b06..14f243fbb 100644 --- a/core/deps/libzip/zip_entry_new.c +++ b/core/deps/libzip/lib/zip_fdopen.c @@ -1,6 +1,6 @@ /* - zip_entry_new.c -- create and init struct zip_entry - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + zip_fdopen.c -- open read-only archive from file descriptor + Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,48 +31,56 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - -#include #include "zipint.h" +#ifdef HAVE_UNISTD_H +#include +#endif - -struct zip_entry * -_zip_entry_new(struct zip *za) -{ - struct zip_entry *ze; - if (!za) { - ze = (struct zip_entry *)malloc(sizeof(struct zip_entry)); - if (!ze) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return NULL; - } - } - else { - if (za->nentry >= za->nentry_alloc-1) { - za->nentry_alloc += 16; - za->entry = (struct zip_entry *)realloc(za->entry, - sizeof(struct zip_entry) - * za->nentry_alloc); - if (!za->entry) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return NULL; - } - } - ze = za->entry+za->nentry; +ZIP_EXTERN zip_t * +zip_fdopen(int fd_orig, int _flags, int *zep) { + int fd; + FILE *fp; + zip_t *za; + zip_source_t *src; + struct zip_error error; + + if (_flags < 0 || (_flags & ~(ZIP_CHECKCONS | ZIP_RDONLY))) { + _zip_set_open_error(zep, NULL, ZIP_ER_INVAL); + return NULL; } - ze->state = ZIP_ST_UNCHANGED; + /* We dup() here to avoid messing with the passed in fd. + We could not restore it to the original state in case of error. */ - ze->ch_filename = NULL; - ze->ch_comment = NULL; - ze->ch_comment_len = -1; - ze->source = NULL; + if ((fd = dup(fd_orig)) < 0) { + _zip_set_open_error(zep, NULL, ZIP_ER_OPEN); + return NULL; + } - if (za) - za->nentry++; + if ((fp = fdopen(fd, "rb")) == NULL) { + close(fd); + _zip_set_open_error(zep, NULL, ZIP_ER_OPEN); + return NULL; + } - return ze; + zip_error_init(&error); + if ((src = zip_source_filep_create(fp, 0, -1, &error)) == NULL) { + fclose(fp); + _zip_set_open_error(zep, &error, 0); + zip_error_fini(&error); + return NULL; + } + + if ((za = zip_open_from_source(src, _flags, &error)) == NULL) { + zip_source_free(src); + _zip_set_open_error(zep, &error, 0); + zip_error_fini(&error); + return NULL; + } + + zip_error_fini(&error); + close(fd_orig); + return za; } diff --git a/core/deps/libzip/lib/zip_file_add.c b/core/deps/libzip/lib/zip_file_add.c new file mode 100644 index 000000000..40386c095 --- /dev/null +++ b/core/deps/libzip/lib/zip_file_add.c @@ -0,0 +1,52 @@ +/* + zip_file_add.c -- add file via callback function + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + +/* + NOTE: Return type is signed so we can return -1 on error. + The index can not be larger than ZIP_INT64_MAX since the size + of the central directory cannot be larger than + ZIP_UINT64_MAX, and each entry is larger than 2 bytes. +*/ + +ZIP_EXTERN zip_int64_t +zip_file_add(zip_t *za, const char *name, zip_source_t *source, zip_flags_t flags) { + if (name == NULL || source == NULL) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + return _zip_file_replace(za, ZIP_UINT64_MAX, name, source, flags); +} diff --git a/core/deps/libzip/zip_file_error_clear.c b/core/deps/libzip/lib/zip_file_error_clear.c similarity index 92% rename from core/deps/libzip/zip_file_error_clear.c rename to core/deps/libzip/lib/zip_file_error_clear.c index ef6fa10e4..863dae762 100644 --- a/core/deps/libzip/zip_file_error_clear.c +++ b/core/deps/libzip/lib/zip_file_error_clear.c @@ -1,6 +1,6 @@ /* zip_file_error_clear.c -- clear zip file error - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,14 +31,14 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include "zipint.h" - ZIP_EXTERN void -zip_file_error_clear(struct zip_file *zf) -{ +zip_file_error_clear(zip_file_t *zf) { + if (zf == NULL) + return; + _zip_error_clear(&zf->error); } diff --git a/core/deps/libzip/zip_file_error_get.c b/core/deps/libzip/lib/zip_file_error_get.c similarity index 91% rename from core/deps/libzip/zip_file_error_get.c rename to core/deps/libzip/lib/zip_file_error_get.c index f20e011fc..a47797646 100644 --- a/core/deps/libzip/zip_file_error_get.c +++ b/core/deps/libzip/lib/zip_file_error_get.c @@ -1,6 +1,6 @@ /* zip_file_error_get.c -- get zip file error - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,14 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" - ZIP_EXTERN void -zip_file_error_get(struct zip_file *zf, int *zep, int *sep) -{ +zip_file_error_get(zip_file_t *zf, int *zep, int *sep) { _zip_error_get(&zf->error, zep, sep); } diff --git a/core/deps/libzip/lib/zip_file_get_comment.c b/core/deps/libzip/lib/zip_file_get_comment.c new file mode 100644 index 000000000..746186a71 --- /dev/null +++ b/core/deps/libzip/lib/zip_file_get_comment.c @@ -0,0 +1,55 @@ +/* + zip_file_get_comment.c -- get file comment + Copyright (C) 2006-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + +/* lenp is 32 bit because converted comment can be longer than ZIP_UINT16_MAX */ + +ZIP_EXTERN const char * +zip_file_get_comment(zip_t *za, zip_uint64_t idx, zip_uint32_t *lenp, zip_flags_t flags) { + zip_dirent_t *de; + zip_uint32_t len; + const zip_uint8_t *str; + + if ((de = _zip_get_dirent(za, idx, flags, NULL)) == NULL) + return NULL; + + if ((str = _zip_string_get(de->comment, &len, flags, &za->error)) == NULL) + return NULL; + + if (lenp) + *lenp = len; + + return (const char *)str; +} diff --git a/core/deps/libzip/lib/zip_file_get_external_attributes.c b/core/deps/libzip/lib/zip_file_get_external_attributes.c new file mode 100644 index 000000000..6d4e0e490 --- /dev/null +++ b/core/deps/libzip/lib/zip_file_get_external_attributes.c @@ -0,0 +1,50 @@ +/* + zip_file_get_external_attributes.c -- get opsys/external attributes + Copyright (C) 2013-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zipint.h" + +int +zip_file_get_external_attributes(zip_t *za, zip_uint64_t idx, zip_flags_t flags, zip_uint8_t *opsys, zip_uint32_t *attributes) { + zip_dirent_t *de; + + if ((de = _zip_get_dirent(za, idx, flags, NULL)) == NULL) + return -1; + + if (opsys) + *opsys = (zip_uint8_t)((de->version_madeby >> 8) & 0xff); + + if (attributes) + *attributes = de->ext_attrib; + + return 0; +} diff --git a/core/deps/libzip/lib/zip_file_get_offset.c b/core/deps/libzip/lib/zip_file_get_offset.c new file mode 100644 index 000000000..eb9b0178c --- /dev/null +++ b/core/deps/libzip/lib/zip_file_get_offset.c @@ -0,0 +1,117 @@ +/* + zip_file_get_offset.c -- get offset of file data in archive. + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include +#include + +#include "zipint.h" + + +/* _zip_file_get_offset(za, ze): + Returns the offset of the file data for entry ze. + + On error, fills in za->error and returns 0. +*/ + +zip_uint64_t +_zip_file_get_offset(const zip_t *za, zip_uint64_t idx, zip_error_t *error) { + zip_uint64_t offset; + zip_int32_t size; + + if (za->entry[idx].orig == NULL) { + zip_error_set(error, ZIP_ER_INTERNAL, 0); + return 0; + } + + offset = za->entry[idx].orig->offset; + + if (zip_source_seek(za->src, (zip_int64_t)offset, SEEK_SET) < 0) { + _zip_error_set_from_source(error, za->src); + return 0; + } + + /* TODO: cache? */ + if ((size = _zip_dirent_size(za->src, ZIP_EF_LOCAL, error)) < 0) + return 0; + + if (offset + (zip_uint32_t)size > ZIP_INT64_MAX) { + zip_error_set(error, ZIP_ER_SEEK, EFBIG); + return 0; + } + + return offset + (zip_uint32_t)size; +} + +zip_uint64_t +_zip_file_get_end(const zip_t *za, zip_uint64_t index, zip_error_t *error) { + zip_uint64_t offset; + zip_dirent_t *entry; + + if ((offset = _zip_file_get_offset(za, index, error)) == 0) { + return 0; + } + + entry = za->entry[index].orig; + + if (offset + entry->comp_size < offset || offset + entry->comp_size > ZIP_INT64_MAX) { + zip_error_set(error, ZIP_ER_SEEK, EFBIG); + return 0; + } + offset += entry->comp_size; + + if (entry->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) { + zip_uint8_t buf[4]; + if (zip_source_seek(za->src, (zip_int64_t)offset, SEEK_SET) < 0) { + _zip_error_set_from_source(error, za->src); + return 0; + } + if (zip_source_read(za->src, buf, 4) != 4) { + _zip_error_set_from_source(error, za->src); + return 0; + } + if (memcmp(buf, DATADES_MAGIC, 4) == 0) { + offset += 4; + } + offset += 12; + if (_zip_dirent_needs_zip64(entry, 0)) { + offset += 8; + } + if (offset > ZIP_INT64_MAX) { + zip_error_set(error, ZIP_ER_SEEK, EFBIG); + return 0; + } + } + + return offset; +} diff --git a/core/deps/libzip/zip_set_name.c b/core/deps/libzip/lib/zip_file_rename.c similarity index 64% rename from core/deps/libzip/zip_set_name.c rename to core/deps/libzip/lib/zip_file_rename.c index 5c7da3d7c..a830b6aa8 100644 --- a/core/deps/libzip/zip_set_name.c +++ b/core/deps/libzip/lib/zip_file_rename.c @@ -1,6 +1,6 @@ /* - zip_set_name.c -- rename helper function - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + zip_file_rename.c -- rename file in zip archive + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,45 +31,37 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -#include #include #include "zipint.h" - -int -_zip_set_name(struct zip *za, int idx, const char *name) -{ - char *s; - int i; - - if (idx < 0 || idx >= za->nentry || name == NULL) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; +ZIP_EXTERN int +zip_file_rename(zip_t *za, zip_uint64_t idx, const char *name, zip_flags_t flags) { + const char *old_name; + int old_is_dir, new_is_dir; + + if (idx >= za->nentry || (name != NULL && strlen(name) > ZIP_UINT16_MAX)) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; } - if ((i=_zip_name_locate(za, name, 0, NULL)) != -1 && i != idx) { - _zip_error_set(&za->error, ZIP_ER_EXISTS, 0); - return -1; + if (ZIP_IS_RDONLY(za)) { + zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; } - /* no effective name change */ - if (i == idx) - return 0; - - if ((s=strdup(name)) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return -1; + if ((old_name = zip_get_name(za, idx, 0)) == NULL) + return -1; + + new_is_dir = (name != NULL && name[strlen(name) - 1] == '/'); + old_is_dir = (old_name[strlen(old_name) - 1] == '/'); + + if (new_is_dir != old_is_dir) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; } - - if (za->entry[idx].state == ZIP_ST_UNCHANGED) - za->entry[idx].state = ZIP_ST_RENAMED; - free(za->entry[idx].ch_filename); - za->entry[idx].ch_filename = s; - - return 0; + return _zip_set_name(za, idx, name, flags); } diff --git a/core/deps/libzip/lib/zip_file_replace.c b/core/deps/libzip/lib/zip_file_replace.c new file mode 100644 index 000000000..c824d7fba --- /dev/null +++ b/core/deps/libzip/lib/zip_file_replace.c @@ -0,0 +1,105 @@ +/* + zip_file_replace.c -- replace file via callback function + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +ZIP_EXTERN int +zip_file_replace(zip_t *za, zip_uint64_t idx, zip_source_t *source, zip_flags_t flags) { + if (idx >= za->nentry || source == NULL) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (_zip_file_replace(za, idx, NULL, source, flags) == -1) + return -1; + + return 0; +} + + +/* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ + +zip_int64_t +_zip_file_replace(zip_t *za, zip_uint64_t idx, const char *name, zip_source_t *source, zip_flags_t flags) { + zip_uint64_t za_nentry_prev; + + if (ZIP_IS_RDONLY(za)) { + zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + za_nentry_prev = za->nentry; + if (idx == ZIP_UINT64_MAX) { + zip_int64_t i = -1; + + if (flags & ZIP_FL_OVERWRITE) + i = _zip_name_locate(za, name, flags, NULL); + + if (i == -1) { + /* create and use new entry, used by zip_add */ + if ((i = _zip_add_entry(za)) < 0) + return -1; + } + idx = (zip_uint64_t)i; + } + + if (name && _zip_set_name(za, idx, name, flags) != 0) { + if (za->nentry != za_nentry_prev) { + _zip_entry_finalize(za->entry + idx); + za->nentry = za_nentry_prev; + } + return -1; + } + + /* does not change any name related data, so we can do it here; + * needed for a double add of the same file name */ + _zip_unchange_data(za->entry + idx); + + if (za->entry[idx].orig != NULL && (za->entry[idx].changes == NULL || (za->entry[idx].changes->changed & ZIP_DIRENT_COMP_METHOD) == 0)) { + if (za->entry[idx].changes == NULL) { + if ((za->entry[idx].changes = _zip_dirent_clone(za->entry[idx].orig)) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + } + + za->entry[idx].changes->comp_method = ZIP_CM_REPLACED_DEFAULT; + za->entry[idx].changes->changed |= ZIP_DIRENT_COMP_METHOD; + } + + za->entry[idx].source = source; + + return (zip_int64_t)idx; +} diff --git a/core/deps/libzip/lib/zip_file_set_comment.c b/core/deps/libzip/lib/zip_file_set_comment.c new file mode 100644 index 000000000..8c76f25ac --- /dev/null +++ b/core/deps/libzip/lib/zip_file_set_comment.c @@ -0,0 +1,101 @@ +/* + zip_file_set_comment.c -- set comment for file in archive + Copyright (C) 2006-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include + +#include "zipint.h" + + +ZIP_EXTERN int +zip_file_set_comment(zip_t *za, zip_uint64_t idx, const char *comment, zip_uint16_t len, zip_flags_t flags) { + zip_entry_t *e; + zip_string_t *cstr; + int changed; + + if (_zip_get_dirent(za, idx, 0, NULL) == NULL) + return -1; + + if (ZIP_IS_RDONLY(za)) { + zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (len > 0 && comment == NULL) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (len > 0) { + if ((cstr = _zip_string_new((const zip_uint8_t *)comment, len, flags, &za->error)) == NULL) + return -1; + if ((flags & ZIP_FL_ENCODING_ALL) == ZIP_FL_ENC_GUESS && _zip_guess_encoding(cstr, ZIP_ENCODING_UNKNOWN) == ZIP_ENCODING_UTF8_GUESSED) + cstr->encoding = ZIP_ENCODING_UTF8_KNOWN; + } + else + cstr = NULL; + + e = za->entry + idx; + + if (e->changes) { + _zip_string_free(e->changes->comment); + e->changes->comment = NULL; + e->changes->changed &= ~ZIP_DIRENT_COMMENT; + } + + if (e->orig && e->orig->comment) + changed = !_zip_string_equal(e->orig->comment, cstr); + else + changed = (cstr != NULL); + + if (changed) { + if (e->changes == NULL) { + if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + _zip_string_free(cstr); + return -1; + } + } + e->changes->comment = cstr; + e->changes->changed |= ZIP_DIRENT_COMMENT; + } + else { + _zip_string_free(cstr); + if (e->changes && e->changes->changed == 0) { + _zip_dirent_free(e->changes); + e->changes = NULL; + } + } + + return 0; +} diff --git a/core/deps/libzip/lib/zip_file_set_encryption.c b/core/deps/libzip/lib/zip_file_set_encryption.c new file mode 100644 index 000000000..6025e4a82 --- /dev/null +++ b/core/deps/libzip/lib/zip_file_set_encryption.c @@ -0,0 +1,116 @@ +/* + zip_file_set_encryption.c -- set encryption for file in archive + Copyright (C) 2016-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + +#include +#include + +ZIP_EXTERN int +zip_file_set_encryption(zip_t *za, zip_uint64_t idx, zip_uint16_t method, const char *password) { + zip_entry_t *e; + zip_uint16_t old_method; + + if (idx >= za->nentry) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (ZIP_IS_RDONLY(za)) { + zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (method != ZIP_EM_NONE && _zip_get_encryption_implementation(method, ZIP_CODEC_ENCODE) == NULL) { + zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0); + return -1; + } + + e = za->entry + idx; + + old_method = (e->orig == NULL ? ZIP_EM_NONE : e->orig->encryption_method); + + if (method == old_method && password == NULL) { + if (e->changes) { + if (e->changes->changed & ZIP_DIRENT_PASSWORD) { + _zip_crypto_clear(e->changes->password, strlen(e->changes->password)); + free(e->changes->password); + e->changes->password = (e->orig == NULL ? NULL : e->orig->password); + } + e->changes->changed &= ~(ZIP_DIRENT_ENCRYPTION_METHOD | ZIP_DIRENT_PASSWORD); + if (e->changes->changed == 0) { + _zip_dirent_free(e->changes); + e->changes = NULL; + } + } + } + else { + char *our_password = NULL; + + if (password) { + if ((our_password = strdup(password)) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + } + + if (e->changes == NULL) { + if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) { + if (our_password) { + _zip_crypto_clear(our_password, strlen(our_password)); + } + free(our_password); + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + } + + e->changes->encryption_method = method; + e->changes->changed |= ZIP_DIRENT_ENCRYPTION_METHOD; + if (password) { + e->changes->password = our_password; + e->changes->changed |= ZIP_DIRENT_PASSWORD; + } + else { + if (e->changes->changed & ZIP_DIRENT_PASSWORD) { + _zip_crypto_clear(e->changes->password, strlen(e->changes->password)); + free(e->changes->password); + e->changes->password = e->orig ? e->orig->password : NULL; + e->changes->changed &= ~ZIP_DIRENT_PASSWORD; + } + } + } + + return 0; +} diff --git a/core/deps/libzip/lib/zip_file_set_external_attributes.c b/core/deps/libzip/lib/zip_file_set_external_attributes.c new file mode 100644 index 000000000..0662f60d2 --- /dev/null +++ b/core/deps/libzip/lib/zip_file_set_external_attributes.c @@ -0,0 +1,82 @@ +/* + zip_file_set_external_attributes.c -- set external attributes for entry + Copyright (C) 2013-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zipint.h" + +ZIP_EXTERN int +zip_file_set_external_attributes(zip_t *za, zip_uint64_t idx, zip_flags_t flags, zip_uint8_t opsys, zip_uint32_t attributes) { + zip_entry_t *e; + int changed; + zip_uint8_t unchanged_opsys; + zip_uint32_t unchanged_attributes; + + if (_zip_get_dirent(za, idx, 0, NULL) == NULL) + return -1; + + if (ZIP_IS_RDONLY(za)) { + zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + e = za->entry + idx; + + unchanged_opsys = (e->orig ? (zip_uint8_t)(e->orig->version_madeby >> 8) : (zip_uint8_t)ZIP_OPSYS_DEFAULT); + unchanged_attributes = e->orig ? e->orig->ext_attrib : ZIP_EXT_ATTRIB_DEFAULT; + + changed = (opsys != unchanged_opsys || attributes != unchanged_attributes); + + if (changed) { + if (e->changes == NULL) { + if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + } + e->changes->version_madeby = (zip_uint16_t)((opsys << 8) | (e->changes->version_madeby & 0xff)); + e->changes->ext_attrib = attributes; + e->changes->changed |= ZIP_DIRENT_ATTRIBUTES; + } + else if (e->changes) { + e->changes->changed &= ~ZIP_DIRENT_ATTRIBUTES; + if (e->changes->changed == 0) { + _zip_dirent_free(e->changes); + e->changes = NULL; + } + else { + e->changes->version_madeby = (zip_uint16_t)((unchanged_opsys << 8) | (e->changes->version_madeby & 0xff)); + e->changes->ext_attrib = unchanged_attributes; + } + } + + return 0; +} diff --git a/core/deps/libzip/lib/zip_file_set_mtime.c b/core/deps/libzip/lib/zip_file_set_mtime.c new file mode 100644 index 000000000..2753d595e --- /dev/null +++ b/core/deps/libzip/lib/zip_file_set_mtime.c @@ -0,0 +1,68 @@ +/* + zip_file_set_mtime.c -- set modification time of entry. + Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "zipint.h" + +ZIP_EXTERN int +zip_file_set_dostime(zip_t *za, zip_uint64_t idx, zip_uint16_t dtime, zip_uint16_t ddate, zip_flags_t flags) { + time_t mtime; + mtime = _zip_d2u_time(dtime, ddate); + return zip_file_set_mtime(za, idx, mtime, flags); +} + +ZIP_EXTERN int +zip_file_set_mtime(zip_t *za, zip_uint64_t idx, time_t mtime, zip_flags_t flags) { + zip_entry_t *e; + + if (_zip_get_dirent(za, idx, 0, NULL) == NULL) + return -1; + + if (ZIP_IS_RDONLY(za)) { + zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + e = za->entry + idx; + + if (e->changes == NULL) { + if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + } + + e->changes->last_mod = mtime; + e->changes->changed |= ZIP_DIRENT_LAST_MOD; + + return 0; +} diff --git a/core/deps/libzip/zip_file_strerror.c b/core/deps/libzip/lib/zip_file_strerror.c similarity index 91% rename from core/deps/libzip/zip_file_strerror.c rename to core/deps/libzip/lib/zip_file_strerror.c index 9ba70f14f..2dcdba72b 100644 --- a/core/deps/libzip/zip_file_strerror.c +++ b/core/deps/libzip/lib/zip_file_strerror.c @@ -1,6 +1,6 @@ /* zip_file_sterror.c -- get string representation of zip file error - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,14 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include "zipint.h" - ZIP_EXTERN const char * -zip_file_strerror(struct zip_file *zf) -{ - return _zip_error_strerror(&zf->error); +zip_file_strerror(zip_file_t *zf) { + return zip_error_strerror(&zf->error); } diff --git a/core/deps/libzip/zip_fopen.c b/core/deps/libzip/lib/zip_fopen.c similarity index 82% rename from core/deps/libzip/zip_fopen.c rename to core/deps/libzip/lib/zip_fopen.c index 6e2f72412..2da0cc5f0 100644 --- a/core/deps/libzip/zip_fopen.c +++ b/core/deps/libzip/lib/zip_fopen.c @@ -1,6 +1,6 @@ /* zip_fopen.c -- open file in zip archive for reading - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,19 +31,16 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include "zipint.h" - -ZIP_EXTERN struct zip_file * -zip_fopen(struct zip *za, const char *fname, int flags) -{ - int idx; +ZIP_EXTERN zip_file_t * +zip_fopen(zip_t *za, const char *fname, zip_flags_t flags) { + zip_int64_t idx; - if ((idx=zip_name_locate(za, fname, flags)) < 0) - return NULL; + if ((idx = zip_name_locate(za, fname, flags)) < 0) + return NULL; - return zip_fopen_index(za, idx, flags); + return zip_fopen_index_encrypted(za, (zip_uint64_t)idx, flags, za->default_password); } diff --git a/core/deps/libzip/lib/zip_fopen_encrypted.c b/core/deps/libzip/lib/zip_fopen_encrypted.c new file mode 100644 index 000000000..80160152a --- /dev/null +++ b/core/deps/libzip/lib/zip_fopen_encrypted.c @@ -0,0 +1,46 @@ +/* + zip_fopen_encrypted.c -- open file for reading with password + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +ZIP_EXTERN zip_file_t * +zip_fopen_encrypted(zip_t *za, const char *fname, zip_flags_t flags, const char *password) { + zip_int64_t idx; + + if ((idx = zip_name_locate(za, fname, flags)) < 0) + return NULL; + + return zip_fopen_index_encrypted(za, (zip_uint64_t)idx, flags, password); +} diff --git a/core/deps/libzip/lib/zip_fopen_index.c b/core/deps/libzip/lib/zip_fopen_index.c new file mode 100644 index 000000000..5fd5f1a61 --- /dev/null +++ b/core/deps/libzip/lib/zip_fopen_index.c @@ -0,0 +1,41 @@ +/* + zip_fopen_index.c -- open file in zip archive for reading by index + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +ZIP_EXTERN zip_file_t * +zip_fopen_index(zip_t *za, zip_uint64_t index, zip_flags_t flags) { + return zip_fopen_index_encrypted(za, index, flags, za->default_password); +} diff --git a/core/deps/libzip/zip_file_get_offset.c b/core/deps/libzip/lib/zip_fopen_index_encrypted.c similarity index 58% rename from core/deps/libzip/zip_file_get_offset.c rename to core/deps/libzip/lib/zip_fopen_index_encrypted.c index b96fd5e48..280a5bd0c 100644 --- a/core/deps/libzip/zip_file_get_offset.c +++ b/core/deps/libzip/lib/zip_fopen_index_encrypted.c @@ -1,6 +1,6 @@ /* - zip_file_get_offset.c -- get offset of file data in archive. - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + zip_fopen_index_encrypted.c -- open file for reading by index w/ password + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,44 +31,57 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include #include -#include -#include -#include -#include #include "zipint.h" - +static zip_file_t *_zip_file_new(zip_t *za); -/* _zip_file_get_offset(za, ze): - Returns the offset of the file data for entry ze. - On error, fills in za->error and returns 0. -*/ +ZIP_EXTERN zip_file_t * +zip_fopen_index_encrypted(zip_t *za, zip_uint64_t index, zip_flags_t flags, const char *password) { + zip_file_t *zf; + zip_source_t *src; -unsigned int -_zip_file_get_offset(struct zip *za, int idx) -{ - struct zip_dirent de; - unsigned int offset; + if (password != NULL && password[0] == '\0') { + password = NULL; + } + + if ((src = _zip_source_zip_new(za, za, index, flags, 0, 0, password)) == NULL) + return NULL; - offset = za->cdir->entry[idx].offset; - - if (fseeko(za->zp, offset, SEEK_SET) != 0) { - _zip_error_set(&za->error, ZIP_ER_SEEK, errno); - return 0; + if (zip_source_open(src) < 0) { + _zip_error_set_from_source(&za->error, src); + zip_source_free(src); + return NULL; } - if (_zip_dirent_read(&de, za->zp, NULL, NULL, 1, &za->error) != 0) - return 0; + if ((zf = _zip_file_new(za)) == NULL) { + zip_source_free(src); + return NULL; + } - offset += LENTRYSIZE + de.filename_len + de.extrafield_len; + zf->src = src; - _zip_dirent_finalize(&de); - - return offset; + return zf; +} + + +static zip_file_t * +_zip_file_new(zip_t *za) { + zip_file_t *zf; + + if ((zf = (zip_file_t *)malloc(sizeof(struct zip_file))) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; + } + + zf->za = za; + zip_error_init(&zf->error); + zf->eof = 0; + zf->src = NULL; + + return zf; } diff --git a/core/deps/libzip/lib/zip_fread.c b/core/deps/libzip/lib/zip_fread.c new file mode 100644 index 000000000..ecf0c3b00 --- /dev/null +++ b/core/deps/libzip/lib/zip_fread.c @@ -0,0 +1,62 @@ +/* + zip_fread.c -- read from file + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +ZIP_EXTERN zip_int64_t +zip_fread(zip_file_t *zf, void *outbuf, zip_uint64_t toread) { + zip_int64_t n; + + if (!zf) + return -1; + + if (zf->error.zip_err != 0) + return -1; + + if (toread > ZIP_INT64_MAX) { + zip_error_set(&zf->error, ZIP_ER_INVAL, 0); + return -1; + } + + if ((zf->eof) || (toread == 0)) + return 0; + + if ((n = zip_source_read(zf->src, outbuf, toread)) < 0) { + _zip_error_set_from_source(&zf->error, zf->src); + return -1; + } + + return n; +} diff --git a/core/deps/libzip/lib/zip_fseek.c b/core/deps/libzip/lib/zip_fseek.c new file mode 100644 index 000000000..21f344a6e --- /dev/null +++ b/core/deps/libzip/lib/zip_fseek.c @@ -0,0 +1,51 @@ +/* + zip_fseek.c -- seek in file + Copyright (C) 2016-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + +ZIP_EXTERN zip_int8_t +zip_fseek(zip_file_t *zf, zip_int64_t offset, int whence) { + if (!zf) + return -1; + + if (zf->error.zip_err != 0) + return -1; + + if (zip_source_seek(zf->src, offset, whence) < 0) { + _zip_error_set_from_source(&zf->error, zf->src); + return -1; + } + + return 0; +} diff --git a/core/deps/libzip/lib/zip_ftell.c b/core/deps/libzip/lib/zip_ftell.c new file mode 100644 index 000000000..2b36770af --- /dev/null +++ b/core/deps/libzip/lib/zip_ftell.c @@ -0,0 +1,54 @@ +/* + zip_ftell.c -- tell position in file + Copyright (C) 2016-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + +ZIP_EXTERN zip_int64_t +zip_ftell(zip_file_t *zf) { + zip_int64_t res; + + if (!zf) + return -1; + + if (zf->error.zip_err != 0) + return -1; + + res = zip_source_tell(zf->src); + if (res < 0) { + _zip_error_set_from_source(&zf->error, zf->src); + return -1; + } + + return res; +} diff --git a/core/deps/libzip/zip_get_archive_comment.c b/core/deps/libzip/lib/zip_get_archive_comment.c similarity index 74% rename from core/deps/libzip/zip_get_archive_comment.c rename to core/deps/libzip/lib/zip_get_archive_comment.c index 669eb7021..18a4b6106 100644 --- a/core/deps/libzip/zip_get_archive_comment.c +++ b/core/deps/libzip/lib/zip_get_archive_comment.c @@ -1,6 +1,6 @@ /* zip_get_archive_comment.c -- get archive comment - Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,30 +31,28 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + +#include #include "zipint.h" - ZIP_EXTERN const char * -zip_get_archive_comment(struct zip *za, int *lenp, int flags) -{ - if ((flags & ZIP_FL_UNCHANGED) - || (za->ch_comment_len == -1)) { - if (za->cdir) { - if (lenp != NULL) - *lenp = za->cdir->comment_len; - return za->cdir->comment; - } - else { - if (lenp != NULL) - *lenp = -1; - return NULL; - } - } - - if (lenp != NULL) - *lenp = za->ch_comment_len; - return za->ch_comment; +zip_get_archive_comment(zip_t *za, int *lenp, zip_flags_t flags) { + zip_string_t *comment; + zip_uint32_t len; + const zip_uint8_t *str; + + if ((flags & ZIP_FL_UNCHANGED) || (za->comment_changes == NULL)) + comment = za->comment_orig; + else + comment = za->comment_changes; + + if ((str = _zip_string_get(comment, &len, flags, &za->error)) == NULL) + return NULL; + + if (lenp) + *lenp = (int)len; + + return (const char *)str; } diff --git a/core/deps/libzip/zip_get_archive_flag.c b/core/deps/libzip/lib/zip_get_archive_flag.c similarity index 91% rename from core/deps/libzip/zip_get_archive_flag.c rename to core/deps/libzip/lib/zip_get_archive_flag.c index 4733d92b5..3185ac53a 100644 --- a/core/deps/libzip/zip_get_archive_flag.c +++ b/core/deps/libzip/lib/zip_get_archive_flag.c @@ -1,6 +1,6 @@ /* zip_get_archive_flag.c -- get archive global flag - Copyright (C) 2008 Dieter Baron and Thomas Klausner + Copyright (C) 2008-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,16 +31,13 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include "zipint.h" - ZIP_EXTERN int -zip_get_archive_flag(struct zip *za, int flag, int flags) -{ - int fl; +zip_get_archive_flag(zip_t *za, zip_flags_t flag, zip_flags_t flags) { + unsigned int fl; fl = (flags & ZIP_FL_UNCHANGED) ? za->flags : za->ch_flags; diff --git a/core/deps/libzip/zip_replace.c b/core/deps/libzip/lib/zip_get_encryption_implementation.c similarity index 64% rename from core/deps/libzip/zip_replace.c rename to core/deps/libzip/lib/zip_get_encryption_implementation.c index 6cdb80c50..c1643dafe 100644 --- a/core/deps/libzip/zip_replace.c +++ b/core/deps/libzip/lib/zip_get_encryption_implementation.c @@ -1,6 +1,6 @@ /* - zip_replace.c -- replace file via callback function - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + zip_get_encryption_implementation.c -- get encryption implementation + Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,48 +31,32 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include "zipint.h" - + +zip_encryption_implementation +_zip_get_encryption_implementation(zip_uint16_t em, int operation) { + switch (em) { + case ZIP_EM_TRAD_PKWARE: + return operation == ZIP_CODEC_DECODE ? zip_source_pkware_decode : zip_source_pkware_encode; + +#if defined(HAVE_CRYPTO) + case ZIP_EM_AES_128: + case ZIP_EM_AES_192: + case ZIP_EM_AES_256: + return operation == ZIP_CODEC_DECODE ? zip_source_winzip_aes_decode : zip_source_winzip_aes_encode; +#endif + + default: + return NULL; + } +} ZIP_EXTERN int -zip_replace(struct zip *za, int idx, struct zip_source *source) -{ - if (idx < 0 || idx >= za->nentry || source == NULL) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; +zip_encryption_method_supported(zip_uint16_t method, int encode) { + if (method == ZIP_EM_NONE) { + return 1; } - - if (_zip_replace(za, idx, NULL, source) == -1) - return -1; - - return 0; -} - - - - -int -_zip_replace(struct zip *za, int idx, const char *name, - struct zip_source *source) -{ - if (idx == -1) { - if (_zip_entry_new(za) == NULL) - return -1; - - idx = za->nentry - 1; - } - - _zip_unchange_data(za->entry+idx); - - if (name && _zip_set_name(za, idx, name) != 0) - return -1; - - za->entry[idx].state = ((za->cdir == NULL || idx >= za->cdir->nentry) - ? ZIP_ST_ADDED : ZIP_ST_REPLACED); - za->entry[idx].source = source; - - return idx; + return _zip_get_encryption_implementation(method, encode ? ZIP_CODEC_ENCODE : ZIP_CODEC_DECODE) != NULL; } diff --git a/core/deps/libzip/zip_get_file_comment.c b/core/deps/libzip/lib/zip_get_file_comment.c similarity index 75% rename from core/deps/libzip/zip_get_file_comment.c rename to core/deps/libzip/lib/zip_get_file_comment.c index adace7247..28429bc87 100644 --- a/core/deps/libzip/zip_get_file_comment.c +++ b/core/deps/libzip/lib/zip_get_file_comment.c @@ -1,6 +1,6 @@ /* zip_get_file_comment.c -- get file comment - Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,28 +31,20 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" - ZIP_EXTERN const char * -zip_get_file_comment(struct zip *za, int idx, int *lenp, int flags) -{ - if (idx < 0 || idx >= za->nentry) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return NULL; +zip_get_file_comment(zip_t *za, zip_uint64_t idx, int *lenp, int flags) { + zip_uint32_t len; + const char *s; + + if ((s = zip_file_get_comment(za, idx, &len, (zip_flags_t)flags)) != NULL) { + if (lenp) + *lenp = (int)len; } - if ((flags & ZIP_FL_UNCHANGED) - || (za->entry[idx].ch_comment_len == -1)) { - if (lenp != NULL) - *lenp = za->cdir->entry[idx].comment_len; - return za->cdir->entry[idx].comment; - } - - if (lenp != NULL) - *lenp = za->entry[idx].ch_comment_len; - return za->entry[idx].ch_comment; + return s; } diff --git a/core/deps/libzip/zip_get_name.c b/core/deps/libzip/lib/zip_get_name.c similarity index 70% rename from core/deps/libzip/zip_get_name.c rename to core/deps/libzip/lib/zip_get_name.c index 8f5050bd2..1a4bab8f3 100644 --- a/core/deps/libzip/zip_get_name.c +++ b/core/deps/libzip/lib/zip_get_name.c @@ -1,6 +1,6 @@ /* zip_get_name.c -- get filename for a file in zip file - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,41 +31,28 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + +#include #include "zipint.h" - ZIP_EXTERN const char * -zip_get_name(struct zip *za, int idx, int flags) -{ +zip_get_name(zip_t *za, zip_uint64_t idx, zip_flags_t flags) { return _zip_get_name(za, idx, flags, &za->error); } - const char * -_zip_get_name(struct zip *za, int idx, int flags, struct zip_error *error) -{ - if (idx < 0 || idx >= za->nentry) { - _zip_error_set(error, ZIP_ER_INVAL, 0); - return NULL; - } +_zip_get_name(zip_t *za, zip_uint64_t idx, zip_flags_t flags, zip_error_t *error) { + zip_dirent_t *de; + const zip_uint8_t *str; - if ((flags & ZIP_FL_UNCHANGED) == 0) { - if (za->entry[idx].state == ZIP_ST_DELETED) { - _zip_error_set(error, ZIP_ER_DELETED, 0); - return NULL; - } - if (za->entry[idx].ch_filename) - return za->entry[idx].ch_filename; - } + if ((de = _zip_get_dirent(za, idx, flags, error)) == NULL) + return NULL; - if (za->cdir == NULL || idx >= za->cdir->nentry) { - _zip_error_set(error, ZIP_ER_INVAL, 0); - return NULL; - } - - return za->cdir->entry[idx].filename; + if ((str = _zip_string_get(de->filename, NULL, flags, error)) == NULL) + return NULL; + + return (const char *)str; } diff --git a/core/deps/libzip/zip_source_file.c b/core/deps/libzip/lib/zip_get_num_entries.c similarity index 77% rename from core/deps/libzip/zip_source_file.c rename to core/deps/libzip/lib/zip_get_num_entries.c index eb1129a27..3b18c7479 100644 --- a/core/deps/libzip/zip_source_file.c +++ b/core/deps/libzip/lib/zip_get_num_entries.c @@ -1,6 +1,6 @@ /* - zip_source_file.c -- create data source from file - Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner + zip_get_num_entries.c -- get number of entries in archive + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,25 +31,22 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - -#include -#include #include "zipint.h" - -ZIP_EXTERN struct zip_source * -zip_source_file(struct zip *za, const char *fname, off_t start, off_t len) -{ +ZIP_EXTERN zip_int64_t +zip_get_num_entries(zip_t *za, zip_flags_t flags) { + zip_uint64_t n; + if (za == NULL) - return NULL; + return -1; - if (fname == NULL || start < 0 || len < -1) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return NULL; + if (flags & ZIP_FL_UNCHANGED) { + n = za->nentry; + while (n > 0 && za->entry[n - 1].orig == NULL) + --n; + return (zip_int64_t)n; } - - return _zip_source_file_or_p(za, fname, NULL, start, len); + return (zip_int64_t)za->nentry; } diff --git a/core/deps/libzip/zip_get_num_files.c b/core/deps/libzip/lib/zip_get_num_files.c similarity index 84% rename from core/deps/libzip/zip_get_num_files.c rename to core/deps/libzip/lib/zip_get_num_files.c index 1d9baa3d6..23d7c9c96 100644 --- a/core/deps/libzip/zip_get_num_files.c +++ b/core/deps/libzip/lib/zip_get_num_files.c @@ -1,6 +1,6 @@ /* zip_get_num_files.c -- get number of files in archive - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,17 +31,21 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" +#include - ZIP_EXTERN int -zip_get_num_files(struct zip *za) -{ +zip_get_num_files(zip_t *za) { if (za == NULL) - return -1; + return -1; - return za->nentry; + if (za->nentry > INT_MAX) { + zip_error_set(&za->error, ZIP_ER_OPNOTSUPP, 0); + return -1; + } + + return (int)za->nentry; } diff --git a/core/deps/libzip/lib/zip_hash.c b/core/deps/libzip/lib/zip_hash.c new file mode 100644 index 000000000..56e8d78ca --- /dev/null +++ b/core/deps/libzip/lib/zip_hash.c @@ -0,0 +1,410 @@ +/* + zip_hash.c -- hash table string -> uint64 + Copyright (C) 2015-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zipint.h" +#include +#include + +/* parameter for the string hash function */ +#define HASH_MULTIPLIER 33 +#define HASH_START 5381 + +/* hash table's fill ratio is kept between these by doubling/halfing its size as necessary */ +#define HASH_MAX_FILL .75 +#define HASH_MIN_FILL .01 + +/* but hash table size is kept between these */ +#define HASH_MIN_SIZE 256 +#define HASH_MAX_SIZE 0x80000000ul + +struct zip_hash_entry { + const zip_uint8_t *name; + zip_int64_t orig_index; + zip_int64_t current_index; + struct zip_hash_entry *next; + zip_uint32_t hash_value; +}; +typedef struct zip_hash_entry zip_hash_entry_t; + +struct zip_hash { + zip_uint32_t table_size; + zip_uint64_t nentries; + zip_hash_entry_t **table; +}; + + +/* free list of entries */ +static void +free_list(zip_hash_entry_t *entry) { + while (entry != NULL) { + zip_hash_entry_t *next = entry->next; + free(entry); + entry = next; + } +} + + +/* compute hash of string, full 32 bit value */ +static zip_uint32_t +hash_string(const zip_uint8_t *name) { + zip_uint64_t value = HASH_START; + + if (name == NULL) { + return 0; + } + + while (*name != 0) { + value = (zip_uint64_t)(((value * HASH_MULTIPLIER) + (zip_uint8_t)*name) % 0x100000000ul); + name++; + } + + return (zip_uint32_t)value; +} + + +/* resize hash table; new_size must be a power of 2, can be larger or smaller than current size */ +static bool +hash_resize(zip_hash_t *hash, zip_uint32_t new_size, zip_error_t *error) { + zip_hash_entry_t **new_table; + + if (new_size == hash->table_size) { + return true; + } + + if ((new_table = (zip_hash_entry_t **)calloc(new_size, sizeof(zip_hash_entry_t *))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return false; + } + + if (hash->nentries > 0) { + zip_uint32_t i; + + for (i = 0; i < hash->table_size; i++) { + zip_hash_entry_t *entry = hash->table[i]; + while (entry) { + zip_hash_entry_t *next = entry->next; + + zip_uint32_t new_index = entry->hash_value % new_size; + + entry->next = new_table[new_index]; + new_table[new_index] = entry; + + entry = next; + } + } + } + + free(hash->table); + hash->table = new_table; + hash->table_size = new_size; + + return true; +} + + +static zip_uint32_t +size_for_capacity(zip_uint64_t capacity) { + double needed_size = capacity / HASH_MAX_FILL; + zip_uint32_t v; + + if (needed_size > ZIP_UINT32_MAX) { + v = ZIP_UINT32_MAX; + } + else { + v = (zip_uint32_t)needed_size; + } + + if (v > HASH_MAX_SIZE) { + return HASH_MAX_SIZE; + } + + /* From Bit Twiddling Hacks by Sean Eron Anderson + (http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2). */ + + v--; + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + v++; + + return v; +} + + +zip_hash_t * +_zip_hash_new(zip_error_t *error) { + zip_hash_t *hash; + + if ((hash = (zip_hash_t *)malloc(sizeof(zip_hash_t))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + hash->table_size = 0; + hash->nentries = 0; + hash->table = NULL; + + return hash; +} + + +void +_zip_hash_free(zip_hash_t *hash) { + zip_uint32_t i; + + if (hash == NULL) { + return; + } + + if (hash->table != NULL) { + for (i = 0; i < hash->table_size; i++) { + if (hash->table[i] != NULL) { + free_list(hash->table[i]); + } + } + free(hash->table); + } + free(hash); +} + + +/* insert into hash, return error on existence or memory issues */ +bool +_zip_hash_add(zip_hash_t *hash, const zip_uint8_t *name, zip_uint64_t index, zip_flags_t flags, zip_error_t *error) { + zip_uint32_t hash_value, table_index; + zip_hash_entry_t *entry; + + if (hash == NULL || name == NULL || index > ZIP_INT64_MAX) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return false; + } + + if (hash->table_size == 0) { + if (!hash_resize(hash, HASH_MIN_SIZE, error)) { + return false; + } + } + + hash_value = hash_string(name); + table_index = hash_value % hash->table_size; + + for (entry = hash->table[table_index]; entry != NULL; entry = entry->next) { + if (entry->hash_value == hash_value && strcmp((const char *)name, (const char *)entry->name) == 0) { + if (((flags & ZIP_FL_UNCHANGED) && entry->orig_index != -1) || entry->current_index != -1) { + zip_error_set(error, ZIP_ER_EXISTS, 0); + return false; + } + else { + break; + } + } + } + + if (entry == NULL) { + if ((entry = (zip_hash_entry_t *)malloc(sizeof(zip_hash_entry_t))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return false; + } + entry->name = name; + entry->next = hash->table[table_index]; + hash->table[table_index] = entry; + entry->hash_value = hash_value; + entry->orig_index = -1; + hash->nentries++; + if (hash->nentries > hash->table_size * HASH_MAX_FILL && hash->table_size < HASH_MAX_SIZE) { + if (!hash_resize(hash, hash->table_size * 2, error)) { + return false; + } + } + } + + if (flags & ZIP_FL_UNCHANGED) { + entry->orig_index = (zip_int64_t)index; + } + entry->current_index = (zip_int64_t)index; + + return true; +} + + +/* remove entry from hash, error if not found */ +bool +_zip_hash_delete(zip_hash_t *hash, const zip_uint8_t *name, zip_error_t *error) { + zip_uint32_t hash_value, index; + zip_hash_entry_t *entry, *previous; + + if (hash == NULL || name == NULL) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return false; + } + + if (hash->nentries > 0) { + hash_value = hash_string(name); + index = hash_value % hash->table_size; + previous = NULL; + entry = hash->table[index]; + while (entry) { + if (entry->hash_value == hash_value && strcmp((const char *)name, (const char *)entry->name) == 0) { + if (entry->orig_index == -1) { + if (previous) { + previous->next = entry->next; + } + else { + hash->table[index] = entry->next; + } + free(entry); + hash->nentries--; + if (hash->nentries < hash->table_size * HASH_MIN_FILL && hash->table_size > HASH_MIN_SIZE) { + if (!hash_resize(hash, hash->table_size / 2, error)) { + return false; + } + } + } + else { + entry->current_index = -1; + } + return true; + } + previous = entry; + entry = entry->next; + } + } + + zip_error_set(error, ZIP_ER_NOENT, 0); + return false; +} + + +/* find value for entry in hash, -1 if not found */ +zip_int64_t +_zip_hash_lookup(zip_hash_t *hash, const zip_uint8_t *name, zip_flags_t flags, zip_error_t *error) { + zip_uint32_t hash_value, index; + zip_hash_entry_t *entry; + + if (hash == NULL || name == NULL) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return -1; + } + + if (hash->nentries > 0) { + hash_value = hash_string(name); + index = hash_value % hash->table_size; + for (entry = hash->table[index]; entry != NULL; entry = entry->next) { + if (strcmp((const char *)name, (const char *)entry->name) == 0) { + if (flags & ZIP_FL_UNCHANGED) { + if (entry->orig_index != -1) { + return entry->orig_index; + } + } + else { + if (entry->current_index != -1) { + return entry->current_index; + } + } + break; + } + } + } + + zip_error_set(error, ZIP_ER_NOENT, 0); + return -1; +} + + +bool +_zip_hash_reserve_capacity(zip_hash_t *hash, zip_uint64_t capacity, zip_error_t *error) { + zip_uint32_t new_size; + + if (capacity == 0) { + return true; + } + + new_size = size_for_capacity(capacity); + + if (new_size <= hash->table_size) { + return true; + } + + if (!hash_resize(hash, new_size, error)) { + return false; + } + + return true; +} + + +bool +_zip_hash_revert(zip_hash_t *hash, zip_error_t *error) { + zip_uint32_t i; + zip_hash_entry_t *entry, *previous; + + for (i = 0; i < hash->table_size; i++) { + previous = NULL; + entry = hash->table[i]; + while (entry) { + if (entry->orig_index == -1) { + zip_hash_entry_t *p; + if (previous) { + previous->next = entry->next; + } + else { + hash->table[i] = entry->next; + } + p = entry; + entry = entry->next; + /* previous does not change */ + free(p); + hash->nentries--; + } + else { + entry->current_index = entry->orig_index; + previous = entry; + entry = entry->next; + } + } + } + + if (hash->nentries < hash->table_size * HASH_MIN_FILL && hash->table_size > HASH_MIN_SIZE) { + zip_uint32_t new_size = hash->table_size / 2; + while (hash->nentries < new_size * HASH_MIN_FILL && new_size > HASH_MIN_SIZE) { + new_size /= 2; + } + if (!hash_resize(hash, new_size, error)) { + return false; + } + } + + return true; +} diff --git a/core/deps/libzip/lib/zip_io_util.c b/core/deps/libzip/lib/zip_io_util.c new file mode 100644 index 000000000..3678dd59d --- /dev/null +++ b/core/deps/libzip/lib/zip_io_util.c @@ -0,0 +1,134 @@ +/* + zip_io_util.c -- I/O helper functions + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#include "zipint.h" + +int +_zip_read(zip_source_t *src, zip_uint8_t *b, zip_uint64_t length, zip_error_t *error) { + zip_int64_t n; + + if (length > ZIP_INT64_MAX) { + zip_error_set(error, ZIP_ER_INTERNAL, 0); + return -1; + } + + if ((n = zip_source_read(src, b, length)) < 0) { + _zip_error_set_from_source(error, src); + return -1; + } + + if (n < (zip_int64_t)length) { + zip_error_set(error, ZIP_ER_EOF, 0); + return -1; + } + + return 0; +} + + +zip_uint8_t * +_zip_read_data(zip_buffer_t *buffer, zip_source_t *src, size_t length, bool nulp, zip_error_t *error) { + zip_uint8_t *r; + + if (length == 0 && !nulp) { + return NULL; + } + + r = (zip_uint8_t *)malloc(length + (nulp ? 1 : 0)); + if (!r) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if (buffer) { + zip_uint8_t *data = _zip_buffer_get(buffer, length); + + if (data == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + free(r); + return NULL; + } + memcpy(r, data, length); + } + else { + if (_zip_read(src, r, length, error) < 0) { + free(r); + return NULL; + } + } + + if (nulp) { + zip_uint8_t *o; + /* replace any in-string NUL characters with spaces */ + r[length] = 0; + for (o = r; o < r + length; o++) + if (*o == '\0') + *o = ' '; + } + + return r; +} + + +zip_string_t * +_zip_read_string(zip_buffer_t *buffer, zip_source_t *src, zip_uint16_t len, bool nulp, zip_error_t *error) { + zip_uint8_t *raw; + zip_string_t *s; + + if ((raw = _zip_read_data(buffer, src, len, nulp, error)) == NULL) + return NULL; + + s = _zip_string_new(raw, len, ZIP_FL_ENC_GUESS, error); + free(raw); + return s; +} + + +int +_zip_write(zip_t *za, const void *data, zip_uint64_t length) { + zip_int64_t n; + + if ((n = zip_source_write(za->src, data, length)) < 0) { + _zip_error_set_from_source(&za->error, za->src); + return -1; + } + if ((zip_uint64_t)n != length) { + zip_error_set(&za->error, ZIP_ER_WRITE, EINTR); + return -1; + } + + return 0; +} diff --git a/core/deps/libzip/lib/zip_libzip_version.c b/core/deps/libzip/lib/zip_libzip_version.c new file mode 100644 index 000000000..df1e55b9c --- /dev/null +++ b/core/deps/libzip/lib/zip_libzip_version.c @@ -0,0 +1,41 @@ +/* + zip_libzip_version.c -- return run-time version of library + Copyright (C) 2017-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +ZIP_EXTERN const char * +zip_libzip_version(void) { + return LIBZIP_VERSION; +} diff --git a/core/deps/libzip/zip_memdup.c b/core/deps/libzip/lib/zip_memdup.c similarity index 88% rename from core/deps/libzip/zip_memdup.c rename to core/deps/libzip/lib/zip_memdup.c index 641125ed2..169186087 100644 --- a/core/deps/libzip/zip_memdup.c +++ b/core/deps/libzip/lib/zip_memdup.c @@ -1,6 +1,6 @@ /* zip_memdup.c -- internal zip function, "strdup" with len - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -36,17 +36,18 @@ #include "zipint.h" - void * -_zip_memdup(const void *mem, size_t len, struct zip_error *error) -{ +_zip_memdup(const void *mem, size_t len, zip_error_t *error) { void *ret; + if (len == 0) + return NULL; + ret = malloc(len); if (!ret) { - _zip_error_set(error, ZIP_ER_MEMORY, 0); - return NULL; + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; } memcpy(ret, mem, len); diff --git a/core/deps/libzip/lib/zip_mkstempm.c b/core/deps/libzip/lib/zip_mkstempm.c new file mode 100644 index 000000000..41516d2ff --- /dev/null +++ b/core/deps/libzip/lib/zip_mkstempm.c @@ -0,0 +1,93 @@ +/* + zip_mkstempm.c -- mkstemp replacement that accepts a mode argument + Copyright (C) 2019-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include +#include +#include + +#include "zipint.h" + +/* + * create temporary file with same permissions as previous one; + * or default permissions if there is no previous file + */ +int +_zip_mkstempm(char *path, int mode) { + int fd; + char *start, *end, *xs; + + int xcnt = 0; + + end = path + strlen(path); + start = end - 1; + while (start >= path && *start == 'X') { + xcnt++; + start--; + } + + if (xcnt == 0) { + errno = EINVAL; + return -1; + } + + start++; + + for (;;) { + zip_uint32_t value = zip_random_uint32(); + + xs = start; + + while (xs < end) { + char digit = value % 36; + if (digit < 10) { + *(xs++) = digit + '0'; + } + else { + *(xs++) = digit - 10 + 'a'; + } + value /= 36; + } + + if ((fd = open(path, O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC, mode == -1 ? 0666 : (mode_t)mode)) >= 0) { + if (mode != -1) { + /* open() honors umask(), which we don't want in this case */ + (void)chmod(path, (mode_t)mode); + } + return fd; + } + if (errno != EEXIST) { + return -1; + } + } +} diff --git a/core/deps/libzip/zip_name_locate.c b/core/deps/libzip/lib/zip_name_locate.c similarity index 58% rename from core/deps/libzip/zip_name_locate.c rename to core/deps/libzip/lib/zip_name_locate.c index baa6141f6..308d843c2 100644 --- a/core/deps/libzip/zip_name_locate.c +++ b/core/deps/libzip/lib/zip_name_locate.c @@ -1,6 +1,6 @@ /* zip_name_locate.c -- get index by name - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,58 +31,62 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include +#ifdef HAVE_STRINGS_H +#include +#endif #include "zipint.h" - -ZIP_EXTERN int -zip_name_locate(struct zip *za, const char *fname, int flags) -{ +ZIP_EXTERN zip_int64_t +zip_name_locate(zip_t *za, const char *fname, zip_flags_t flags) { return _zip_name_locate(za, fname, flags, &za->error); } - -int -_zip_name_locate(struct zip *za, const char *fname, int flags, - struct zip_error *error) -{ +zip_int64_t +_zip_name_locate(zip_t *za, const char *fname, zip_flags_t flags, zip_error_t *error) { int (*cmp)(const char *, const char *); const char *fn, *p; - int i, n; + zip_uint64_t i; + + if (za == NULL) + return -1; if (fname == NULL) { - _zip_error_set(error, ZIP_ER_INVAL, 0); - return -1; - } - - cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp; - - n = (flags & ZIP_FL_UNCHANGED) ? za->cdir->nentry : za->nentry; - for (i=0; icdir->entry[i].filename; - else - fn = _zip_get_name(za, i, flags, error); - - /* newly added (partially filled) entry */ - if (fn == NULL) - continue; - - if (flags & ZIP_FL_NODIR) { - p = strrchr(fn, '/'); - if (p) - fn = p+1; - } - - if (cmp(fname, fn) == 0) - return i; + zip_error_set(error, ZIP_ER_INVAL, 0); + return -1; } - _zip_error_set(error, ZIP_ER_NOENT, 0); - return -1; + if (flags & (ZIP_FL_NOCASE | ZIP_FL_NODIR | ZIP_FL_ENC_CP437)) { + /* can't use hash table */ + cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp; + + for (i = 0; i < za->nentry; i++) { + fn = _zip_get_name(za, i, flags, error); + + /* newly added (partially filled) entry or error */ + if (fn == NULL) + continue; + + if (flags & ZIP_FL_NODIR) { + p = strrchr(fn, '/'); + if (p) + fn = p + 1; + } + + if (cmp(fname, fn) == 0) { + _zip_error_clear(error); + return (zip_int64_t)i; + } + } + + zip_error_set(error, ZIP_ER_NOENT, 0); + return -1; + } + else { + return _zip_hash_lookup(za->names, (const zip_uint8_t *)fname, flags, error); + } } diff --git a/core/deps/libzip/zip_new.c b/core/deps/libzip/lib/zip_new.c similarity index 74% rename from core/deps/libzip/zip_new.c rename to core/deps/libzip/lib/zip_new.c index 3e8ccee64..d2a5fa14d 100644 --- a/core/deps/libzip/zip_new.c +++ b/core/deps/libzip/lib/zip_new.c @@ -1,6 +1,6 @@ /* zip_new.c -- create and init struct zip - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,40 +31,43 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include #include "zipint.h" - /* _zip_new: creates a new zipfile struct, and sets the contents to zero; returns the new struct. */ -struct zip * -_zip_new(struct zip_error *error) -{ - struct zip *za; +zip_t * +_zip_new(zip_error_t *error) { + zip_t *za; - za = (struct zip *)malloc(sizeof(struct zip)); + za = (zip_t *)malloc(sizeof(struct zip)); if (!za) { - _zip_error_set(error, ZIP_ER_MEMORY, 0); - return NULL; + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; } - za->zn = NULL; - za->zp = NULL; - _zip_error_init(&za->error); - za->cdir = NULL; - za->ch_comment = NULL; - za->ch_comment_len = -1; + if ((za->names = _zip_hash_new(error)) == NULL) { + free(za); + return NULL; + } + + za->src = NULL; + za->open_flags = 0; + zip_error_init(&za->error); + za->flags = za->ch_flags = 0; + za->default_password = NULL; + za->comment_orig = za->comment_changes = NULL; + za->comment_changed = 0; za->nentry = za->nentry_alloc = 0; za->entry = NULL; - za->nfile = za->nfile_alloc = 0; - za->file = NULL; - za->flags = za->ch_flags = 0; - + za->nopen_source = za->nopen_source_alloc = 0; + za->open_source = NULL; + za->progress = NULL; + return za; } diff --git a/core/deps/libzip/lib/zip_open.c b/core/deps/libzip/lib/zip_open.c new file mode 100644 index 000000000..292bfc84d --- /dev/null +++ b/core/deps/libzip/lib/zip_open.c @@ -0,0 +1,849 @@ +/* + zip_open.c -- open zip archive by name + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include +#include +#include + +#include "zipint.h" + +typedef enum { EXISTS_ERROR = -1, EXISTS_NOT = 0, EXISTS_OK } exists_t; +static zip_t *_zip_allocate_new(zip_source_t *src, unsigned int flags, zip_error_t *error); +static zip_int64_t _zip_checkcons(zip_t *za, zip_cdir_t *cdir, zip_error_t *error); +static zip_cdir_t *_zip_find_central_dir(zip_t *za, zip_uint64_t len); +static exists_t _zip_file_exists(zip_source_t *src, zip_error_t *error); +static int _zip_headercomp(const zip_dirent_t *, const zip_dirent_t *); +static unsigned char *_zip_memmem(const unsigned char *, size_t, const unsigned char *, size_t); +static zip_cdir_t *_zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_error_t *error); +static zip_cdir_t *_zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *error); +static zip_cdir_t *_zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *error); + + +ZIP_EXTERN zip_t * +zip_open(const char *fn, int _flags, int *zep) { + zip_t *za; + zip_source_t *src; + struct zip_error error; + + zip_error_init(&error); + if ((src = zip_source_file_create(fn, 0, -1, &error)) == NULL) { + _zip_set_open_error(zep, &error, 0); + zip_error_fini(&error); + return NULL; + } + + if ((za = zip_open_from_source(src, _flags, &error)) == NULL) { + zip_source_free(src); + _zip_set_open_error(zep, &error, 0); + zip_error_fini(&error); + return NULL; + } + + zip_error_fini(&error); + return za; +} + + +ZIP_EXTERN zip_t * +zip_open_from_source(zip_source_t *src, int _flags, zip_error_t *error) { + static zip_int64_t needed_support_read = -1; + static zip_int64_t needed_support_write = -1; + + unsigned int flags; + zip_int64_t supported; + exists_t exists; + + if (_flags < 0 || src == NULL) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + flags = (unsigned int)_flags; + + supported = zip_source_supports(src); + if (needed_support_read == -1) { + needed_support_read = zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_SEEK, ZIP_SOURCE_TELL, ZIP_SOURCE_STAT, -1); + needed_support_write = zip_source_make_command_bitmap(ZIP_SOURCE_BEGIN_WRITE, ZIP_SOURCE_COMMIT_WRITE, ZIP_SOURCE_ROLLBACK_WRITE, ZIP_SOURCE_SEEK_WRITE, ZIP_SOURCE_TELL_WRITE, ZIP_SOURCE_REMOVE, -1); + } + if ((supported & needed_support_read) != needed_support_read) { + zip_error_set(error, ZIP_ER_OPNOTSUPP, 0); + return NULL; + } + if ((supported & needed_support_write) != needed_support_write) { + flags |= ZIP_RDONLY; + } + + if ((flags & (ZIP_RDONLY | ZIP_TRUNCATE)) == (ZIP_RDONLY | ZIP_TRUNCATE)) { + zip_error_set(error, ZIP_ER_RDONLY, 0); + return NULL; + } + + exists = _zip_file_exists(src, error); + switch (exists) { + case EXISTS_ERROR: + return NULL; + + case EXISTS_NOT: + if ((flags & ZIP_CREATE) == 0) { + zip_error_set(error, ZIP_ER_NOENT, 0); + return NULL; + } + return _zip_allocate_new(src, flags, error); + + default: { + zip_t *za; + if (flags & ZIP_EXCL) { + zip_error_set(error, ZIP_ER_EXISTS, 0); + return NULL; + } + if (zip_source_open(src) < 0) { + _zip_error_set_from_source(error, src); + return NULL; + } + + if (flags & ZIP_TRUNCATE) { + za = _zip_allocate_new(src, flags, error); + } + else { + /* ZIP_CREATE gets ignored if file exists and not ZIP_EXCL, just like open() */ + za = _zip_open(src, flags, error); + } + + if (za == NULL) { + zip_source_close(src); + return NULL; + } + return za; + } + } +} + + +zip_t * +_zip_open(zip_source_t *src, unsigned int flags, zip_error_t *error) { + zip_t *za; + zip_cdir_t *cdir; + struct zip_stat st; + zip_uint64_t len, idx; + + zip_stat_init(&st); + if (zip_source_stat(src, &st) < 0) { + _zip_error_set_from_source(error, src); + return NULL; + } + if ((st.valid & ZIP_STAT_SIZE) == 0) { + zip_error_set(error, ZIP_ER_SEEK, EOPNOTSUPP); + return NULL; + } + len = st.size; + + + if ((za = _zip_allocate_new(src, flags, error)) == NULL) { + return NULL; + } + + /* treat empty files as empty archives */ + if (len == 0 && zip_source_accept_empty(src)) { + return za; + } + + if ((cdir = _zip_find_central_dir(za, len)) == NULL) { + _zip_error_copy(error, &za->error); + /* keep src so discard does not get rid of it */ + zip_source_keep(src); + zip_discard(za); + return NULL; + } + + za->entry = cdir->entry; + za->nentry = cdir->nentry; + za->nentry_alloc = cdir->nentry_alloc; + za->comment_orig = cdir->comment; + + free(cdir); + + _zip_hash_reserve_capacity(za->names, za->nentry, &za->error); + + for (idx = 0; idx < za->nentry; idx++) { + const zip_uint8_t *name = _zip_string_get(za->entry[idx].orig->filename, NULL, 0, error); + if (name == NULL) { + /* keep src so discard does not get rid of it */ + zip_source_keep(src); + zip_discard(za); + return NULL; + } + + if (_zip_hash_add(za->names, name, idx, ZIP_FL_UNCHANGED, &za->error) == false) { + if (za->error.zip_err != ZIP_ER_EXISTS || (flags & ZIP_CHECKCONS)) { + _zip_error_copy(error, &za->error); + /* keep src so discard does not get rid of it */ + zip_source_keep(src); + zip_discard(za); + return NULL; + } + } + } + + za->ch_flags = za->flags; + + return za; +} + + +void +_zip_set_open_error(int *zep, const zip_error_t *err, int ze) { + if (err) { + ze = zip_error_code_zip(err); + if (zip_error_system_type(err) == ZIP_ET_SYS) { + errno = zip_error_code_system(err); + } + } + + if (zep) + *zep = ze; +} + + +/* _zip_readcdir: + tries to find a valid end-of-central-directory at the beginning of + buf, and then the corresponding central directory entries. + Returns a struct zip_cdir which contains the central directory + entries, or NULL if unsuccessful. */ + +static zip_cdir_t * +_zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_error_t *error) { + zip_cdir_t *cd; + zip_uint16_t comment_len; + zip_uint64_t i, left; + zip_uint64_t eocd_offset = _zip_buffer_offset(buffer); + zip_buffer_t *cd_buffer; + + if (_zip_buffer_left(buffer) < EOCDLEN) { + /* not enough bytes left for comment */ + zip_error_set(error, ZIP_ER_NOZIP, 0); + return NULL; + } + + /* check for end-of-central-dir magic */ + if (memcmp(_zip_buffer_get(buffer, 4), EOCD_MAGIC, 4) != 0) { + zip_error_set(error, ZIP_ER_NOZIP, 0); + return NULL; + } + + if (eocd_offset >= EOCD64LOCLEN && memcmp(_zip_buffer_data(buffer) + eocd_offset - EOCD64LOCLEN, EOCD64LOC_MAGIC, 4) == 0) { + _zip_buffer_set_offset(buffer, eocd_offset - EOCD64LOCLEN); + cd = _zip_read_eocd64(za->src, buffer, buf_offset, za->flags, error); + } + else { + _zip_buffer_set_offset(buffer, eocd_offset); + cd = _zip_read_eocd(buffer, buf_offset, za->flags, error); + } + + if (cd == NULL) + return NULL; + + _zip_buffer_set_offset(buffer, eocd_offset + 20); + comment_len = _zip_buffer_get_16(buffer); + + if (cd->offset + cd->size > buf_offset + eocd_offset) { + /* cdir spans past EOCD record */ + zip_error_set(error, ZIP_ER_INCONS, 0); + _zip_cdir_free(cd); + return NULL; + } + + if (comment_len || (za->open_flags & ZIP_CHECKCONS)) { + zip_uint64_t tail_len; + + _zip_buffer_set_offset(buffer, eocd_offset + EOCDLEN); + tail_len = _zip_buffer_left(buffer); + + if (tail_len < comment_len || ((za->open_flags & ZIP_CHECKCONS) && tail_len != comment_len)) { + zip_error_set(error, ZIP_ER_INCONS, 0); + _zip_cdir_free(cd); + return NULL; + } + + if (comment_len) { + if ((cd->comment = _zip_string_new(_zip_buffer_get(buffer, comment_len), comment_len, ZIP_FL_ENC_GUESS, error)) == NULL) { + _zip_cdir_free(cd); + return NULL; + } + } + } + + if (cd->offset >= buf_offset) { + zip_uint8_t *data; + /* if buffer already read in, use it */ + _zip_buffer_set_offset(buffer, cd->offset - buf_offset); + + if ((data = _zip_buffer_get(buffer, cd->size)) == NULL) { + zip_error_set(error, ZIP_ER_INCONS, 0); + _zip_cdir_free(cd); + return NULL; + } + if ((cd_buffer = _zip_buffer_new(data, cd->size)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + _zip_cdir_free(cd); + return NULL; + } + } + else { + cd_buffer = NULL; + + if (zip_source_seek(za->src, (zip_int64_t)cd->offset, SEEK_SET) < 0) { + _zip_error_set_from_source(error, za->src); + _zip_cdir_free(cd); + return NULL; + } + + /* possible consistency check: cd->offset = len-(cd->size+cd->comment_len+EOCDLEN) ? */ + if (zip_source_tell(za->src) != (zip_int64_t)cd->offset) { + zip_error_set(error, ZIP_ER_NOZIP, 0); + _zip_cdir_free(cd); + return NULL; + } + } + + left = (zip_uint64_t)cd->size; + i = 0; + while (left > 0) { + bool grown = false; + zip_int64_t entry_size; + + if (i == cd->nentry) { + /* InfoZIP has a hack to avoid using Zip64: it stores nentries % 0x10000 */ + /* This hack isn't applicable if we're using Zip64, or if there is no central directory entry following. */ + + if (cd->is_zip64 || left < CDENTRYSIZE) { + break; + } + + if (!_zip_cdir_grow(cd, 0x10000, error)) { + _zip_cdir_free(cd); + _zip_buffer_free(cd_buffer); + return NULL; + } + grown = true; + } + + if ((cd->entry[i].orig = _zip_dirent_new()) == NULL || (entry_size = _zip_dirent_read(cd->entry[i].orig, za->src, cd_buffer, false, error)) < 0) { + if (grown && zip_error_code_zip(error) == ZIP_ER_NOZIP) { + zip_error_set(error, ZIP_ER_INCONS, 0); + } + _zip_cdir_free(cd); + _zip_buffer_free(cd_buffer); + return NULL; + } + i++; + left -= (zip_uint64_t)entry_size; + } + + if (i != cd->nentry || left > 0) { + zip_error_set(error, ZIP_ER_INCONS, 0); + _zip_buffer_free(cd_buffer); + _zip_cdir_free(cd); + return NULL; + } + + if (za->open_flags & ZIP_CHECKCONS) { + bool ok; + + if (cd_buffer) { + ok = _zip_buffer_eof(cd_buffer); + } + else { + zip_int64_t offset = zip_source_tell(za->src); + + if (offset < 0) { + _zip_error_set_from_source(error, za->src); + _zip_cdir_free(cd); + return NULL; + } + ok = ((zip_uint64_t)offset == cd->offset + cd->size); + } + + if (!ok) { + zip_error_set(error, ZIP_ER_INCONS, 0); + _zip_buffer_free(cd_buffer); + _zip_cdir_free(cd); + return NULL; + } + } + + _zip_buffer_free(cd_buffer); + return cd; +} + + +/* _zip_checkcons: + Checks the consistency of the central directory by comparing central + directory entries with local headers and checking for plausible + file and header offsets. Returns -1 if not plausible, else the + difference between the lowest and the highest fileposition reached */ + +static zip_int64_t +_zip_checkcons(zip_t *za, zip_cdir_t *cd, zip_error_t *error) { + zip_uint64_t i; + zip_uint64_t min, max, j; + struct zip_dirent temp; + + _zip_dirent_init(&temp); + if (cd->nentry) { + max = cd->entry[0].orig->offset; + min = cd->entry[0].orig->offset; + } + else + min = max = 0; + + for (i = 0; i < cd->nentry; i++) { + if (cd->entry[i].orig->offset < min) + min = cd->entry[i].orig->offset; + if (min > (zip_uint64_t)cd->offset) { + zip_error_set(error, ZIP_ER_NOZIP, 0); + return -1; + } + + j = cd->entry[i].orig->offset + cd->entry[i].orig->comp_size + _zip_string_length(cd->entry[i].orig->filename) + LENTRYSIZE; + if (j > max) + max = j; + if (max > (zip_uint64_t)cd->offset) { + zip_error_set(error, ZIP_ER_NOZIP, 0); + return -1; + } + + if (zip_source_seek(za->src, (zip_int64_t)cd->entry[i].orig->offset, SEEK_SET) < 0) { + _zip_error_set_from_source(error, za->src); + return -1; + } + + if (_zip_dirent_read(&temp, za->src, NULL, true, error) == -1) { + _zip_dirent_finalize(&temp); + return -1; + } + + if (_zip_headercomp(cd->entry[i].orig, &temp) != 0) { + zip_error_set(error, ZIP_ER_INCONS, 0); + _zip_dirent_finalize(&temp); + return -1; + } + + cd->entry[i].orig->extra_fields = _zip_ef_merge(cd->entry[i].orig->extra_fields, temp.extra_fields); + cd->entry[i].orig->local_extra_fields_read = 1; + temp.extra_fields = NULL; + + _zip_dirent_finalize(&temp); + } + + return (max - min) < ZIP_INT64_MAX ? (zip_int64_t)(max - min) : ZIP_INT64_MAX; +} + + +/* _zip_headercomp: + compares a central directory entry and a local file header + Return 0 if they are consistent, -1 if not. */ + +static int +_zip_headercomp(const zip_dirent_t *central, const zip_dirent_t *local) { + if ((central->version_needed < local->version_needed) +#if 0 + /* some zip-files have different values in local + and global headers for the bitflags */ + || (central->bitflags != local->bitflags) +#endif + || (central->comp_method != local->comp_method) || (central->last_mod != local->last_mod) || !_zip_string_equal(central->filename, local->filename)) + return -1; + + if ((central->crc != local->crc) || (central->comp_size != local->comp_size) || (central->uncomp_size != local->uncomp_size)) { + /* InfoZip stores valid values in local header even when data descriptor is used. + This is in violation of the appnote. */ + if (((local->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) == 0 || local->crc != 0 || local->comp_size != 0 || local->uncomp_size != 0)) + return -1; + } + + return 0; +} + + +static zip_t * +_zip_allocate_new(zip_source_t *src, unsigned int flags, zip_error_t *error) { + zip_t *za; + + if ((za = _zip_new(error)) == NULL) { + return NULL; + } + + za->src = src; + za->open_flags = flags; + if (flags & ZIP_RDONLY) { + za->flags |= ZIP_AFL_RDONLY; + za->ch_flags |= ZIP_AFL_RDONLY; + } + return za; +} + + +/* + * tests for file existence + */ +static exists_t +_zip_file_exists(zip_source_t *src, zip_error_t *error) { + struct zip_stat st; + + zip_stat_init(&st); + if (zip_source_stat(src, &st) != 0) { + zip_error_t *src_error = zip_source_error(src); + if (zip_error_code_zip(src_error) == ZIP_ER_READ && zip_error_code_system(src_error) == ENOENT) { + return EXISTS_NOT; + } + _zip_error_copy(error, src_error); + return EXISTS_ERROR; + } + + return EXISTS_OK; +} + + +static zip_cdir_t * +_zip_find_central_dir(zip_t *za, zip_uint64_t len) { + zip_cdir_t *cdir, *cdirnew; + zip_uint8_t *match; + zip_int64_t buf_offset; + zip_uint64_t buflen; + zip_int64_t a; + zip_int64_t best; + zip_error_t error; + zip_buffer_t *buffer; + + if (len < EOCDLEN) { + zip_error_set(&za->error, ZIP_ER_NOZIP, 0); + return NULL; + } + + buflen = (len < CDBUFSIZE ? len : CDBUFSIZE); + if (zip_source_seek(za->src, -(zip_int64_t)buflen, SEEK_END) < 0) { + zip_error_t *src_error = zip_source_error(za->src); + if (zip_error_code_zip(src_error) != ZIP_ER_SEEK || zip_error_code_system(src_error) != EFBIG) { + /* seek before start of file on my machine */ + _zip_error_copy(&za->error, src_error); + return NULL; + } + } + if ((buf_offset = zip_source_tell(za->src)) < 0) { + _zip_error_set_from_source(&za->error, za->src); + return NULL; + } + + if ((buffer = _zip_buffer_new_from_source(za->src, buflen, NULL, &za->error)) == NULL) { + return NULL; + } + + best = -1; + cdir = NULL; + if (buflen >= CDBUFSIZE) { + /* EOCD64 locator is before EOCD, so leave place for it */ + _zip_buffer_set_offset(buffer, EOCD64LOCLEN); + } + zip_error_set(&error, ZIP_ER_NOZIP, 0); + + match = _zip_buffer_get(buffer, 0); + while ((match = _zip_memmem(match, _zip_buffer_left(buffer) - (EOCDLEN - 4), (const unsigned char *)EOCD_MAGIC, 4)) != NULL) { + _zip_buffer_set_offset(buffer, (zip_uint64_t)(match - _zip_buffer_data(buffer))); + if ((cdirnew = _zip_read_cdir(za, buffer, (zip_uint64_t)buf_offset, &error)) != NULL) { + if (cdir) { + if (best <= 0) { + best = _zip_checkcons(za, cdir, &error); + } + + a = _zip_checkcons(za, cdirnew, &error); + if (best < a) { + _zip_cdir_free(cdir); + cdir = cdirnew; + best = a; + } + else { + _zip_cdir_free(cdirnew); + } + } + else { + cdir = cdirnew; + if (za->open_flags & ZIP_CHECKCONS) + best = _zip_checkcons(za, cdir, &error); + else { + best = 0; + } + } + cdirnew = NULL; + } + + match++; + _zip_buffer_set_offset(buffer, (zip_uint64_t)(match - _zip_buffer_data(buffer))); + } + + _zip_buffer_free(buffer); + + if (best < 0) { + _zip_error_copy(&za->error, &error); + _zip_cdir_free(cdir); + return NULL; + } + + return cdir; +} + + +static unsigned char * +_zip_memmem(const unsigned char *big, size_t biglen, const unsigned char *little, size_t littlelen) { + const unsigned char *p; + + if ((biglen < littlelen) || (littlelen == 0)) + return NULL; + p = big - 1; + while ((p = (const unsigned char *)memchr(p + 1, little[0], (size_t)(big - (p + 1)) + (size_t)(biglen - littlelen) + 1)) != NULL) { + if (memcmp(p + 1, little + 1, littlelen - 1) == 0) + return (unsigned char *)p; + } + + return NULL; +} + + +static zip_cdir_t * +_zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *error) { + zip_cdir_t *cd; + zip_uint64_t i, nentry, size, offset, eocd_offset; + + if (_zip_buffer_left(buffer) < EOCDLEN) { + zip_error_set(error, ZIP_ER_INCONS, 0); + return NULL; + } + + eocd_offset = _zip_buffer_offset(buffer); + + _zip_buffer_get(buffer, 4); /* magic already verified */ + + if (_zip_buffer_get_32(buffer) != 0) { + zip_error_set(error, ZIP_ER_MULTIDISK, 0); + return NULL; + } + + /* number of cdir-entries on this disk */ + i = _zip_buffer_get_16(buffer); + /* number of cdir-entries */ + nentry = _zip_buffer_get_16(buffer); + + if (nentry != i) { + zip_error_set(error, ZIP_ER_NOZIP, 0); + return NULL; + } + + size = _zip_buffer_get_32(buffer); + offset = _zip_buffer_get_32(buffer); + + if (offset + size < offset) { + zip_error_set(error, ZIP_ER_SEEK, EFBIG); + return NULL; + } + + if (offset + size > buf_offset + eocd_offset) { + /* cdir spans past EOCD record */ + zip_error_set(error, ZIP_ER_INCONS, 0); + return NULL; + } + + if ((flags & ZIP_CHECKCONS) && offset + size != buf_offset + eocd_offset) { + zip_error_set(error, ZIP_ER_INCONS, 0); + return NULL; + } + + if ((cd = _zip_cdir_new(nentry, error)) == NULL) + return NULL; + + cd->is_zip64 = false; + cd->size = size; + cd->offset = offset; + + return cd; +} + + +static zip_cdir_t * +_zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *error) { + zip_cdir_t *cd; + zip_uint64_t offset; + zip_uint8_t eocd[EOCD64LEN]; + zip_uint64_t eocd_offset; + zip_uint64_t size, nentry, i, eocdloc_offset; + bool free_buffer; + zip_uint32_t num_disks, num_disks64, eocd_disk, eocd_disk64; + + eocdloc_offset = _zip_buffer_offset(buffer); + + _zip_buffer_get(buffer, 4); /* magic already verified */ + + num_disks = _zip_buffer_get_16(buffer); + eocd_disk = _zip_buffer_get_16(buffer); + eocd_offset = _zip_buffer_get_64(buffer); + + /* valid seek value for start of EOCD */ + if (eocd_offset > ZIP_INT64_MAX) { + zip_error_set(error, ZIP_ER_SEEK, EFBIG); + return NULL; + } + + /* does EOCD fit before EOCD locator? */ + if (eocd_offset + EOCD64LEN > eocdloc_offset + buf_offset) { + zip_error_set(error, ZIP_ER_INCONS, 0); + return NULL; + } + + /* make sure current position of buffer is beginning of EOCD */ + if (eocd_offset >= buf_offset && eocd_offset + EOCD64LEN <= buf_offset + _zip_buffer_size(buffer)) { + _zip_buffer_set_offset(buffer, eocd_offset - buf_offset); + free_buffer = false; + } + else { + if (zip_source_seek(src, (zip_int64_t)eocd_offset, SEEK_SET) < 0) { + _zip_error_set_from_source(error, src); + return NULL; + } + if ((buffer = _zip_buffer_new_from_source(src, EOCD64LEN, eocd, error)) == NULL) { + return NULL; + } + free_buffer = true; + } + + if (memcmp(_zip_buffer_get(buffer, 4), EOCD64_MAGIC, 4) != 0) { + zip_error_set(error, ZIP_ER_INCONS, 0); + if (free_buffer) { + _zip_buffer_free(buffer); + } + return NULL; + } + + /* size of EOCD */ + size = _zip_buffer_get_64(buffer); + + /* is there a hole between EOCD and EOCD locator, or do they overlap? */ + if ((flags & ZIP_CHECKCONS) && size + eocd_offset + 12 != buf_offset + eocdloc_offset) { + zip_error_set(error, ZIP_ER_INCONS, 0); + if (free_buffer) { + _zip_buffer_free(buffer); + } + return NULL; + } + + _zip_buffer_get(buffer, 4); /* skip version made by/needed */ + + num_disks64 = _zip_buffer_get_32(buffer); + eocd_disk64 = _zip_buffer_get_32(buffer); + + /* if eocd values are 0xffff, we have to use eocd64 values. + otherwise, if the values are not the same, it's inconsistent; + in any case, if the value is not 0, we don't support it */ + if (num_disks == 0xffff) { + num_disks = num_disks64; + } + if (eocd_disk == 0xffff) { + eocd_disk = eocd_disk64; + } + if ((flags & ZIP_CHECKCONS) && (eocd_disk != eocd_disk64 || num_disks != num_disks64)) { + zip_error_set(error, ZIP_ER_INCONS, 0); + if (free_buffer) { + _zip_buffer_free(buffer); + } + return NULL; + } + if (num_disks != 0 || eocd_disk != 0) { + zip_error_set(error, ZIP_ER_MULTIDISK, 0); + if (free_buffer) { + _zip_buffer_free(buffer); + } + return NULL; + } + + nentry = _zip_buffer_get_64(buffer); + i = _zip_buffer_get_64(buffer); + + if (nentry != i) { + zip_error_set(error, ZIP_ER_MULTIDISK, 0); + if (free_buffer) { + _zip_buffer_free(buffer); + } + return NULL; + } + + size = _zip_buffer_get_64(buffer); + offset = _zip_buffer_get_64(buffer); + + /* did we read past the end of the buffer? */ + if (!_zip_buffer_ok(buffer)) { + zip_error_set(error, ZIP_ER_INTERNAL, 0); + if (free_buffer) { + _zip_buffer_free(buffer); + } + return NULL; + } + + if (free_buffer) { + _zip_buffer_free(buffer); + } + + if (offset > ZIP_INT64_MAX || offset + size < offset) { + zip_error_set(error, ZIP_ER_SEEK, EFBIG); + return NULL; + } + if (offset + size > buf_offset + eocd_offset) { + /* cdir spans past EOCD record */ + zip_error_set(error, ZIP_ER_INCONS, 0); + return NULL; + } + if ((flags & ZIP_CHECKCONS) && offset + size != buf_offset + eocd_offset) { + zip_error_set(error, ZIP_ER_INCONS, 0); + return NULL; + } + + if (nentry > size / CDENTRYSIZE) { + zip_error_set(error, ZIP_ER_INCONS, 0); + return NULL; + } + + if ((cd = _zip_cdir_new(nentry, error)) == NULL) + return NULL; + + cd->is_zip64 = true; + cd->size = size; + cd->offset = offset; + + return cd; +} diff --git a/core/deps/libzip/lib/zip_pkware.c b/core/deps/libzip/lib/zip_pkware.c new file mode 100644 index 000000000..1b1b461a0 --- /dev/null +++ b/core/deps/libzip/lib/zip_pkware.c @@ -0,0 +1,112 @@ +/* + zip_pkware.c -- Traditional PKWARE de/encryption backend routines + Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include +#include + +#include "zipint.h" + +#define PKWARE_KEY0 305419896 +#define PKWARE_KEY1 591751049 +#define PKWARE_KEY2 878082192 + + +static void +update_keys(zip_pkware_keys_t *keys, zip_uint8_t b) { + keys->key[0] = (zip_uint32_t)crc32(keys->key[0] ^ 0xffffffffUL, &b, 1) ^ 0xffffffffUL; + keys->key[1] = (keys->key[1] + (keys->key[0] & 0xff)) * 134775813 + 1; + b = (zip_uint8_t)(keys->key[1] >> 24); + keys->key[2] = (zip_uint32_t)crc32(keys->key[2] ^ 0xffffffffUL, &b, 1) ^ 0xffffffffUL; +} + + +static zip_uint8_t +crypt_byte(zip_pkware_keys_t *keys) { + zip_uint16_t tmp; + tmp = (zip_uint16_t)(keys->key[2] | 2); + tmp = (zip_uint16_t)(((zip_uint32_t)tmp * (tmp ^ 1)) >> 8); + return (zip_uint8_t)tmp; +} + + +void +_zip_pkware_keys_reset(zip_pkware_keys_t *keys) { + keys->key[0] = PKWARE_KEY0; + keys->key[1] = PKWARE_KEY1; + keys->key[2] = PKWARE_KEY2; +} + + +void +_zip_pkware_encrypt(zip_pkware_keys_t *keys, zip_uint8_t *out, const zip_uint8_t *in, zip_uint64_t len) { + zip_uint64_t i; + zip_uint8_t b; + zip_uint8_t tmp; + + for (i = 0; i < len; i++) { + b = in[i]; + + if (out != NULL) { + tmp = crypt_byte(keys); + update_keys(keys, b); + b ^= tmp; + out[i] = b; + } + else { + /* during initialization, we're only interested in key updates */ + update_keys(keys, b); + } + } +} + + +void +_zip_pkware_decrypt(zip_pkware_keys_t *keys, zip_uint8_t *out, const zip_uint8_t *in, zip_uint64_t len) { + zip_uint64_t i; + zip_uint8_t b; + zip_uint8_t tmp; + + for (i = 0; i < len; i++) { + b = in[i]; + + /* during initialization, we're only interested in key updates */ + if (out != NULL) { + tmp = crypt_byte(keys); + b ^= tmp; + out[i] = b; + } + + update_keys(keys, b); + } +} diff --git a/core/deps/libzip/lib/zip_progress.c b/core/deps/libzip/lib/zip_progress.c new file mode 100644 index 000000000..a881df476 --- /dev/null +++ b/core/deps/libzip/lib/zip_progress.c @@ -0,0 +1,293 @@ +/* + zip_progress.c -- progress reporting + Copyright (C) 2017-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#include + + +#define _ZIP_COMPILING_DEPRECATED +#include "zipint.h" + +struct zip_progress { + zip_t *za; + + zip_progress_callback callback_progress; + void (*ud_progress_free)(void *); + void *ud_progress; + + zip_cancel_callback callback_cancel; + void (*ud_cancel_free)(void *); + void *ud_cancel; + + double precision; + + /* state */ + double last_update; /* last value callback function was called with */ + + double start; /* start of sub-progress section */ + double end; /* end of sub-progress section */ +}; + +static void _zip_progress_free_cancel_callback(zip_progress_t *progress); +static void _zip_progress_free_progress_callback(zip_progress_t *progress); +static zip_progress_t *_zip_progress_new(zip_t *za); +static void _zip_progress_set_cancel_callback(zip_progress_t *progress, zip_cancel_callback callback, void (*ud_free)(void *), void *ud); +static void _zip_progress_set_progress_callback(zip_progress_t *progress, double precision, zip_progress_callback callback, void (*ud_free)(void *), void *ud); + +void +_zip_progress_end(zip_progress_t *progress) { + _zip_progress_update(progress, 1.0); +} + + +void +_zip_progress_free(zip_progress_t *progress) { + if (progress == NULL) { + return; + } + + _zip_progress_free_progress_callback(progress); + _zip_progress_free_cancel_callback(progress); + + free(progress); +} + + +static zip_progress_t * +_zip_progress_new(zip_t *za) { + zip_progress_t *progress = (zip_progress_t *)malloc(sizeof(*progress)); + + if (progress == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; + } + + progress->za = za; + + progress->callback_progress = NULL; + progress->ud_progress_free = NULL; + progress->ud_progress = NULL; + progress->precision = 0.0; + + progress->callback_cancel = NULL; + progress->ud_cancel_free = NULL; + progress->ud_cancel = NULL; + + return progress; +} + +static void +_zip_progress_free_progress_callback(zip_progress_t *progress) { + if (progress->ud_progress_free) { + progress->ud_progress_free(progress->ud_progress); + } + + progress->callback_progress = NULL; + progress->ud_progress = NULL; + progress->ud_progress_free = NULL; +} + +static void +_zip_progress_free_cancel_callback(zip_progress_t *progress) { + if (progress->ud_cancel_free) { + progress->ud_cancel_free(progress->ud_cancel); + } + + progress->callback_cancel = NULL; + progress->ud_cancel = NULL; + progress->ud_cancel_free = NULL; +} + +static void +_zip_progress_set_progress_callback(zip_progress_t *progress, double precision, zip_progress_callback callback, void (*ud_free)(void *), void *ud) { + _zip_progress_free_progress_callback(progress); + + progress->callback_progress = callback; + progress->ud_progress_free = ud_free; + progress->ud_progress = ud; + progress->precision = precision; +} + +void +_zip_progress_set_cancel_callback(zip_progress_t *progress, zip_cancel_callback callback, void (*ud_free)(void *), void *ud) { + _zip_progress_free_cancel_callback(progress); + + progress->callback_cancel = callback; + progress->ud_cancel_free = ud_free; + progress->ud_cancel = ud; +} + +int +_zip_progress_start(zip_progress_t *progress) { + if (progress == NULL) { + return 0; + } + + if (progress->callback_progress != NULL) { + progress->last_update = 0.0; + progress->callback_progress(progress->za, 0.0, progress->ud_progress); + } + + if (progress->callback_cancel != NULL) { + if (progress->callback_cancel(progress->za, progress->ud_cancel)) { + return -1; + } + } + + return 0; +} + + +int +_zip_progress_subrange(zip_progress_t *progress, double start, double end) { + if (progress == NULL) { + return 0; + } + + progress->start = start; + progress->end = end; + + return _zip_progress_update(progress, 0.0); +} + +int +_zip_progress_update(zip_progress_t *progress, double sub_current) { + double current; + + if (progress == NULL) { + return 0; + } + + if (progress->callback_progress != NULL) { + current = ZIP_MIN(ZIP_MAX(sub_current, 0.0), 1.0) * (progress->end - progress->start) + progress->start; + + if (current - progress->last_update > progress->precision) { + progress->callback_progress(progress->za, current, progress->ud_progress); + progress->last_update = current; + } + } + + if (progress->callback_cancel != NULL) { + if (progress->callback_cancel(progress->za, progress->ud_cancel)) { + return -1; + } + } + + return 0; +} + + +ZIP_EXTERN int +zip_register_progress_callback_with_state(zip_t *za, double precision, zip_progress_callback callback, void (*ud_free)(void *), void *ud) { + if (callback != NULL) { + if (za->progress == NULL) { + if ((za->progress = _zip_progress_new(za)) == NULL) { + return -1; + } + } + + _zip_progress_set_progress_callback(za->progress, precision, callback, ud_free, ud); + } + else { + if (za->progress != NULL) { + if (za->progress->callback_cancel == NULL) { + _zip_progress_free(za->progress); + za->progress = NULL; + } + else { + _zip_progress_free_progress_callback(za->progress); + } + } + } + + return 0; +} + + +ZIP_EXTERN int +zip_register_cancel_callback_with_state(zip_t *za, zip_cancel_callback callback, void (*ud_free)(void *), void *ud) { + if (callback != NULL) { + if (za->progress == NULL) { + if ((za->progress = _zip_progress_new(za)) == NULL) { + return -1; + } + } + + _zip_progress_set_cancel_callback(za->progress, callback, ud_free, ud); + } + else { + if (za->progress != NULL) { + if (za->progress->callback_progress == NULL) { + _zip_progress_free(za->progress); + za->progress = NULL; + } + else { + _zip_progress_free_cancel_callback(za->progress); + } + } + } + + return 0; +} + + +struct legacy_ud { + zip_progress_callback_t callback; +}; + + +static void +_zip_legacy_progress_callback(zip_t *za, double progress, void *vud) { + struct legacy_ud *ud = (struct legacy_ud *)vud; + + ud->callback(progress); +} + +ZIP_EXTERN void +zip_register_progress_callback(zip_t *za, zip_progress_callback_t progress_callback) { + struct legacy_ud *ud; + + if (progress_callback == NULL) { + zip_register_progress_callback_with_state(za, 0, NULL, NULL, NULL); + } + + if ((ud = (struct legacy_ud *)malloc(sizeof(*ud))) == NULL) { + return; + } + + ud->callback = progress_callback; + + if (zip_register_progress_callback_with_state(za, 0.001, _zip_legacy_progress_callback, free, ud) < 0) { + free(ud); + } +} diff --git a/core/deps/libzip/lib/zip_random_unix.c b/core/deps/libzip/lib/zip_random_unix.c new file mode 100644 index 000000000..4aa9cc26e --- /dev/null +++ b/core/deps/libzip/lib/zip_random_unix.c @@ -0,0 +1,104 @@ +/* + zip_random_unix.c -- fill the user's buffer with random stuff (Unix version) + Copyright (C) 2016-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zipint.h" + +#ifdef HAVE_CRYPTO +#include "zip_crypto.h" +#endif + +#ifdef HAVE_ARC4RANDOM + +#include + +#ifndef HAVE_SECURE_RANDOM +ZIP_EXTERN bool +zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) { + arc4random_buf(buffer, length); + return true; +} +#endif + +#ifndef HAVE_RANDOM_UINT32 +zip_uint32_t +zip_random_uint32(void) { + return arc4random(); +} +#endif + +#else /* HAVE_ARC4RANDOM */ + +#ifndef HAVE_SECURE_RANDOM +#include +#include + +ZIP_EXTERN bool +zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) { + int fd; + + if ((fd = open("/dev/urandom", O_RDONLY)) < 0) { + return false; + } + + if (read(fd, buffer, length) != length) { + close(fd); + return false; + } + + close(fd); + return true; +} +#endif + +#ifndef HAVE_RANDOM_UINT32 +#include + +zip_uint32_t +zip_random_uint32(void) { + static bool seeded = false; + + zip_uint32_t value; + + if (zip_secure_random((zip_uint8_t *)&value, sizeof(value))) { + return value; + } + + if (!seeded) { + srandom((unsigned int)time(NULL)); + } + + return (zip_uint32_t)random(); +} +#endif + +#endif /* HAVE_ARC4RANDOM */ diff --git a/core/deps/libzip/lib/zip_random_uwp.c b/core/deps/libzip/lib/zip_random_uwp.c new file mode 100644 index 000000000..77cc9c140 --- /dev/null +++ b/core/deps/libzip/lib/zip_random_uwp.c @@ -0,0 +1,82 @@ +/* + zip_random_uwp.c -- fill the user's buffer with random stuff (UWP version) + Copyright (C) 2017-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zipint.h" + +#ifdef HAVE_CRYPTO +#include "zip_crypto.h" +#endif + +#ifndef HAVE_SECURE_RANDOM + +#include +#include +#include + +ZIP_EXTERN bool +zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) { + BCRYPT_ALG_HANDLE hAlg = NULL; + NTSTATUS hr = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_RNG_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0); + if (hr != STATUS_SUCCESS || hAlg == NULL) { + return false; + } + hr = BCryptGenRandom(&hAlg, buffer, length, 0); + BCryptCloseAlgorithmProvider(&hAlg, 0); + if (hr != STATUS_SUCCESS) { + return false; + } + return true; +} + +#endif + +#ifndef HAVE_RANDOM_UINT32 +#include + +zip_uint32_t +zip_random_uint32(void) { + static bool seeded = false; + + zip_uint32_t value; + + if (zip_secure_random((zip_uint8_t *)&value, sizeof(value))) { + return value; + } + + if (!seeded) { + srand((unsigned int)time(NULL)); + } + + return (zip_uint32_t)rand(); +} +#endif diff --git a/core/deps/libzip/zip_error.c b/core/deps/libzip/lib/zip_random_win32.c similarity index 61% rename from core/deps/libzip/zip_error.c rename to core/deps/libzip/lib/zip_random_win32.c index aab707945..251735778 100644 --- a/core/deps/libzip/zip_error.c +++ b/core/deps/libzip/lib/zip_random_win32.c @@ -1,6 +1,6 @@ /* - zip_error.c -- struct zip_error helper functions - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + zip_random_win32.c -- fill the user's buffer with random stuff (Windows version) + Copyright (C) 2016-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,71 +31,51 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - -#include - #include "zipint.h" - +#ifdef HAVE_CRYPTO +#include "zip_crypto.h" +#endif -void -_zip_error_clear(struct zip_error *err) -{ - err->zip_err = ZIP_ER_OK; - err->sys_err = 0; -} +#include - +#ifndef HAVE_SECURE_RANDOM -void -_zip_error_copy(struct zip_error *dst, struct zip_error *src) -{ - dst->zip_err = src->zip_err; - dst->sys_err = src->sys_err; -} +#include - - -void -_zip_error_fini(struct zip_error *err) -{ - free(err->str); - err->str = NULL; -} - - - -void -_zip_error_get(struct zip_error *err, int *zep, int *sep) -{ - if (zep) - *zep = err->zip_err; - if (sep) { - if (zip_error_get_sys_type(err->zip_err) != ZIP_ET_NONE) - *sep = err->sys_err; - else - *sep = 0; +ZIP_EXTERN bool +zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) { + HCRYPTPROV hprov; + if (!CryptAcquireContext(&hprov, NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) { + return false; } -} - - - -void -_zip_error_init(struct zip_error *err) -{ - err->zip_err = ZIP_ER_OK; - err->sys_err = 0; - err->str = NULL; -} - - - -void -_zip_error_set(struct zip_error *err, int ze, int se) -{ - if (err) { - err->zip_err = ze; - err->sys_err = se; + if (!CryptGenRandom(hprov, length, buffer)) { + return false; } + if (!CryptReleaseContext(hprov, 0)) { + return false; + } + return true; } +#endif + +#ifndef HAVE_RANDOM_UINT32 +#include + +zip_uint32_t +zip_random_uint32(void) { + static bool seeded = false; + + zip_uint32_t value; + + if (zip_secure_random((zip_uint8_t *)&value, sizeof(value))) { + return value; + } + + if (!seeded) { + srand((unsigned int)time(NULL)); + } + + return (zip_uint32_t)rand(); +} +#endif diff --git a/core/deps/libzip/zip_set_archive_flag.c b/core/deps/libzip/lib/zip_rename.c similarity index 85% rename from core/deps/libzip/zip_set_archive_flag.c rename to core/deps/libzip/lib/zip_rename.c index 720e1f350..eb1b3956b 100644 --- a/core/deps/libzip/zip_set_archive_flag.c +++ b/core/deps/libzip/lib/zip_rename.c @@ -1,6 +1,6 @@ /* - zip_get_archive_flag.c -- set archive global flag - Copyright (C) 2008 Dieter Baron and Thomas Klausner + zip_rename.c -- rename file in zip archive + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,19 +31,12 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" - ZIP_EXTERN int -zip_set_archive_flag(struct zip *za, int flag, int value) -{ - if (value) - za->ch_flags |= flag; - else - za->ch_flags &= ~flag; - - return 0; +zip_rename(zip_t *za, zip_uint64_t idx, const char *name) { + return zip_file_rename(za, idx, name, 0); } diff --git a/core/deps/libzip/zip_entry_free.c b/core/deps/libzip/lib/zip_replace.c similarity index 82% rename from core/deps/libzip/zip_entry_free.c rename to core/deps/libzip/lib/zip_replace.c index c50c9434b..2140223ac 100644 --- a/core/deps/libzip/zip_entry_free.c +++ b/core/deps/libzip/lib/zip_replace.c @@ -1,6 +1,6 @@ /* - zip_entry_free.c -- free struct zip_entry - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + zip_replace.c -- replace file via callback function + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,22 +31,12 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - -#include +#define _ZIP_COMPILING_DEPRECATED #include "zipint.h" - -void -_zip_entry_free(struct zip_entry *ze) -{ - free(ze->ch_filename); - ze->ch_filename = NULL; - free(ze->ch_comment); - ze->ch_comment = NULL; - ze->ch_comment_len = -1; - - _zip_unchange_data(ze); +ZIP_EXTERN int +zip_replace(zip_t *za, zip_uint64_t idx, zip_source_t *source) { + return zip_file_replace(za, idx, source, 0); } diff --git a/core/deps/libzip/lib/zip_set_archive_comment.c b/core/deps/libzip/lib/zip_set_archive_comment.c new file mode 100644 index 000000000..ce0c5d38a --- /dev/null +++ b/core/deps/libzip/lib/zip_set_archive_comment.c @@ -0,0 +1,80 @@ +/* + zip_set_archive_comment.c -- set archive comment + Copyright (C) 2006-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include + +#include "zipint.h" + + +ZIP_EXTERN int +zip_set_archive_comment(zip_t *za, const char *comment, zip_uint16_t len) { + zip_string_t *cstr; + + if (ZIP_IS_RDONLY(za)) { + zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (len > 0 && comment == NULL) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (len > 0) { + if ((cstr = _zip_string_new((const zip_uint8_t *)comment, len, ZIP_FL_ENC_GUESS, &za->error)) == NULL) + return -1; + + if (_zip_guess_encoding(cstr, ZIP_ENCODING_UNKNOWN) == ZIP_ENCODING_CP437) { + _zip_string_free(cstr); + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + } + else + cstr = NULL; + + _zip_string_free(za->comment_changes); + za->comment_changes = NULL; + + if (((za->comment_orig && _zip_string_equal(za->comment_orig, cstr)) || (za->comment_orig == NULL && cstr == NULL))) { + _zip_string_free(cstr); + za->comment_changed = 0; + } + else { + za->comment_changes = cstr; + za->comment_changed = 1; + } + + return 0; +} diff --git a/core/deps/libzip/zip_set_file_comment.c b/core/deps/libzip/lib/zip_set_archive_flag.c similarity index 69% rename from core/deps/libzip/zip_set_file_comment.c rename to core/deps/libzip/lib/zip_set_archive_flag.c index bc1938e1d..fe9f62ff0 100644 --- a/core/deps/libzip/zip_set_file_comment.c +++ b/core/deps/libzip/lib/zip_set_archive_flag.c @@ -1,6 +1,6 @@ /* - zip_set_file_comment.c -- set comment for file in archive - Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner + zip_get_archive_flag.c -- set archive global flag + Copyright (C) 2008-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,36 +31,35 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - -#include #include "zipint.h" - ZIP_EXTERN int -zip_set_file_comment(struct zip *za, int idx, const char *comment, int len) -{ - char *tmpcom; +zip_set_archive_flag(zip_t *za, zip_flags_t flag, int value) { + unsigned int new_flags; - if (idx < 0 || idx >= za->nentry - || len < 0 || len > MAXCOMLEN - || (len > 0 && comment == NULL)) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; - } - - if (len > 0) { - if ((tmpcom=(char *)_zip_memdup(comment, len, &za->error)) == NULL) - return -1; - } + if (value) + new_flags = za->ch_flags | flag; else - tmpcom = NULL; + new_flags = za->ch_flags & ~flag; + + if (new_flags == za->ch_flags) + return 0; + + if (ZIP_IS_RDONLY(za)) { + zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if ((flag & ZIP_AFL_RDONLY) && value && (za->ch_flags & ZIP_AFL_RDONLY) == 0) { + if (_zip_changed(za, NULL)) { + zip_error_set(&za->error, ZIP_ER_CHANGED, 0); + return -1; + } + } + + za->ch_flags = new_flags; - free(za->entry[idx].ch_comment); - za->entry[idx].ch_comment = tmpcom; - za->entry[idx].ch_comment_len = len; - return 0; } diff --git a/core/deps/libzip/zip_set_archive_comment.c b/core/deps/libzip/lib/zip_set_default_password.c similarity index 74% rename from core/deps/libzip/zip_set_archive_comment.c rename to core/deps/libzip/lib/zip_set_default_password.c index 343fa5491..d89394927 100644 --- a/core/deps/libzip/zip_set_archive_comment.c +++ b/core/deps/libzip/lib/zip_set_default_password.c @@ -1,6 +1,6 @@ /* - zip_set_archive_comment.c -- set archive comment - Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner + zip_set_default_password.c -- set default password for decryption + Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,35 +31,28 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include +#include #include "zipint.h" - ZIP_EXTERN int -zip_set_archive_comment(struct zip *za, const char *comment, int len) -{ - char *tmpcom; +zip_set_default_password(zip_t *za, const char *passwd) { + if (za == NULL) + return -1; - if (len < 0 || len > MAXCOMLEN - || (len > 0 && comment == NULL)) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; - } + free(za->default_password); - if (len > 0) { - if ((tmpcom=(char *)_zip_memdup(comment, len, &za->error)) == NULL) - return -1; + if (passwd && passwd[0] != '\0') { + if ((za->default_password = strdup(passwd)) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } } else - tmpcom = NULL; + za->default_password = NULL; - free(za->ch_comment); - za->ch_comment = tmpcom; - za->ch_comment_len = len; - return 0; } diff --git a/core/deps/libzip/lib/zip_set_file_comment.c b/core/deps/libzip/lib/zip_set_file_comment.c new file mode 100644 index 000000000..d19121fa1 --- /dev/null +++ b/core/deps/libzip/lib/zip_set_file_comment.c @@ -0,0 +1,46 @@ +/* + zip_set_file_comment.c -- set comment for file in archive + Copyright (C) 2006-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#define _ZIP_COMPILING_DEPRECATED +#include "zipint.h" + + +ZIP_EXTERN int +zip_set_file_comment(zip_t *za, zip_uint64_t idx, const char *comment, int len) { + if (len < 0 || len > ZIP_UINT16_MAX) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + return zip_file_set_comment(za, idx, comment, (zip_uint16_t)len, 0); +} diff --git a/core/deps/libzip/lib/zip_set_file_compression.c b/core/deps/libzip/lib/zip_set_file_compression.c new file mode 100644 index 000000000..511c7d515 --- /dev/null +++ b/core/deps/libzip/lib/zip_set_file_compression.c @@ -0,0 +1,91 @@ +/* + zip_set_file_compression.c -- set compression for file in archive + Copyright (C) 2012-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +ZIP_EXTERN int +zip_set_file_compression(zip_t *za, zip_uint64_t idx, zip_int32_t method, zip_uint32_t flags) { + zip_entry_t *e; + zip_int32_t old_method; + + if (idx >= za->nentry || flags > 9) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (ZIP_IS_RDONLY(za)) { + zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (!zip_compression_method_supported(method, true)) { + zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); + return -1; + } + + e = za->entry + idx; + + old_method = (e->orig == NULL ? ZIP_CM_DEFAULT : e->orig->comp_method); + + /* TODO: do we want to recompress if level is set? Only if it's + * different than what bit flags tell us, but those are not + * defined for all compression methods, or not directly mappable + * to levels */ + + if (method == old_method) { + if (e->changes) { + e->changes->changed &= ~ZIP_DIRENT_COMP_METHOD; + e->changes->compression_level = 0; + if (e->changes->changed == 0) { + _zip_dirent_free(e->changes); + e->changes = NULL; + } + } + } + else { + if (e->changes == NULL) { + if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + } + + e->changes->comp_method = method; + e->changes->compression_level = (zip_uint16_t)flags; + e->changes->changed |= ZIP_DIRENT_COMP_METHOD; + } + + return 0; +} diff --git a/core/deps/libzip/lib/zip_set_name.c b/core/deps/libzip/lib/zip_set_name.c new file mode 100644 index 000000000..52676857e --- /dev/null +++ b/core/deps/libzip/lib/zip_set_name.c @@ -0,0 +1,157 @@ +/* + zip_set_name.c -- rename helper function + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include +#include + +#include "zipint.h" + + +int +_zip_set_name(zip_t *za, zip_uint64_t idx, const char *name, zip_flags_t flags) { + zip_entry_t *e; + zip_string_t *str; + bool same_as_orig; + zip_int64_t i; + const zip_uint8_t *old_name, *new_name; + zip_string_t *old_str; + + if (idx >= za->nentry) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (ZIP_IS_RDONLY(za)) { + zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (name && name[0] != '\0') { + /* TODO: check for string too long */ + if ((str = _zip_string_new((const zip_uint8_t *)name, (zip_uint16_t)strlen(name), flags, &za->error)) == NULL) + return -1; + if ((flags & ZIP_FL_ENCODING_ALL) == ZIP_FL_ENC_GUESS && _zip_guess_encoding(str, ZIP_ENCODING_UNKNOWN) == ZIP_ENCODING_UTF8_GUESSED) + str->encoding = ZIP_ENCODING_UTF8_KNOWN; + } + else + str = NULL; + + /* TODO: encoding flags needed for CP437? */ + if ((i = _zip_name_locate(za, name, 0, NULL)) >= 0 && (zip_uint64_t)i != idx) { + _zip_string_free(str); + zip_error_set(&za->error, ZIP_ER_EXISTS, 0); + return -1; + } + + /* no effective name change */ + if (i >= 0 && (zip_uint64_t)i == idx) { + _zip_string_free(str); + return 0; + } + + e = za->entry + idx; + + if (e->orig) + same_as_orig = _zip_string_equal(e->orig->filename, str); + else + same_as_orig = false; + + if (!same_as_orig && e->changes == NULL) { + if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + _zip_string_free(str); + return -1; + } + } + + if ((new_name = _zip_string_get(same_as_orig ? e->orig->filename : str, NULL, 0, &za->error)) == NULL) { + _zip_string_free(str); + return -1; + } + + if (e->changes) { + old_str = e->changes->filename; + } + else if (e->orig) { + old_str = e->orig->filename; + } + else { + old_str = NULL; + } + + if (old_str) { + if ((old_name = _zip_string_get(old_str, NULL, 0, &za->error)) == NULL) { + _zip_string_free(str); + return -1; + } + } + else { + old_name = NULL; + } + + if (_zip_hash_add(za->names, new_name, idx, 0, &za->error) == false) { + _zip_string_free(str); + return -1; + } + if (old_name) { + _zip_hash_delete(za->names, old_name, NULL); + } + + if (same_as_orig) { + if (e->changes) { + if (e->changes->changed & ZIP_DIRENT_FILENAME) { + _zip_string_free(e->changes->filename); + e->changes->changed &= ~ZIP_DIRENT_FILENAME; + if (e->changes->changed == 0) { + _zip_dirent_free(e->changes); + e->changes = NULL; + } + else { + /* TODO: what if not cloned? can that happen? */ + e->changes->filename = e->orig->filename; + } + } + } + _zip_string_free(str); + } + else { + if (e->changes->changed & ZIP_DIRENT_FILENAME) { + _zip_string_free(e->changes->filename); + } + e->changes->changed |= ZIP_DIRENT_FILENAME; + e->changes->filename = str; + } + + return 0; +} diff --git a/core/deps/libzip/lib/zip_source_accept_empty.c b/core/deps/libzip/lib/zip_source_accept_empty.c new file mode 100644 index 000000000..754b80b76 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_accept_empty.c @@ -0,0 +1,52 @@ +/* + zip_source_accept_empty.c -- if empty source is a valid archive + Copyright (C) 2019-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +bool +zip_source_accept_empty(zip_source_t *src) { + int ret; + + if ((zip_source_supports(src) & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_ACCEPT_EMPTY)) == 0) { + if (ZIP_SOURCE_IS_LAYERED(src)) { + return zip_source_accept_empty(src->src); + } + return true; + } + + ret = (int)_zip_source_call(src, NULL, 0, ZIP_SOURCE_ACCEPT_EMPTY); + + return ret != 0; +} diff --git a/core/deps/libzip/lib/zip_source_begin_write.c b/core/deps/libzip/lib/zip_source_begin_write.c new file mode 100644 index 000000000..3981dc1f9 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_begin_write.c @@ -0,0 +1,52 @@ +/* + zip_source_begin_write.c -- start a new file for writing + Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +ZIP_EXTERN int +zip_source_begin_write(zip_source_t *src) { + if (ZIP_SOURCE_IS_OPEN_WRITING(src)) { + zip_error_set(&src->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (_zip_source_call(src, NULL, 0, ZIP_SOURCE_BEGIN_WRITE) < 0) { + return -1; + } + + src->write_state = ZIP_SOURCE_WRITE_OPEN; + + return 0; +} diff --git a/core/deps/libzip/zip_source_function.c b/core/deps/libzip/lib/zip_source_begin_write_cloning.c similarity index 75% rename from core/deps/libzip/zip_source_function.c rename to core/deps/libzip/lib/zip_source_begin_write_cloning.c index 91b183cb6..bfc63c8a6 100644 --- a/core/deps/libzip/zip_source_function.c +++ b/core/deps/libzip/lib/zip_source_begin_write_cloning.c @@ -1,6 +1,6 @@ /* - zip_source_function.c -- create zip data source from callback function - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + zip_source_begin_write_cloning.c -- clone part of file for writing + Copyright (C) 2017-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,29 +31,22 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - -#include #include "zipint.h" - -ZIP_EXTERN struct zip_source * -zip_source_function(struct zip *za, zip_source_callback zcb, void *ud) -{ - struct zip_source *zs; - - if (za == NULL) - return NULL; - - if ((zs=(struct zip_source *)malloc(sizeof(*zs))) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return NULL; +ZIP_EXTERN int +zip_source_begin_write_cloning(zip_source_t *src, zip_uint64_t offset) { + if (ZIP_SOURCE_IS_OPEN_WRITING(src)) { + zip_error_set(&src->error, ZIP_ER_INVAL, 0); + return -1; } - zs->f = zcb; - zs->ud = ud; - - return zs; + if (_zip_source_call(src, NULL, offset, ZIP_SOURCE_BEGIN_WRITE_CLONING) < 0) { + return -1; + } + + src->write_state = ZIP_SOURCE_WRITE_OPEN; + + return 0; } diff --git a/core/deps/libzip/lib/zip_source_buffer.c b/core/deps/libzip/lib/zip_source_buffer.c new file mode 100644 index 000000000..a54c4fc84 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_buffer.c @@ -0,0 +1,620 @@ +/* + zip_source_buffer.c -- create zip data source from buffer + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include + +#include "zipint.h" + +#ifndef WRITE_FRAGMENT_SIZE +#define WRITE_FRAGMENT_SIZE (64 * 1024) +#endif + +struct buffer { + zip_buffer_fragment_t *fragments; /* fragments */ + zip_uint64_t *fragment_offsets; /* offset of each fragment from start of buffer, nfragments+1 entries */ + zip_uint64_t nfragments; /* number of allocated fragments */ + zip_uint64_t fragments_capacity; /* size of fragments (number of pointers) */ + + zip_uint64_t first_owned_fragment; /* first fragment to free data from */ + + zip_uint64_t shared_fragments; /* number of shared fragments */ + struct buffer *shared_buffer; /* buffer fragments are shared with */ + zip_uint64_t size; /* size of buffer */ + + zip_uint64_t offset; /* current offset in buffer */ + zip_uint64_t current_fragment; /* fragment current offset is in */ +}; + +typedef struct buffer buffer_t; + +struct read_data { + zip_error_t error; + time_t mtime; + zip_file_attributes_t attributes; + buffer_t *in; + buffer_t *out; +}; + +#define buffer_capacity(buffer) ((buffer)->fragment_offsets[(buffer)->nfragments]) +#define buffer_size(buffer) ((buffer)->size) + +static buffer_t *buffer_clone(buffer_t *buffer, zip_uint64_t length, zip_error_t *error); +static zip_uint64_t buffer_find_fragment(const buffer_t *buffer, zip_uint64_t offset); +static void buffer_free(buffer_t *buffer); +static bool buffer_grow_fragments(buffer_t *buffer, zip_uint64_t capacity, zip_error_t *error); +static buffer_t *buffer_new(const zip_buffer_fragment_t *fragments, zip_uint64_t nfragments, int free_data, zip_error_t *error); +static zip_int64_t buffer_read(buffer_t *buffer, zip_uint8_t *data, zip_uint64_t length); +static int buffer_seek(buffer_t *buffer, void *data, zip_uint64_t len, zip_error_t *error); +static zip_int64_t buffer_write(buffer_t *buffer, const zip_uint8_t *data, zip_uint64_t length, zip_error_t *); + +static zip_int64_t read_data(void *, void *, zip_uint64_t, zip_source_cmd_t); + +zip_source_t *zip_source_buffer_with_attributes_create(const void *data, zip_uint64_t len, int freep, zip_file_attributes_t *attributes, zip_error_t *error); +zip_source_t *zip_source_buffer_fragment_with_attributes_create(const zip_buffer_fragment_t *fragments, zip_uint64_t nfragments, int freep, zip_file_attributes_t *attributes, zip_error_t *error); + + +ZIP_EXTERN zip_source_t * +zip_source_buffer(zip_t *za, const void *data, zip_uint64_t len, int freep) { + if (za == NULL) + return NULL; + + return zip_source_buffer_with_attributes_create(data, len, freep, NULL, &za->error); +} + + +ZIP_EXTERN zip_source_t * +zip_source_buffer_create(const void *data, zip_uint64_t len, int freep, zip_error_t *error) { + return zip_source_buffer_with_attributes_create(data, len, freep, NULL, error); +} + + +zip_source_t * +zip_source_buffer_with_attributes_create(const void *data, zip_uint64_t len, int freep, zip_file_attributes_t *attributes, zip_error_t *error) { + zip_buffer_fragment_t fragment; + + if (data == NULL) { + if (len > 0) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + return zip_source_buffer_fragment_with_attributes_create(NULL, 0, freep, attributes, error); + } + + fragment.data = (zip_uint8_t *)data; + fragment.length = len; + + return zip_source_buffer_fragment_with_attributes_create(&fragment, 1, freep, attributes, error); +} + + +ZIP_EXTERN zip_source_t * +zip_source_buffer_fragment(zip_t *za, const zip_buffer_fragment_t *fragments, zip_uint64_t nfragments, int freep) { + if (za == NULL) { + return NULL; + } + + return zip_source_buffer_fragment_with_attributes_create(fragments, nfragments, freep, NULL, &za->error); +} + + +ZIP_EXTERN zip_source_t * +zip_source_buffer_fragment_create(const zip_buffer_fragment_t *fragments, zip_uint64_t nfragments, int freep, zip_error_t *error) { + return zip_source_buffer_fragment_with_attributes_create(fragments, nfragments, freep, NULL, error); +} + +zip_source_t * +zip_source_buffer_fragment_with_attributes_create(const zip_buffer_fragment_t *fragments, zip_uint64_t nfragments, int freep, zip_file_attributes_t *attributes, zip_error_t *error) { + struct read_data *ctx; + zip_source_t *zs; + buffer_t *buffer; + + if (fragments == NULL && nfragments > 0) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((buffer = buffer_new(fragments, nfragments, freep, error)) == NULL) { + return NULL; + } + + if ((ctx = (struct read_data *)malloc(sizeof(*ctx))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + buffer_free(buffer); + return NULL; + } + + ctx->in = buffer; + ctx->out = NULL; + ctx->mtime = time(NULL); + if (attributes) { + memcpy(&ctx->attributes, attributes, sizeof(ctx->attributes)); + } + else { + zip_file_attributes_init(&ctx->attributes); + } + zip_error_init(&ctx->error); + + if ((zs = zip_source_function_create(read_data, ctx, error)) == NULL) { + buffer_free(ctx->in); + free(ctx); + return NULL; + } + + return zs; +} + + +zip_source_t * +zip_source_buffer_with_attributes(zip_t *za, const void *data, zip_uint64_t len, int freep, zip_file_attributes_t *attributes) { + return zip_source_buffer_with_attributes_create(data, len, freep, attributes, &za->error); +} + +static zip_int64_t +read_data(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) { + struct read_data *ctx = (struct read_data *)state; + + switch (cmd) { + case ZIP_SOURCE_BEGIN_WRITE: + if ((ctx->out = buffer_new(NULL, 0, 0, &ctx->error)) == NULL) { + return -1; + } + ctx->out->offset = 0; + ctx->out->current_fragment = 0; + return 0; + + case ZIP_SOURCE_BEGIN_WRITE_CLONING: + if ((ctx->out = buffer_clone(ctx->in, len, &ctx->error)) == NULL) { + return -1; + } + ctx->out->offset = len; + ctx->out->current_fragment = ctx->out->nfragments; + return 0; + + case ZIP_SOURCE_CLOSE: + return 0; + + case ZIP_SOURCE_COMMIT_WRITE: + buffer_free(ctx->in); + ctx->in = ctx->out; + ctx->out = NULL; + return 0; + + case ZIP_SOURCE_ERROR: + return zip_error_to_data(&ctx->error, data, len); + + case ZIP_SOURCE_FREE: + buffer_free(ctx->in); + buffer_free(ctx->out); + free(ctx); + return 0; + + case ZIP_SOURCE_GET_FILE_ATTRIBUTES: { + if (len < sizeof(ctx->attributes)) { + zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); + return -1; + } + + memcpy(data, &ctx->attributes, sizeof(ctx->attributes)); + + return sizeof(ctx->attributes); + } + + case ZIP_SOURCE_OPEN: + ctx->in->offset = 0; + ctx->in->current_fragment = 0; + return 0; + + case ZIP_SOURCE_READ: + if (len > ZIP_INT64_MAX) { + zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); + return -1; + } + return buffer_read(ctx->in, data, len); + + case ZIP_SOURCE_REMOVE: { + buffer_t *empty = buffer_new(NULL, 0, 0, &ctx->error); + if (empty == NULL) { + return -1; + } + + buffer_free(ctx->in); + ctx->in = empty; + return 0; + } + + case ZIP_SOURCE_ROLLBACK_WRITE: + buffer_free(ctx->out); + ctx->out = NULL; + return 0; + + case ZIP_SOURCE_SEEK: + return buffer_seek(ctx->in, data, len, &ctx->error); + + case ZIP_SOURCE_SEEK_WRITE: + return buffer_seek(ctx->out, data, len, &ctx->error); + + case ZIP_SOURCE_STAT: { + zip_stat_t *st; + + if (len < sizeof(*st)) { + zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); + return -1; + } + + st = (zip_stat_t *)data; + + zip_stat_init(st); + st->mtime = ctx->mtime; + st->size = ctx->in->size; + st->comp_size = st->size; + st->comp_method = ZIP_CM_STORE; + st->encryption_method = ZIP_EM_NONE; + st->valid = ZIP_STAT_MTIME | ZIP_STAT_SIZE | ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD | ZIP_STAT_ENCRYPTION_METHOD; + + return sizeof(*st); + } + + case ZIP_SOURCE_SUPPORTS: + return zip_source_make_command_bitmap(ZIP_SOURCE_GET_FILE_ATTRIBUTES, ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_SEEK, ZIP_SOURCE_TELL, ZIP_SOURCE_BEGIN_WRITE, ZIP_SOURCE_BEGIN_WRITE_CLONING, ZIP_SOURCE_COMMIT_WRITE, ZIP_SOURCE_REMOVE, ZIP_SOURCE_ROLLBACK_WRITE, ZIP_SOURCE_SEEK_WRITE, ZIP_SOURCE_TELL_WRITE, ZIP_SOURCE_WRITE, -1); + + case ZIP_SOURCE_TELL: + if (ctx->in->offset > ZIP_INT64_MAX) { + zip_error_set(&ctx->error, ZIP_ER_TELL, EOVERFLOW); + return -1; + } + return (zip_int64_t)ctx->in->offset; + + + case ZIP_SOURCE_TELL_WRITE: + if (ctx->out->offset > ZIP_INT64_MAX) { + zip_error_set(&ctx->error, ZIP_ER_TELL, EOVERFLOW); + return -1; + } + return (zip_int64_t)ctx->out->offset; + + case ZIP_SOURCE_WRITE: + if (len > ZIP_INT64_MAX) { + zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); + return -1; + } + return buffer_write(ctx->out, data, len, &ctx->error); + + default: + zip_error_set(&ctx->error, ZIP_ER_OPNOTSUPP, 0); + return -1; + } +} + + +static buffer_t * +buffer_clone(buffer_t *buffer, zip_uint64_t offset, zip_error_t *error) { + zip_uint64_t fragment, fragment_offset, waste; + buffer_t *clone; + + if (offset == 0) { + return buffer_new(NULL, 0, 1, error); + } + + if (offset > buffer->size) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + if (buffer->shared_buffer != NULL) { + zip_error_set(error, ZIP_ER_INUSE, 0); + return NULL; + } + + fragment = buffer_find_fragment(buffer, offset); + fragment_offset = offset - buffer->fragment_offsets[fragment]; + + if (fragment_offset == 0) { + fragment--; + fragment_offset = buffer->fragments[fragment].length; + } + + waste = buffer->fragments[fragment].length - fragment_offset; + if (waste > offset) { + zip_error_set(error, ZIP_ER_OPNOTSUPP, 0); + return NULL; + } + + if ((clone = buffer_new(buffer->fragments, fragment + 1, 0, error)) == NULL) { + return NULL; + } + +#ifndef __clang_analyzer__ + /* clone->fragments can't be null, since it was created with at least one fragment */ + clone->fragments[clone->nfragments - 1].length = fragment_offset; +#endif + clone->fragment_offsets[clone->nfragments] = offset; + clone->size = offset; + + clone->first_owned_fragment = ZIP_MIN(buffer->first_owned_fragment, clone->nfragments - 1); + + buffer->shared_buffer = clone; + clone->shared_buffer = buffer; + buffer->shared_fragments = clone->nfragments; + clone->shared_fragments = fragment + 1; + + return clone; +} + + +static zip_uint64_t +buffer_find_fragment(const buffer_t *buffer, zip_uint64_t offset) { + zip_uint64_t low, high, mid; + + low = 0; + high = buffer->nfragments - 1; + + while (low < high) { + mid = (high - low) / 2 + low; + if (buffer->fragment_offsets[mid] > offset) { + high = mid - 1; + } + else if (mid == buffer->nfragments || buffer->fragment_offsets[mid + 1] > offset) { + return mid; + } + else { + low = mid + 1; + } + } + + return low; +} + + +static void +buffer_free(buffer_t *buffer) { + zip_uint64_t i; + + if (buffer == NULL) { + return; + } + + if (buffer->shared_buffer != NULL) { + buffer->shared_buffer->shared_buffer = NULL; + buffer->shared_buffer->shared_fragments = 0; + + buffer->first_owned_fragment = ZIP_MAX(buffer->first_owned_fragment, buffer->shared_fragments); + } + + for (i = buffer->first_owned_fragment; i < buffer->nfragments; i++) { + free(buffer->fragments[i].data); + } + free(buffer->fragments); + free(buffer->fragment_offsets); + free(buffer); +} + + +static bool +buffer_grow_fragments(buffer_t *buffer, zip_uint64_t capacity, zip_error_t *error) { + zip_buffer_fragment_t *fragments; + zip_uint64_t *offsets; + + if (capacity < buffer->fragments_capacity) { + return true; + } + + if ((fragments = realloc(buffer->fragments, sizeof(buffer->fragments[0]) * capacity)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return false; + } + buffer->fragments = fragments; + if ((offsets = realloc(buffer->fragment_offsets, sizeof(buffer->fragment_offsets[0]) * (capacity + 1))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return false; + } + buffer->fragment_offsets = offsets; + buffer->fragments_capacity = capacity; + + return true; +} + + +static buffer_t * +buffer_new(const zip_buffer_fragment_t *fragments, zip_uint64_t nfragments, int free_data, zip_error_t *error) { + buffer_t *buffer; + + if ((buffer = malloc(sizeof(*buffer))) == NULL) { + return NULL; + } + + buffer->offset = 0; + buffer->first_owned_fragment = 0; + buffer->size = 0; + buffer->fragments = NULL; + buffer->fragment_offsets = NULL; + buffer->nfragments = 0; + buffer->fragments_capacity = 0; + buffer->shared_buffer = NULL; + buffer->shared_fragments = 0; + + if (nfragments == 0) { + if ((buffer->fragment_offsets = malloc(sizeof(buffer->fragment_offsets[0]))) == NULL) { + free(buffer); + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + buffer->fragment_offsets[0] = 0; + } + else { + zip_uint64_t i, j, offset; + + if (!buffer_grow_fragments(buffer, nfragments, NULL)) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + buffer_free(buffer); + return NULL; + } + + offset = 0; + for (i = 0, j = 0; i < nfragments; i++) { + if (fragments[i].length == 0) { + continue; + } + if (fragments[i].data == NULL) { + zip_error_set(error, ZIP_ER_INVAL, 0); + buffer_free(buffer); + return NULL; + } + buffer->fragments[j].data = fragments[i].data; + buffer->fragments[j].length = fragments[i].length; + buffer->fragment_offsets[i] = offset; + offset += fragments[i].length; + j++; + } + buffer->nfragments = j; + buffer->first_owned_fragment = free_data ? 0 : buffer->nfragments; + buffer->fragment_offsets[buffer->nfragments] = offset; + buffer->size = offset; + } + + return buffer; +} + +static zip_int64_t +buffer_read(buffer_t *buffer, zip_uint8_t *data, zip_uint64_t length) { + zip_uint64_t n, i, fragment_offset; + + length = ZIP_MIN(length, buffer->size - buffer->offset); + + if (length == 0) { + return 0; + } + if (length > ZIP_INT64_MAX) { + return -1; + } + + i = buffer->current_fragment; + fragment_offset = buffer->offset - buffer->fragment_offsets[i]; + n = 0; + while (n < length) { + zip_uint64_t left = ZIP_MIN(length - n, buffer->fragments[i].length - fragment_offset); + + memcpy(data + n, buffer->fragments[i].data + fragment_offset, left); + + if (left == buffer->fragments[i].length - fragment_offset) { + i++; + } + n += left; + fragment_offset = 0; + } + + buffer->offset += n; + buffer->current_fragment = i; + return (zip_int64_t)n; +} + + +static int +buffer_seek(buffer_t *buffer, void *data, zip_uint64_t len, zip_error_t *error) { + zip_int64_t new_offset = zip_source_seek_compute_offset(buffer->offset, buffer->size, data, len, error); + + if (new_offset < 0) { + return -1; + } + + buffer->offset = (zip_uint64_t)new_offset; + buffer->current_fragment = buffer_find_fragment(buffer, buffer->offset); + return 0; +} + + +static zip_int64_t +buffer_write(buffer_t *buffer, const zip_uint8_t *data, zip_uint64_t length, zip_error_t *error) { + zip_uint64_t n, i, fragment_offset, capacity; + + if (buffer->offset + length + WRITE_FRAGMENT_SIZE - 1 < length) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return -1; + } + + /* grow buffer if needed */ + capacity = buffer_capacity(buffer); + if (buffer->offset + length > capacity) { + zip_uint64_t needed_fragments = buffer->nfragments + (length - (capacity - buffer->offset) + WRITE_FRAGMENT_SIZE - 1) / WRITE_FRAGMENT_SIZE; + + if (needed_fragments > buffer->fragments_capacity) { + zip_uint64_t new_capacity = buffer->fragments_capacity; + + if (new_capacity == 0) { + new_capacity = 16; + } + while (new_capacity < needed_fragments) { + new_capacity *= 2; + } + + if (!buffer_grow_fragments(buffer, new_capacity, error)) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return -1; + } + } + + while (buffer->nfragments < needed_fragments) { + if ((buffer->fragments[buffer->nfragments].data = malloc(WRITE_FRAGMENT_SIZE)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return -1; + } + buffer->fragments[buffer->nfragments].length = WRITE_FRAGMENT_SIZE; + buffer->nfragments++; + capacity += WRITE_FRAGMENT_SIZE; + buffer->fragment_offsets[buffer->nfragments] = capacity; + } + } + + i = buffer->current_fragment; + fragment_offset = buffer->offset - buffer->fragment_offsets[i]; + n = 0; + while (n < length) { + zip_uint64_t left = ZIP_MIN(length - n, buffer->fragments[i].length - fragment_offset); + + memcpy(buffer->fragments[i].data + fragment_offset, data + n, left); + + if (left == buffer->fragments[i].length - fragment_offset) { + i++; + } + n += left; + fragment_offset = 0; + } + + buffer->offset += n; + buffer->current_fragment = i; + if (buffer->offset > buffer->size) { + buffer->size = buffer->offset; + } + + return (zip_int64_t)n; +} diff --git a/core/deps/libzip/lib/zip_source_call.c b/core/deps/libzip/lib/zip_source_call.c new file mode 100644 index 000000000..66b13d6e4 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_call.c @@ -0,0 +1,68 @@ +/* + zip_source_call.c -- invoke callback command on zip_source + Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#include "zipint.h" + + +zip_int64_t +_zip_source_call(zip_source_t *src, void *data, zip_uint64_t length, zip_source_cmd_t command) { + zip_int64_t ret; + + if ((src->supports & ZIP_SOURCE_MAKE_COMMAND_BITMASK(command)) == 0) { + zip_error_set(&src->error, ZIP_ER_OPNOTSUPP, 0); + return -1; + } + + if (src->src == NULL) { + ret = src->cb.f(src->ud, data, length, command); + } + else { + ret = src->cb.l(src->src, src->ud, data, length, command); + } + + if (ret < 0) { + if (command != ZIP_SOURCE_ERROR && command != ZIP_SOURCE_SUPPORTS) { + int e[2]; + + if (_zip_source_call(src, e, sizeof(e), ZIP_SOURCE_ERROR) < 0) { + zip_error_set(&src->error, ZIP_ER_INTERNAL, 0); + } + else { + zip_error_set(&src->error, e[0], e[1]); + } + } + } + + return ret; +} diff --git a/core/deps/libzip/lib/zip_source_close.c b/core/deps/libzip/lib/zip_source_close.c new file mode 100644 index 000000000..264e4b0d3 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_close.c @@ -0,0 +1,57 @@ +/* + zip_source_close.c -- close zip_source (stop reading) + Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +int +zip_source_close(zip_source_t *src) { + if (!ZIP_SOURCE_IS_OPEN_READING(src)) { + zip_error_set(&src->error, ZIP_ER_INVAL, 0); + return -1; + } + + src->open_count--; + if (src->open_count == 0) { + _zip_source_call(src, NULL, 0, ZIP_SOURCE_CLOSE); + + if (ZIP_SOURCE_IS_LAYERED(src)) { + if (zip_source_close(src->src) < 0) { + zip_error_set(&src->error, ZIP_ER_INTERNAL, 0); + } + } + } + + return 0; +} diff --git a/core/deps/libzip/zip_rename.c b/core/deps/libzip/lib/zip_source_commit_write.c similarity index 68% rename from core/deps/libzip/zip_rename.c rename to core/deps/libzip/lib/zip_source_commit_write.c index 1d056bbe3..ec8cd8bc3 100644 --- a/core/deps/libzip/zip_rename.c +++ b/core/deps/libzip/lib/zip_source_commit_write.c @@ -1,6 +1,6 @@ /* - zip_rename.c -- rename file in zip archive - Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner + zip_source_commit_write.c -- commit changes to file + Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,35 +31,33 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - -#include #include "zipint.h" - ZIP_EXTERN int -zip_rename(struct zip *za, int idx, const char *name) -{ - const char *old_name; - int old_is_dir, new_is_dir; - - if (idx >= za->nentry || idx < 0 || name[0] == '\0') { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; +zip_source_commit_write(zip_source_t *src) { + if (!ZIP_SOURCE_IS_OPEN_WRITING(src)) { + zip_error_set(&src->error, ZIP_ER_INVAL, 0); + return -1; } - if ((old_name=zip_get_name(za, idx, 0)) == NULL) - return -1; - - new_is_dir = (name[strlen(name)-1] == '/'); - old_is_dir = (old_name[strlen(old_name)-1] == '/'); - - if (new_is_dir != old_is_dir) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; + if (src->open_count > 1) { + zip_error_set(&src->error, ZIP_ER_INUSE, 0); + return -1; + } + else if (ZIP_SOURCE_IS_OPEN_READING(src)) { + if (zip_source_close(src) < 0) { + return -1; + } } - return _zip_set_name(za, idx, name); + if (_zip_source_call(src, NULL, 0, ZIP_SOURCE_COMMIT_WRITE) < 0) { + src->write_state = ZIP_SOURCE_WRITE_FAILED; + return -1; + } + + src->write_state = ZIP_SOURCE_WRITE_CLOSED; + + return 0; } diff --git a/core/deps/libzip/lib/zip_source_compress.c b/core/deps/libzip/lib/zip_source_compress.c new file mode 100644 index 000000000..35a022cc2 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_compress.c @@ -0,0 +1,398 @@ +/* + zip_source_compress.c -- (de)compression routines + Copyright (C) 2017-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include + +#include "zipint.h" + +struct context { + zip_error_t error; + + bool end_of_input; + bool end_of_stream; + bool can_store; + bool is_stored; /* only valid if end_of_stream is true */ + bool compress; + zip_int32_t method; + + zip_uint64_t size; + zip_int64_t first_read; + zip_uint8_t buffer[BUFSIZE]; + + zip_compression_algorithm_t *algorithm; + void *ud; +}; + + +struct implementation { + zip_uint16_t method; + zip_compression_algorithm_t *compress; + zip_compression_algorithm_t *decompress; +}; + +static struct implementation implementations[] = { + {ZIP_CM_DEFLATE, &zip_algorithm_deflate_compress, &zip_algorithm_deflate_decompress}, +#if defined(HAVE_LIBBZ2) + {ZIP_CM_BZIP2, &zip_algorithm_bzip2_compress, &zip_algorithm_bzip2_decompress}, +#endif +#if defined(HAVE_LIBLZMA) + {ZIP_CM_LZMA, &zip_algorithm_xz_compress, &zip_algorithm_xz_decompress}, + /* Disabled - because 7z isn't able to unpack ZIP+LZMA2 + archives made this way - and vice versa. + + {ZIP_CM_LZMA2, &zip_algorithm_xz_compress, &zip_algorithm_xz_decompress}, + */ + {ZIP_CM_XZ, &zip_algorithm_xz_compress, &zip_algorithm_xz_decompress}, +#endif +#if defined(HAVE_LIBZSTD) + {ZIP_CM_ZSTD, &zip_algorithm_zstd_compress, &zip_algorithm_zstd_decompress}, +#endif + +}; + +static size_t implementations_size = sizeof(implementations) / sizeof(implementations[0]); + +static zip_source_t *compression_source_new(zip_t *za, zip_source_t *src, zip_int32_t method, bool compress, int compression_flags); +static zip_int64_t compress_callback(zip_source_t *, void *, void *, zip_uint64_t, zip_source_cmd_t); +static void context_free(struct context *ctx); +static struct context *context_new(zip_int32_t method, bool compress, int compression_flags, zip_compression_algorithm_t *algorithm); +static zip_int64_t compress_read(zip_source_t *, struct context *, void *, zip_uint64_t); + +zip_compression_algorithm_t * +_zip_get_compression_algorithm(zip_int32_t method, bool compress) { + size_t i; + zip_uint16_t real_method = ZIP_CM_ACTUAL(method); + + for (i = 0; i < implementations_size; i++) { + if (implementations[i].method == real_method) { + if (compress) { + return implementations[i].compress; + } + else { + return implementations[i].decompress; + } + } + } + + return NULL; +} + +ZIP_EXTERN int +zip_compression_method_supported(zip_int32_t method, int compress) { + if (method == ZIP_CM_STORE) { + return 1; + } + return _zip_get_compression_algorithm(method, compress) != NULL; +} + +zip_source_t * +zip_source_compress(zip_t *za, zip_source_t *src, zip_int32_t method, int compression_flags) { + return compression_source_new(za, src, method, true, compression_flags); +} + +zip_source_t * +zip_source_decompress(zip_t *za, zip_source_t *src, zip_int32_t method) { + return compression_source_new(za, src, method, false, 0); +} + + +static zip_source_t * +compression_source_new(zip_t *za, zip_source_t *src, zip_int32_t method, bool compress, int compression_flags) { + struct context *ctx; + zip_source_t *s2; + zip_compression_algorithm_t *algorithm = NULL; + + if (src == NULL) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((algorithm = _zip_get_compression_algorithm(method, compress)) == NULL) { + zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); + return NULL; + } + + if ((ctx = context_new(method, compress, compression_flags, algorithm)) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if ((s2 = zip_source_layered(za, src, compress_callback, ctx)) == NULL) { + context_free(ctx); + return NULL; + } + + return s2; +} + + +static struct context * +context_new(zip_int32_t method, bool compress, int compression_flags, zip_compression_algorithm_t *algorithm) { + struct context *ctx; + + if ((ctx = (struct context *)malloc(sizeof(*ctx))) == NULL) { + return NULL; + } + zip_error_init(&ctx->error); + ctx->can_store = compress ? ZIP_CM_IS_DEFAULT(method) : false; + ctx->algorithm = algorithm; + ctx->method = method; + ctx->compress = compress; + ctx->end_of_input = false; + ctx->end_of_stream = false; + ctx->is_stored = false; + + if ((ctx->ud = ctx->algorithm->allocate(ZIP_CM_ACTUAL(method), compression_flags, &ctx->error)) == NULL) { + zip_error_fini(&ctx->error); + free(ctx); + return NULL; + } + + return ctx; +} + + +static void +context_free(struct context *ctx) { + if (ctx == NULL) { + return; + } + + ctx->algorithm->deallocate(ctx->ud); + zip_error_fini(&ctx->error); + + free(ctx); +} + + +static zip_int64_t +compress_read(zip_source_t *src, struct context *ctx, void *data, zip_uint64_t len) { + zip_compression_status_t ret; + bool end; + zip_int64_t n; + zip_uint64_t out_offset; + zip_uint64_t out_len; + + if (zip_error_code_zip(&ctx->error) != ZIP_ER_OK) { + return -1; + } + + if (len == 0 || ctx->end_of_stream) { + return 0; + } + + out_offset = 0; + + end = false; + while (!end && out_offset < len) { + out_len = len - out_offset; + ret = ctx->algorithm->process(ctx->ud, (zip_uint8_t *)data + out_offset, &out_len); + + if (ret != ZIP_COMPRESSION_ERROR) { + out_offset += out_len; + } + + switch (ret) { + case ZIP_COMPRESSION_END: + ctx->end_of_stream = true; + + if (!ctx->end_of_input) { + /* TODO: garbage after stream, or compression ended before all data read */ + } + + if (ctx->first_read < 0) { + /* we got end of processed stream before reading any input data */ + zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0); + end = true; + break; + } + if (ctx->can_store && (zip_uint64_t)ctx->first_read <= out_offset) { + ctx->is_stored = true; + ctx->size = (zip_uint64_t)ctx->first_read; + memcpy(data, ctx->buffer, ctx->size); + return (zip_int64_t)ctx->size; + } + end = true; + break; + + case ZIP_COMPRESSION_OK: + break; + + case ZIP_COMPRESSION_NEED_DATA: + if (ctx->end_of_input) { + /* TODO: error: stream not ended, but no more input */ + end = true; + break; + } + + if ((n = zip_source_read(src, ctx->buffer, sizeof(ctx->buffer))) < 0) { + _zip_error_set_from_source(&ctx->error, src); + end = true; + break; + } + else if (n == 0) { + ctx->end_of_input = true; + ctx->algorithm->end_of_input(ctx->ud); + if (ctx->first_read < 0) { + ctx->first_read = 0; + } + } + else { + if (ctx->first_read >= 0) { + /* we overwrote a previously filled ctx->buffer */ + ctx->can_store = false; + } + else { + ctx->first_read = n; + } + + ctx->algorithm->input(ctx->ud, ctx->buffer, (zip_uint64_t)n); + } + break; + + case ZIP_COMPRESSION_ERROR: + /* error set by algorithm */ + if (zip_error_code_zip(&ctx->error) == ZIP_ER_OK) { + zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0); + } + end = true; + break; + } + } + + if (out_offset > 0) { + ctx->can_store = false; + ctx->size += out_offset; + return (zip_int64_t)out_offset; + } + + return (zip_error_code_zip(&ctx->error) == ZIP_ER_OK) ? 0 : -1; +} + + +static zip_int64_t +compress_callback(zip_source_t *src, void *ud, void *data, zip_uint64_t len, zip_source_cmd_t cmd) { + struct context *ctx; + + ctx = (struct context *)ud; + + switch (cmd) { + case ZIP_SOURCE_OPEN: { + zip_stat_t st; + zip_file_attributes_t attributes; + + ctx->size = 0; + ctx->end_of_input = false; + ctx->end_of_stream = false; + ctx->is_stored = false; + ctx->first_read = -1; + + if (zip_source_stat(src, &st) < 0 || zip_source_get_file_attributes(src, &attributes) < 0) { + _zip_error_set_from_source(&ctx->error, src); + return -1; + } + + if (!ctx->algorithm->start(ctx->ud, &st, &attributes)) { + return -1; + } + + return 0; + } + + case ZIP_SOURCE_READ: + return compress_read(src, ctx, data, len); + + case ZIP_SOURCE_CLOSE: + if (!ctx->algorithm->end(ctx->ud)) { + return -1; + } + return 0; + + case ZIP_SOURCE_STAT: { + zip_stat_t *st; + + st = (zip_stat_t *)data; + + if (ctx->compress) { + if (ctx->end_of_stream) { + st->comp_method = ctx->is_stored ? ZIP_CM_STORE : ZIP_CM_ACTUAL(ctx->method); + st->comp_size = ctx->size; + st->valid |= ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD; + } + else { + st->valid &= ~(ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD); + } + } + else { + st->comp_method = ZIP_CM_STORE; + st->valid |= ZIP_STAT_COMP_METHOD; + if (ctx->end_of_stream) { + st->size = ctx->size; + st->valid |= ZIP_STAT_SIZE; + } + } + } + return 0; + + case ZIP_SOURCE_ERROR: + return zip_error_to_data(&ctx->error, data, len); + + case ZIP_SOURCE_FREE: + context_free(ctx); + return 0; + + case ZIP_SOURCE_GET_FILE_ATTRIBUTES: { + zip_file_attributes_t *attributes = (zip_file_attributes_t *)data; + + if (len < sizeof(*attributes)) { + zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); + return -1; + } + + attributes->valid |= ZIP_FILE_ATTRIBUTES_VERSION_NEEDED | ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS; + attributes->version_needed = ctx->algorithm->version_needed; + attributes->general_purpose_bit_mask = ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS_ALLOWED_MASK; + attributes->general_purpose_bit_flags = (ctx->is_stored ? 0 : ctx->algorithm->general_purpose_bit_flags(ctx->ud)); + + return sizeof(*attributes); + } + + case ZIP_SOURCE_SUPPORTS: + return ZIP_SOURCE_SUPPORTS_READABLE | zip_source_make_command_bitmap(ZIP_SOURCE_GET_FILE_ATTRIBUTES, -1); + + default: + zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0); + return -1; + } +} diff --git a/core/deps/libzip/lib/zip_source_crc.c b/core/deps/libzip/lib/zip_source_crc.c new file mode 100644 index 000000000..cae73635a --- /dev/null +++ b/core/deps/libzip/lib/zip_source_crc.c @@ -0,0 +1,197 @@ +/* + zip_source_crc.c -- pass-through source that calculates CRC32 and size + Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include +#include +#include + +#include "zipint.h" + +struct crc_context { + int validate; /* whether to check CRC on EOF and return error on mismatch */ + int crc_complete; /* whether CRC was computed for complete file */ + zip_error_t error; + zip_uint64_t size; + zip_uint64_t position; /* current reading position */ + zip_uint64_t crc_position; /* how far we've computed the CRC */ + zip_uint32_t crc; +}; + +static zip_int64_t crc_read(zip_source_t *, void *, void *, zip_uint64_t, zip_source_cmd_t); + + +zip_source_t * +zip_source_crc(zip_t *za, zip_source_t *src, int validate) { + struct crc_context *ctx; + + if (src == NULL) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((ctx = (struct crc_context *)malloc(sizeof(*ctx))) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; + } + + zip_error_init(&ctx->error); + ctx->validate = validate; + ctx->crc_complete = 0; + ctx->crc_position = 0; + ctx->crc = (zip_uint32_t)crc32(0, NULL, 0); + ctx->size = 0; + + return zip_source_layered(za, src, crc_read, ctx); +} + + +static zip_int64_t +crc_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_source_cmd_t cmd) { + struct crc_context *ctx; + zip_int64_t n; + + ctx = (struct crc_context *)_ctx; + + switch (cmd) { + case ZIP_SOURCE_OPEN: + ctx->position = 0; + return 0; + + case ZIP_SOURCE_READ: + if ((n = zip_source_read(src, data, len)) < 0) { + _zip_error_set_from_source(&ctx->error, src); + return -1; + } + + if (n == 0) { + if (ctx->crc_position == ctx->position) { + ctx->crc_complete = 1; + ctx->size = ctx->position; + + if (ctx->validate) { + struct zip_stat st; + + if (zip_source_stat(src, &st) < 0) { + _zip_error_set_from_source(&ctx->error, src); + return -1; + } + + if ((st.valid & ZIP_STAT_CRC) && st.crc != ctx->crc) { + zip_error_set(&ctx->error, ZIP_ER_CRC, 0); + return -1; + } + if ((st.valid & ZIP_STAT_SIZE) && st.size != ctx->size) { + zip_error_set(&ctx->error, ZIP_ER_INCONS, 0); + return -1; + } + } + } + } + else if (!ctx->crc_complete && ctx->position <= ctx->crc_position) { + zip_uint64_t i, nn; + + for (i = ctx->crc_position - ctx->position; i < (zip_uint64_t)n; i += nn) { + nn = ZIP_MIN(UINT_MAX, (zip_uint64_t)n - i); + + ctx->crc = (zip_uint32_t)crc32(ctx->crc, (const Bytef *)data + i, (uInt)nn); + ctx->crc_position += nn; + } + } + ctx->position += (zip_uint64_t)n; + return n; + + case ZIP_SOURCE_CLOSE: + return 0; + + case ZIP_SOURCE_STAT: { + zip_stat_t *st; + + st = (zip_stat_t *)data; + + if (ctx->crc_complete) { + /* TODO: Set comp_size, comp_method, encryption_method? + After all, this only works for uncompressed data. */ + st->size = ctx->size; + st->crc = ctx->crc; + st->comp_size = ctx->size; + st->comp_method = ZIP_CM_STORE; + st->encryption_method = ZIP_EM_NONE; + st->valid |= ZIP_STAT_SIZE | ZIP_STAT_CRC | ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD | ZIP_STAT_ENCRYPTION_METHOD; + } + return 0; + } + + case ZIP_SOURCE_ERROR: + return zip_error_to_data(&ctx->error, data, len); + + case ZIP_SOURCE_FREE: + free(ctx); + return 0; + + case ZIP_SOURCE_SUPPORTS: { + zip_int64_t mask = zip_source_supports(src); + + if (mask < 0) { + _zip_error_set_from_source(&ctx->error, src); + return -1; + } + + return mask & ~zip_source_make_command_bitmap(ZIP_SOURCE_BEGIN_WRITE, ZIP_SOURCE_COMMIT_WRITE, ZIP_SOURCE_ROLLBACK_WRITE, ZIP_SOURCE_SEEK_WRITE, ZIP_SOURCE_TELL_WRITE, ZIP_SOURCE_REMOVE, ZIP_SOURCE_GET_FILE_ATTRIBUTES, -1); + } + + case ZIP_SOURCE_SEEK: { + zip_int64_t new_position; + zip_source_args_seek_t *args = ZIP_SOURCE_GET_ARGS(zip_source_args_seek_t, data, len, &ctx->error); + + if (args == NULL) { + return -1; + } + if (zip_source_seek(src, args->offset, args->whence) < 0 || (new_position = zip_source_tell(src)) < 0) { + _zip_error_set_from_source(&ctx->error, src); + return -1; + } + + ctx->position = (zip_uint64_t)new_position; + + return 0; + } + + case ZIP_SOURCE_TELL: + return (zip_int64_t)ctx->position; + + default: + zip_error_set(&ctx->error, ZIP_ER_OPNOTSUPP, 0); + return -1; + } +} diff --git a/core/deps/libzip/lib/zip_source_error.c b/core/deps/libzip/lib/zip_source_error.c new file mode 100644 index 000000000..00998e839 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_error.c @@ -0,0 +1,46 @@ +/* + zip_source_error.c -- get last error from zip_source + Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +zip_error_t * +zip_source_error(zip_source_t *src) { + return &src->error; +} + +bool +_zip_source_had_error(zip_source_t *src) { + return zip_source_error(src)->zip_err != ZIP_ER_OK; +} diff --git a/core/deps/libzip/lib/zip_source_file.h b/core/deps/libzip/lib/zip_source_file.h new file mode 100644 index 000000000..43a464533 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_file.h @@ -0,0 +1,90 @@ +/* + zip_source_file.h -- header for common file operations + Copyright (C) 2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +struct zip_source_file_stat { + zip_uint64_t size; /* must be valid for regular files */ + time_t mtime; /* must always be valid, is initialized to current time */ + bool exists; /* must always be vaild */ + bool regular_file; /* must always be valid */ +}; + +typedef struct zip_source_file_context zip_source_file_context_t; +typedef struct zip_source_file_operations zip_source_file_operations_t; +typedef struct zip_source_file_stat zip_source_file_stat_t; + +struct zip_source_file_context { + zip_error_t error; /* last error information */ + zip_int64_t supports; + + /* reading */ + char *fname; /* name of file to read from */ + void *f; /* file to read from */ + zip_stat_t st; /* stat information passed in */ + zip_file_attributes_t attributes; /* additional file attributes */ + zip_error_t stat_error; /* error returned for stat */ + zip_uint64_t start; /* start offset of data to read */ + zip_uint64_t len; /* length of the file, 0 for up to EOF */ + zip_uint64_t offset; /* current offset relative to start (0 is beginning of part we read) */ + + /* writing */ + char *tmpname; + void *fout; + + zip_source_file_operations_t *ops; + void *ops_userdata; +}; + + +/* The following methods must be implemented to support each feature: + - close, read, seek, and stat must always be implemented. + - To support specifying the file by name, open, and strdup must be implemented. + - For write support, the file must be specified by name and close, commit_write, create_temp_output, remove, rollback_write, and tell must be implemented. + - create_temp_output_cloning is always optional. */ + +struct zip_source_file_operations { + void (*close)(zip_source_file_context_t *ctx); + zip_int64_t (*commit_write)(zip_source_file_context_t *ctx); + zip_int64_t (*create_temp_output)(zip_source_file_context_t *ctx); + zip_int64_t (*create_temp_output_cloning)(zip_source_file_context_t *ctx, zip_uint64_t len); + bool (*open)(zip_source_file_context_t *ctx); + zip_int64_t (*read)(zip_source_file_context_t *ctx, void *buf, zip_uint64_t len); + zip_int64_t (*remove)(zip_source_file_context_t *ctx); + void (*rollback_write)(zip_source_file_context_t *ctx); + bool (*seek)(zip_source_file_context_t *ctx, void *f, zip_int64_t offset, int whence); + bool (*stat)(zip_source_file_context_t *ctx, zip_source_file_stat_t *st); + char *(*string_duplicate)(zip_source_file_context_t *ctx, const char *); + zip_int64_t (*tell)(zip_source_file_context_t *ctx, void *f); + zip_int64_t (*write)(zip_source_file_context_t *ctx, const void *data, zip_uint64_t len); +}; + +zip_source_t *zip_source_file_common_new(const char *fname, void *file, zip_uint64_t start, zip_int64_t len, const zip_stat_t *st, zip_source_file_operations_t *ops, void *ops_userdata, zip_error_t *error); diff --git a/core/deps/libzip/lib/zip_source_file_common.c b/core/deps/libzip/lib/zip_source_file_common.c new file mode 100644 index 000000000..32414361b --- /dev/null +++ b/core/deps/libzip/lib/zip_source_file_common.c @@ -0,0 +1,378 @@ +/* + zip_source_file_common.c -- create data source from file + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include +#include + +#include "zipint.h" + +#include "zip_source_file.h" + +static zip_int64_t read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd); + +static void +zip_source_file_stat_init(zip_source_file_stat_t *st) { + st->size = 0; + st->mtime = time(NULL); + st->exists = false; + st->regular_file = false; +} + +zip_source_t * +zip_source_file_common_new(const char *fname, void *file, zip_uint64_t start, zip_int64_t len, const zip_stat_t *st, zip_source_file_operations_t *ops, void *ops_userdata, zip_error_t *error) { + zip_source_file_context_t *ctx; + zip_source_t *zs; + zip_source_file_stat_t sb; + + if (ops == NULL) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + if (ops->close == NULL || ops->read == NULL || ops->seek == NULL || ops->stat == NULL) { + zip_error_set(error, ZIP_ER_INTERNAL, 0); + return NULL; + } + + if (ops->write != NULL && (ops->commit_write == NULL || ops->create_temp_output == NULL || ops->remove == NULL || ops->rollback_write == NULL || ops->tell == NULL)) { + zip_error_set(error, ZIP_ER_INTERNAL, 0); + return NULL; + } + + if (fname != NULL) { + if (ops->open == NULL || ops->string_duplicate == NULL) { + zip_error_set(error, ZIP_ER_INTERNAL, 0); + return NULL; + } + } + else if (file == NULL) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + if (len < 0) { + len = 0; + } + + if (start > ZIP_INT64_MAX || start + (zip_uint64_t)len < start) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((ctx = (zip_source_file_context_t *)malloc(sizeof(zip_source_file_context_t))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + ctx->ops = ops; + ctx->ops_userdata = ops_userdata; + ctx->fname = NULL; + if (fname) { + if ((ctx->fname = ops->string_duplicate(ctx, fname)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + free(ctx); + return NULL; + } + } + ctx->f = file; + ctx->start = start; + ctx->len = (zip_uint64_t)len; + if (st) { + memcpy(&ctx->st, st, sizeof(ctx->st)); + ctx->st.name = NULL; + ctx->st.valid &= ~ZIP_STAT_NAME; + } + else { + zip_stat_init(&ctx->st); + } + + if (ctx->len > 0) { + ctx->st.size = ctx->len; + ctx->st.valid |= ZIP_STAT_SIZE; + } + + zip_error_init(&ctx->stat_error); + + ctx->tmpname = NULL; + ctx->fout = NULL; + + zip_error_init(&ctx->error); + zip_file_attributes_init(&ctx->attributes); + + ctx->supports = ZIP_SOURCE_SUPPORTS_READABLE | zip_source_make_command_bitmap(ZIP_SOURCE_SUPPORTS, ZIP_SOURCE_TELL, -1); + + zip_source_file_stat_init(&sb); + if (!ops->stat(ctx, &sb)) { + _zip_error_copy(error, &ctx->error); + free(ctx->fname); + free(ctx); + return NULL; + } + + if (!sb.exists) { + if (ctx->fname && ctx->start == 0 && ctx->len == 0 && ops->write != NULL) { + ctx->supports = ZIP_SOURCE_SUPPORTS_WRITABLE; + /* zip_open_from_source checks for this to detect non-existing files */ + zip_error_set(&ctx->stat_error, ZIP_ER_READ, ENOENT); + } + else { + zip_error_set(&ctx->stat_error, ZIP_ER_READ, ENOENT); + free(ctx->fname); + free(ctx); + return NULL; + } + } + else { + if ((ctx->st.valid & ZIP_STAT_MTIME) == 0) { + ctx->st.mtime = sb.mtime; + ctx->st.valid |= ZIP_STAT_MTIME; + } + if (sb.regular_file) { + ctx->supports = ZIP_SOURCE_SUPPORTS_SEEKABLE; + + if (ctx->start + ctx->len > sb.size) { + zip_error_set(error, ZIP_ER_INVAL, 0); + free(ctx->fname); + free(ctx); + return NULL; + } + + if (ctx->len == 0) { + ctx->len = sb.size - ctx->start; + ctx->st.size = ctx->len; + ctx->st.valid |= ZIP_STAT_SIZE; + + /* when using a partial file, don't allow writing */ + if (ctx->fname && start == 0 && ops->write != NULL) { + ctx->supports = ZIP_SOURCE_SUPPORTS_WRITABLE; + } + } + } + + ctx->supports |= ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_GET_FILE_ATTRIBUTES); + } + + ctx->supports |= ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_ACCEPT_EMPTY); + if (ops->create_temp_output_cloning != NULL) { + if (ctx->supports & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_BEGIN_WRITE)) { + ctx->supports |= ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_BEGIN_WRITE_CLONING); + } + } + + if ((zs = zip_source_function_create(read_file, ctx, error)) == NULL) { + free(ctx->fname); + free(ctx); + return NULL; + } + + return zs; +} + + +static zip_int64_t +read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) { + zip_source_file_context_t *ctx; + char *buf; + + ctx = (zip_source_file_context_t *)state; + buf = (char *)data; + + switch (cmd) { + case ZIP_SOURCE_ACCEPT_EMPTY: + return 0; + + case ZIP_SOURCE_BEGIN_WRITE: + /* write support should not be set if fname is NULL */ + if (ctx->fname == NULL) { + zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0); + return -1; + } + return ctx->ops->create_temp_output(ctx); + + case ZIP_SOURCE_BEGIN_WRITE_CLONING: + /* write support should not be set if fname is NULL */ + if (ctx->fname == NULL) { + zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0); + return -1; + } + return ctx->ops->create_temp_output_cloning(ctx, len); + + case ZIP_SOURCE_CLOSE: + if (ctx->fname) { + ctx->ops->close(ctx); + ctx->f = NULL; + } + return 0; + + case ZIP_SOURCE_COMMIT_WRITE: { + zip_int64_t ret = ctx->ops->commit_write(ctx); + ctx->fout = NULL; + if (ret == 0) { + free(ctx->tmpname); + ctx->tmpname = NULL; + } + return ret; + } + + case ZIP_SOURCE_ERROR: + return zip_error_to_data(&ctx->error, data, len); + + case ZIP_SOURCE_FREE: + free(ctx->fname); + free(ctx->tmpname); + if (ctx->f) { + ctx->ops->close(ctx); + } + free(ctx); + return 0; + + case ZIP_SOURCE_GET_FILE_ATTRIBUTES: + if (len < sizeof(ctx->attributes)) { + zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); + return -1; + } + memcpy(data, &ctx->attributes, sizeof(ctx->attributes)); + return sizeof(ctx->attributes); + + case ZIP_SOURCE_OPEN: + if (ctx->fname) { + if (ctx->ops->open(ctx) == false) { + return -1; + } + } + + if (ctx->start > 0) { // TODO: rewind on re-open + if (ctx->ops->seek(ctx, ctx->f, (zip_int64_t)ctx->start, SEEK_SET) == false) { + /* TODO: skip by reading */ + return -1; + } + } + ctx->offset = 0; + return 0; + + case ZIP_SOURCE_READ: { + zip_int64_t i; + zip_uint64_t n; + + if (ctx->len > 0) { + n = ZIP_MIN(ctx->len - ctx->offset, len); + } + else { + n = len; + } + + if ((i = ctx->ops->read(ctx, buf, n)) < 0) { + zip_error_set(&ctx->error, ZIP_ER_READ, errno); + return -1; + } + ctx->offset += (zip_uint64_t)i; + + return i; + } + + case ZIP_SOURCE_REMOVE: + return ctx->ops->remove(ctx); + + case ZIP_SOURCE_ROLLBACK_WRITE: + ctx->ops->rollback_write(ctx); + ctx->fout = NULL; + free(ctx->tmpname); + ctx->tmpname = NULL; + return 0; + + case ZIP_SOURCE_SEEK: { + zip_int64_t new_offset = zip_source_seek_compute_offset(ctx->offset, ctx->len, data, len, &ctx->error); + + if (new_offset < 0) { + return -1; + } + + /* The actual offset inside the file must be representable as zip_int64_t. */ + if (new_offset > ZIP_INT64_MAX - (zip_int64_t)ctx->start) { + zip_error_set(&ctx->error, ZIP_ER_SEEK, EOVERFLOW); + return -1; + } + + ctx->offset = (zip_uint64_t)new_offset; + + if (ctx->ops->seek(ctx, ctx->f, (zip_int64_t)(ctx->offset + ctx->start), SEEK_SET) == false) { + return -1; + } + return 0; + } + + case ZIP_SOURCE_SEEK_WRITE: { + zip_source_args_seek_t *args; + + args = ZIP_SOURCE_GET_ARGS(zip_source_args_seek_t, data, len, &ctx->error); + if (args == NULL) { + return -1; + } + + if (ctx->ops->seek(ctx, ctx->fout, args->offset, args->whence) == false) { + return -1; + } + return 0; + } + + case ZIP_SOURCE_STAT: { + if (len < sizeof(ctx->st)) + return -1; + + if (zip_error_code_zip(&ctx->stat_error) != 0) { + zip_error_set(&ctx->error, zip_error_code_zip(&ctx->stat_error), zip_error_code_system(&ctx->stat_error)); + return -1; + } + + memcpy(data, &ctx->st, sizeof(ctx->st)); + return sizeof(ctx->st); + } + + case ZIP_SOURCE_SUPPORTS: + return ctx->supports; + + case ZIP_SOURCE_TELL: + return (zip_int64_t)ctx->offset; + + case ZIP_SOURCE_TELL_WRITE: + return ctx->ops->tell(ctx, ctx->fout); + + case ZIP_SOURCE_WRITE: + return ctx->ops->write(ctx, data, len); + + default: + zip_error_set(&ctx->error, ZIP_ER_OPNOTSUPP, 0); + return -1; + } +} diff --git a/core/deps/libzip/lib/zip_source_file_stdio.c b/core/deps/libzip/lib/zip_source_file_stdio.c new file mode 100644 index 000000000..15817716c --- /dev/null +++ b/core/deps/libzip/lib/zip_source_file_stdio.c @@ -0,0 +1,208 @@ +/* + zip_source_file_stdio.c -- read-only stdio file source implementation + Copyright (C) 2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zipint.h" + +#include "zip_source_file.h" +#include "zip_source_file_stdio.h" + +#include +#include +#include +#include + +#ifdef _WIN32 +#ifndef S_IWUSR +#define S_IWUSR _S_IWRITE +#endif +#endif + +/* clang-format off */ +static zip_source_file_operations_t ops_stdio_read = { + _zip_stdio_op_close, + NULL, + NULL, + NULL, + NULL, + _zip_stdio_op_read, + NULL, + NULL, + _zip_stdio_op_seek, + _zip_stdio_op_stat, + NULL, + _zip_stdio_op_tell, + NULL +}; +/* clang-format on */ + + +ZIP_EXTERN zip_source_t * +zip_source_filep(zip_t *za, FILE *file, zip_uint64_t start, zip_int64_t len) { + if (za == NULL) { + return NULL; + } + + return zip_source_filep_create(file, start, len, &za->error); +} + + +ZIP_EXTERN zip_source_t * +zip_source_filep_create(FILE *file, zip_uint64_t start, zip_int64_t length, zip_error_t *error) { + if (file == NULL || length < -1) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + return zip_source_file_common_new(NULL, file, start, length, NULL, &ops_stdio_read, NULL, error); +} + + +void +_zip_stdio_op_close(zip_source_file_context_t *ctx) { + fclose((FILE *)ctx->f); +} + + +zip_int64_t +_zip_stdio_op_read(zip_source_file_context_t *ctx, void *buf, zip_uint64_t len) { + size_t i; + if (len > SIZE_MAX) { + len = SIZE_MAX; + } + + if ((i = fread(buf, 1, (size_t)len, ctx->f)) == 0) { + if (ferror((FILE *)ctx->f)) { + zip_error_set(&ctx->error, ZIP_ER_READ, errno); + return -1; + } + } + + return (zip_int64_t)i; +} + + +bool +_zip_stdio_op_seek(zip_source_file_context_t *ctx, void *f, zip_int64_t offset, int whence) { +#if ZIP_FSEEK_MAX > ZIP_INT64_MAX + if (offset > ZIP_FSEEK_MAX || offset < ZIP_FSEEK_MIN) { + zip_error_set(&ctx->error, ZIP_ER_SEEK, EOVERFLOW); + return false; + } +#endif + + if (fseeko((FILE *)f, (off_t)offset, whence) < 0) { + zip_error_set(&ctx->error, ZIP_ER_SEEK, errno); + return false; + } + return true; +} + + +bool +_zip_stdio_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t *st) { + struct stat sb; + + int ret; + + if (ctx->fname) { + ret = stat(ctx->fname, &sb); + } + else { + ret = fstat(fileno((FILE *)ctx->f), &sb); + } + + if (ret < 0) { + if (errno == ENOENT) { + st->exists = false; + return true; + } + zip_error_set(&ctx->error, ZIP_ER_READ, errno); + return false; + } + + st->size = (zip_uint64_t)sb.st_size; + st->mtime = sb.st_mtime; + + st->regular_file = S_ISREG(sb.st_mode); + st->exists = true; + + /* We're using UNIX file API, even on Windows; thus, we supply external file attributes with Unix values. */ + /* TODO: This could be improved on Windows by providing Windows-specific file attributes */ + ctx->attributes.valid = ZIP_FILE_ATTRIBUTES_HOST_SYSTEM | ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES; + ctx->attributes.host_system = ZIP_OPSYS_UNIX; + ctx->attributes.external_file_attributes = (((zip_uint32_t)sb.st_mode) << 16) | ((sb.st_mode & S_IWUSR) ? 0 : 1); + + return true; +} + + +zip_int64_t +_zip_stdio_op_tell(zip_source_file_context_t *ctx, void *f) { + off_t offset = ftello((FILE *)f); + + if (offset < 0) { + zip_error_set(&ctx->error, ZIP_ER_SEEK, errno); + } + + return offset; +} + + +/* + * fopen replacement that sets the close-on-exec flag + * some implementations support an fopen 'e' flag for that, + * but e.g. macOS doesn't. + */ +FILE * +_zip_fopen_close_on_exec(const char *name, bool writeable) { + int fd; + int flags; + FILE *fp; + + flags = O_CLOEXEC; + if (writeable) { + flags |= O_RDWR; + } + else { + flags |= O_RDONLY; + } + + /* mode argument needed on Windows */ + if ((fd = open(name, flags, 0666)) < 0) { + return NULL; + } + if ((fp = fdopen(fd, writeable ? "r+b" : "rb")) == NULL) { + return NULL; + } + return fp; +} diff --git a/core/deps/libzip/lib/zip_source_file_stdio.h b/core/deps/libzip/lib/zip_source_file_stdio.h new file mode 100644 index 000000000..1bf698ce2 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_file_stdio.h @@ -0,0 +1,47 @@ +#ifndef _HAD_ZIP_SOURCE_FILE_STDIO_H +#define _HAD_ZIP_SOURCE_FILE_STDIO_H + +/* + zip_source_file_stdio.h -- common header for stdio file implementation + Copyright (C) 2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +void _zip_stdio_op_close(zip_source_file_context_t *ctx); +zip_int64_t _zip_stdio_op_read(zip_source_file_context_t *ctx, void *buf, zip_uint64_t len); +bool _zip_stdio_op_seek(zip_source_file_context_t *ctx, void *f, zip_int64_t offset, int whence); +bool _zip_stdio_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t *st); +zip_int64_t _zip_stdio_op_tell(zip_source_file_context_t *ctx, void *f); + +FILE *_zip_fopen_close_on_exec(const char *name, bool writeable); + +#endif /* _HAD_ZIP_SOURCE_FILE_STDIO_H */ diff --git a/core/deps/libzip/lib/zip_source_file_stdio_named.c b/core/deps/libzip/lib/zip_source_file_stdio_named.c new file mode 100644 index 000000000..5387c7663 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_file_stdio_named.c @@ -0,0 +1,313 @@ +/* + zip_source_file_stdio_named.c -- source for stdio file opened by name + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zipint.h" + +#include "zip_source_file.h" +#include "zip_source_file_stdio.h" + +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_CLONEFILE +#include +#include +#define CAN_CLONE +#endif +#ifdef HAVE_FICLONERANGE +#include +#include +#define CAN_CLONE +#endif + +static zip_int64_t _zip_stdio_op_commit_write(zip_source_file_context_t *ctx); +static zip_int64_t _zip_stdio_op_create_temp_output(zip_source_file_context_t *ctx); +#ifdef CAN_CLONE +static zip_int64_t _zip_stdio_op_create_temp_output_cloning(zip_source_file_context_t *ctx, zip_uint64_t offset); +#endif +static bool _zip_stdio_op_open(zip_source_file_context_t *ctx); +static zip_int64_t _zip_stdio_op_remove(zip_source_file_context_t *ctx); +static void _zip_stdio_op_rollback_write(zip_source_file_context_t *ctx); +static char *_zip_stdio_op_strdup(zip_source_file_context_t *ctx, const char *string); +static zip_int64_t _zip_stdio_op_write(zip_source_file_context_t *ctx, const void *data, zip_uint64_t len); + +/* clang-format off */ +static zip_source_file_operations_t ops_stdio_named = { + _zip_stdio_op_close, + _zip_stdio_op_commit_write, + _zip_stdio_op_create_temp_output, +#ifdef CAN_CLONE + _zip_stdio_op_create_temp_output_cloning, +#else + NULL, +#endif + _zip_stdio_op_open, + _zip_stdio_op_read, + _zip_stdio_op_remove, + _zip_stdio_op_rollback_write, + _zip_stdio_op_seek, + _zip_stdio_op_stat, + _zip_stdio_op_strdup, + _zip_stdio_op_tell, + _zip_stdio_op_write +}; +/* clang-format on */ + +ZIP_EXTERN zip_source_t * +zip_source_file(zip_t *za, const char *fname, zip_uint64_t start, zip_int64_t len) { + if (za == NULL) + return NULL; + + return zip_source_file_create(fname, start, len, &za->error); +} + + +ZIP_EXTERN zip_source_t * +zip_source_file_create(const char *fname, zip_uint64_t start, zip_int64_t length, zip_error_t *error) { + if (fname == NULL || length < -1) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + return zip_source_file_common_new(fname, NULL, start, length, NULL, &ops_stdio_named, NULL, error); +} + + +static zip_int64_t +_zip_stdio_op_commit_write(zip_source_file_context_t *ctx) { + if (fclose(ctx->fout) < 0) { + zip_error_set(&ctx->error, ZIP_ER_WRITE, errno); + return -1; + } + if (rename(ctx->tmpname, ctx->fname) < 0) { + zip_error_set(&ctx->error, ZIP_ER_RENAME, errno); + return -1; + } + + return 0; +} + + +static zip_int64_t +_zip_stdio_op_create_temp_output(zip_source_file_context_t *ctx) { + char *temp; + int tfd; + int mode; + FILE *tfp; + struct stat st; + + if ((temp = (char *)malloc(strlen(ctx->fname) + 8)) == NULL) { + zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0); + return -1; + } + + if (stat(ctx->fname, &st) == 0) { + mode = st.st_mode; + } + else { + mode = -1; + } + + sprintf(temp, "%s.XXXXXX", ctx->fname); + + if ((tfd = _zip_mkstempm(temp, mode)) == -1) { + zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno); + free(temp); + return -1; + } + + if ((tfp = fdopen(tfd, "r+b")) == NULL) { + zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno); + close(tfd); + (void)remove(temp); + free(temp); + return -1; + } + + ctx->fout = tfp; + ctx->tmpname = temp; + + return 0; +} + +#ifdef CAN_CLONE +static zip_int64_t +_zip_stdio_op_create_temp_output_cloning(zip_source_file_context_t *ctx, zip_uint64_t offset) { + char *temp; + FILE *tfp; + + if (offset > ZIP_OFF_MAX) { + zip_error_set(&ctx->error, ZIP_ER_SEEK, E2BIG); + return -1; + } + + if ((temp = (char *)malloc(strlen(ctx->fname) + 8)) == NULL) { + zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0); + return -1; + } + sprintf(temp, "%s.XXXXXX", ctx->fname); + +#ifdef HAVE_CLONEFILE +#ifndef __clang_analyzer__ + /* we can't use mkstemp, since clonefile insists on creating the file */ + if (mktemp(temp) == NULL) { + zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno); + free(temp); + return -1; + } +#endif + + if (clonefile(ctx->fname, temp, 0) < 0) { + zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno); + free(temp); + return -1; + } + if ((tfp = _zip_fopen_close_on_exec(temp, true)) == NULL) { + zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno); + (void)remove(temp); + free(temp); + return -1; + } +#else + { + int fd; + struct file_clone_range range; + struct stat st; + + if (fstat(fileno(ctx->f), &st) < 0) { + zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno); + free(temp); + return -1; + } + + if ((fd = mkstemp(temp)) < 0) { + zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno); + free(temp); + return -1; + } + + range.src_fd = fileno(ctx->f); + range.src_offset = 0; + range.src_length = ((offset + st.st_blksize - 1) / st.st_blksize) * st.st_blksize; + if (range.src_length > st.st_size) { + range.src_length = 0; + } + range.dest_offset = 0; + if (ioctl(fd, FICLONERANGE, &range) < 0) { + zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno); + (void)close(fd); + (void)remove(temp); + free(temp); + return -1; + } + + if ((tfp = fdopen(fd, "r+b")) == NULL) { + zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno); + (void)close(fd); + (void)remove(temp); + free(temp); + return -1; + } + } +#endif + + if (ftruncate(fileno(tfp), (off_t)offset) < 0) { + (void)fclose(tfp); + (void)remove(temp); + free(temp); + return -1; + } + if (fseeko(tfp, (off_t)offset, SEEK_SET) < 0) { + (void)fclose(tfp); + (void)remove(temp); + free(temp); + zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno); + } + + ctx->fout = tfp; + ctx->tmpname = temp; + + return 0; +} +#endif + +static bool +_zip_stdio_op_open(zip_source_file_context_t *ctx) { + if ((ctx->f = _zip_fopen_close_on_exec(ctx->fname, false)) == NULL) { + zip_error_set(&ctx->error, ZIP_ER_OPEN, errno); + return false; + } + return true; +} + + +static zip_int64_t +_zip_stdio_op_remove(zip_source_file_context_t *ctx) { + if (remove(ctx->fname) < 0) { + zip_error_set(&ctx->error, ZIP_ER_REMOVE, errno); + return -1; + } + return 0; +} + + +static void +_zip_stdio_op_rollback_write(zip_source_file_context_t *ctx) { + if (ctx->fout) { + fclose(ctx->fout); + } + (void)remove(ctx->tmpname); +} + +static char * +_zip_stdio_op_strdup(zip_source_file_context_t *ctx, const char *string) { + return strdup(string); +} + + +static zip_int64_t +_zip_stdio_op_write(zip_source_file_context_t *ctx, const void *data, zip_uint64_t len) { + size_t ret; + + clearerr((FILE *)ctx->fout); + ret = fwrite(data, 1, len, (FILE *)ctx->fout); + if (ret != len || ferror((FILE *)ctx->fout)) { + zip_error_set(&ctx->error, ZIP_ER_WRITE, errno); + return -1; + } + + return (zip_int64_t)ret; +} diff --git a/core/deps/libzip/lib/zip_source_file_win32.c b/core/deps/libzip/lib/zip_source_file_win32.c new file mode 100644 index 000000000..6547fc20e --- /dev/null +++ b/core/deps/libzip/lib/zip_source_file_win32.c @@ -0,0 +1,234 @@ +/* + zip_source_file_win32.c -- read-only Windows file source implementation + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zip_source_file_win32.h" + +static bool _zip_win32_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t *st); + +static bool _zip_stat_win32(zip_source_file_context_t *ctx, zip_source_file_stat_t *st, HANDLE h); + +/* clang-format off */ + +static zip_source_file_operations_t ops_win32_read = { + _zip_win32_op_close, + NULL, + NULL, + NULL, + NULL, + _zip_win32_op_read, + NULL, + NULL, + _zip_win32_op_seek, + _zip_win32_op_stat, + NULL, + _zip_win32_op_tell, + NULL +}; + +/* clang-format on */ + +ZIP_EXTERN zip_source_t * +zip_source_win32handle(zip_t *za, HANDLE h, zip_uint64_t start, zip_int64_t len) { + if (za == NULL) { + return NULL; + } + + return zip_source_win32handle_create(h, start, len, &za->error); +} + + +ZIP_EXTERN zip_source_t * +zip_source_win32handle_create(HANDLE h, zip_uint64_t start, zip_int64_t length, zip_error_t *error) { + if (h == INVALID_HANDLE_VALUE || length < -1) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + return zip_source_file_common_new(NULL, h, start, length, NULL, &ops_win32_read, NULL, error); +} + + +void +_zip_win32_op_close(zip_source_file_context_t *ctx) { + CloseHandle((HANDLE)ctx->f); +} + + +zip_int64_t +_zip_win32_op_read(zip_source_file_context_t *ctx, void *buf, zip_uint64_t len) { + DWORD i; + + /* TODO: cap len to "DWORD_MAX" */ + if (!ReadFile((HANDLE)ctx->f, buf, (DWORD)len, &i, NULL)) { + zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(GetLastError())); + return -1; + } + + return (zip_int64_t)i; +} + + +bool +_zip_win32_op_seek(zip_source_file_context_t *ctx, void *f, zip_int64_t offset, int whence) { + LARGE_INTEGER li; + DWORD method; + + switch (whence) { + case SEEK_SET: + method = FILE_BEGIN; + break; + case SEEK_END: + method = FILE_END; + break; + case SEEK_CUR: + method = FILE_CURRENT; + break; + default: + zip_error_set(&ctx->error, ZIP_ER_SEEK, EINVAL); + return -1; + } + + li.QuadPart = (LONGLONG)offset; + if (!SetFilePointerEx((HANDLE)f, li, NULL, method)) { + zip_error_set(&ctx->error, ZIP_ER_SEEK, _zip_win32_error_to_errno(GetLastError())); + return false; + } + + return true; +} + + +static bool +_zip_win32_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t *st) { + return _zip_stat_win32(ctx, st, (HANDLE)ctx->f); +} + + +zip_int64_t +_zip_win32_op_tell(zip_source_file_context_t *ctx, void *f) { + LARGE_INTEGER zero; + LARGE_INTEGER new_offset; + + zero.QuadPart = 0; + if (!SetFilePointerEx((HANDLE)f, zero, &new_offset, FILE_CURRENT)) { + zip_error_set(&ctx->error, ZIP_ER_SEEK, _zip_win32_error_to_errno(GetLastError())); + return -1; + } + + return (zip_int64_t)new_offset.QuadPart; +} + + +int +_zip_win32_error_to_errno(DWORD win32err) { + /* Note: This list isn't exhaustive, but should cover common cases. */ + switch (win32err) { + case ERROR_INVALID_PARAMETER: + return EINVAL; + case ERROR_FILE_NOT_FOUND: + case ERROR_PATH_NOT_FOUND: + return ENOENT; + case ERROR_INVALID_HANDLE: + return EBADF; + case ERROR_ACCESS_DENIED: + return EACCES; + case ERROR_FILE_EXISTS: + return EEXIST; + case ERROR_TOO_MANY_OPEN_FILES: + return EMFILE; + case ERROR_DISK_FULL: + return ENOSPC; + default: + return 10000 + win32err; + } +} + + +static bool +_zip_stat_win32(zip_source_file_context_t *ctx, zip_source_file_stat_t *st, HANDLE h) { + FILETIME mtimeft; + time_t mtime; + LARGE_INTEGER size; + + if (!GetFileTime(h, NULL, NULL, &mtimeft)) { + zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(GetLastError())); + return false; + } + if (_zip_filetime_to_time_t(mtimeft, &mtime) < 0) { + zip_error_set(&ctx->error, ZIP_ER_READ, ERANGE); + return false; + } + + st->exists = true; + st->mtime = mtime; + + if (GetFileType(h) == FILE_TYPE_DISK) { + st->regular_file = 1; + + if (!GetFileSizeEx(h, &size)) { + zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(GetLastError())); + return false; + } + + st->size = (zip_uint64_t)size.QuadPart; + } + + /* TODO: fill in ctx->attributes */ + + return true; +} + + +bool +_zip_filetime_to_time_t(FILETIME ft, time_t *t) { + /* + Inspired by http://stackoverflow.com/questions/6161776/convert-windows-filetime-to-second-in-unix-linux + */ + const zip_int64_t WINDOWS_TICK = 10000000LL; + const zip_int64_t SEC_TO_UNIX_EPOCH = 11644473600LL; + ULARGE_INTEGER li; + zip_int64_t secs; + time_t temp; + + li.LowPart = ft.dwLowDateTime; + li.HighPart = ft.dwHighDateTime; + secs = (li.QuadPart / WINDOWS_TICK - SEC_TO_UNIX_EPOCH); + + temp = (time_t)secs; + if (secs != (zip_int64_t)temp) { + return false; + } + + *t = temp; + return true; +} diff --git a/core/deps/libzip/lib/zip_source_file_win32.h b/core/deps/libzip/lib/zip_source_file_win32.h new file mode 100644 index 000000000..88e45b1f9 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_file_win32.h @@ -0,0 +1,76 @@ +#ifndef _HAD_ZIP_SOURCE_FILE_WIN32_H +#define _HAD_ZIP_SOURCE_FILE_WIN32_H + +/* + zip_source_file_win32.h -- common header for Windows file implementation + Copyright (C) 2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* 0x0501 => Windows XP; needs to be at least this value because of GetFileSizeEx */ +#if !defined(MS_UWP) && !defined(_WIN32_WINNT) +#define _WIN32_WINNT 0x0501 +#endif + +#include + +#include + +#include + +#include "zipint.h" + +#include "zip_source_file.h" + +struct zip_win32_file_operations { + char *(*allocate_tempname)(const char *name, size_t extra_chars, size_t *lengthp); + HANDLE(__stdcall *create_file)(const void *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file); + BOOL(__stdcall *delete_file)(const void *name); + DWORD(__stdcall *get_file_attributes)(const void *name); + BOOL(__stdcall *get_file_attributes_ex)(const void *name, GET_FILEEX_INFO_LEVELS info_level, void *information); + void (*make_tempname)(char *buf, size_t len, const char *name, zip_uint32_t i); + BOOL(__stdcall *move_file)(const void *from, const void *to, DWORD flags); + BOOL(__stdcall *set_file_attributes)(const void *name, DWORD attributes); + char *(*string_duplicate)(const char *string); +}; + +typedef struct zip_win32_file_operations zip_win32_file_operations_t; + +extern zip_source_file_operations_t _zip_source_file_win32_named_ops; + +void _zip_win32_op_close(zip_source_file_context_t *ctx); +zip_int64_t _zip_win32_op_read(zip_source_file_context_t *ctx, void *buf, zip_uint64_t len); +bool _zip_win32_op_seek(zip_source_file_context_t *ctx, void *f, zip_int64_t offset, int whence); +zip_int64_t _zip_win32_op_tell(zip_source_file_context_t *ctx, void *f); + +bool _zip_filetime_to_time_t(FILETIME ft, time_t *t); +int _zip_win32_error_to_errno(DWORD win32err); + +#endif /* _HAD_ZIP_SOURCE_FILE_WIN32_H */ diff --git a/core/deps/libzip/lib/zip_source_file_win32_ansi.c b/core/deps/libzip/lib/zip_source_file_win32_ansi.c new file mode 100644 index 000000000..f299692b8 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_file_win32_ansi.c @@ -0,0 +1,85 @@ +/* + zip_source_file_win32_ansi.c -- source for Windows file opened by ANSI name + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zip_source_file_win32.h" + +static char *ansi_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp); +static void ansi_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i); + +/* clang-format off */ + +zip_win32_file_operations_t ops_ansi = { + ansi_allocate_tempname, + CreateFileA, + DeleteFileA, + GetFileAttributesA, + GetFileAttributesExA, + ansi_make_tempname, + MoveFileExA, + SetFileAttributesA, + strdup +}; + +/* clang-format on */ + +ZIP_EXTERN zip_source_t * +zip_source_win32a(zip_t *za, const char *fname, zip_uint64_t start, zip_int64_t len) { + if (za == NULL) + return NULL; + + return zip_source_win32a_create(fname, start, len, &za->error); +} + + +ZIP_EXTERN zip_source_t * +zip_source_win32a_create(const char *fname, zip_uint64_t start, zip_int64_t length, zip_error_t *error) { + if (fname == NULL || length < -1) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + return zip_source_file_common_new(fname, NULL, start, length, NULL, &_zip_source_file_win32_named_ops, &ops_ansi, error); +} + + +static char * +ansi_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp) { + *lengthp = strlen(name) + extra_chars; + return (char *)malloc(*lengthp); +} + + +static void +ansi_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i) { + snprintf(buf, len, "%s.%08x", name, i); +} diff --git a/core/deps/libzip/lib/zip_source_file_win32_named.c b/core/deps/libzip/lib/zip_source_file_win32_named.c new file mode 100644 index 000000000..1fe559180 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_file_win32_named.c @@ -0,0 +1,275 @@ +/* + zip_source_file_win32_named.c -- source for Windows file opened by name + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zip_source_file_win32.h" + +static zip_int64_t _zip_win32_named_op_commit_write(zip_source_file_context_t *ctx); +static zip_int64_t _zip_win32_named_op_create_temp_output(zip_source_file_context_t *ctx); +static bool _zip_win32_named_op_open(zip_source_file_context_t *ctx); +static zip_int64_t _zip_win32_named_op_remove(zip_source_file_context_t *ctx); +static void _zip_win32_named_op_rollback_write(zip_source_file_context_t *ctx); +static bool _zip_win32_named_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t *st); +static char *_zip_win32_named_op_string_duplicate(zip_source_file_context_t *ctx, const char *string); +static zip_int64_t _zip_win32_named_op_write(zip_source_file_context_t *ctx, const void *data, zip_uint64_t len); + +static HANDLE win32_named_open(zip_source_file_context_t *ctx, const char *name, bool temporary, PSECURITY_ATTRIBUTES security_attributes); + +/* clang-format off */ +zip_source_file_operations_t _zip_source_file_win32_named_ops = { + _zip_win32_op_close, + _zip_win32_named_op_commit_write, + _zip_win32_named_op_create_temp_output, + NULL, + _zip_win32_named_op_open, + _zip_win32_op_read, + _zip_win32_named_op_remove, + _zip_win32_named_op_rollback_write, + _zip_win32_op_seek, + _zip_win32_named_op_stat, + _zip_win32_named_op_string_duplicate, + _zip_win32_op_tell, + _zip_win32_named_op_write +}; +/* clang-format on */ + +static zip_int64_t +_zip_win32_named_op_commit_write(zip_source_file_context_t *ctx) { + zip_win32_file_operations_t *file_ops = (zip_win32_file_operations_t *)ctx->ops_userdata; + DWORD attributes; + + if (!CloseHandle((HANDLE)ctx->fout)) { + zip_error_set(&ctx->error, ZIP_ER_WRITE, _zip_win32_error_to_errno(GetLastError())); + return -1; + } + + attributes = file_ops->get_file_attributes(ctx->tmpname); + if (attributes == INVALID_FILE_ATTRIBUTES) { + zip_error_set(&ctx->error, ZIP_ER_RENAME, _zip_win32_error_to_errno(GetLastError())); + return -1; + } + + if (attributes & FILE_ATTRIBUTE_TEMPORARY) { + if (!file_ops->set_file_attributes(ctx->tmpname, attributes & ~FILE_ATTRIBUTE_TEMPORARY)) { + zip_error_set(&ctx->error, ZIP_ER_RENAME, _zip_win32_error_to_errno(GetLastError())); + return -1; + } + } + + if (!file_ops->move_file(ctx->tmpname, ctx->fname, MOVEFILE_REPLACE_EXISTING)) { + zip_error_set(&ctx->error, ZIP_ER_RENAME, _zip_win32_error_to_errno(GetLastError())); + return -1; + } + + return 0; +} + +static zip_int64_t +_zip_win32_named_op_create_temp_output(zip_source_file_context_t *ctx) { + zip_win32_file_operations_t *file_ops = (zip_win32_file_operations_t *)ctx->ops_userdata; + + zip_uint32_t value, i; + HANDLE th = INVALID_HANDLE_VALUE; + void *temp = NULL; + PSECURITY_DESCRIPTOR psd = NULL; + PSECURITY_ATTRIBUTES psa = NULL; + SECURITY_ATTRIBUTES sa; + SECURITY_INFORMATION si; + DWORD success; + PACL dacl = NULL; + char *tempname = NULL; + size_t tempname_size = 0; + + if ((HANDLE)ctx->f != INVALID_HANDLE_VALUE && GetFileType((HANDLE)ctx->f) == FILE_TYPE_DISK) { + si = DACL_SECURITY_INFORMATION | UNPROTECTED_DACL_SECURITY_INFORMATION; + success = GetSecurityInfo((HANDLE)ctx->f, SE_FILE_OBJECT, si, NULL, NULL, &dacl, NULL, &psd); + if (success == ERROR_SUCCESS) { + sa.nLength = sizeof(SECURITY_ATTRIBUTES); + sa.bInheritHandle = FALSE; + sa.lpSecurityDescriptor = psd; + psa = &sa; + } + } + +#ifndef MS_UWP + value = GetTickCount(); +#else + value = (zip_uint32_t)(GetTickCount64() & 0xffffffff); +#endif + + if ((tempname = file_ops->allocate_tempname(ctx->fname, 10, &tempname_size)) == NULL) { + zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0); + return -1; + } + + for (i = 0; i < 1024 && th == INVALID_HANDLE_VALUE; i++) { + file_ops->make_tempname(tempname, tempname_size, ctx->fname, value + i); + + th = win32_named_open(ctx, tempname, true, psa); + if (th == INVALID_HANDLE_VALUE && GetLastError() != ERROR_FILE_EXISTS) + break; + } + + if (th == INVALID_HANDLE_VALUE) { + free(tempname); + LocalFree(psd); + zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, _zip_win32_error_to_errno(GetLastError())); + return -1; + } + + LocalFree(psd); + ctx->fout = th; + ctx->tmpname = tempname; + + return 0; +} + + +static bool +_zip_win32_named_op_open(zip_source_file_context_t *ctx) { + HANDLE h = win32_named_open(ctx, ctx->fname, false, NULL); + + if (h == INVALID_HANDLE_VALUE) { + return false; + } + + ctx->f = h; + return true; +} + + +static zip_int64_t +_zip_win32_named_op_remove(zip_source_file_context_t *ctx) { + zip_win32_file_operations_t *file_ops = (zip_win32_file_operations_t *)ctx->ops_userdata; + + if (!file_ops->delete_file(ctx->fname)) { + zip_error_set(&ctx->error, ZIP_ER_REMOVE, _zip_win32_error_to_errno(GetLastError())); + return -1; + } + + return 0; +} + + +static void +_zip_win32_named_op_rollback_write(zip_source_file_context_t *ctx) { + zip_win32_file_operations_t *file_ops = (zip_win32_file_operations_t *)ctx->ops_userdata; + + if (ctx->fout) { + CloseHandle((HANDLE)ctx->fout); + } + file_ops->delete_file(ctx->tmpname); +} + + +static bool +_zip_win32_named_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t *st) { + zip_win32_file_operations_t *file_ops = (zip_win32_file_operations_t *)ctx->ops_userdata; + + WIN32_FILE_ATTRIBUTE_DATA file_attributes; + + if (!file_ops->get_file_attributes_ex(ctx->fname, GetFileExInfoStandard, &file_attributes)) { + DWORD error = GetLastError(); + if (error == ERROR_FILE_NOT_FOUND) { + st->exists = false; + return true; + } + zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(error)); + return false; + } + + st->exists = true; + st->regular_file = false; + + if (file_attributes.dwFileAttributes != INVALID_FILE_ATTRIBUTES) { + if ((file_attributes.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_REPARSE_POINT)) == 0) { + st->regular_file = true; + } + } + + if (!_zip_filetime_to_time_t(file_attributes.ftLastWriteTime, &st->mtime)) { + zip_error_set(&ctx->error, ZIP_ER_READ, ERANGE); + return false; + } + st->size = ((zip_uint64_t)file_attributes.nFileSizeHigh << 32) | file_attributes.nFileSizeLow; + + /* TODO: fill in ctx->attributes */ + + return true; +} + + +static char * +_zip_win32_named_op_string_duplicate(zip_source_file_context_t *ctx, const char *string) { + zip_win32_file_operations_t *file_ops = (zip_win32_file_operations_t *)ctx->ops_userdata; + + return file_ops->string_duplicate(string); +} + + +static zip_int64_t +_zip_win32_named_op_write(zip_source_file_context_t *ctx, const void *data, zip_uint64_t len) { + DWORD ret; + if (!WriteFile((HANDLE)ctx->fout, data, (DWORD)len, &ret, NULL) || ret != len) { + zip_error_set(&ctx->error, ZIP_ER_WRITE, _zip_win32_error_to_errno(GetLastError())); + return -1; + } + + return (zip_int64_t)ret; +} + + +static HANDLE +win32_named_open(zip_source_file_context_t *ctx, const char *name, bool temporary, PSECURITY_ATTRIBUTES security_attributes) { + zip_win32_file_operations_t *file_ops = (zip_win32_file_operations_t *)ctx->ops_userdata; + + DWORD access = GENERIC_READ; + DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE; + DWORD creation_disposition = OPEN_EXISTING; + DWORD file_attributes = FILE_ATTRIBUTE_NORMAL; + HANDLE h; + + if (temporary) { + access = GENERIC_READ | GENERIC_WRITE; + share_mode = FILE_SHARE_READ; + creation_disposition = CREATE_NEW; + file_attributes = FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_TEMPORARY; + } + + h = file_ops->create_file(name, access, share_mode, security_attributes, creation_disposition, file_attributes, NULL); + + if (h == INVALID_HANDLE_VALUE) { + zip_error_set(&ctx->error, ZIP_ER_OPEN, _zip_win32_error_to_errno(GetLastError())); + } + + return h; +} diff --git a/core/deps/libzip/lib/zip_source_file_win32_utf16.c b/core/deps/libzip/lib/zip_source_file_win32_utf16.c new file mode 100644 index 000000000..6aef2bb49 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_file_win32_utf16.c @@ -0,0 +1,111 @@ +/* + zip_source_file_win32_utf16.c -- source for Windows file opened by UTF-16 name + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zip_source_file_win32.h" + +static char *utf16_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp); +static HANDLE __stdcall utf16_create_file(const char *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file); +static void utf16_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i); +static char *utf16_strdup(const char *string); + +/* clang-format off */ + +zip_win32_file_operations_t ops_utf16 = { + utf16_allocate_tempname, + utf16_create_file, + DeleteFileW, + GetFileAttributesW, + GetFileAttributesExW, + utf16_make_tempname, + MoveFileExW, + SetFileAttributesW, + utf16_strdup +}; + +/* clang-format on */ + +ZIP_EXTERN zip_source_t * +zip_source_win32w(zip_t *za, const wchar_t *fname, zip_uint64_t start, zip_int64_t len) { + if (za == NULL) + return NULL; + + return zip_source_win32w_create(fname, start, len, &za->error); +} + + +ZIP_EXTERN zip_source_t * +zip_source_win32w_create(const wchar_t *fname, zip_uint64_t start, zip_int64_t length, zip_error_t *error) { + if (fname == NULL || length < -1) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + + return zip_source_file_common_new((const char *)fname, NULL, start, length, NULL, &_zip_source_file_win32_named_ops, &ops_utf16, error); +} + + +static char * +utf16_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp) { + *lengthp = wcslen((const wchar_t *)name) + extra_chars; + return (char *)malloc(*lengthp * sizeof(wchar_t)); +} + + +static HANDLE __stdcall utf16_create_file(const char *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file) { +#ifdef MS_UWP + CREATEFILE2_EXTENDED_PARAMETERS extParams = {0}; + extParams.dwFileAttributes = file_attributes; + extParams.dwFileFlags = FILE_FLAG_RANDOM_ACCESS; + extParams.dwSecurityQosFlags = SECURITY_ANONYMOUS; + extParams.dwSize = sizeof(extParams); + extParams.hTemplateFile = template_file; + extParams.lpSecurityAttributes = security_attributes; + + return CreateFile2((const wchar_t *)name, access, share_mode, creation_disposition, &extParams); +#else + return CreateFileW((const wchar_t *)name, access, share_mode, security_attributes, creation_disposition, file_attributes, template_file); +#endif +} + + +static void +utf16_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i) { + _snwprintf((wchar_t *)buf, len, L"%s.%08x", (const wchar_t *)name, i); +} + + +static char * +utf16_strdup(const char *string) { + return (char *)_wcsdup((const wchar_t *)string); +} diff --git a/core/deps/libzip/lib/zip_source_file_win32_utf8.c b/core/deps/libzip/lib/zip_source_file_win32_utf8.c new file mode 100644 index 000000000..d6728e34f --- /dev/null +++ b/core/deps/libzip/lib/zip_source_file_win32_utf8.c @@ -0,0 +1,73 @@ +/* + zip_source_file_win32_ansi.c -- source for Windows file opened by UTF-8 name + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zip_source_file_win32.h" + +ZIP_EXTERN zip_source_t * +zip_source_file(zip_t *za, const char *fname, zip_uint64_t start, zip_int64_t len) { + if (za == NULL) { + return NULL; + } + + return zip_source_file_create(fname, start, len, &za->error); +} + + +ZIP_EXTERN zip_source_t * +zip_source_file_create(const char *fname, zip_uint64_t start, zip_int64_t length, zip_error_t *error) { + int size; + wchar_t *wfname; + zip_source_t *source; + + if (fname == NULL || length < -1) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + /* Convert fname from UTF-8 to Windows-friendly UTF-16. */ + size = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, fname, -1, NULL, 0); + if (size == 0) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + if ((wfname = (wchar_t *)malloc(sizeof(wchar_t) * size)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, fname, -1, wfname, size); + + source = zip_source_win32w_create(wfname, start, length, error); + + free(wfname); + return source; +} diff --git a/core/deps/libzip/zip_add_dir.c b/core/deps/libzip/lib/zip_source_free.c similarity index 67% rename from core/deps/libzip/zip_add_dir.c rename to core/deps/libzip/lib/zip_source_free.c index 493e28dda..26504931e 100644 --- a/core/deps/libzip/zip_add_dir.c +++ b/core/deps/libzip/lib/zip_source_free.c @@ -1,6 +1,6 @@ /* - zip_add_dir.c -- add directory - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + zip_source_free.c -- free zip data source + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,50 +31,41 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include -#include #include "zipint.h" - -ZIP_EXTERN int -zip_add_dir(struct zip *za, const char *name) -{ - int len, ret; - char *s; - struct zip_source *source; +ZIP_EXTERN void +zip_source_free(zip_source_t *src) { + if (src == NULL) + return; - if (name == NULL) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; + if (src->refcount > 0) { + src->refcount--; + } + if (src->refcount > 0) { + return; } - s = NULL; - len = strlen(name); - - if (name[len-1] != '/') { - if ((s=(char *)malloc(len+2)) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return -1; - } - strcpy(s, name); - s[len] = '/'; - s[len+1] = '\0'; + if (ZIP_SOURCE_IS_OPEN_READING(src)) { + src->open_count = 1; /* force close */ + zip_source_close(src); + } + if (ZIP_SOURCE_IS_OPEN_WRITING(src)) { + zip_source_rollback_write(src); } - if ((source=zip_source_buffer(za, NULL, 0, 0)) == NULL) { - free(s); - return -1; + if (src->source_archive && !src->source_closed) { + _zip_deregister_source(src->source_archive, src); } - - ret = _zip_replace(za, -1, s ? s : name, source); - free(s); - if (ret < 0) - zip_source_free(source); + (void)_zip_source_call(src, NULL, 0, ZIP_SOURCE_FREE); - return ret; + if (src->src) { + zip_source_free(src->src); + } + + free(src); } diff --git a/core/deps/libzip/lib/zip_source_function.c b/core/deps/libzip/lib/zip_source_function.c new file mode 100644 index 000000000..5602f1d19 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_function.c @@ -0,0 +1,98 @@ +/* + zip_source_function.c -- create zip data source from callback function + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include + +#include "zipint.h" + + +ZIP_EXTERN zip_source_t * +zip_source_function(zip_t *za, zip_source_callback zcb, void *ud) { + if (za == NULL) { + return NULL; + } + + return zip_source_function_create(zcb, ud, &za->error); +} + + +ZIP_EXTERN zip_source_t * +zip_source_function_create(zip_source_callback zcb, void *ud, zip_error_t *error) { + zip_source_t *zs; + + if ((zs = _zip_source_new(error)) == NULL) + return NULL; + + zs->cb.f = zcb; + zs->ud = ud; + + zs->supports = zcb(ud, NULL, 0, ZIP_SOURCE_SUPPORTS); + if (zs->supports < 0) { + zs->supports = ZIP_SOURCE_SUPPORTS_READABLE; + } + + return zs; +} + + +ZIP_EXTERN void +zip_source_keep(zip_source_t *src) { + src->refcount++; +} + + +zip_source_t * +_zip_source_new(zip_error_t *error) { + zip_source_t *src; + + if ((src = (zip_source_t *)malloc(sizeof(*src))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + src->src = NULL; + src->cb.f = NULL; + src->ud = NULL; + src->open_count = 0; + src->write_state = ZIP_SOURCE_WRITE_CLOSED; + src->source_closed = false; + src->source_archive = NULL; + src->refcount = 1; + zip_error_init(&src->error); + src->eof = false; + src->had_read_error = false; + src->bytes_read = 0; + + return src; +} diff --git a/core/deps/libzip/lib/zip_source_get_file_attributes.c b/core/deps/libzip/lib/zip_source_get_file_attributes.c new file mode 100644 index 000000000..734767a0e --- /dev/null +++ b/core/deps/libzip/lib/zip_source_get_file_attributes.c @@ -0,0 +1,106 @@ +/* + zip_source_get_file_attributes.c -- get attributes for file from source + Copyright (C) 2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zipint.h" + +ZIP_EXTERN void +zip_file_attributes_init(zip_file_attributes_t *attributes) { + attributes->valid = 0; + attributes->version = 1; +} + +int +zip_source_get_file_attributes(zip_source_t *src, zip_file_attributes_t *attributes) { + if (src->source_closed) { + return -1; + } + if (attributes == NULL) { + zip_error_set(&src->error, ZIP_ER_INVAL, 0); + return -1; + } + + zip_file_attributes_init(attributes); + + if (src->supports & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_GET_FILE_ATTRIBUTES)) { + if (_zip_source_call(src, attributes, sizeof(*attributes), ZIP_SOURCE_GET_FILE_ATTRIBUTES) < 0) { + return -1; + } + } + + if (ZIP_SOURCE_IS_LAYERED(src)) { + zip_file_attributes_t lower_attributes; + + if (zip_source_get_file_attributes(src->src, &lower_attributes) < 0) { + _zip_error_set_from_source(&src->error, src->src); + return -1; + } + + if ((lower_attributes.valid & ZIP_FILE_ATTRIBUTES_HOST_SYSTEM) && (attributes->valid & ZIP_FILE_ATTRIBUTES_HOST_SYSTEM) == 0) { + attributes->host_system = lower_attributes.host_system; + attributes->valid |= ZIP_FILE_ATTRIBUTES_HOST_SYSTEM; + } + if ((lower_attributes.valid & ZIP_FILE_ATTRIBUTES_ASCII) && (attributes->valid & ZIP_FILE_ATTRIBUTES_ASCII) == 0) { + attributes->ascii = lower_attributes.ascii; + attributes->valid |= ZIP_FILE_ATTRIBUTES_ASCII; + } + if ((lower_attributes.valid & ZIP_FILE_ATTRIBUTES_VERSION_NEEDED)) { + if (attributes->valid & ZIP_FILE_ATTRIBUTES_VERSION_NEEDED) { + attributes->version_needed = ZIP_MAX(lower_attributes.version_needed, attributes->version_needed); + } + else { + attributes->version_needed = lower_attributes.version_needed; + attributes->valid |= ZIP_FILE_ATTRIBUTES_VERSION_NEEDED; + } + } + if ((lower_attributes.valid & ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES) && (attributes->valid & ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES) == 0) { + attributes->external_file_attributes = lower_attributes.external_file_attributes; + attributes->valid |= ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES; + } + if ((lower_attributes.valid & ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS)) { + if (attributes->valid & ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS) { + /* only take from lower level what is not defined at current level */ + lower_attributes.general_purpose_bit_mask &= ~attributes->general_purpose_bit_mask; + + attributes->general_purpose_bit_flags |= lower_attributes.general_purpose_bit_flags & lower_attributes.general_purpose_bit_mask; + attributes->general_purpose_bit_mask |= lower_attributes.general_purpose_bit_mask; + } + else { + attributes->valid |= ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS; + attributes->general_purpose_bit_flags = lower_attributes.general_purpose_bit_flags; + attributes->general_purpose_bit_mask = lower_attributes.general_purpose_bit_mask; + } + } + } + + return 0; +} diff --git a/core/deps/libzip/lib/zip_source_is_deleted.c b/core/deps/libzip/lib/zip_source_is_deleted.c new file mode 100644 index 000000000..27c931fd4 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_is_deleted.c @@ -0,0 +1,41 @@ +/* + zip_source_is_deleted.c -- was archive was removed? + Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +ZIP_EXTERN int +zip_source_is_deleted(zip_source_t *src) { + return src->write_state == ZIP_SOURCE_WRITE_REMOVED; +} diff --git a/core/deps/libzip/lib/zip_source_layered.c b/core/deps/libzip/lib/zip_source_layered.c new file mode 100644 index 000000000..a02986929 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_layered.c @@ -0,0 +1,67 @@ +/* + zip_source_layered.c -- create layered source + Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include + +#include "zipint.h" + + +zip_source_t * +zip_source_layered(zip_t *za, zip_source_t *src, zip_source_layered_callback cb, void *ud) { + if (za == NULL) + return NULL; + + return zip_source_layered_create(src, cb, ud, &za->error); +} + + +zip_source_t * +zip_source_layered_create(zip_source_t *src, zip_source_layered_callback cb, void *ud, zip_error_t *error) { + zip_source_t *zs; + + if ((zs = _zip_source_new(error)) == NULL) + return NULL; + + zip_source_keep(src); + zs->src = src; + zs->cb.l = cb; + zs->ud = ud; + + zs->supports = cb(src, ud, NULL, 0, ZIP_SOURCE_SUPPORTS); + if (zs->supports < 0) { + zs->supports = ZIP_SOURCE_SUPPORTS_READABLE; + } + + return zs; +} diff --git a/core/deps/libzip/zip_unchange.c b/core/deps/libzip/lib/zip_source_open.c similarity index 58% rename from core/deps/libzip/zip_unchange.c rename to core/deps/libzip/lib/zip_source_open.c index ed0d4de65..442f1894f 100644 --- a/core/deps/libzip/zip_unchange.c +++ b/core/deps/libzip/lib/zip_source_open.c @@ -1,6 +1,6 @@ /* - zip_unchange.c -- undo changes to file in zip archive - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + zip_source_open.c -- open zip_source (prepare for reading) + Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,52 +31,46 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - -#include #include "zipint.h" - - ZIP_EXTERN int -zip_unchange(struct zip *za, int idx) -{ - return _zip_unchange(za, idx, 0); -} - - - -int -_zip_unchange(struct zip *za, int idx, int allow_duplicates) -{ - int i; - - if (idx < 0 || idx >= za->nentry) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; +zip_source_open(zip_source_t *src) { + if (src->source_closed) { + return -1; + } + if (src->write_state == ZIP_SOURCE_WRITE_REMOVED) { + zip_error_set(&src->error, ZIP_ER_DELETED, 0); + return -1; } - if (za->entry[idx].ch_filename) { - if (!allow_duplicates) { - i = _zip_name_locate(za, - _zip_get_name(za, idx, ZIP_FL_UNCHANGED, NULL), - 0, NULL); - if (i != -1 && i != idx) { - _zip_error_set(&za->error, ZIP_ER_EXISTS, 0); - return -1; - } - } + if (ZIP_SOURCE_IS_OPEN_READING(src)) { + if ((zip_source_supports(src) & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SEEK)) == 0) { + zip_error_set(&src->error, ZIP_ER_INUSE, 0); + return -1; + } + } + else { + if (ZIP_SOURCE_IS_LAYERED(src)) { + if (zip_source_open(src->src) < 0) { + _zip_error_set_from_source(&src->error, src->src); + return -1; + } + } - free(za->entry[idx].ch_filename); - za->entry[idx].ch_filename = NULL; + if (_zip_source_call(src, NULL, 0, ZIP_SOURCE_OPEN) < 0) { + if (ZIP_SOURCE_IS_LAYERED(src)) { + zip_source_close(src->src); + } + return -1; + } } - free(za->entry[idx].ch_comment); - za->entry[idx].ch_comment = NULL; - za->entry[idx].ch_comment_len = -1; - - _zip_unchange_data(za->entry+idx); + src->eof = false; + src->had_read_error = false; + _zip_error_clear(&src->error); + src->bytes_read = 0; + src->open_count++; return 0; } diff --git a/core/deps/libzip/lib/zip_source_pkware_decode.c b/core/deps/libzip/lib/zip_source_pkware_decode.c new file mode 100644 index 000000000..a1c9e3a9b --- /dev/null +++ b/core/deps/libzip/lib/zip_source_pkware_decode.c @@ -0,0 +1,220 @@ +/* + zip_source_pkware_decode.c -- Traditional PKWARE decryption routines + Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include +#include + +#include "zipint.h" + +struct trad_pkware { + char *password; + zip_pkware_keys_t keys; + zip_error_t error; +}; + + +static int decrypt_header(zip_source_t *, struct trad_pkware *); +static zip_int64_t pkware_decrypt(zip_source_t *, void *, void *, zip_uint64_t, zip_source_cmd_t); +static struct trad_pkware *trad_pkware_new(const char *password, zip_error_t *error); +static void trad_pkware_free(struct trad_pkware *); + + +zip_source_t * +zip_source_pkware_decode(zip_t *za, zip_source_t *src, zip_uint16_t em, int flags, const char *password) { + struct trad_pkware *ctx; + zip_source_t *s2; + + if (password == NULL || src == NULL || em != ZIP_EM_TRAD_PKWARE) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + if (flags & ZIP_CODEC_ENCODE) { + zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0); + return NULL; + } + + if ((ctx = trad_pkware_new(password, &za->error)) == NULL) { + return NULL; + } + + if ((s2 = zip_source_layered(za, src, pkware_decrypt, ctx)) == NULL) { + trad_pkware_free(ctx); + return NULL; + } + + return s2; +} + + +static int +decrypt_header(zip_source_t *src, struct trad_pkware *ctx) { + zip_uint8_t header[ZIP_CRYPTO_PKWARE_HEADERLEN]; + struct zip_stat st; + zip_int64_t n; + bool ok = false; + + if ((n = zip_source_read(src, header, ZIP_CRYPTO_PKWARE_HEADERLEN)) < 0) { + _zip_error_set_from_source(&ctx->error, src); + return -1; + } + + if (n != ZIP_CRYPTO_PKWARE_HEADERLEN) { + zip_error_set(&ctx->error, ZIP_ER_EOF, 0); + return -1; + } + + _zip_pkware_decrypt(&ctx->keys, header, header, ZIP_CRYPTO_PKWARE_HEADERLEN); + + if (zip_source_stat(src, &st)) { + /* stat failed, skip password validation */ + return 0; + } + + /* password verification - two ways: + * mtime - InfoZIP way, to avoid computing complete CRC before encrypting data + * CRC - old PKWare way + */ + + if (st.valid & ZIP_STAT_MTIME) { + unsigned short dostime, dosdate; + _zip_u2d_time(st.mtime, &dostime, &dosdate); + if (header[ZIP_CRYPTO_PKWARE_HEADERLEN - 1] == dostime >> 8) { + ok = true; + } + } + + if (st.valid & ZIP_STAT_CRC) { + if (header[ZIP_CRYPTO_PKWARE_HEADERLEN - 1] == st.crc >> 24) { + ok = true; + } + } + + if (!ok && ((st.valid & (ZIP_STAT_MTIME | ZIP_STAT_CRC)) != 0)) { + zip_error_set(&ctx->error, ZIP_ER_WRONGPASSWD, 0); + return -1; + } + + return 0; +} + + +static zip_int64_t +pkware_decrypt(zip_source_t *src, void *ud, void *data, zip_uint64_t len, zip_source_cmd_t cmd) { + struct trad_pkware *ctx; + zip_int64_t n; + + ctx = (struct trad_pkware *)ud; + + switch (cmd) { + case ZIP_SOURCE_OPEN: + _zip_pkware_keys_reset(&ctx->keys); + _zip_pkware_decrypt(&ctx->keys, NULL, (const zip_uint8_t *)ctx->password, strlen(ctx->password)); + if (decrypt_header(src, ctx) < 0) { + return -1; + } + return 0; + + case ZIP_SOURCE_READ: + if ((n = zip_source_read(src, data, len)) < 0) { + _zip_error_set_from_source(&ctx->error, src); + return -1; + } + + _zip_pkware_decrypt(&ctx->keys, (zip_uint8_t *)data, (zip_uint8_t *)data, (zip_uint64_t)n); + return n; + + case ZIP_SOURCE_CLOSE: + return 0; + + case ZIP_SOURCE_STAT: { + zip_stat_t *st; + + st = (zip_stat_t *)data; + + st->encryption_method = ZIP_EM_NONE; + st->valid |= ZIP_STAT_ENCRYPTION_METHOD; + if (st->valid & ZIP_STAT_COMP_SIZE) { + st->comp_size -= ZIP_CRYPTO_PKWARE_HEADERLEN; + } + + return 0; + } + + case ZIP_SOURCE_SUPPORTS: + return zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, -1); + + case ZIP_SOURCE_ERROR: + return zip_error_to_data(&ctx->error, data, len); + + case ZIP_SOURCE_FREE: + trad_pkware_free(ctx); + return 0; + + default: + zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); + return -1; + } +} + + +static struct trad_pkware * +trad_pkware_new(const char *password, zip_error_t *error) { + struct trad_pkware *ctx; + + if ((ctx = (struct trad_pkware *)malloc(sizeof(*ctx))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if ((ctx->password = strdup(password)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + free(ctx); + return NULL; + } + + zip_error_init(&ctx->error); + + return ctx; +} + + +static void +trad_pkware_free(struct trad_pkware *ctx) { + if (ctx == NULL) { + return; + } + + free(ctx->password); + free(ctx); +} diff --git a/core/deps/libzip/lib/zip_source_pkware_encode.c b/core/deps/libzip/lib/zip_source_pkware_encode.c new file mode 100644 index 000000000..7c77e1e86 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_pkware_encode.c @@ -0,0 +1,249 @@ +/* + zip_source_pkware_encode.c -- Traditional PKWARE encryption routines + Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include +#include + +#include "zipint.h" + +struct trad_pkware { + char *password; + zip_pkware_keys_t keys; + zip_buffer_t *buffer; + bool eof; + zip_error_t error; +}; + + +static int encrypt_header(zip_source_t *, struct trad_pkware *); +static zip_int64_t pkware_encrypt(zip_source_t *, void *, void *, zip_uint64_t, zip_source_cmd_t); +static void trad_pkware_free(struct trad_pkware *); +static struct trad_pkware *trad_pkware_new(const char *password, zip_error_t *error); + + +zip_source_t * +zip_source_pkware_encode(zip_t *za, zip_source_t *src, zip_uint16_t em, int flags, const char *password) { + struct trad_pkware *ctx; + zip_source_t *s2; + + if (password == NULL || src == NULL || em != ZIP_EM_TRAD_PKWARE) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + if (!(flags & ZIP_CODEC_ENCODE)) { + zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0); + return NULL; + } + + if ((ctx = trad_pkware_new(password, &za->error)) == NULL) { + return NULL; + } + + if ((s2 = zip_source_layered(za, src, pkware_encrypt, ctx)) == NULL) { + trad_pkware_free(ctx); + return NULL; + } + + return s2; +} + + +static int +encrypt_header(zip_source_t *src, struct trad_pkware *ctx) { + struct zip_stat st; + unsigned short dostime, dosdate; + zip_uint8_t *header; + + if (zip_source_stat(src, &st) != 0) { + _zip_error_set_from_source(&ctx->error, src); + return -1; + } + + _zip_u2d_time(st.mtime, &dostime, &dosdate); + + if ((ctx->buffer = _zip_buffer_new(NULL, ZIP_CRYPTO_PKWARE_HEADERLEN)) == NULL) { + zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0); + return -1; + } + + header = _zip_buffer_data(ctx->buffer); + + /* generate header from random bytes and mtime + see appnote.iz, XIII. Decryption, Step 2, last paragraph */ + if (!zip_secure_random(header, ZIP_CRYPTO_PKWARE_HEADERLEN - 1)) { + zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0); + _zip_buffer_free(ctx->buffer); + ctx->buffer = NULL; + return -1; + } + header[ZIP_CRYPTO_PKWARE_HEADERLEN - 1] = (zip_uint8_t)((dostime >> 8) & 0xff); + + _zip_pkware_encrypt(&ctx->keys, header, header, ZIP_CRYPTO_PKWARE_HEADERLEN); + + return 0; +} + + +static zip_int64_t +pkware_encrypt(zip_source_t *src, void *ud, void *data, zip_uint64_t length, zip_source_cmd_t cmd) { + struct trad_pkware *ctx; + zip_int64_t n; + zip_uint64_t buffer_n; + + ctx = (struct trad_pkware *)ud; + + switch (cmd) { + case ZIP_SOURCE_OPEN: + ctx->eof = false; + + /* initialize keys */ + _zip_pkware_keys_reset(&ctx->keys); + _zip_pkware_encrypt(&ctx->keys, NULL, (const zip_uint8_t *)ctx->password, strlen(ctx->password)); + + if (encrypt_header(src, ctx) < 0) { + return -1; + } + return 0; + + case ZIP_SOURCE_READ: + buffer_n = 0; + + if (ctx->buffer) { + /* write header values to data */ + buffer_n = _zip_buffer_read(ctx->buffer, data, length); + data = (zip_uint8_t *)data + buffer_n; + length -= buffer_n; + + if (_zip_buffer_eof(ctx->buffer)) { + _zip_buffer_free(ctx->buffer); + ctx->buffer = NULL; + } + } + + if (ctx->eof) { + return (zip_int64_t)buffer_n; + } + + if ((n = zip_source_read(src, data, length)) < 0) { + _zip_error_set_from_source(&ctx->error, src); + return -1; + } + + _zip_pkware_encrypt(&ctx->keys, (zip_uint8_t *)data, (zip_uint8_t *)data, (zip_uint64_t)n); + + if ((zip_uint64_t)n < length) { + ctx->eof = true; + } + + return (zip_int64_t)buffer_n + n; + + case ZIP_SOURCE_CLOSE: + _zip_buffer_free(ctx->buffer); + ctx->buffer = NULL; + return 0; + + case ZIP_SOURCE_STAT: { + zip_stat_t *st; + + st = (zip_stat_t *)data; + st->encryption_method = ZIP_EM_TRAD_PKWARE; + st->valid |= ZIP_STAT_ENCRYPTION_METHOD; + if (st->valid & ZIP_STAT_COMP_SIZE) { + st->comp_size += ZIP_CRYPTO_PKWARE_HEADERLEN; + } + + return 0; + } + + case ZIP_SOURCE_GET_FILE_ATTRIBUTES: { + zip_file_attributes_t *attributes = (zip_file_attributes_t *)data; + if (length < sizeof(*attributes)) { + zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); + return -1; + } + attributes->valid |= ZIP_FILE_ATTRIBUTES_VERSION_NEEDED; + attributes->version_needed = 20; + + return 0; + } + + case ZIP_SOURCE_SUPPORTS: + return zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_GET_FILE_ATTRIBUTES, -1); + + case ZIP_SOURCE_ERROR: + return zip_error_to_data(&ctx->error, data, length); + + case ZIP_SOURCE_FREE: + trad_pkware_free(ctx); + return 0; + + default: + zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); + return -1; + } +} + + +static struct trad_pkware * +trad_pkware_new(const char *password, zip_error_t *error) { + struct trad_pkware *ctx; + + if ((ctx = (struct trad_pkware *)malloc(sizeof(*ctx))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if ((ctx->password = strdup(password)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + free(ctx); + return NULL; + } + ctx->buffer = NULL; + zip_error_init(&ctx->error); + + return ctx; +} + + +static void +trad_pkware_free(struct trad_pkware *ctx) { + if (ctx == NULL) { + return; + } + + free(ctx->password); + _zip_buffer_free(ctx->buffer); + zip_error_fini(&ctx->error); + free(ctx); +} diff --git a/core/deps/libzip/lib/zip_source_read.c b/core/deps/libzip/lib/zip_source_read.c new file mode 100644 index 000000000..f146ab065 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_read.c @@ -0,0 +1,96 @@ +/* + zip_source_read.c -- read data from zip_source + Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +zip_int64_t +zip_source_read(zip_source_t *src, void *data, zip_uint64_t len) { + zip_uint64_t bytes_read; + zip_int64_t n; + + if (src->source_closed) { + return -1; + } + if (!ZIP_SOURCE_IS_OPEN_READING(src) || len > ZIP_INT64_MAX || (len > 0 && data == NULL)) { + zip_error_set(&src->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (src->had_read_error) { + return -1; + } + + if (_zip_source_eof(src)) { + return 0; + } + + if (len == 0) { + return 0; + } + + bytes_read = 0; + while (bytes_read < len) { + if ((n = _zip_source_call(src, (zip_uint8_t *)data + bytes_read, len - bytes_read, ZIP_SOURCE_READ)) < 0) { + src->had_read_error = true; + if (bytes_read == 0) { + return -1; + } + else { + return (zip_int64_t)bytes_read; + } + } + + if (n == 0) { + src->eof = 1; + break; + } + + bytes_read += (zip_uint64_t)n; + } + + if (src->bytes_read + bytes_read < src->bytes_read) { + src->bytes_read = ZIP_UINT64_MAX; + } + else { + src->bytes_read += bytes_read; + } + return (zip_int64_t)bytes_read; +} + + +bool +_zip_source_eof(zip_source_t *src) { + return src->eof; +} diff --git a/core/deps/libzip/lib/zip_source_remove.c b/core/deps/libzip/lib/zip_source_remove.c new file mode 100644 index 000000000..a6ccd7eda --- /dev/null +++ b/core/deps/libzip/lib/zip_source_remove.c @@ -0,0 +1,60 @@ +/* + zip_source_remove.c -- remove empty archive + Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#include "zipint.h" + + +int +zip_source_remove(zip_source_t *src) { + if (src->write_state == ZIP_SOURCE_WRITE_REMOVED) { + return 0; + } + + if (ZIP_SOURCE_IS_OPEN_READING(src)) { + if (zip_source_close(src) < 0) { + return -1; + } + } + if (src->write_state != ZIP_SOURCE_WRITE_CLOSED) { + zip_source_rollback_write(src); + } + + if (_zip_source_call(src, NULL, 0, ZIP_SOURCE_REMOVE) < 0) { + return -1; + } + + src->write_state = ZIP_SOURCE_WRITE_REMOVED; + + return 0; +} diff --git a/core/deps/libzip/lib/zip_source_rollback_write.c b/core/deps/libzip/lib/zip_source_rollback_write.c new file mode 100644 index 000000000..d21b1ffe2 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_rollback_write.c @@ -0,0 +1,46 @@ +/* + zip_source_rollback_write.c -- discard changes + Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +ZIP_EXTERN void +zip_source_rollback_write(zip_source_t *src) { + if (src->write_state != ZIP_SOURCE_WRITE_OPEN && src->write_state != ZIP_SOURCE_WRITE_FAILED) { + return; + } + + _zip_source_call(src, NULL, 0, ZIP_SOURCE_ROLLBACK_WRITE); + src->write_state = ZIP_SOURCE_WRITE_CLOSED; +} diff --git a/core/deps/libzip/lib/zip_source_seek.c b/core/deps/libzip/lib/zip_source_seek.c new file mode 100644 index 000000000..29d1e968e --- /dev/null +++ b/core/deps/libzip/lib/zip_source_seek.c @@ -0,0 +1,95 @@ +/* + zip_source_seek.c -- seek to offset + Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +ZIP_EXTERN int +zip_source_seek(zip_source_t *src, zip_int64_t offset, int whence) { + zip_source_args_seek_t args; + + if (src->source_closed) { + return -1; + } + if (!ZIP_SOURCE_IS_OPEN_READING(src) || (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END)) { + zip_error_set(&src->error, ZIP_ER_INVAL, 0); + return -1; + } + + args.offset = offset; + args.whence = whence; + + if (_zip_source_call(src, &args, sizeof(args), ZIP_SOURCE_SEEK) < 0) { + return -1; + } + + src->eof = 0; + return 0; +} + + +zip_int64_t +zip_source_seek_compute_offset(zip_uint64_t offset, zip_uint64_t length, void *data, zip_uint64_t data_length, zip_error_t *error) { + zip_int64_t new_offset; + zip_source_args_seek_t *args = ZIP_SOURCE_GET_ARGS(zip_source_args_seek_t, data, data_length, error); + + if (args == NULL) { + return -1; + } + + switch (args->whence) { + case SEEK_CUR: + new_offset = (zip_int64_t)offset + args->offset; + break; + + case SEEK_END: + new_offset = (zip_int64_t)length + args->offset; + break; + + case SEEK_SET: + new_offset = args->offset; + break; + + default: + zip_error_set(error, ZIP_ER_INVAL, 0); + return -1; + } + + if (new_offset < 0 || (zip_uint64_t)new_offset > length) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return -1; + } + + return new_offset; +} diff --git a/core/deps/libzip/lib/zip_source_seek_write.c b/core/deps/libzip/lib/zip_source_seek_write.c new file mode 100644 index 000000000..5fa2a8129 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_seek_write.c @@ -0,0 +1,51 @@ +/* + zip_source_seek_write.c -- seek to offset for writing + Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +ZIP_EXTERN int +zip_source_seek_write(zip_source_t *src, zip_int64_t offset, int whence) { + zip_source_args_seek_t args; + + if (!ZIP_SOURCE_IS_OPEN_WRITING(src) || (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END)) { + zip_error_set(&src->error, ZIP_ER_INVAL, 0); + return -1; + } + + args.offset = offset; + args.whence = whence; + + return (_zip_source_call(src, &args, sizeof(args), ZIP_SOURCE_SEEK_WRITE) < 0 ? -1 : 0); +} diff --git a/core/deps/libzip/zip_filerange_crc.c b/core/deps/libzip/lib/zip_source_stat.c similarity index 71% rename from core/deps/libzip/zip_filerange_crc.c rename to core/deps/libzip/lib/zip_source_stat.c index 4d1ad5669..46eb92db5 100644 --- a/core/deps/libzip/zip_filerange_crc.c +++ b/core/deps/libzip/lib/zip_source_stat.c @@ -1,6 +1,6 @@ /* - zip_filerange_crc.c -- compute CRC32 for a range of a file - Copyright (C) 2008 Dieter Baron and Thomas Klausner + zip_source_stat.c -- get meta information from zip_source + Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,40 +31,31 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - -#include -#include #include "zipint.h" - - -int -_zip_filerange_crc(FILE *fp, off_t start, off_t len, uLong *crcp, - struct zip_error *errp) -{ - Bytef buf[BUFSIZE]; - size_t n; - - *crcp = crc32(0L, Z_NULL, 0); - - if (fseeko(fp, start, SEEK_SET) != 0) { - _zip_error_set(errp, ZIP_ER_SEEK, errno); - return -1; +ZIP_EXTERN int +zip_source_stat(zip_source_t *src, zip_stat_t *st) { + if (src->source_closed) { + return -1; + } + if (st == NULL) { + zip_error_set(&src->error, ZIP_ER_INVAL, 0); + return -1; } - - while (len > 0) { - n = len > BUFSIZE ? BUFSIZE : len; - if ((n=fread(buf, 1, n, fp)) <= 0) { - _zip_error_set(errp, ZIP_ER_READ, errno); - return -1; - } - *crcp = crc32(*crcp, buf, n); + zip_stat_init(st); - len-= n; + if (ZIP_SOURCE_IS_LAYERED(src)) { + if (zip_source_stat(src->src, st) < 0) { + _zip_error_set_from_source(&src->error, src->src); + return -1; + } + } + + if (_zip_source_call(src, st, sizeof(*st), ZIP_SOURCE_STAT) < 0) { + return -1; } return 0; diff --git a/core/deps/libzip/lib/zip_source_supports.c b/core/deps/libzip/lib/zip_source_supports.c new file mode 100644 index 000000000..b4575a74b --- /dev/null +++ b/core/deps/libzip/lib/zip_source_supports.c @@ -0,0 +1,65 @@ +/* + zip_source_supports.c -- check for supported functions + Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include + +#include "zipint.h" + + +zip_int64_t +zip_source_supports(zip_source_t *src) { + return src->supports; +} + + +ZIP_EXTERN zip_int64_t +zip_source_make_command_bitmap(zip_source_cmd_t cmd0, ...) { + zip_int64_t bitmap; + va_list ap; + + bitmap = ZIP_SOURCE_MAKE_COMMAND_BITMASK(cmd0); + + + va_start(ap, cmd0); + for (;;) { + int cmd = va_arg(ap, int); + if (cmd < 0) { + break; + } + bitmap |= ZIP_SOURCE_MAKE_COMMAND_BITMASK(cmd); + } + va_end(ap); + + return bitmap; +} diff --git a/core/deps/libzip/lib/zip_source_tell.c b/core/deps/libzip/lib/zip_source_tell.c new file mode 100644 index 000000000..b17412be7 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_tell.c @@ -0,0 +1,57 @@ +/* + zip_source_tell.c -- report current offset + Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +ZIP_EXTERN zip_int64_t +zip_source_tell(zip_source_t *src) { + if (src->source_closed) { + return -1; + } + if (!ZIP_SOURCE_IS_OPEN_READING(src)) { + zip_error_set(&src->error, ZIP_ER_INVAL, 0); + return -1; + } + + if ((src->supports & (ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_TELL) | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SEEK))) == 0) { + if (src->bytes_read > ZIP_INT64_MAX) { + zip_error_set(&src->error, ZIP_ER_TELL, EOVERFLOW); + return -1; + } + return (zip_int64_t)src->bytes_read; + } + + return _zip_source_call(src, NULL, 0, ZIP_SOURCE_TELL); +} diff --git a/core/deps/libzip/lib/zip_source_tell_write.c b/core/deps/libzip/lib/zip_source_tell_write.c new file mode 100644 index 000000000..c09a79fcb --- /dev/null +++ b/core/deps/libzip/lib/zip_source_tell_write.c @@ -0,0 +1,46 @@ +/* + zip_source_tell_write.c -- report current offset for writing + Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +ZIP_EXTERN zip_int64_t +zip_source_tell_write(zip_source_t *src) { + if (!ZIP_SOURCE_IS_OPEN_WRITING(src)) { + zip_error_set(&src->error, ZIP_ER_INVAL, 0); + return -1; + } + + return _zip_source_call(src, NULL, 0, ZIP_SOURCE_TELL_WRITE); +} diff --git a/core/deps/libzip/lib/zip_source_window.c b/core/deps/libzip/lib/zip_source_window.c new file mode 100644 index 000000000..b63ba1df4 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_window.c @@ -0,0 +1,294 @@ +/* + zip_source_window.c -- return part of lower source + Copyright (C) 2012-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include +#include + +#include "zipint.h" + +struct window { + zip_uint64_t start; /* where in file we start reading */ + zip_uint64_t end; /* where in file we stop reading */ + + /* if not NULL, read file data for this file */ + zip_t *source_archive; + zip_uint64_t source_index; + + zip_uint64_t offset; /* offset in src for next read */ + + zip_stat_t stat; + zip_file_attributes_t attributes; + zip_error_t error; + zip_int64_t supports; + bool needs_seek; +}; + +static zip_int64_t window_read(zip_source_t *, void *, void *, zip_uint64_t, zip_source_cmd_t); + + +zip_source_t * +zip_source_window(zip_t *za, zip_source_t *src, zip_uint64_t start, zip_uint64_t len) { + return _zip_source_window_new(src, start, len, NULL, 0, NULL, 0, &za->error); +} + + +zip_source_t * +_zip_source_window_new(zip_source_t *src, zip_uint64_t start, zip_uint64_t length, zip_stat_t *st, zip_file_attributes_t *attributes, zip_t *source_archive, zip_uint64_t source_index, zip_error_t *error) { + struct window *ctx; + + if (src == NULL || start + length < start || (source_archive == NULL && source_index != 0)) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((ctx = (struct window *)malloc(sizeof(*ctx))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + ctx->start = start; + ctx->end = start + length; + zip_stat_init(&ctx->stat); + if (attributes != NULL) { + memcpy(&ctx->attributes, attributes, sizeof(ctx->attributes)); + } + else { + zip_file_attributes_init(&ctx->attributes); + } + ctx->source_archive = source_archive; + ctx->source_index = source_index; + zip_error_init(&ctx->error); + ctx->supports = (zip_source_supports(src) & ZIP_SOURCE_SUPPORTS_SEEKABLE) | (zip_source_make_command_bitmap(ZIP_SOURCE_GET_FILE_ATTRIBUTES, ZIP_SOURCE_SUPPORTS, ZIP_SOURCE_TELL, -1)); + ctx->needs_seek = (ctx->supports & ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SEEK)) ? true : false; + + if (st) { + if (_zip_stat_merge(&ctx->stat, st, error) < 0) { + free(ctx); + return NULL; + } + } + + return zip_source_layered_create(src, window_read, ctx, error); +} + + +int +_zip_source_set_source_archive(zip_source_t *src, zip_t *za) { + src->source_archive = za; + return _zip_register_source(za, src); +} + + +/* called by zip_discard to avoid operating on file from closed archive */ +void +_zip_source_invalidate(zip_source_t *src) { + src->source_closed = 1; + + if (zip_error_code_zip(&src->error) == ZIP_ER_OK) { + zip_error_set(&src->error, ZIP_ER_ZIPCLOSED, 0); + } +} + + +static zip_int64_t +window_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_source_cmd_t cmd) { + struct window *ctx; + zip_int64_t ret; + zip_uint64_t n, i; + + ctx = (struct window *)_ctx; + + switch (cmd) { + case ZIP_SOURCE_CLOSE: + return 0; + + case ZIP_SOURCE_ERROR: + return zip_error_to_data(&ctx->error, data, len); + + case ZIP_SOURCE_FREE: + free(ctx); + return 0; + + case ZIP_SOURCE_OPEN: + if (ctx->source_archive) { + zip_uint64_t offset; + + if ((offset = _zip_file_get_offset(ctx->source_archive, ctx->source_index, &ctx->error)) == 0) { + return -1; + } + if (ctx->end + offset < ctx->end) { + /* zip archive data claims end of data past zip64 limits */ + zip_error_set(&ctx->error, ZIP_ER_INCONS, 0); + return -1; + } + ctx->start += offset; + ctx->end += offset; + ctx->source_archive = NULL; + } + + if (!ctx->needs_seek) { + DEFINE_BYTE_ARRAY(b, BUFSIZE); + + if (!byte_array_init(b, BUFSIZE)) { + zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0); + return -1; + } + + for (n = 0; n < ctx->start; n += (zip_uint64_t)ret) { + i = (ctx->start - n > BUFSIZE ? BUFSIZE : ctx->start - n); + if ((ret = zip_source_read(src, b, i)) < 0) { + _zip_error_set_from_source(&ctx->error, src); + byte_array_fini(b); + return -1; + } + if (ret == 0) { + zip_error_set(&ctx->error, ZIP_ER_EOF, 0); + byte_array_fini(b); + return -1; + } + } + + byte_array_fini(b); + } + + ctx->offset = ctx->start; + return 0; + + case ZIP_SOURCE_READ: + if (len > ctx->end - ctx->offset) + len = ctx->end - ctx->offset; + + if (len == 0) + return 0; + + if (ctx->needs_seek) { + if (zip_source_seek(src, (zip_int64_t)ctx->offset, SEEK_SET) < 0) { + _zip_error_set_from_source(&ctx->error, src); + return -1; + } + } + + if ((ret = zip_source_read(src, data, len)) < 0) { + zip_error_set(&ctx->error, ZIP_ER_EOF, 0); + return -1; + } + + ctx->offset += (zip_uint64_t)ret; + + if (ret == 0) { + if (ctx->offset < ctx->end) { + zip_error_set(&ctx->error, ZIP_ER_EOF, 0); + return -1; + } + } + return ret; + + case ZIP_SOURCE_SEEK: { + zip_int64_t new_offset = zip_source_seek_compute_offset(ctx->offset - ctx->start, ctx->end - ctx->start, data, len, &ctx->error); + + if (new_offset < 0) { + return -1; + } + + ctx->offset = (zip_uint64_t)new_offset + ctx->start; + return 0; + } + + case ZIP_SOURCE_STAT: { + zip_stat_t *st; + + st = (zip_stat_t *)data; + + if (_zip_stat_merge(st, &ctx->stat, &ctx->error) < 0) { + return -1; + } + return 0; + } + + case ZIP_SOURCE_GET_FILE_ATTRIBUTES: + if (len < sizeof(ctx->attributes)) { + zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); + return -1; + } + + memcpy(data, &ctx->attributes, sizeof(ctx->attributes)); + return sizeof(ctx->attributes); + + case ZIP_SOURCE_SUPPORTS: + return ctx->supports; + + case ZIP_SOURCE_TELL: + return (zip_int64_t)(ctx->offset - ctx->start); + + default: + zip_error_set(&ctx->error, ZIP_ER_OPNOTSUPP, 0); + return -1; + } +} + + +void +_zip_deregister_source(zip_t *za, zip_source_t *src) { + unsigned int i; + + for (i = 0; i < za->nopen_source; i++) { + if (za->open_source[i] == src) { + za->open_source[i] = za->open_source[za->nopen_source - 1]; + za->nopen_source--; + break; + } + } +} + + +int +_zip_register_source(zip_t *za, zip_source_t *src) { + zip_source_t **open_source; + + if (za->nopen_source + 1 >= za->nopen_source_alloc) { + unsigned int n; + n = za->nopen_source_alloc + 10; + open_source = (zip_source_t **)realloc(za->open_source, n * sizeof(zip_source_t *)); + if (open_source == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + za->nopen_source_alloc = n; + za->open_source = open_source; + } + + za->open_source[za->nopen_source++] = src; + + return 0; +} diff --git a/core/deps/libzip/lib/zip_source_winzip_aes_decode.c b/core/deps/libzip/lib/zip_source_winzip_aes_decode.c new file mode 100644 index 000000000..b2bb3cbb7 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_winzip_aes_decode.c @@ -0,0 +1,265 @@ +/* + zip_source_winzip_aes_decode.c -- Winzip AES decryption routines + Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include +#include + +#include "zipint.h" + +struct winzip_aes { + char *password; + zip_uint16_t encryption_method; + + zip_uint64_t data_length; + zip_uint64_t current_position; + + zip_winzip_aes_t *aes_ctx; + zip_error_t error; +}; + + +static int decrypt_header(zip_source_t *src, struct winzip_aes *ctx); +static void winzip_aes_free(struct winzip_aes *); +static zip_int64_t winzip_aes_decrypt(zip_source_t *src, void *ud, void *data, zip_uint64_t len, zip_source_cmd_t cmd); +static struct winzip_aes *winzip_aes_new(zip_uint16_t encryption_method, const char *password, zip_error_t *error); + + +zip_source_t * +zip_source_winzip_aes_decode(zip_t *za, zip_source_t *src, zip_uint16_t encryption_method, int flags, const char *password) { + zip_source_t *s2; + zip_stat_t st; + zip_uint64_t aux_length; + struct winzip_aes *ctx; + + if ((encryption_method != ZIP_EM_AES_128 && encryption_method != ZIP_EM_AES_192 && encryption_method != ZIP_EM_AES_256) || password == NULL || src == NULL) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + if (flags & ZIP_CODEC_ENCODE) { + zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0); + return NULL; + } + + if (zip_source_stat(src, &st) != 0) { + _zip_error_set_from_source(&za->error, src); + return NULL; + } + + aux_length = WINZIP_AES_PASSWORD_VERIFY_LENGTH + SALT_LENGTH(encryption_method) + HMAC_LENGTH; + + if ((st.valid & ZIP_STAT_COMP_SIZE) == 0 || st.comp_size < aux_length) { + zip_error_set(&za->error, ZIP_ER_OPNOTSUPP, 0); + return NULL; + } + + if ((ctx = winzip_aes_new(encryption_method, password, &za->error)) == NULL) { + return NULL; + } + + ctx->data_length = st.comp_size - aux_length; + + if ((s2 = zip_source_layered(za, src, winzip_aes_decrypt, ctx)) == NULL) { + winzip_aes_free(ctx); + return NULL; + } + + return s2; +} + + +static int +decrypt_header(zip_source_t *src, struct winzip_aes *ctx) { + zip_uint8_t header[WINZIP_AES_MAX_HEADER_LENGTH]; + zip_uint8_t password_verification[WINZIP_AES_PASSWORD_VERIFY_LENGTH]; + unsigned int headerlen; + zip_int64_t n; + + headerlen = WINZIP_AES_PASSWORD_VERIFY_LENGTH + SALT_LENGTH(ctx->encryption_method); + if ((n = zip_source_read(src, header, headerlen)) < 0) { + _zip_error_set_from_source(&ctx->error, src); + return -1; + } + + if (n != headerlen) { + zip_error_set(&ctx->error, ZIP_ER_EOF, 0); + return -1; + } + + if ((ctx->aes_ctx = _zip_winzip_aes_new((zip_uint8_t *)ctx->password, strlen(ctx->password), header, ctx->encryption_method, password_verification, &ctx->error)) == NULL) { + return -1; + } + if (memcmp(password_verification, header + SALT_LENGTH(ctx->encryption_method), WINZIP_AES_PASSWORD_VERIFY_LENGTH) != 0) { + _zip_winzip_aes_free(ctx->aes_ctx); + ctx->aes_ctx = NULL; + zip_error_set(&ctx->error, ZIP_ER_WRONGPASSWD, 0); + return -1; + } + return 0; +} + + +static bool +verify_hmac(zip_source_t *src, struct winzip_aes *ctx) { + unsigned char computed[SHA1_LENGTH], from_file[HMAC_LENGTH]; + if (zip_source_read(src, from_file, HMAC_LENGTH) < HMAC_LENGTH) { + _zip_error_set_from_source(&ctx->error, src); + return false; + } + + if (!_zip_winzip_aes_finish(ctx->aes_ctx, computed)) { + zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0); + return false; + } + _zip_winzip_aes_free(ctx->aes_ctx); + ctx->aes_ctx = NULL; + + if (memcmp(from_file, computed, HMAC_LENGTH) != 0) { + zip_error_set(&ctx->error, ZIP_ER_CRC, 0); + return false; + } + + return true; +} + + +static zip_int64_t +winzip_aes_decrypt(zip_source_t *src, void *ud, void *data, zip_uint64_t len, zip_source_cmd_t cmd) { + struct winzip_aes *ctx; + zip_int64_t n; + + ctx = (struct winzip_aes *)ud; + + switch (cmd) { + case ZIP_SOURCE_OPEN: + if (decrypt_header(src, ctx) < 0) { + return -1; + } + ctx->current_position = 0; + return 0; + + case ZIP_SOURCE_READ: + if (len > ctx->data_length - ctx->current_position) { + len = ctx->data_length - ctx->current_position; + } + + if (len == 0) { + if (!verify_hmac(src, ctx)) { + return -1; + } + return 0; + } + + if ((n = zip_source_read(src, data, len)) < 0) { + _zip_error_set_from_source(&ctx->error, src); + return -1; + } + ctx->current_position += (zip_uint64_t)n; + + if (!_zip_winzip_aes_decrypt(ctx->aes_ctx, (zip_uint8_t *)data, (zip_uint64_t)n)) { + zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0); + return -1; + } + + return n; + + case ZIP_SOURCE_CLOSE: + return 0; + + case ZIP_SOURCE_STAT: { + zip_stat_t *st; + + st = (zip_stat_t *)data; + + st->encryption_method = ZIP_EM_NONE; + st->valid |= ZIP_STAT_ENCRYPTION_METHOD; + if (st->valid & ZIP_STAT_COMP_SIZE) { + st->comp_size -= 12 + SALT_LENGTH(ctx->encryption_method); + } + + return 0; + } + + case ZIP_SOURCE_SUPPORTS: + return zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, -1); + + case ZIP_SOURCE_ERROR: + return zip_error_to_data(&ctx->error, data, len); + + case ZIP_SOURCE_FREE: + winzip_aes_free(ctx); + return 0; + + default: + zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); + return -1; + } +} + + +static void +winzip_aes_free(struct winzip_aes *ctx) { + if (ctx == NULL) { + return; + } + + _zip_crypto_clear(ctx->password, strlen(ctx->password)); + free(ctx->password); + zip_error_fini(&ctx->error); + _zip_winzip_aes_free(ctx->aes_ctx); + free(ctx); +} + + +static struct winzip_aes * +winzip_aes_new(zip_uint16_t encryption_method, const char *password, zip_error_t *error) { + struct winzip_aes *ctx; + + if ((ctx = (struct winzip_aes *)malloc(sizeof(*ctx))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if ((ctx->password = strdup(password)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + free(ctx); + return NULL; + } + + ctx->encryption_method = encryption_method; + ctx->aes_ctx = NULL; + + zip_error_init(&ctx->error); + + return ctx; +} diff --git a/core/deps/libzip/lib/zip_source_winzip_aes_encode.c b/core/deps/libzip/lib/zip_source_winzip_aes_encode.c new file mode 100644 index 000000000..19d5cf026 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_winzip_aes_encode.c @@ -0,0 +1,254 @@ +/* + zip_source_winzip_aes_encode.c -- Winzip AES encryption routines + Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include +#include + +#include "zipint.h" + + +struct winzip_aes { + char *password; + zip_uint16_t encryption_method; + + zip_uint8_t data[ZIP_MAX(WINZIP_AES_MAX_HEADER_LENGTH, SHA1_LENGTH)]; + zip_buffer_t *buffer; + + zip_winzip_aes_t *aes_ctx; + bool eof; + zip_error_t error; +}; + + +static int encrypt_header(zip_source_t *src, struct winzip_aes *ctx); +static void winzip_aes_free(struct winzip_aes *); +static zip_int64_t winzip_aes_encrypt(zip_source_t *src, void *ud, void *data, zip_uint64_t len, zip_source_cmd_t cmd); +static struct winzip_aes *winzip_aes_new(zip_uint16_t encryption_method, const char *password, zip_error_t *error); + + +zip_source_t * +zip_source_winzip_aes_encode(zip_t *za, zip_source_t *src, zip_uint16_t encryption_method, int flags, const char *password) { + zip_source_t *s2; + struct winzip_aes *ctx; + + if ((encryption_method != ZIP_EM_AES_128 && encryption_method != ZIP_EM_AES_192 && encryption_method != ZIP_EM_AES_256) || password == NULL || src == NULL) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((ctx = winzip_aes_new(encryption_method, password, &za->error)) == NULL) { + return NULL; + } + + if ((s2 = zip_source_layered(za, src, winzip_aes_encrypt, ctx)) == NULL) { + winzip_aes_free(ctx); + return NULL; + } + + return s2; +} + + +static int +encrypt_header(zip_source_t *src, struct winzip_aes *ctx) { + zip_uint16_t salt_length = SALT_LENGTH(ctx->encryption_method); + if (!zip_secure_random(ctx->data, salt_length)) { + zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0); + return -1; + } + + if ((ctx->aes_ctx = _zip_winzip_aes_new((zip_uint8_t *)ctx->password, strlen(ctx->password), ctx->data, ctx->encryption_method, ctx->data + salt_length, &ctx->error)) == NULL) { + return -1; + } + + if ((ctx->buffer = _zip_buffer_new(ctx->data, salt_length + WINZIP_AES_PASSWORD_VERIFY_LENGTH)) == NULL) { + _zip_winzip_aes_free(ctx->aes_ctx); + ctx->aes_ctx = NULL; + zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0); + return -1; + } + + return 0; +} + + +static zip_int64_t +winzip_aes_encrypt(zip_source_t *src, void *ud, void *data, zip_uint64_t length, zip_source_cmd_t cmd) { + struct winzip_aes *ctx; + zip_int64_t ret; + zip_uint64_t buffer_n; + + ctx = (struct winzip_aes *)ud; + + switch (cmd) { + case ZIP_SOURCE_OPEN: + ctx->eof = false; + if (encrypt_header(src, ctx) < 0) { + return -1; + } + return 0; + + case ZIP_SOURCE_READ: + buffer_n = 0; + + if (ctx->buffer) { + buffer_n = _zip_buffer_read(ctx->buffer, data, length); + + data = (zip_uint8_t *)data + buffer_n; + length -= buffer_n; + + if (_zip_buffer_eof(ctx->buffer)) { + _zip_buffer_free(ctx->buffer); + ctx->buffer = NULL; + } + } + + if (ctx->eof) { + return (zip_int64_t)buffer_n; + } + + if ((ret = zip_source_read(src, data, length)) < 0) { + _zip_error_set_from_source(&ctx->error, src); + return -1; + } + + if (!_zip_winzip_aes_encrypt(ctx->aes_ctx, data, (zip_uint64_t)ret)) { + zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0); + /* TODO: return partial read? */ + return -1; + } + + if ((zip_uint64_t)ret < length) { + ctx->eof = true; + if (!_zip_winzip_aes_finish(ctx->aes_ctx, ctx->data)) { + zip_error_set(&ctx->error, ZIP_ER_INTERNAL, 0); + /* TODO: return partial read? */ + return -1; + } + _zip_winzip_aes_free(ctx->aes_ctx); + ctx->aes_ctx = NULL; + if ((ctx->buffer = _zip_buffer_new(ctx->data, HMAC_LENGTH)) == NULL) { + zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0); + /* TODO: return partial read? */ + return -1; + } + buffer_n += _zip_buffer_read(ctx->buffer, (zip_uint8_t *)data + ret, length - (zip_uint64_t)ret); + } + + return (zip_int64_t)(buffer_n + (zip_uint64_t)ret); + + case ZIP_SOURCE_CLOSE: + return 0; + + case ZIP_SOURCE_STAT: { + zip_stat_t *st; + + st = (zip_stat_t *)data; + st->encryption_method = ctx->encryption_method; + st->valid |= ZIP_STAT_ENCRYPTION_METHOD; + if (st->valid & ZIP_STAT_COMP_SIZE) { + st->comp_size += 12 + SALT_LENGTH(ctx->encryption_method); + } + + return 0; + } + + case ZIP_SOURCE_GET_FILE_ATTRIBUTES: { + zip_file_attributes_t *attributes = (zip_file_attributes_t *)data; + if (length < sizeof(*attributes)) { + zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); + return -1; + } + attributes->valid |= ZIP_FILE_ATTRIBUTES_VERSION_NEEDED; + attributes->version_needed = 51; + + return 0; + } + + case ZIP_SOURCE_SUPPORTS: + return zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_GET_FILE_ATTRIBUTES, -1); + + case ZIP_SOURCE_ERROR: + return zip_error_to_data(&ctx->error, data, length); + + case ZIP_SOURCE_FREE: + winzip_aes_free(ctx); + return 0; + + default: + zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); + return -1; + } +} + + +static void +winzip_aes_free(struct winzip_aes *ctx) { + if (ctx == NULL) { + return; + } + + _zip_crypto_clear(ctx->password, strlen(ctx->password)); + free(ctx->password); + zip_error_fini(&ctx->error); + _zip_buffer_free(ctx->buffer); + _zip_winzip_aes_free(ctx->aes_ctx); + free(ctx); +} + + +static struct winzip_aes * +winzip_aes_new(zip_uint16_t encryption_method, const char *password, zip_error_t *error) { + struct winzip_aes *ctx; + + if ((ctx = (struct winzip_aes *)malloc(sizeof(*ctx))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if ((ctx->password = strdup(password)) == NULL) { + free(ctx); + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + ctx->encryption_method = encryption_method; + ctx->buffer = NULL; + ctx->aes_ctx = NULL; + + zip_error_init(&ctx->error); + + ctx->eof = false; + return ctx; +} diff --git a/core/deps/libzip/lib/zip_source_write.c b/core/deps/libzip/lib/zip_source_write.c new file mode 100644 index 000000000..33bf9c944 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_write.c @@ -0,0 +1,46 @@ +/* + zip_source_write.c -- start a new file for writing + Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + + +ZIP_EXTERN zip_int64_t +zip_source_write(zip_source_t *src, const void *data, zip_uint64_t length) { + if (!ZIP_SOURCE_IS_OPEN_WRITING(src) || length > ZIP_INT64_MAX) { + zip_error_set(&src->error, ZIP_ER_INVAL, 0); + return -1; + } + + return _zip_source_call(src, (void *)data, length, ZIP_SOURCE_WRITE); +} diff --git a/core/deps/libzip/lib/zip_source_zip.c b/core/deps/libzip/lib/zip_source_zip.c new file mode 100644 index 000000000..cb62540d5 --- /dev/null +++ b/core/deps/libzip/lib/zip_source_zip.c @@ -0,0 +1,56 @@ +/* + zip_source_zip.c -- create data source from zip file + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include + +#include "zipint.h" + + +ZIP_EXTERN zip_source_t * +zip_source_zip(zip_t *za, zip_t *srcza, zip_uint64_t srcidx, zip_flags_t flags, zip_uint64_t start, zip_int64_t len) { + if (len < -1) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if (len == -1) + len = 0; + + if (start == 0 && len == 0) + flags |= ZIP_FL_COMPRESSED; + else + flags &= ~ZIP_FL_COMPRESSED; + + return _zip_source_zip_new(za, srcza, srcidx, flags, start, (zip_uint64_t)len, NULL); +} diff --git a/core/deps/libzip/lib/zip_source_zip_new.c b/core/deps/libzip/lib/zip_source_zip_new.c new file mode 100644 index 000000000..ffb2bdf4b --- /dev/null +++ b/core/deps/libzip/lib/zip_source_zip_new.c @@ -0,0 +1,191 @@ +/* + zip_source_zip_new.c -- prepare data structures for zip_fopen/zip_source_zip + Copyright (C) 2012-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include + +#include "zipint.h" + +static void _zip_file_attributes_from_dirent(zip_file_attributes_t *attributes, zip_dirent_t *de); + +zip_source_t * +_zip_source_zip_new(zip_t *za, zip_t *srcza, zip_uint64_t srcidx, zip_flags_t flags, zip_uint64_t start, zip_uint64_t len, const char *password) { + zip_source_t *src, *s2; + zip_stat_t st; + zip_file_attributes_t attributes; + zip_dirent_t *de; + bool partial_data, needs_crc, needs_decrypt, needs_decompress; + + if (za == NULL) { + return NULL; + } + + if (srcza == NULL || srcidx >= srcza->nentry) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((flags & ZIP_FL_UNCHANGED) == 0 && (ZIP_ENTRY_DATA_CHANGED(srcza->entry + srcidx) || srcza->entry[srcidx].deleted)) { + zip_error_set(&za->error, ZIP_ER_CHANGED, 0); + return NULL; + } + + if (zip_stat_index(srcza, srcidx, flags | ZIP_FL_UNCHANGED, &st) < 0) { + zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + return NULL; + } + + if (flags & ZIP_FL_ENCRYPTED) { + flags |= ZIP_FL_COMPRESSED; + } + + if ((start > 0 || len > 0) && (flags & ZIP_FL_COMPRESSED)) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + /* overflow or past end of file */ + if ((start > 0 || len > 0) && (start + len < start || start + len > st.size)) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if (len == 0) { + len = st.size - start; + } + + partial_data = len < st.size; + needs_decrypt = ((flags & ZIP_FL_ENCRYPTED) == 0) && (st.encryption_method != ZIP_EM_NONE); + needs_decompress = ((flags & ZIP_FL_COMPRESSED) == 0) && (st.comp_method != ZIP_CM_STORE); + /* when reading the whole file, check for CRC errors */ + needs_crc = ((flags & ZIP_FL_COMPRESSED) == 0 || st.comp_method == ZIP_CM_STORE) && !partial_data; + + if (needs_decrypt) { + if (password == NULL) { + password = za->default_password; + } + if (password == NULL) { + zip_error_set(&za->error, ZIP_ER_NOPASSWD, 0); + return NULL; + } + } + + if ((de = _zip_get_dirent(srcza, srcidx, flags, &za->error)) == NULL) { + return NULL; + } + _zip_file_attributes_from_dirent(&attributes, de); + + if (st.comp_size == 0) { + return zip_source_buffer_with_attributes(za, NULL, 0, 0, &attributes); + } + + if (partial_data && !needs_decrypt && !needs_decompress) { + struct zip_stat st2; + + st2.size = len; + st2.comp_size = len; + st2.comp_method = ZIP_CM_STORE; + st2.mtime = st.mtime; + st2.valid = ZIP_STAT_SIZE | ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD | ZIP_STAT_MTIME; + + if ((src = _zip_source_window_new(srcza->src, start, len, &st2, &attributes, srcza, srcidx, &za->error)) == NULL) { + return NULL; + } + } + else { + if ((src = _zip_source_window_new(srcza->src, 0, st.comp_size, &st, &attributes, srcza, srcidx, &za->error)) == NULL) { + return NULL; + } + } + + if (_zip_source_set_source_archive(src, srcza) < 0) { + zip_source_free(src); + return NULL; + } + + /* creating a layered source calls zip_keep() on the lower layer, so we free it */ + + if (needs_decrypt) { + zip_encryption_implementation enc_impl; + + if ((enc_impl = _zip_get_encryption_implementation(st.encryption_method, ZIP_CODEC_DECODE)) == NULL) { + zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0); + return NULL; + } + + s2 = enc_impl(za, src, st.encryption_method, 0, password); + zip_source_free(src); + if (s2 == NULL) { + return NULL; + } + src = s2; + } + if (needs_decompress) { + s2 = zip_source_decompress(za, src, st.comp_method); + zip_source_free(src); + if (s2 == NULL) { + return NULL; + } + src = s2; + } + if (needs_crc) { + s2 = zip_source_crc(za, src, 1); + zip_source_free(src); + if (s2 == NULL) { + return NULL; + } + src = s2; + } + + if (partial_data && (needs_decrypt || needs_decompress)) { + s2 = zip_source_window(za, src, start, len); + zip_source_free(src); + if (s2 == NULL) { + return NULL; + } + src = s2; + } + + return src; +} + +static void +_zip_file_attributes_from_dirent(zip_file_attributes_t *attributes, zip_dirent_t *de) { + zip_file_attributes_init(attributes); + attributes->valid = ZIP_FILE_ATTRIBUTES_ASCII | ZIP_FILE_ATTRIBUTES_HOST_SYSTEM | ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES | ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS; + attributes->ascii = de->int_attrib & 1; + attributes->host_system = de->version_madeby >> 8; + attributes->external_file_attributes = de->ext_attrib; + attributes->general_purpose_bit_flags = de->bitflags; + attributes->general_purpose_bit_mask = ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS_ALLOWED_MASK; +} diff --git a/core/deps/libzip/zip_stat.c b/core/deps/libzip/lib/zip_stat.c similarity index 84% rename from core/deps/libzip/zip_stat.c rename to core/deps/libzip/lib/zip_stat.c index df1c0b50b..c328dcfb4 100644 --- a/core/deps/libzip/zip_stat.c +++ b/core/deps/libzip/lib/zip_stat.c @@ -1,6 +1,6 @@ /* zip_stat.c -- get information about file by name - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,19 +31,16 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include "zipint.h" - ZIP_EXTERN int -zip_stat(struct zip *za, const char *fname, int flags, struct zip_stat *st) -{ - int idx; +zip_stat(zip_t *za, const char *fname, zip_flags_t flags, zip_stat_t *st) { + zip_int64_t idx; - if ((idx=zip_name_locate(za, fname, flags)) < 0) - return -1; + if ((idx = zip_name_locate(za, fname, flags)) < 0) + return -1; - return zip_stat_index(za, idx, flags, st); + return zip_stat_index(za, (zip_uint64_t)idx, flags, st); } diff --git a/core/deps/libzip/zip_stat_index.c b/core/deps/libzip/lib/zip_stat_index.c similarity index 56% rename from core/deps/libzip/zip_stat_index.c rename to core/deps/libzip/lib/zip_stat_index.c index 60558e432..62dc0455e 100644 --- a/core/deps/libzip/zip_stat_index.c +++ b/core/deps/libzip/lib/zip_stat_index.c @@ -1,6 +1,6 @@ /* zip_stat_index.c -- get information about file by index - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,60 +31,50 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include "zipint.h" - ZIP_EXTERN int -zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st) -{ +zip_stat_index(zip_t *za, zip_uint64_t index, zip_flags_t flags, zip_stat_t *st) { const char *name; - - if (index < 0 || index >= za->nentry) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; - } + zip_dirent_t *de; - if ((name=zip_get_name(za, index, flags)) == NULL) - return -1; - + if ((de = _zip_get_dirent(za, index, flags, NULL)) == NULL) + return -1; - if ((flags & ZIP_FL_UNCHANGED) == 0 - && ZIP_ENTRY_DATA_CHANGED(za->entry+index)) { - if (za->entry[index].source->f(za->entry[index].source->ud, - st, sizeof(*st), ZIP_SOURCE_STAT) < 0) { - _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); - return -1; - } + if ((name = zip_get_name(za, index, flags)) == NULL) + return -1; + + + if ((flags & ZIP_FL_UNCHANGED) == 0 && ZIP_ENTRY_DATA_CHANGED(za->entry + index)) { + zip_entry_t *entry = za->entry + index; + + if (zip_source_stat(entry->source, st) < 0) { + zip_error_set(&za->error, ZIP_ER_CHANGED, 0); + return -1; + } + + if (entry->changes != NULL && entry->changes->changed & ZIP_DIRENT_LAST_MOD) { + st->mtime = de->last_mod; + st->valid |= ZIP_STAT_MTIME; + } } else { - if (za->cdir == NULL || index >= za->cdir->nentry) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return -1; - } - - st->crc = za->cdir->entry[index].crc; - st->size = za->cdir->entry[index].uncomp_size; - st->mtime = za->cdir->entry[index].last_mod; - st->comp_size = za->cdir->entry[index].comp_size; - st->comp_method = za->cdir->entry[index].comp_method; - if (za->cdir->entry[index].bitflags & ZIP_GPBF_ENCRYPTED) { - if (za->cdir->entry[index].bitflags & ZIP_GPBF_STRONG_ENCRYPTION) { - /* XXX */ - st->encryption_method = ZIP_EM_UNKNOWN; - } - else - st->encryption_method = ZIP_EM_TRAD_PKWARE; - } - else - st->encryption_method = ZIP_EM_NONE; - /* st->bitflags = za->cdir->entry[index].bitflags; */ + zip_stat_init(st); + + st->crc = de->crc; + st->size = de->uncomp_size; + st->mtime = de->last_mod; + st->comp_size = de->comp_size; + st->comp_method = (zip_uint16_t)de->comp_method; + st->encryption_method = de->encryption_method; + st->valid = (de->crc_valid ? ZIP_STAT_CRC : 0) | ZIP_STAT_SIZE | ZIP_STAT_MTIME | ZIP_STAT_COMP_SIZE | ZIP_STAT_COMP_METHOD | ZIP_STAT_ENCRYPTION_METHOD; } st->index = index; st->name = name; - + st->valid |= ZIP_STAT_INDEX | ZIP_STAT_NAME; + return 0; } diff --git a/core/deps/libzip/lib/zip_stat_init.c b/core/deps/libzip/lib/zip_stat_init.c new file mode 100644 index 000000000..0cf51efad --- /dev/null +++ b/core/deps/libzip/lib/zip_stat_init.c @@ -0,0 +1,83 @@ +/* + zip_stat_init.c -- initialize struct zip_stat. + Copyright (C) 2006-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include "zipint.h" + + +ZIP_EXTERN void +zip_stat_init(zip_stat_t *st) { + st->valid = 0; + st->name = NULL; + st->index = ZIP_UINT64_MAX; + st->crc = 0; + st->mtime = (time_t)-1; + st->size = 0; + st->comp_size = 0; + st->comp_method = ZIP_CM_STORE; + st->encryption_method = ZIP_EM_NONE; +} + + +int +_zip_stat_merge(zip_stat_t *dst, const zip_stat_t *src, zip_error_t *error) { + /* name is not merged, since zip_stat_t doesn't own it, and src may not be valid as long as dst */ + if (src->valid & ZIP_STAT_INDEX) { + dst->index = src->index; + } + if (src->valid & ZIP_STAT_SIZE) { + dst->size = src->size; + } + if (src->valid & ZIP_STAT_COMP_SIZE) { + dst->comp_size = src->comp_size; + } + if (src->valid & ZIP_STAT_MTIME) { + dst->mtime = src->mtime; + } + if (src->valid & ZIP_STAT_CRC) { + dst->crc = src->crc; + } + if (src->valid & ZIP_STAT_COMP_METHOD) { + dst->comp_method = src->comp_method; + } + if (src->valid & ZIP_STAT_ENCRYPTION_METHOD) { + dst->encryption_method = src->encryption_method; + } + if (src->valid & ZIP_STAT_FLAGS) { + dst->flags = src->flags; + } + dst->valid |= src->valid; + + return 0; +} diff --git a/core/deps/libzip/zip_strerror.c b/core/deps/libzip/lib/zip_strerror.c similarity index 92% rename from core/deps/libzip/zip_strerror.c rename to core/deps/libzip/lib/zip_strerror.c index 9ebee144f..6adec16cd 100644 --- a/core/deps/libzip/zip_strerror.c +++ b/core/deps/libzip/lib/zip_strerror.c @@ -1,6 +1,6 @@ /* zip_sterror.c -- get string representation of zip error - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,14 +31,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include "zipint.h" - ZIP_EXTERN const char * -zip_strerror(struct zip *za) -{ - return _zip_error_strerror(&za->error); +zip_strerror(zip_t *za) { + return zip_error_strerror(&za->error); } diff --git a/core/deps/libzip/lib/zip_string.c b/core/deps/libzip/lib/zip_string.c new file mode 100644 index 000000000..2c6f42826 --- /dev/null +++ b/core/deps/libzip/lib/zip_string.c @@ -0,0 +1,178 @@ +/* + zip_string.c -- string handling (with encoding) + Copyright (C) 2012-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include +#include +#include + +#include "zipint.h" + +zip_uint32_t +_zip_string_crc32(const zip_string_t *s) { + zip_uint32_t crc; + + crc = (zip_uint32_t)crc32(0L, Z_NULL, 0); + + if (s != NULL) + crc = (zip_uint32_t)crc32(crc, s->raw, s->length); + + return crc; +} + + +int +_zip_string_equal(const zip_string_t *a, const zip_string_t *b) { + if (a == NULL || b == NULL) + return a == b; + + if (a->length != b->length) + return 0; + + /* TODO: encoding */ + + return (memcmp(a->raw, b->raw, a->length) == 0); +} + + +void +_zip_string_free(zip_string_t *s) { + if (s == NULL) + return; + + free(s->raw); + free(s->converted); + free(s); +} + + +const zip_uint8_t * +_zip_string_get(zip_string_t *string, zip_uint32_t *lenp, zip_flags_t flags, zip_error_t *error) { + static const zip_uint8_t empty[1] = ""; + + if (string == NULL) { + if (lenp) + *lenp = 0; + return empty; + } + + if ((flags & ZIP_FL_ENC_RAW) == 0) { + /* start guessing */ + if (string->encoding == ZIP_ENCODING_UNKNOWN) + _zip_guess_encoding(string, ZIP_ENCODING_UNKNOWN); + + if (((flags & ZIP_FL_ENC_STRICT) && string->encoding != ZIP_ENCODING_ASCII && string->encoding != ZIP_ENCODING_UTF8_KNOWN) || (string->encoding == ZIP_ENCODING_CP437)) { + if (string->converted == NULL) { + if ((string->converted = _zip_cp437_to_utf8(string->raw, string->length, &string->converted_length, error)) == NULL) + return NULL; + } + if (lenp) + *lenp = string->converted_length; + return string->converted; + } + } + + if (lenp) + *lenp = string->length; + return string->raw; +} + + +zip_uint16_t +_zip_string_length(const zip_string_t *s) { + if (s == NULL) + return 0; + + return s->length; +} + + +zip_string_t * +_zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, zip_error_t *error) { + zip_string_t *s; + zip_encoding_type_t expected_encoding; + + if (length == 0) + return NULL; + + switch (flags & ZIP_FL_ENCODING_ALL) { + case ZIP_FL_ENC_GUESS: + expected_encoding = ZIP_ENCODING_UNKNOWN; + break; + case ZIP_FL_ENC_UTF_8: + expected_encoding = ZIP_ENCODING_UTF8_KNOWN; + break; + case ZIP_FL_ENC_CP437: + expected_encoding = ZIP_ENCODING_CP437; + break; + default: + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((s = (zip_string_t *)malloc(sizeof(*s))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if ((s->raw = (zip_uint8_t *)malloc((size_t)length + 1)) == NULL) { + free(s); + return NULL; + } + + memcpy(s->raw, raw, length); + s->raw[length] = '\0'; + s->length = length; + s->encoding = ZIP_ENCODING_UNKNOWN; + s->converted = NULL; + s->converted_length = 0; + + if (expected_encoding != ZIP_ENCODING_UNKNOWN) { + if (_zip_guess_encoding(s, expected_encoding) == ZIP_ENCODING_ERROR) { + _zip_string_free(s); + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + } + + return s; +} + + +int +_zip_string_write(zip_t *za, const zip_string_t *s) { + if (s == NULL) + return 0; + + return _zip_write(za, s->raw, s->length); +} diff --git a/core/deps/libzip/lib/zip_unchange.c b/core/deps/libzip/lib/zip_unchange.c new file mode 100644 index 000000000..17e250099 --- /dev/null +++ b/core/deps/libzip/lib/zip_unchange.c @@ -0,0 +1,93 @@ +/* + zip_unchange.c -- undo changes to file in zip archive + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include + +#include "zipint.h" + + +ZIP_EXTERN int +zip_unchange(zip_t *za, zip_uint64_t idx) { + return _zip_unchange(za, idx, 0); +} + + +int +_zip_unchange(zip_t *za, zip_uint64_t idx, int allow_duplicates) { + zip_int64_t i; + const char *orig_name, *changed_name; + + if (idx >= za->nentry) { + zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (!allow_duplicates && za->entry[idx].changes && (za->entry[idx].changes->changed & ZIP_DIRENT_FILENAME)) { + if (za->entry[idx].orig != NULL) { + if ((orig_name = _zip_get_name(za, idx, ZIP_FL_UNCHANGED, &za->error)) == NULL) { + return -1; + } + + i = _zip_name_locate(za, orig_name, 0, NULL); + if (i >= 0 && (zip_uint64_t)i != idx) { + zip_error_set(&za->error, ZIP_ER_EXISTS, 0); + return -1; + } + } + else { + orig_name = NULL; + } + + if ((changed_name = _zip_get_name(za, idx, 0, &za->error)) == NULL) { + return -1; + } + + if (orig_name) { + if (_zip_hash_add(za->names, (const zip_uint8_t *)orig_name, idx, 0, &za->error) == false) { + return -1; + } + } + if (_zip_hash_delete(za->names, (const zip_uint8_t *)changed_name, &za->error) == false) { + _zip_hash_delete(za->names, (const zip_uint8_t *)orig_name, NULL); + return -1; + } + } + + _zip_dirent_free(za->entry[idx].changes); + za->entry[idx].changes = NULL; + + _zip_unchange_data(za->entry + idx); + + return 0; +} diff --git a/core/deps/libzip/zip_unchange_all.c b/core/deps/libzip/lib/zip_unchange_all.c similarity index 85% rename from core/deps/libzip/zip_unchange_all.c rename to core/deps/libzip/lib/zip_unchange_all.c index 54a7a0d2e..b8bfd70e9 100644 --- a/core/deps/libzip/zip_unchange_all.c +++ b/core/deps/libzip/lib/zip_unchange_all.c @@ -1,6 +1,6 @@ /* zip_unchange.c -- undo changes to all files in zip archive - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,22 +31,22 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - -#include #include "zipint.h" - ZIP_EXTERN int -zip_unchange_all(struct zip *za) -{ - int ret, i; +zip_unchange_all(zip_t *za) { + int ret; + zip_uint64_t i; + + if (!_zip_hash_revert(za->names, &za->error)) { + return -1; + } ret = 0; - for (i=0; inentry; i++) - ret |= _zip_unchange(za, i, 1); + for (i = 0; i < za->nentry; i++) + ret |= _zip_unchange(za, i, 1); ret |= zip_unchange_archive(za); diff --git a/core/deps/libzip/zip_unchange_archive.c b/core/deps/libzip/lib/zip_unchange_archive.c similarity index 87% rename from core/deps/libzip/zip_unchange_archive.c rename to core/deps/libzip/lib/zip_unchange_archive.c index 8f9c024c3..ebf2bd58a 100644 --- a/core/deps/libzip/zip_unchange_archive.c +++ b/core/deps/libzip/lib/zip_unchange_archive.c @@ -1,6 +1,6 @@ /* zip_unchange_archive.c -- undo global changes to ZIP archive - Copyright (C) 2006-2008 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,20 +31,19 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include #include "zipint.h" - ZIP_EXTERN int -zip_unchange_archive(struct zip *za) -{ - free(za->ch_comment); - za->ch_comment = NULL; - za->ch_comment_len = -1; +zip_unchange_archive(zip_t *za) { + if (za->comment_changed) { + _zip_string_free(za->comment_changes); + za->comment_changes = NULL; + za->comment_changed = 0; + } za->ch_flags = za->flags; diff --git a/core/deps/libzip/zip_unchange_data.c b/core/deps/libzip/lib/zip_unchange_data.c similarity index 76% rename from core/deps/libzip/zip_unchange_data.c rename to core/deps/libzip/lib/zip_unchange_data.c index 6fe89f4fb..2a393add8 100644 --- a/core/deps/libzip/zip_unchange_data.c +++ b/core/deps/libzip/lib/zip_unchange_data.c @@ -1,8 +1,6 @@ /* - $NiH: zip_unchange_data.c,v 1.14 2004/11/30 23:02:47 wiz Exp $ - zip_unchange_data.c -- undo helper function - Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -19,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -33,21 +31,23 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - -#include #include "zipint.h" void -_zip_unchange_data(struct zip_entry *ze) -{ +_zip_unchange_data(zip_entry_t *ze) { if (ze->source) { - (void)ze->source->f(ze->source->ud, NULL, 0, ZIP_SOURCE_FREE); - free(ze->source); - ze->source = NULL; + zip_source_free(ze->source); + ze->source = NULL; } - - ze->state = ze->ch_filename ? ZIP_ST_RENAMED : ZIP_ST_UNCHANGED; -} + if (ze->changes != NULL && (ze->changes->changed & ZIP_DIRENT_COMP_METHOD) && ze->changes->comp_method == ZIP_CM_REPLACED_DEFAULT) { + ze->changes->changed &= ~ZIP_DIRENT_COMP_METHOD; + if (ze->changes->changed == 0) { + _zip_dirent_free(ze->changes); + ze->changes = NULL; + } + } + + ze->deleted = 0; +} diff --git a/core/deps/libzip/lib/zip_utf-8.c b/core/deps/libzip/lib/zip_utf-8.c new file mode 100644 index 000000000..51a47221e --- /dev/null +++ b/core/deps/libzip/lib/zip_utf-8.c @@ -0,0 +1,226 @@ +/* + zip_utf-8.c -- UTF-8 support functions for libzip + Copyright (C) 2011-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "zipint.h" + +#include + + +static const zip_uint16_t _cp437_to_unicode[256] = { + /* 0x00 - 0x0F */ + 0x0000, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, + + /* 0x10 - 0x1F */ + 0x25BA, 0x25C4, 0x2195, 0x203C, 0x00B6, 0x00A7, 0x25AC, 0x21A8, 0x2191, 0x2193, 0x2192, 0x2190, 0x221F, 0x2194, 0x25B2, 0x25BC, + + /* 0x20 - 0x2F */ + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + + /* 0x30 - 0x3F */ + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + + /* 0x40 - 0x4F */ + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + + /* 0x50 - 0x5F */ + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + + /* 0x60 - 0x6F */ + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + + /* 0x70 - 0x7F */ + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x2302, + + /* 0x80 - 0x8F */ + 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, + + /* 0x90 - 0x9F */ + 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192, + + /* 0xA0 - 0xAF */ + 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, + + /* 0xB0 - 0xBF */ + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, + + /* 0xC0 - 0xCF */ + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, + + /* 0xD0 - 0xDF */ + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + + /* 0xE0 - 0xEF */ + 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, + + /* 0xF0 - 0xFF */ + 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0}; + +#define UTF_8_LEN_2_MASK 0xe0 +#define UTF_8_LEN_2_MATCH 0xc0 +#define UTF_8_LEN_3_MASK 0xf0 +#define UTF_8_LEN_3_MATCH 0xe0 +#define UTF_8_LEN_4_MASK 0xf8 +#define UTF_8_LEN_4_MATCH 0xf0 +#define UTF_8_CONTINUE_MASK 0xc0 +#define UTF_8_CONTINUE_MATCH 0x80 + + +zip_encoding_type_t +_zip_guess_encoding(zip_string_t *str, zip_encoding_type_t expected_encoding) { + zip_encoding_type_t enc; + const zip_uint8_t *name; + zip_uint32_t i, j, ulen; + + if (str == NULL) + return ZIP_ENCODING_ASCII; + + name = str->raw; + + if (str->encoding != ZIP_ENCODING_UNKNOWN) + enc = str->encoding; + else { + enc = ZIP_ENCODING_ASCII; + for (i = 0; i < str->length; i++) { + if ((name[i] > 31 && name[i] < 128) || name[i] == '\r' || name[i] == '\n' || name[i] == '\t') + continue; + + enc = ZIP_ENCODING_UTF8_GUESSED; + if ((name[i] & UTF_8_LEN_2_MASK) == UTF_8_LEN_2_MATCH) + ulen = 1; + else if ((name[i] & UTF_8_LEN_3_MASK) == UTF_8_LEN_3_MATCH) + ulen = 2; + else if ((name[i] & UTF_8_LEN_4_MASK) == UTF_8_LEN_4_MATCH) + ulen = 3; + else { + enc = ZIP_ENCODING_CP437; + break; + } + + if (i + ulen >= str->length) { + enc = ZIP_ENCODING_CP437; + break; + } + + for (j = 1; j <= ulen; j++) { + if ((name[i + j] & UTF_8_CONTINUE_MASK) != UTF_8_CONTINUE_MATCH) { + enc = ZIP_ENCODING_CP437; + goto done; + } + } + i += ulen; + } + } + +done: + str->encoding = enc; + + if (expected_encoding != ZIP_ENCODING_UNKNOWN) { + if (expected_encoding == ZIP_ENCODING_UTF8_KNOWN && enc == ZIP_ENCODING_UTF8_GUESSED) + str->encoding = enc = ZIP_ENCODING_UTF8_KNOWN; + + if (expected_encoding != enc && enc != ZIP_ENCODING_ASCII) + return ZIP_ENCODING_ERROR; + } + + return enc; +} + + +static zip_uint32_t +_zip_unicode_to_utf8_len(zip_uint32_t codepoint) { + if (codepoint < 0x0080) + return 1; + if (codepoint < 0x0800) + return 2; + if (codepoint < 0x10000) + return 3; + return 4; +} + + +static zip_uint32_t +_zip_unicode_to_utf8(zip_uint32_t codepoint, zip_uint8_t *buf) { + if (codepoint < 0x0080) { + buf[0] = codepoint & 0xff; + return 1; + } + if (codepoint < 0x0800) { + buf[0] = (zip_uint8_t)(UTF_8_LEN_2_MATCH | ((codepoint >> 6) & 0x1f)); + buf[1] = (zip_uint8_t)(UTF_8_CONTINUE_MATCH | (codepoint & 0x3f)); + return 2; + } + if (codepoint < 0x10000) { + buf[0] = (zip_uint8_t)(UTF_8_LEN_3_MATCH | ((codepoint >> 12) & 0x0f)); + buf[1] = (zip_uint8_t)(UTF_8_CONTINUE_MATCH | ((codepoint >> 6) & 0x3f)); + buf[2] = (zip_uint8_t)(UTF_8_CONTINUE_MATCH | (codepoint & 0x3f)); + return 3; + } + buf[0] = (zip_uint8_t)(UTF_8_LEN_4_MATCH | ((codepoint >> 18) & 0x07)); + buf[1] = (zip_uint8_t)(UTF_8_CONTINUE_MATCH | ((codepoint >> 12) & 0x3f)); + buf[2] = (zip_uint8_t)(UTF_8_CONTINUE_MATCH | ((codepoint >> 6) & 0x3f)); + buf[3] = (zip_uint8_t)(UTF_8_CONTINUE_MATCH | (codepoint & 0x3f)); + return 4; +} + + +zip_uint8_t * +_zip_cp437_to_utf8(const zip_uint8_t *const _cp437buf, zip_uint32_t len, zip_uint32_t *utf8_lenp, zip_error_t *error) { + zip_uint8_t *cp437buf = (zip_uint8_t *)_cp437buf; + zip_uint8_t *utf8buf; + zip_uint32_t buflen, i, offset; + + if (len == 0) { + if (utf8_lenp) + *utf8_lenp = 0; + return NULL; + } + + buflen = 1; + for (i = 0; i < len; i++) + buflen += _zip_unicode_to_utf8_len(_cp437_to_unicode[cp437buf[i]]); + + if ((utf8buf = (zip_uint8_t *)malloc(buflen)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + offset = 0; + for (i = 0; i < len; i++) + offset += _zip_unicode_to_utf8(_cp437_to_unicode[cp437buf[i]], utf8buf + offset); + + utf8buf[buflen - 1] = 0; + if (utf8_lenp) + *utf8_lenp = buflen - 1; + return utf8buf; +} diff --git a/core/deps/libzip/lib/zip_winzip_aes.c b/core/deps/libzip/lib/zip_winzip_aes.c new file mode 100644 index 000000000..75b279a96 --- /dev/null +++ b/core/deps/libzip/lib/zip_winzip_aes.c @@ -0,0 +1,162 @@ +/* + zip_winzip_aes.c -- Winzip AES de/encryption backend routines + Copyright (C) 2017-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "zipint.h" + +#include "zip_crypto.h" + +#include +#include + + +#define MAX_KEY_LENGTH 256 +#define PBKDF2_ITERATIONS 1000 + +struct _zip_winzip_aes { + _zip_crypto_aes_t *aes; + _zip_crypto_hmac_t *hmac; + zip_uint8_t counter[ZIP_CRYPTO_AES_BLOCK_LENGTH]; + zip_uint8_t pad[ZIP_CRYPTO_AES_BLOCK_LENGTH]; + int pad_offset; +}; + +static bool +aes_crypt(zip_winzip_aes_t *ctx, zip_uint8_t *data, zip_uint64_t length) { + zip_uint64_t i, j; + + for (i = 0; i < length; i++) { + if (ctx->pad_offset == AES_BLOCK_SIZE) { + for (j = 0; j < 8; j++) { + ctx->counter[j]++; + if (ctx->counter[j] != 0) { + break; + } + } + if (!_zip_crypto_aes_encrypt_block(ctx->aes, ctx->counter, ctx->pad)) { + return false; + } + ctx->pad_offset = 0; + } + data[i] ^= ctx->pad[ctx->pad_offset++]; + } + + return true; +} + + +zip_winzip_aes_t * +_zip_winzip_aes_new(const zip_uint8_t *password, zip_uint64_t password_length, const zip_uint8_t *salt, zip_uint16_t encryption_method, zip_uint8_t *password_verify, zip_error_t *error) { + zip_winzip_aes_t *ctx; + zip_uint8_t buffer[2 * (MAX_KEY_LENGTH / 8) + WINZIP_AES_PASSWORD_VERIFY_LENGTH]; + zip_uint16_t key_size = 0; /* in bits */ + zip_uint16_t key_length; /* in bytes */ + + switch (encryption_method) { + case ZIP_EM_AES_128: + key_size = 128; + break; + case ZIP_EM_AES_192: + key_size = 192; + break; + case ZIP_EM_AES_256: + key_size = 256; + break; + } + + if (key_size == 0 || salt == NULL || password == NULL || password_length == 0) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + key_length = key_size / 8; + + if ((ctx = (zip_winzip_aes_t *)malloc(sizeof(*ctx))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + memset(ctx->counter, 0, sizeof(ctx->counter)); + ctx->pad_offset = ZIP_CRYPTO_AES_BLOCK_LENGTH; + + if (!_zip_crypto_pbkdf2(password, password_length, salt, key_length / 2, PBKDF2_ITERATIONS, buffer, 2 * key_length + WINZIP_AES_PASSWORD_VERIFY_LENGTH)) { + free(ctx); + return NULL; + } + + if ((ctx->aes = _zip_crypto_aes_new(buffer, key_size, error)) == NULL) { + _zip_crypto_clear(ctx, sizeof(*ctx)); + free(ctx); + return NULL; + } + if ((ctx->hmac = _zip_crypto_hmac_new(buffer + key_length, key_length, error)) == NULL) { + _zip_crypto_aes_free(ctx->aes); + free(ctx); + return NULL; + } + + if (password_verify) { + memcpy(password_verify, buffer + (2 * key_size / 8), WINZIP_AES_PASSWORD_VERIFY_LENGTH); + } + + return ctx; +} + + +bool +_zip_winzip_aes_encrypt(zip_winzip_aes_t *ctx, zip_uint8_t *data, zip_uint64_t length) { + return aes_crypt(ctx, data, length) && _zip_crypto_hmac(ctx->hmac, data, length); +} + + +bool +_zip_winzip_aes_decrypt(zip_winzip_aes_t *ctx, zip_uint8_t *data, zip_uint64_t length) { + return _zip_crypto_hmac(ctx->hmac, data, length) && aes_crypt(ctx, data, length); +} + + +bool +_zip_winzip_aes_finish(zip_winzip_aes_t *ctx, zip_uint8_t *hmac) { + return _zip_crypto_hmac_output(ctx->hmac, hmac); +} + + +void +_zip_winzip_aes_free(zip_winzip_aes_t *ctx) { + if (ctx == NULL) { + return; + } + + _zip_crypto_aes_free(ctx->aes); + _zip_crypto_hmac_free(ctx->hmac); + free(ctx); +} diff --git a/core/deps/libzip/lib/zipint.h b/core/deps/libzip/lib/zipint.h new file mode 100644 index 000000000..6036d2e42 --- /dev/null +++ b/core/deps/libzip/lib/zipint.h @@ -0,0 +1,609 @@ +#ifndef _HAD_ZIPINT_H +#define _HAD_ZIPINT_H + +/* + zipint.h -- internal declarations. + Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "config.h" + +#include "compat.h" + +#ifdef ZIP_ALLOCATE_BUFFER +#include +#endif + +#ifndef _ZIP_COMPILING_DEPRECATED +#define ZIP_DISABLE_DEPRECATED +#endif + +#include "zip.h" + +#define CENTRAL_MAGIC "PK\1\2" +#define LOCAL_MAGIC "PK\3\4" +#define EOCD_MAGIC "PK\5\6" +#define DATADES_MAGIC "PK\7\10" +#define EOCD64LOC_MAGIC "PK\6\7" +#define EOCD64_MAGIC "PK\6\6" +#define CDENTRYSIZE 46u +#define LENTRYSIZE 30 +#define MAXCOMLEN 65536 +#define MAXEXTLEN 65536 +#define EOCDLEN 22 +#define EOCD64LOCLEN 20 +#define EOCD64LEN 56 +#define CDBUFSIZE (MAXCOMLEN + EOCDLEN + EOCD64LOCLEN) +#define BUFSIZE 8192 +#define EFZIP64SIZE 28 +#define EF_WINZIP_AES_SIZE 7 +#define MAX_DATA_DESCRIPTOR_LENGTH 24 + +#define ZIP_CRYPTO_PKWARE_HEADERLEN 12 + +#define ZIP_CM_REPLACED_DEFAULT (-2) +#define ZIP_CM_WINZIP_AES 99 /* Winzip AES encrypted */ + +#define WINZIP_AES_PASSWORD_VERIFY_LENGTH 2 +#define WINZIP_AES_MAX_HEADER_LENGTH (16 + WINZIP_AES_PASSWORD_VERIFY_LENGTH) +#define AES_BLOCK_SIZE 16 +#define HMAC_LENGTH 10 +#define SHA1_LENGTH 20 +#define SALT_LENGTH(method) ((method) == ZIP_EM_AES_128 ? 8 : ((method) == ZIP_EM_AES_192 ? 12 : 16)) + +#define ZIP_CM_IS_DEFAULT(x) ((x) == ZIP_CM_DEFAULT || (x) == ZIP_CM_REPLACED_DEFAULT) +#define ZIP_CM_ACTUAL(x) ((zip_uint16_t)(ZIP_CM_IS_DEFAULT(x) ? ZIP_CM_DEFLATE : (x))) + +#define ZIP_EF_UTF_8_COMMENT 0x6375 +#define ZIP_EF_UTF_8_NAME 0x7075 +#define ZIP_EF_WINZIP_AES 0x9901 +#define ZIP_EF_ZIP64 0x0001 + +#define ZIP_EF_IS_INTERNAL(id) ((id) == ZIP_EF_UTF_8_COMMENT || (id) == ZIP_EF_UTF_8_NAME || (id) == ZIP_EF_WINZIP_AES || (id) == ZIP_EF_ZIP64) + +/* according to unzip-6.0's zipinfo.c, this corresponds to a regular file with rw permissions for everyone */ +#define ZIP_EXT_ATTRIB_DEFAULT (0100666u << 16) +/* according to unzip-6.0's zipinfo.c, this corresponds to a directory with rwx permissions for everyone */ +#define ZIP_EXT_ATTRIB_DEFAULT_DIR (0040777u << 16) + +#define ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS_ALLOWED_MASK 0x0836 + +#define ZIP_MAX(a, b) ((a) > (b) ? (a) : (b)) +#define ZIP_MIN(a, b) ((a) < (b) ? (a) : (b)) + +/* This section contains API that won't materialize like this. It's + placed in the internal section, pending cleanup. */ + +/* flags for compression and encryption sources */ + +#define ZIP_CODEC_DECODE 0 /* decompress/decrypt (encode flag not set) */ +#define ZIP_CODEC_ENCODE 1 /* compress/encrypt */ + +typedef zip_source_t *(*zip_encryption_implementation)(zip_t *, zip_source_t *, zip_uint16_t, int, const char *); + +zip_encryption_implementation _zip_get_encryption_implementation(zip_uint16_t method, int operation); + +/* clang-format off */ +enum zip_compression_status { + ZIP_COMPRESSION_OK, + ZIP_COMPRESSION_END, + ZIP_COMPRESSION_ERROR, + ZIP_COMPRESSION_NEED_DATA +}; +/* clang-format on */ +typedef enum zip_compression_status zip_compression_status_t; + +struct zip_compression_algorithm { + /* Return maxiumum compressed size for uncompressed data of given size. */ + zip_uint64_t (*maximum_compressed_size)(zip_uint64_t uncompressed_size); + + /* called once to create new context */ + void *(*allocate)(zip_uint16_t method, int compression_flags, zip_error_t *error); + /* called once to free context */ + void (*deallocate)(void *ctx); + + /* get compression specific general purpose bitflags */ + zip_uint16_t (*general_purpose_bit_flags)(void *ctx); + /* minimum version needed when using this algorithm */ + zip_uint8_t version_needed; + + /* start processing */ + bool (*start)(void *ctx, zip_stat_t *st, zip_file_attributes_t *attributes); + /* stop processing */ + bool (*end)(void *ctx); + + /* provide new input data, remains valid until next call to input or end */ + bool (*input)(void *ctx, zip_uint8_t *data, zip_uint64_t length); + + /* all input data has been provided */ + void (*end_of_input)(void *ctx); + + /* process input data, writing to data, which has room for length bytes, update length to number of bytes written */ + zip_compression_status_t (*process)(void *ctx, zip_uint8_t *data, zip_uint64_t *length); +}; +typedef struct zip_compression_algorithm zip_compression_algorithm_t; + +extern zip_compression_algorithm_t zip_algorithm_bzip2_compress; +extern zip_compression_algorithm_t zip_algorithm_bzip2_decompress; +extern zip_compression_algorithm_t zip_algorithm_deflate_compress; +extern zip_compression_algorithm_t zip_algorithm_deflate_decompress; +extern zip_compression_algorithm_t zip_algorithm_xz_compress; +extern zip_compression_algorithm_t zip_algorithm_xz_decompress; +extern zip_compression_algorithm_t zip_algorithm_zstd_compress; +extern zip_compression_algorithm_t zip_algorithm_zstd_decompress; + +zip_compression_algorithm_t *_zip_get_compression_algorithm(zip_int32_t method, bool compress); + +/* This API is not final yet, but we need it internally, so it's private for now. */ + +const zip_uint8_t *zip_get_extra_field_by_id(zip_t *, int, int, zip_uint16_t, int, zip_uint16_t *); + +/* This section contains API that is of limited use until support for + user-supplied compression/encryption implementation is finished. + Thus we will keep it private for now. */ + +typedef zip_int64_t (*zip_source_layered_callback)(zip_source_t *, void *, void *, zip_uint64_t, enum zip_source_cmd); +zip_source_t *zip_source_compress(zip_t *za, zip_source_t *src, zip_int32_t cm, int compression_flags); +zip_source_t *zip_source_crc(zip_t *, zip_source_t *, int); +zip_source_t *zip_source_decompress(zip_t *za, zip_source_t *src, zip_int32_t cm); +zip_source_t *zip_source_layered(zip_t *, zip_source_t *, zip_source_layered_callback, void *); +zip_source_t *zip_source_layered_create(zip_source_t *src, zip_source_layered_callback cb, void *ud, zip_error_t *error); +zip_source_t *zip_source_pkware_decode(zip_t *, zip_source_t *, zip_uint16_t, int, const char *); +zip_source_t *zip_source_pkware_encode(zip_t *, zip_source_t *, zip_uint16_t, int, const char *); +int zip_source_remove(zip_source_t *); +zip_int64_t zip_source_supports(zip_source_t *src); +zip_source_t *zip_source_window(zip_t *, zip_source_t *, zip_uint64_t, zip_uint64_t); +zip_source_t *zip_source_winzip_aes_decode(zip_t *, zip_source_t *, zip_uint16_t, int, const char *); +zip_source_t *zip_source_winzip_aes_encode(zip_t *, zip_source_t *, zip_uint16_t, int, const char *); +zip_source_t *zip_source_buffer_with_attributes(zip_t *za, const void *data, zip_uint64_t len, int freep, zip_file_attributes_t *attributes); + +/* error source for layered sources */ + +enum zip_les { ZIP_LES_NONE, ZIP_LES_UPPER, ZIP_LES_LOWER, ZIP_LES_INVAL }; + +/* directory entry: general purpose bit flags */ + +#define ZIP_GPBF_ENCRYPTED 0x0001u /* is encrypted */ +#define ZIP_GPBF_DATA_DESCRIPTOR 0x0008u /* crc/size after file data */ +#define ZIP_GPBF_STRONG_ENCRYPTION 0x0040u /* uses strong encryption */ +#define ZIP_GPBF_ENCODING_UTF_8 0x0800u /* file name encoding is UTF-8 */ + + +/* extra fields */ +#define ZIP_EF_LOCAL ZIP_FL_LOCAL /* include in local header */ +#define ZIP_EF_CENTRAL ZIP_FL_CENTRAL /* include in central directory */ +#define ZIP_EF_BOTH (ZIP_EF_LOCAL | ZIP_EF_CENTRAL) /* include in both */ + +#define ZIP_FL_FORCE_ZIP64 1024 /* force zip64 extra field (_zip_dirent_write) */ + +#define ZIP_FL_ENCODING_ALL (ZIP_FL_ENC_GUESS | ZIP_FL_ENC_CP437 | ZIP_FL_ENC_UTF_8) + + +/* encoding type */ +enum zip_encoding_type { + ZIP_ENCODING_UNKNOWN, /* not yet analyzed */ + ZIP_ENCODING_ASCII, /* plain ASCII */ + ZIP_ENCODING_UTF8_KNOWN, /* is UTF-8 */ + ZIP_ENCODING_UTF8_GUESSED, /* possibly UTF-8 */ + ZIP_ENCODING_CP437, /* Code Page 437 */ + ZIP_ENCODING_ERROR /* should be UTF-8 but isn't */ +}; + +typedef enum zip_encoding_type zip_encoding_type_t; + +struct zip_hash; +struct zip_progress; + +typedef struct zip_cdir zip_cdir_t; +typedef struct zip_dirent zip_dirent_t; +typedef struct zip_entry zip_entry_t; +typedef struct zip_extra_field zip_extra_field_t; +typedef struct zip_string zip_string_t; +typedef struct zip_buffer zip_buffer_t; +typedef struct zip_hash zip_hash_t; +typedef struct zip_progress zip_progress_t; + +/* zip archive, part of API */ + +struct zip { + zip_source_t *src; /* data source for archive */ + unsigned int open_flags; /* flags passed to zip_open */ + zip_error_t error; /* error information */ + + unsigned int flags; /* archive global flags */ + unsigned int ch_flags; /* changed archive global flags */ + + char *default_password; /* password used when no other supplied */ + + zip_string_t *comment_orig; /* archive comment */ + zip_string_t *comment_changes; /* changed archive comment */ + bool comment_changed; /* whether archive comment was changed */ + + zip_uint64_t nentry; /* number of entries */ + zip_uint64_t nentry_alloc; /* number of entries allocated */ + zip_entry_t *entry; /* entries */ + + unsigned int nopen_source; /* number of open sources using archive */ + unsigned int nopen_source_alloc; /* number of sources allocated */ + zip_source_t **open_source; /* open sources using archive */ + + zip_hash_t *names; /* hash table for name lookup */ + + zip_progress_t *progress; /* progress callback for zip_close() */ +}; + +/* file in zip archive, part of API */ + +struct zip_file { + zip_t *za; /* zip archive containing this file */ + zip_error_t error; /* error information */ + bool eof; + zip_source_t *src; /* data source */ +}; + +/* zip archive directory entry (central or local) */ + +#define ZIP_DIRENT_COMP_METHOD 0x0001u +#define ZIP_DIRENT_FILENAME 0x0002u +#define ZIP_DIRENT_COMMENT 0x0004u +#define ZIP_DIRENT_EXTRA_FIELD 0x0008u +#define ZIP_DIRENT_ATTRIBUTES 0x0010u +#define ZIP_DIRENT_LAST_MOD 0x0020u +#define ZIP_DIRENT_ENCRYPTION_METHOD 0x0040u +#define ZIP_DIRENT_PASSWORD 0x0080u +#define ZIP_DIRENT_ALL ZIP_UINT32_MAX + +struct zip_dirent { + zip_uint32_t changed; + bool local_extra_fields_read; /* whether we already read in local header extra fields */ + bool cloned; /* whether this instance is cloned, and thus shares non-changed strings */ + + bool crc_valid; /* if CRC is valid (sometimes not for encrypted archives) */ + + zip_uint16_t version_madeby; /* (c) version of creator */ + zip_uint16_t version_needed; /* (cl) version needed to extract */ + zip_uint16_t bitflags; /* (cl) general purpose bit flag */ + zip_int32_t comp_method; /* (cl) compression method used (uint16 and ZIP_CM_DEFAULT (-1)) */ + time_t last_mod; /* (cl) time of last modification */ + zip_uint32_t crc; /* (cl) CRC-32 of uncompressed data */ + zip_uint64_t comp_size; /* (cl) size of compressed data */ + zip_uint64_t uncomp_size; /* (cl) size of uncompressed data */ + zip_string_t *filename; /* (cl) file name (NUL-terminated) */ + zip_extra_field_t *extra_fields; /* (cl) extra fields, parsed */ + zip_string_t *comment; /* (c) file comment */ + zip_uint32_t disk_number; /* (c) disk number start */ + zip_uint16_t int_attrib; /* (c) internal file attributes */ + zip_uint32_t ext_attrib; /* (c) external file attributes */ + zip_uint64_t offset; /* (c) offset of local header */ + + zip_uint16_t compression_level; /* level of compression to use (never valid in orig) */ + zip_uint16_t encryption_method; /* encryption method, computed from other fields */ + char *password; /* file specific encryption password */ +}; + +/* zip archive central directory */ + +struct zip_cdir { + zip_entry_t *entry; /* directory entries */ + zip_uint64_t nentry; /* number of entries */ + zip_uint64_t nentry_alloc; /* number of entries allocated */ + + zip_uint64_t size; /* size of central directory */ + zip_uint64_t offset; /* offset of central directory in file */ + zip_string_t *comment; /* zip archive comment */ + bool is_zip64; /* central directory in zip64 format */ +}; + +struct zip_extra_field { + zip_extra_field_t *next; + zip_flags_t flags; /* in local/central header */ + zip_uint16_t id; /* header id */ + zip_uint16_t size; /* data size */ + zip_uint8_t *data; +}; + +enum zip_source_write_state { + ZIP_SOURCE_WRITE_CLOSED, /* write is not in progress */ + ZIP_SOURCE_WRITE_OPEN, /* write is in progress */ + ZIP_SOURCE_WRITE_FAILED, /* commit failed, only rollback allowed */ + ZIP_SOURCE_WRITE_REMOVED /* file was removed */ +}; +typedef enum zip_source_write_state zip_source_write_state_t; + +struct zip_source { + zip_source_t *src; + union { + zip_source_callback f; + zip_source_layered_callback l; + } cb; + void *ud; + zip_error_t error; + zip_int64_t supports; /* supported commands */ + unsigned int open_count; /* number of times source was opened (directly or as lower layer) */ + zip_source_write_state_t write_state; /* whether source is open for writing */ + bool source_closed; /* set if source archive is closed */ + zip_t *source_archive; /* zip archive we're reading from, NULL if not from archive */ + unsigned int refcount; + bool eof; /* EOF reached */ + bool had_read_error; /* a previous ZIP_SOURCE_READ reported an error */ + zip_uint64_t bytes_read; /* for sources that don't support ZIP_SOURCE_TELL. */ +}; + +#define ZIP_SOURCE_IS_OPEN_READING(src) ((src)->open_count > 0) +#define ZIP_SOURCE_IS_OPEN_WRITING(src) ((src)->write_state == ZIP_SOURCE_WRITE_OPEN) +#define ZIP_SOURCE_IS_LAYERED(src) ((src)->src != NULL) + +/* entry in zip archive directory */ + +struct zip_entry { + zip_dirent_t *orig; + zip_dirent_t *changes; + zip_source_t *source; + bool deleted; +}; + + +/* file or archive comment, or filename */ + +struct zip_string { + zip_uint8_t *raw; /* raw string */ + zip_uint16_t length; /* length of raw string */ + enum zip_encoding_type encoding; /* autorecognized encoding */ + zip_uint8_t *converted; /* autoconverted string */ + zip_uint32_t converted_length; /* length of converted */ +}; + + +/* byte array */ + +/* For performance, we usually keep 8k byte arrays on the stack. + However, there are (embedded) systems with a stack size of 12k; + for those, use malloc()/free() */ + +#ifdef ZIP_ALLOCATE_BUFFER +#define DEFINE_BYTE_ARRAY(buf, size) zip_uint8_t *buf +#define byte_array_init(buf, size) (((buf) = (zip_uint8_t *)malloc(size)) != NULL) +#define byte_array_fini(buf) (free(buf)) +#else +#define DEFINE_BYTE_ARRAY(buf, size) zip_uint8_t buf[size] +#define byte_array_init(buf, size) (1) +#define byte_array_fini(buf) ((void)0) +#endif + + +/* bounds checked access to memory buffer */ + +struct zip_buffer { + bool ok; + bool free_data; + + zip_uint8_t *data; + zip_uint64_t size; + zip_uint64_t offset; +}; + +/* which files to write in which order */ + +struct zip_filelist { + zip_uint64_t idx; + /* TODO const char *name; */ +}; + +typedef struct zip_filelist zip_filelist_t; + +struct _zip_winzip_aes; +typedef struct _zip_winzip_aes zip_winzip_aes_t; + +struct _zip_pkware_keys { + zip_uint32_t key[3]; +}; +typedef struct _zip_pkware_keys zip_pkware_keys_t; + +extern const char *const _zip_err_str[]; +extern const int _zip_nerr_str; +extern const int _zip_err_type[]; + +#define ZIP_MAX(a, b) ((a) > (b) ? (a) : (b)) +#define ZIP_MIN(a, b) ((a) < (b) ? (a) : (b)) + +#define ZIP_ENTRY_CHANGED(e, f) ((e)->changes && ((e)->changes->changed & (f))) +#define ZIP_ENTRY_DATA_CHANGED(x) ((x)->source != NULL) +#define ZIP_ENTRY_HAS_CHANGES(e) (ZIP_ENTRY_DATA_CHANGED(e) || (e)->deleted || ZIP_ENTRY_CHANGED((e), ZIP_DIRENT_ALL)) + +#define ZIP_IS_RDONLY(za) ((za)->ch_flags & ZIP_AFL_RDONLY) + + +#ifdef HAVE_EXPLICIT_MEMSET +#define _zip_crypto_clear(b, l) explicit_memset((b), 0, (l)) +#else +#ifdef HAVE_EXPLICIT_BZERO +#define _zip_crypto_clear(b, l) explicit_bzero((b), (l)) +#else +#include +#define _zip_crypto_clear(b, l) memset((b), 0, (l)) +#endif +#endif + + +zip_int64_t _zip_add_entry(zip_t *); + +zip_uint8_t *_zip_buffer_data(zip_buffer_t *buffer); +bool _zip_buffer_eof(zip_buffer_t *buffer); +void _zip_buffer_free(zip_buffer_t *buffer); +zip_uint8_t *_zip_buffer_get(zip_buffer_t *buffer, zip_uint64_t length); +zip_uint16_t _zip_buffer_get_16(zip_buffer_t *buffer); +zip_uint32_t _zip_buffer_get_32(zip_buffer_t *buffer); +zip_uint64_t _zip_buffer_get_64(zip_buffer_t *buffer); +zip_uint8_t _zip_buffer_get_8(zip_buffer_t *buffer); +zip_uint64_t _zip_buffer_left(zip_buffer_t *buffer); +zip_buffer_t *_zip_buffer_new(zip_uint8_t *data, zip_uint64_t size); +zip_buffer_t *_zip_buffer_new_from_source(zip_source_t *src, zip_uint64_t size, zip_uint8_t *buf, zip_error_t *error); +zip_uint64_t _zip_buffer_offset(zip_buffer_t *buffer); +bool _zip_buffer_ok(zip_buffer_t *buffer); +zip_uint8_t *_zip_buffer_peek(zip_buffer_t *buffer, zip_uint64_t length); +int _zip_buffer_put(zip_buffer_t *buffer, const void *src, size_t length); +int _zip_buffer_put_16(zip_buffer_t *buffer, zip_uint16_t i); +int _zip_buffer_put_32(zip_buffer_t *buffer, zip_uint32_t i); +int _zip_buffer_put_64(zip_buffer_t *buffer, zip_uint64_t i); +int _zip_buffer_put_8(zip_buffer_t *buffer, zip_uint8_t i); +zip_uint64_t _zip_buffer_read(zip_buffer_t *buffer, zip_uint8_t *data, zip_uint64_t length); +int _zip_buffer_skip(zip_buffer_t *buffer, zip_uint64_t length); +int _zip_buffer_set_offset(zip_buffer_t *buffer, zip_uint64_t offset); +zip_uint64_t _zip_buffer_size(zip_buffer_t *buffer); + +void _zip_cdir_free(zip_cdir_t *); +bool _zip_cdir_grow(zip_cdir_t *cd, zip_uint64_t additional_entries, zip_error_t *error); +zip_cdir_t *_zip_cdir_new(zip_uint64_t, zip_error_t *); +zip_int64_t _zip_cdir_write(zip_t *za, const zip_filelist_t *filelist, zip_uint64_t survivors); +time_t _zip_d2u_time(zip_uint16_t, zip_uint16_t); +void _zip_deregister_source(zip_t *za, zip_source_t *src); + +void _zip_dirent_apply_attributes(zip_dirent_t *, zip_file_attributes_t *, bool, zip_uint32_t); +zip_dirent_t *_zip_dirent_clone(const zip_dirent_t *); +void _zip_dirent_free(zip_dirent_t *); +void _zip_dirent_finalize(zip_dirent_t *); +void _zip_dirent_init(zip_dirent_t *); +bool _zip_dirent_needs_zip64(const zip_dirent_t *, zip_flags_t); +zip_dirent_t *_zip_dirent_new(void); +zip_int64_t _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, bool local, zip_error_t *error); +void _zip_dirent_set_version_needed(zip_dirent_t *de, bool force_zip64); +zip_int32_t _zip_dirent_size(zip_source_t *src, zip_uint16_t, zip_error_t *); +int _zip_dirent_write(zip_t *za, zip_dirent_t *dirent, zip_flags_t flags); + +zip_extra_field_t *_zip_ef_clone(const zip_extra_field_t *, zip_error_t *); +zip_extra_field_t *_zip_ef_delete_by_id(zip_extra_field_t *, zip_uint16_t, zip_uint16_t, zip_flags_t); +void _zip_ef_free(zip_extra_field_t *); +const zip_uint8_t *_zip_ef_get_by_id(const zip_extra_field_t *, zip_uint16_t *, zip_uint16_t, zip_uint16_t, zip_flags_t, zip_error_t *); +zip_extra_field_t *_zip_ef_merge(zip_extra_field_t *, zip_extra_field_t *); +zip_extra_field_t *_zip_ef_new(zip_uint16_t, zip_uint16_t, const zip_uint8_t *, zip_flags_t); +bool _zip_ef_parse(const zip_uint8_t *, zip_uint16_t, zip_flags_t, zip_extra_field_t **, zip_error_t *); +zip_extra_field_t *_zip_ef_remove_internal(zip_extra_field_t *); +zip_uint16_t _zip_ef_size(const zip_extra_field_t *, zip_flags_t); +int _zip_ef_write(zip_t *za, const zip_extra_field_t *ef, zip_flags_t flags); + +void _zip_entry_finalize(zip_entry_t *); +void _zip_entry_init(zip_entry_t *); + +void _zip_error_clear(zip_error_t *); +void _zip_error_get(const zip_error_t *, int *, int *); + +void _zip_error_copy(zip_error_t *dst, const zip_error_t *src); +void _zip_error_set_from_source(zip_error_t *, zip_source_t *); + +const zip_uint8_t *_zip_extract_extra_field_by_id(zip_error_t *, zip_uint16_t, int, const zip_uint8_t *, zip_uint16_t, zip_uint16_t *); + +int _zip_file_extra_field_prepare_for_change(zip_t *, zip_uint64_t); +int _zip_file_fillbuf(void *, size_t, zip_file_t *); +zip_uint64_t _zip_file_get_end(const zip_t *za, zip_uint64_t index, zip_error_t *error); +zip_uint64_t _zip_file_get_offset(const zip_t *, zip_uint64_t, zip_error_t *); + +zip_dirent_t *_zip_get_dirent(zip_t *, zip_uint64_t, zip_flags_t, zip_error_t *); + +enum zip_encoding_type _zip_guess_encoding(zip_string_t *, enum zip_encoding_type); +zip_uint8_t *_zip_cp437_to_utf8(const zip_uint8_t *const, zip_uint32_t, zip_uint32_t *, zip_error_t *); + +bool _zip_hash_add(zip_hash_t *hash, const zip_uint8_t *name, zip_uint64_t index, zip_flags_t flags, zip_error_t *error); +bool _zip_hash_delete(zip_hash_t *hash, const zip_uint8_t *key, zip_error_t *error); +void _zip_hash_free(zip_hash_t *hash); +zip_int64_t _zip_hash_lookup(zip_hash_t *hash, const zip_uint8_t *name, zip_flags_t flags, zip_error_t *error); +zip_hash_t *_zip_hash_new(zip_error_t *error); +bool _zip_hash_reserve_capacity(zip_hash_t *hash, zip_uint64_t capacity, zip_error_t *error); +bool _zip_hash_revert(zip_hash_t *hash, zip_error_t *error); + +int _zip_mkstempm(char *path, int mode); + +zip_t *_zip_open(zip_source_t *, unsigned int, zip_error_t *); + +void _zip_progress_end(zip_progress_t *progress); +void _zip_progress_free(zip_progress_t *progress); +int _zip_progress_start(zip_progress_t *progress); +int _zip_progress_subrange(zip_progress_t *progress, double start, double end); +int _zip_progress_update(zip_progress_t *progress, double value); + +/* this symbol is extern so it can be overridden for regression testing */ +ZIP_EXTERN bool zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length); +zip_uint32_t zip_random_uint32(void); + +int _zip_read(zip_source_t *src, zip_uint8_t *data, zip_uint64_t length, zip_error_t *error); +int _zip_read_at_offset(zip_source_t *src, zip_uint64_t offset, unsigned char *b, size_t length, zip_error_t *error); +zip_uint8_t *_zip_read_data(zip_buffer_t *buffer, zip_source_t *src, size_t length, bool nulp, zip_error_t *error); +int _zip_read_local_ef(zip_t *, zip_uint64_t); +zip_string_t *_zip_read_string(zip_buffer_t *buffer, zip_source_t *src, zip_uint16_t length, bool nulp, zip_error_t *error); +int _zip_register_source(zip_t *za, zip_source_t *src); + +void _zip_set_open_error(int *zep, const zip_error_t *err, int ze); + +bool zip_source_accept_empty(zip_source_t *src); +zip_int64_t _zip_source_call(zip_source_t *src, void *data, zip_uint64_t length, zip_source_cmd_t command); +bool _zip_source_eof(zip_source_t *); +zip_source_t *_zip_source_file_or_p(const char *, FILE *, zip_uint64_t, zip_int64_t, const zip_stat_t *, zip_error_t *error); +bool _zip_source_had_error(zip_source_t *); +void _zip_source_invalidate(zip_source_t *src); +zip_source_t *_zip_source_new(zip_error_t *error); +int _zip_source_set_source_archive(zip_source_t *, zip_t *); +zip_source_t *_zip_source_window_new(zip_source_t *src, zip_uint64_t start, zip_uint64_t length, zip_stat_t *st, zip_file_attributes_t *attributes, zip_t *source_archive, zip_uint64_t source_index, zip_error_t *error); +zip_source_t *_zip_source_zip_new(zip_t *, zip_t *, zip_uint64_t, zip_flags_t, zip_uint64_t, zip_uint64_t, const char *); + +int _zip_stat_merge(zip_stat_t *dst, const zip_stat_t *src, zip_error_t *error); +int _zip_string_equal(const zip_string_t *, const zip_string_t *); +void _zip_string_free(zip_string_t *); +zip_uint32_t _zip_string_crc32(const zip_string_t *); +const zip_uint8_t *_zip_string_get(zip_string_t *, zip_uint32_t *, zip_flags_t, zip_error_t *); +zip_uint16_t _zip_string_length(const zip_string_t *); +zip_string_t *_zip_string_new(const zip_uint8_t *, zip_uint16_t, zip_flags_t, zip_error_t *); +int _zip_string_write(zip_t *za, const zip_string_t *string); +bool _zip_winzip_aes_decrypt(zip_winzip_aes_t *ctx, zip_uint8_t *data, zip_uint64_t length); +bool _zip_winzip_aes_encrypt(zip_winzip_aes_t *ctx, zip_uint8_t *data, zip_uint64_t length); +bool _zip_winzip_aes_finish(zip_winzip_aes_t *ctx, zip_uint8_t *hmac); +void _zip_winzip_aes_free(zip_winzip_aes_t *ctx); +zip_winzip_aes_t *_zip_winzip_aes_new(const zip_uint8_t *password, zip_uint64_t password_length, const zip_uint8_t *salt, zip_uint16_t key_size, zip_uint8_t *password_verify, zip_error_t *error); + +void _zip_pkware_encrypt(zip_pkware_keys_t *keys, zip_uint8_t *out, const zip_uint8_t *in, zip_uint64_t len); +void _zip_pkware_decrypt(zip_pkware_keys_t *keys, zip_uint8_t *out, const zip_uint8_t *in, zip_uint64_t len); +zip_pkware_keys_t *_zip_pkware_keys_new(zip_error_t *error); +void _zip_pkware_keys_free(zip_pkware_keys_t *keys); +void _zip_pkware_keys_reset(zip_pkware_keys_t *keys); + +int _zip_changed(const zip_t *, zip_uint64_t *); +const char *_zip_get_name(zip_t *, zip_uint64_t, zip_flags_t, zip_error_t *); +int _zip_local_header_read(zip_t *, int); +void *_zip_memdup(const void *, size_t, zip_error_t *); +zip_int64_t _zip_name_locate(zip_t *, const char *, zip_flags_t, zip_error_t *); +zip_t *_zip_new(zip_error_t *); + +zip_int64_t _zip_file_replace(zip_t *, zip_uint64_t, const char *, zip_source_t *, zip_flags_t); +int _zip_set_name(zip_t *, zip_uint64_t, const char *, zip_flags_t); +void _zip_u2d_time(time_t, zip_uint16_t *, zip_uint16_t *); +int _zip_unchange(zip_t *, zip_uint64_t, int); +void _zip_unchange_data(zip_entry_t *); +int _zip_write(zip_t *za, const void *data, zip_uint64_t length); + +#endif /* zipint.h */ diff --git a/core/deps/libzip/libzip-config.cmake.in b/core/deps/libzip/libzip-config.cmake.in new file mode 100644 index 000000000..5b9aa5580 --- /dev/null +++ b/core/deps/libzip/libzip-config.cmake.in @@ -0,0 +1,11 @@ +@PACKAGE_INIT@ + +# only needed for static library, and doesn't work as-is +#include(CMakeFindDependencyMacro) +#find_dependency(ZLIB::ZLIB) +# how to handle the optional dependencies? +# Provide all our library targets to users. +include("${CMAKE_CURRENT_LIST_DIR}/libzip-targets.cmake") + +check_required_components(libzip) + diff --git a/core/deps/libzip/libzip.pc.in b/core/deps/libzip/libzip.pc.in new file mode 100644 index 000000000..58b3dca7c --- /dev/null +++ b/core/deps/libzip/libzip.pc.in @@ -0,0 +1,15 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@ +libdir=@libdir@ +includedir=@includedir@ + +zipcmp=@bindir@/zipcmp + +Name: libzip +Description: library for handling zip archives +Version: @PROJECT_VERSION@ +Libs: @PKG_CONFIG_RPATH@ -L${libdir} -lzip +Libs.private: @LIBS@ +Cflags: -I${includedir} + diff --git a/core/deps/libzip/man/CMakeLists.txt b/core/deps/libzip/man/CMakeLists.txt new file mode 100644 index 000000000..90d462a51 --- /dev/null +++ b/core/deps/libzip/man/CMakeLists.txt @@ -0,0 +1,161 @@ +set(MAN_PAGES + ZIP_SOURCE_GET_ARGS.3 + libzip.3 + zip_add.3 + zip_add_dir.3 + zip_close.3 + zip_compression_method_supported.3 + zip_delete.3 + zip_dir_add.3 + zip_discard.3 + zip_encryption_method_supported.3 + zip_error_clear.3 + zip_error_code_system.3 + zip_error_code_zip.3 + zip_error_fini.3 + zip_error_get.3 + zip_error_get_sys_type.3 + zip_error_init.3 + zip_error_set.3 + zip_error_strerror.3 + zip_error_system_type.3 + zip_error_to_data.3 + zip_error_to_str.3 + zip_errors.3 + zip_fclose.3 + zip_fdopen.3 + zip_file_add.3 + zip_file_attributes_init.3 + zip_file_extra_field_delete.3 + zip_file_extra_field_get.3 + zip_file_extra_field_set.3 + zip_file_extra_fields_count.3 + zip_file_get_comment.3 + zip_file_get_error.3 + zip_file_get_external_attributes.3 + zip_file_rename.3 + zip_file_set_comment.3 + zip_file_set_encryption.3 + zip_file_set_external_attributes.3 + zip_file_set_mtime.3 + zip_file_strerror.3 + zip_fopen.3 + zip_fopen_encrypted.3 + zip_fread.3 + zip_fseek.3 + zip_ftell.3 + zip_get_archive_comment.3 + zip_get_archive_flag.3 + zip_get_error.3 + zip_get_file_comment.3 + zip_get_name.3 + zip_get_num_entries.3 + zip_get_num_files.3 + zip_libzip_version.3 + zip_name_locate.3 + zip_open.3 + zip_register_progress_callback.3 + zip_register_progress_callback_with_state.3 + zip_rename.3 + zip_set_archive_comment.3 + zip_set_archive_flag.3 + zip_set_default_password.3 + zip_set_file_comment.3 + zip_set_file_compression.3 + zip_source.3 + zip_source_begin_write.3 + zip_source_buffer.3 + zip_source_buffer_fragment.3 + zip_source_close.3 + zip_source_commit_write.3 + zip_source_error.3 + zip_source_file.3 + zip_source_filep.3 + zip_source_free.3 + zip_source_function.3 + zip_source_is_deleted.3 + zip_source_keep.3 + zip_source_make_command_bitmap.3 + zip_source_open.3 + zip_source_read.3 + zip_source_rollback_write.3 + zip_source_seek.3 + zip_source_seek_compute_offset.3 + zip_source_seek_write.3 + zip_source_stat.3 + zip_source_tell.3 + zip_source_tell_write.3 + zip_source_win32a.3 + zip_source_win32handle.3 + zip_source_win32w.3 + zip_source_write.3 + zip_source_zip.3 + zip_stat.3 + zip_stat_init.3 + zip_unchange.3 + zip_unchange_all.3 + zip_unchange_archive.3 + zipcmp.1 + zipmerge.1 + ziptool.1 +) + +foreach(MAN_PAGE ${MAN_PAGES}) + string(REGEX REPLACE "[1-9]$" "${DOCUMENTATION_FORMAT}" SOURCE_FILE ${MAN_PAGE}) + if(LIBZIP_DO_INSTALL) + if (DOCUMENTATION_FORMAT MATCHES "html") + install(FILES ${PROJECT_BINARY_DIR}/man/${MAN_PAGE} DESTINATION ${CMAKE_INSTALL_DOCDIR}/${PROJECT_NAME} RENAME ${SOURCE_FILE}) + else() + string(REGEX REPLACE ".*(.)$" "man\\1" SUBDIR ${MAN_PAGE}) + install(FILES ${PROJECT_BINARY_DIR}/man/${MAN_PAGE} DESTINATION ${CMAKE_INSTALL_MANDIR}/${SUBDIR}) + endif() + endif() + # configure_file does not find out about updates to the sources, and it does not provide a target + #configure_file(${SOURCE_FILE} ${MAN_PAGE} COPYONLY) + add_custom_command(OUTPUT ${MAN_PAGE} + DEPENDS ${SOURCE_FILE} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PROJECT_SOURCE_DIR}/man/${SOURCE_FILE} ${PROJECT_BINARY_DIR}/man/${MAN_PAGE} + COMMENT "Preparing ${MAN_PAGE}" + ) + + string(REGEX REPLACE "[1-9]$" "html" HTML_FILE ${MAN_PAGE}) + string(REGEX REPLACE "[1-9]$" "man" MAN_FILE ${MAN_PAGE}) + string(REGEX REPLACE "[1-9]$" "mdoc" MDOC_FILE ${MAN_PAGE}) + + # html re-generation + add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/man/${HTML_FILE} + DEPENDS ${MDOC_FILE} + COMMAND ${CMAKE_COMMAND} -DIN=${MDOC_FILE} -DOUT=${HTML_FILE} -DDIR=${PROJECT_SOURCE_DIR}/man -P ${PROJECT_SOURCE_DIR}/man/update-html.cmake + ) + list(APPEND UPDATEHTML ${PROJECT_SOURCE_DIR}/man/${HTML_FILE}) + + # man re-generation + add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/man/${MAN_FILE} + DEPENDS ${MDOC_FILE} + COMMAND ${CMAKE_COMMAND} -DIN=${MDOC_FILE} -DOUT=${MAN_FILE} -DDIR=${PROJECT_SOURCE_DIR}/man -P ${PROJECT_SOURCE_DIR}/man/update-man.cmake + ) + list(APPEND UPDATEMAN ${PROJECT_SOURCE_DIR}/man/${MAN_FILE}) +endforeach() +add_custom_target(man ALL DEPENDS ${MAN_PAGES}) +add_custom_target(update-man DEPENDS ${UPDATEMAN}) +add_custom_target(update-html DEPENDS ${UPDATEHTML}) + +file(STRINGS links MANPAGE_LINKS) +foreach(LINKS_LINE ${MANPAGE_LINKS}) + if(${LINKS_LINE} MATCHES "(.*) (.*)") + set(SOURCE ${CMAKE_MATCH_1}) + set(TARGET ${CMAKE_MATCH_2}) + if(LIBZIP_DO_INSTALL) + if (DOCUMENTATION_FORMAT MATCHES "html") + INSTALL(FILES ${PROJECT_BINARY_DIR}/man/${SOURCE}.3 DESTINATION ${CMAKE_INSTALL_DOCDIR}/${PROJECT_NAME} RENAME ${TARGET}.html) + else() + INSTALL(FILES ${PROJECT_BINARY_DIR}/man/${SOURCE}.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 RENAME ${TARGET}.3) + endif() + endif() + endif() +endforeach() + +add_custom_target(update_zip_errors + COMMAND sh ${PROJECT_SOURCE_DIR}/man/make_zip_errors.sh ${CMAKE_SOURCE_DIR}/lib/zip.h ${PROJECT_SOURCE_DIR}/man/zip_errors.mdoc + DEPENDS ${CMAKE_SOURCE_DIR}/lib/zip.h ${PROJECT_SOURCE_DIR}/man/zip_errors.mdoc +) diff --git a/core/deps/libzip/man/ZIP_SOURCE_GET_ARGS.html b/core/deps/libzip/man/ZIP_SOURCE_GET_ARGS.html new file mode 100644 index 000000000..bea0f3c6f --- /dev/null +++ b/core/deps/libzip/man/ZIP_SOURCE_GET_ARGS.html @@ -0,0 +1,114 @@ + + + + + + + ZIP_SOURCE_GET_ARGS(3) + + + + + + + + +
ZIP_SOURCE_GET_ARGS(3)Library Functions ManualZIP_SOURCE_GET_ARGS(3)
+
+
+

+ZIP_SOURCE_GET_ARGS — +
validate and cast arguments to source callback
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

type * +
+ ZIP_SOURCE_GET_ARGS(type, + void *data, + zip_uint64_t len, + zip_error_t *error);

+
+
+

+The ZIP_SOURCE_GET_ARGS() macro casts + data to a pointer to type. +
+
+

+On success, ZIP_SOURCE_GET_ARGS() returns + data. In case of error, it returns + NULL and sets error. +
+
+

+ZIP_SOURCE_GET_ARGS() fails if: +
+
[]
+
len is less than the size of + type
+
+
+
+

+libzip(3), + zip_source_function(3) +
+
+

+ZIP_SOURCE_GET_ARGS() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/ZIP_SOURCE_GET_ARGS.man b/core/deps/libzip/man/ZIP_SOURCE_GET_ARGS.man new file mode 100644 index 000000000..0e23ebd2a --- /dev/null +++ b/core/deps/libzip/man/ZIP_SOURCE_GET_ARGS.man @@ -0,0 +1,83 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" ZIP_SOURCE_GET_ARGS -- validate and cast arguments to source callback +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_GET_ARGS" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBZIP_SOURCE_GET_ARGS\fR +\- validate and cast arguments to source callback +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fItype *\fR +.br +.PD 0 +.HP 4n +\fBZIP_SOURCE_GET_ARGS\fR(\fItype\fR, \fIvoid\ *data\fR, \fIzip_uint64_t\ len\fR, \fIzip_error_t\ *error\fR); +.PD +.SH "DESCRIPTION" +The +\fBZIP_SOURCE_GET_ARGS\fR() +macro casts +\fIdata\fR +to a pointer to +\fItype\fR. +.SH "RETURN VALUES" +On success, +\fBZIP_SOURCE_GET_ARGS\fR() +returns +\fIdata\fR. +In case of error, it returns +\fRNULL\fR +and sets +\fIerror\fR. +.SH "ERRORS" +\fBZIP_SOURCE_GET_ARGS\fR() +fails if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIlen\fR +is less than the size of +\fItype\fR +.SH "SEE ALSO" +libzip(3), +zip_source_function(3) +.SH "HISTORY" +\fBZIP_SOURCE_GET_ARGS\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/ZIP_SOURCE_GET_ARGS.mdoc b/core/deps/libzip/man/ZIP_SOURCE_GET_ARGS.mdoc new file mode 100644 index 000000000..2735964e1 --- /dev/null +++ b/core/deps/libzip/man/ZIP_SOURCE_GET_ARGS.mdoc @@ -0,0 +1,79 @@ +.\" ZIP_SOURCE_GET_ARGS -- validate and cast arguments to source callback +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_GET_ARGS 3 +.Os +.Sh NAME +.Nm ZIP_SOURCE_GET_ARGS +.Nd validate and cast arguments to source callback +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft type * +.Fn ZIP_SOURCE_GET_ARGS "type" "void *data" "zip_uint64_t len" "zip_error_t *error" +.Sh DESCRIPTION +The +.Fn ZIP_SOURCE_GET_ARGS +macro casts +.Ar data +to a pointer to +.Ar type . +.Sh RETURN VALUES +On success, +.Fn ZIP_SOURCE_GET_ARGS +returns +.Ar data . +In case of error, it returns +.Dv NULL +and sets +.Ar error . +.Sh ERRORS +.Fn ZIP_SOURCE_GET_ARGS +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +.Ar len +is less than the size of +.Ar type +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source_function 3 +.Sh HISTORY +.Fn ZIP_SOURCE_GET_ARGS +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/fix-man-links.sh b/core/deps/libzip/man/fix-man-links.sh new file mode 100644 index 000000000..53b7b0766 --- /dev/null +++ b/core/deps/libzip/man/fix-man-links.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +# +LINKBASE='http://pubs.opengroup.org/onlinepubs/9699919799/functions/' + +sed -E -e 's,(),\1'"$LINKBASE"'\2\3,g' -e "s,$LINKBASE"'(libzip|zip),\1,g' diff --git a/core/deps/libzip/man/handle_links b/core/deps/libzip/man/handle_links new file mode 100644 index 000000000..7c2ed37d3 --- /dev/null +++ b/core/deps/libzip/man/handle_links @@ -0,0 +1,74 @@ +#!/usr/bin/env perl + +use strict; + +my $operation = shift @ARGV; + +if ($operation !~ m/^(install|uninstall)$/) { + print STDERR "$0: unknown operation $operation\n"; + exit(1); +} + +my %options = (); + +for my $arg (@ARGV) { + if ($arg =~ m/([^=]*)=(.*)/) { + $options{$1} = $2; + } + else { + print STDERR "$0: can't parse option [$arg]\n"; + exit(1); + } +} + +for my $option (qw(command directory extension file)) { + unless (defined($options{$option})) { + print STDERR "$0: required variable $option not provided\n"; + exit(1); + } +} + +my $fh; +unless (open $fh, '<', $options{file}) { + print STDERR "$0: can't open links file '$options{file}': $!"; + exit(1); +} + +my @cmd = split /\s+/, $options{command}; + +while (my $line = <$fh>) { + chomp $line; + my @args = split /\s+/, $line; + + process(@args); +} + +sub process { + my ($source, @destinations) = @_; + + my @args = (@cmd); + + if ($operation eq 'install') { + push @args, "$options{directory}/$source.$options{extension}"; + } + + for my $destination (@destinations) { + push @args, "$options{directory}/$destination.$options{extension}"; + run_command(@args); + pop @args; + } +} + +sub run_command { + print (join ' ', @_); + print "\n"; + + my $ret = system(@_); + + if ($ret != 0) { + print STDERR "$0: command failed: $?\n"; + exit(1); + } + + return 1; +} diff --git a/core/deps/libzip/man/libzip.html b/core/deps/libzip/man/libzip.html new file mode 100644 index 000000000..bda14619d --- /dev/null +++ b/core/deps/libzip/man/libzip.html @@ -0,0 +1,265 @@ + + + + + + + LIBZIP(3) + + + + + + + + +
LIBZIP(3)Library Functions ManualLIBZIP(3)
+
+
+

+libzip — +
library for manipulating zip archives
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +
+
+

+libzip is a library for reading, creating, and modifying + zip archives. +

The main design criteria for libzip + were:

+
    +
  • Do not create corrupt files, even in case of errors.
  • +
  • Do not delete data.
  • +
  • Be efficient.
  • +
+

For this reason, when modifying zip archives, + libzip writes to a temporary file and replaces the + original zip archive atomically.

+

Below there are two sections listing functions: one for how to + read from zip archives and one for how to create/modify them.

+
+

+In general, different zip archives opened by libzip are + independent of each other and can be used by parallel-running threads without + locking. If you want to use an archive from multiple threads, you have to + synchronize access to it yourself. If you use an archive as a source for + zip_file_add(3) or + zip_file_replace(3), access to + the target archive must be synchronized with access to the source archive as + well. +
+
+
+

+
+

+ +
+
+

+ +
+
+

+ +
+
+

+ +
+
+

+ +
+
+
+

+
+

+ +
+
+

+ +
+
+

+ +
+
+

+ +
+
+

+ +
+
+

+ +
+
+

+ +
+
+

+ +
+
+
+

+ +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
September 15, 2020NiH
+ + diff --git a/core/deps/libzip/man/libzip.man b/core/deps/libzip/man/libzip.man new file mode 100644 index 000000000..aa12a9d68 --- /dev/null +++ b/core/deps/libzip/man/libzip.man @@ -0,0 +1,319 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" libzip.mdoc -- general overview of available functions +.\" Copyright (C) 2005-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "LIBZIP" "3" "September 15, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBlibzip\fR +\- library for manipulating zip archives +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.SH "DESCRIPTION" +\fBlibzip\fR +is a library for reading, creating, and modifying zip archives. +.PP +The main design criteria for +\fBlibzip\fR +were: +.PD 0 +.TP 4n +\fB\(bu\fR +Do not create corrupt files, even in case of errors. +.TP 4n +\fB\(bu\fR +Do not delete data. +.TP 4n +\fB\(bu\fR +Be efficient. +.PD +.PP +For this reason, when modifying zip archives, +\fBlibzip\fR +writes to a temporary file and replaces the original +zip archive atomically. +.PP +Below there are two sections listing functions: one for how to read +from zip archives and one for how to create/modify them. +.SS "THREAD SAFETY" +In general, different zip archives opened by +\fBlibzip\fR +are independent of each other and can be used by parallel-running +threads without locking. +If you want to use an archive from multiple threads, you have to +synchronize access to it yourself. +If you use an archive as a source for +zip_file_add(3) +or +zip_file_replace(3), +access to the target archive must be synchronized with access to the +source archive as well. +.SH "READING ZIP ARCHIVES" +.SS "open archive" +.TP 4n +\fB\(bu\fR +zip_open(3) +.PD 0 +.TP 4n +\fB\(bu\fR +zip_fdopen(3) +.PD +.SS "find files" +.TP 4n +\fB\(bu\fR +zip_name_locate(3) +.SS "read files" +.TP 4n +\fB\(bu\fR +zip_fopen(3) +.PD 0 +.TP 4n +\fB\(bu\fR +zip_fopen_encrypted(3) +.TP 4n +\fB\(bu\fR +zip_fopen_index(3) +.TP 4n +\fB\(bu\fR +zip_fopen_index_encrypted(3) +.TP 4n +\fB\(bu\fR +zip_fread(3) +.TP 4n +\fB\(bu\fR +zip_fseek(3) +(uncompressed files only) +.TP 4n +\fB\(bu\fR +zip_ftell(3) +(uncompressed files only) +.TP 4n +\fB\(bu\fR +zip_fclose(3) +.PD +.SS "close archive" +.TP 4n +\fB\(bu\fR +zip_close(3) +.SS "miscellaneous" +.TP 4n +\fB\(bu\fR +zip_stat(3) +.PD 0 +.TP 4n +\fB\(bu\fR +zip_compression_method_supported(3) +.TP 4n +\fB\(bu\fR +zip_encryption_method_supported(3) +.TP 4n +\fB\(bu\fR +zip_file_get_comment(3) +.TP 4n +\fB\(bu\fR +zip_file_get_external_attributes(3) +.TP 4n +\fB\(bu\fR +zip_get_archive_comment(3) +.TP 4n +\fB\(bu\fR +zip_get_archive_flag(3) +.TP 4n +\fB\(bu\fR +zip_get_name(3) +.TP 4n +\fB\(bu\fR +zip_get_num_entries(3) +.TP 4n +\fB\(bu\fR +zip_set_default_password(3) +.PD +.SH "CREATING/MODIFYING ZIP ARCHIVES" +.SS "create/open archive" +.TP 4n +\fB\(bu\fR +zip_open(3) +.SS "add/change files and directories" +.TP 4n +\fB\(bu\fR +zip_dir_add(3) +.PD 0 +.TP 4n +\fB\(bu\fR +zip_file_add(3) +.TP 4n +\fB\(bu\fR +zip_file_replace(3) +.TP 4n +\fB\(bu\fR +zip_file_set_comment(3) +.TP 4n +\fB\(bu\fR +zip_file_set_dostime(3) +.TP 4n +\fB\(bu\fR +zip_file_set_external_attributes(3) +.TP 4n +\fB\(bu\fR +zip_file_set_encryption(3) +.TP 4n +\fB\(bu\fR +zip_file_set_mtime(3) +.TP 4n +\fB\(bu\fR +zip_set_file_compression(3) +.TP 4n +\fB\(bu\fR +zip_source_buffer(3) +.TP 4n +\fB\(bu\fR +zip_source_file(3) +.TP 4n +\fB\(bu\fR +zip_source_filep(3) +.TP 4n +\fB\(bu\fR +zip_source_free(3) +.TP 4n +\fB\(bu\fR +zip_source_function(3) +.TP 4n +\fB\(bu\fR +zip_source_zip(3) +.PD +.SS "rename files" +.TP 4n +\fB\(bu\fR +zip_rename(3) +.SS "delete files" +.TP 4n +\fB\(bu\fR +zip_delete(3) +.SS "revert changes" +.TP 4n +\fB\(bu\fR +zip_unchange(3) +.PD 0 +.TP 4n +\fB\(bu\fR +zip_unchange_all(3) +.TP 4n +\fB\(bu\fR +zip_unchange_archive(3) +.PD +.SS "read/modify extra fields" +.TP 4n +\fB\(bu\fR +zip_file_extra_field_by_id(3) +.PD 0 +.TP 4n +\fB\(bu\fR +zip_file_extra_field_delete(3) +.TP 4n +\fB\(bu\fR +zip_file_extra_field_delete_by_id(3) +.TP 4n +\fB\(bu\fR +zip_file_extra_field_get(3) +.TP 4n +\fB\(bu\fR +zip_file_extra_field_set(3) +.TP 4n +\fB\(bu\fR +zip_file_extra_fields_count(3) +.TP 4n +\fB\(bu\fR +zip_file_extra_fields_count_by_id(3) +.PD +.SS "close archive (writing)" +.TP 4n +\fB\(bu\fR +zip_close(3) +.PD 0 +.TP 4n +\fB\(bu\fR +zip_discard(3) +.PD +.SS "miscellaneous (writing)" +.TP 4n +\fB\(bu\fR +zip_file_attributes_init(3) +.PD 0 +.TP 4n +\fB\(bu\fR +zip_libzip_version(3) +.TP 4n +\fB\(bu\fR +zip_register_progress_callback_with_state(3) +.TP 4n +\fB\(bu\fR +zip_set_archive_comment(3) +.TP 4n +\fB\(bu\fR +zip_set_archive_flag(3) +.TP 4n +\fB\(bu\fR +zip_source(3) +.PD +.SH "ERROR HANDLING" +.TP 4n +\fB\(bu\fR +zip_error_strerror(3) +.PD 0 +.TP 4n +\fB\(bu\fR +zip_strerror(3) +.TP 4n +\fB\(bu\fR +zip_file_strerror(3) +.TP 4n +\fB\(bu\fR +zip_file_get_error(3) +.TP 4n +\fB\(bu\fR +zip_get_error(3) +.TP 4n +\fB\(bu\fR +zip_error_init_with_code(3) +.TP 4n +\fB\(bu\fR +zip_error_system_type(3) +.TP 4n +\fB\(bu\fR +zip_errors(3) +.PD +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/libzip.mdoc b/core/deps/libzip/man/libzip.mdoc new file mode 100644 index 000000000..b3ade6bb3 --- /dev/null +++ b/core/deps/libzip/man/libzip.mdoc @@ -0,0 +1,260 @@ +.\" libzip.mdoc -- general overview of available functions +.\" Copyright (C) 2005-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 15, 2020 +.Dt LIBZIP 3 +.Os +.Sh NAME +.Nm libzip +.Nd library for manipulating zip archives +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Sh DESCRIPTION +.Nm +is a library for reading, creating, and modifying zip archives. +.Pp +The main design criteria for +.Nm +were: +.Bl -bullet -compact +.It +Do not create corrupt files, even in case of errors. +.It +Do not delete data. +.It +Be efficient. +.El +.Pp +For this reason, when modifying zip archives, +.Nm +writes to a temporary file and replaces the original +zip archive atomically. +.Pp +Below there are two sections listing functions: one for how to read +from zip archives and one for how to create/modify them. +.Ss THREAD SAFETY +In general, different zip archives opened by +.Nm +are independent of each other and can be used by parallel-running +threads without locking. +If you want to use an archive from multiple threads, you have to +synchronize access to it yourself. +If you use an archive as a source for +.Xr zip_file_add 3 +or +.Xr zip_file_replace 3 , +access to the target archive must be synchronized with access to the +source archive as well. +.Sh READING ZIP ARCHIVES +.Ss open archive +.Bl -bullet -compact +.It +.Xr zip_open 3 +.It +.Xr zip_fdopen 3 +.El +.Ss find files +.Bl -bullet -compact +.It +.Xr zip_name_locate 3 +.El +.Ss read files +.Bl -bullet -compact +.It +.Xr zip_fopen 3 +.It +.Xr zip_fopen_encrypted 3 +.It +.Xr zip_fopen_index 3 +.It +.Xr zip_fopen_index_encrypted 3 +.It +.Xr zip_fread 3 +.It +.Xr zip_fseek 3 +(uncompressed files only) +.It +.Xr zip_ftell 3 +(uncompressed files only) +.It +.Xr zip_fclose 3 +.El +.Ss close archive +.Bl -bullet -compact +.It +.Xr zip_close 3 +.El +.Ss miscellaneous +.Bl -bullet -compact +.It +.Xr zip_stat 3 +.It +.Xr zip_compression_method_supported 3 +.It +.Xr zip_encryption_method_supported 3 +.It +.Xr zip_file_get_comment 3 +.It +.Xr zip_file_get_external_attributes 3 +.It +.Xr zip_get_archive_comment 3 +.It +.Xr zip_get_archive_flag 3 +.It +.Xr zip_get_name 3 +.It +.Xr zip_get_num_entries 3 +.It +.Xr zip_set_default_password 3 +.El +.Sh CREATING/MODIFYING ZIP ARCHIVES +.Ss create/open archive +.Bl -bullet -compact +.It +.Xr zip_open 3 +.El +.Ss add/change files and directories +.Bl -bullet -compact +.It +.Xr zip_dir_add 3 +.It +.Xr zip_file_add 3 +.It +.Xr zip_file_replace 3 +.It +.Xr zip_file_set_comment 3 +.It +.Xr zip_file_set_dostime 3 +.It +.Xr zip_file_set_external_attributes 3 +.It +.Xr zip_file_set_encryption 3 +.It +.Xr zip_file_set_mtime 3 +.It +.Xr zip_set_file_compression 3 +.It +.Xr zip_source_buffer 3 +.It +.Xr zip_source_file 3 +.It +.Xr zip_source_filep 3 +.It +.Xr zip_source_free 3 +.It +.Xr zip_source_function 3 +.It +.Xr zip_source_zip 3 +.El +.Ss rename files +.Bl -bullet -compact +.It +.Xr zip_rename 3 +.El +.Ss delete files +.Bl -bullet -compact +.It +.Xr zip_delete 3 +.El +.Ss revert changes +.Bl -bullet -compact +.It +.Xr zip_unchange 3 +.It +.Xr zip_unchange_all 3 +.It +.Xr zip_unchange_archive 3 +.El +.Ss read/modify extra fields +.Bl -bullet -compact +.It +.Xr zip_file_extra_field_by_id 3 +.It +.Xr zip_file_extra_field_delete 3 +.It +.Xr zip_file_extra_field_delete_by_id 3 +.It +.Xr zip_file_extra_field_get 3 +.It +.Xr zip_file_extra_field_set 3 +.It +.Xr zip_file_extra_fields_count 3 +.It +.Xr zip_file_extra_fields_count_by_id 3 +.El +.Ss close archive (writing) +.Bl -bullet -compact +.It +.Xr zip_close 3 +.It +.Xr zip_discard 3 +.El +.Ss miscellaneous (writing) +.Bl -bullet -compact +.It +.Xr zip_file_attributes_init 3 +.It +.Xr zip_libzip_version 3 +.It +.Xr zip_register_progress_callback_with_state 3 +.It +.Xr zip_set_archive_comment 3 +.It +.Xr zip_set_archive_flag 3 +.It +.Xr zip_source 3 +.El +.Sh ERROR HANDLING +.Bl -bullet -compact +.It +.Xr zip_error_strerror 3 +.It +.Xr zip_strerror 3 +.It +.Xr zip_file_strerror 3 +.It +.Xr zip_file_get_error 3 +.It +.Xr zip_get_error 3 +.It +.Xr zip_error_init_with_code 3 +.It +.Xr zip_error_system_type 3 +.It +.Xr zip_errors 3 +.El +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/links b/core/deps/libzip/man/links new file mode 100644 index 000000000..807dd49be --- /dev/null +++ b/core/deps/libzip/man/links @@ -0,0 +1,23 @@ +zip_add zip_replace +zip_error_clear zip_file_error_clear +zip_error_get zip_file_error_get +zip_error_init zip_error_init_with_code +zip_file_add zip_file_replace +zip_file_extra_field_delete zip_file_extra_field_delete_by_id +zip_file_extra_field_get zip_file_extra_field_get_by_id +zip_file_extra_fields_count zip_file_extra_fields_count_by_id +zip_file_set_mtime zip_file_set_dostime +zip_file_strerror zip_strerror +zip_fopen zip_fopen_index +zip_fopen_encrypted zip_fopen_index_encrypted +zip_open zip_open_from_source +zip_source_begin_write zip_source_begin_write_cloning +zip_source_buffer zip_source_buffer_create +zip_source_buffer_fragment zip_source_buffer_fragment_create +zip_source_file zip_source_file_create +zip_source_filep zip_source_filep_create +zip_source_function zip_source_function_create +zip_source_win32a zip_source_win32a_create +zip_source_win32handle zip_source_win32handle_create +zip_source_win32w zip_source_win32w_create +zip_stat zip_stat_index diff --git a/core/deps/libzip/man/make_zip_errors.sh b/core/deps/libzip/man/make_zip_errors.sh new file mode 100644 index 000000000..6533cf581 --- /dev/null +++ b/core/deps/libzip/man/make_zip_errors.sh @@ -0,0 +1,114 @@ +#!/bin/sh + +# make_zip_errrors.sh: create zip_errors.mdoc from zip.h +# Copyright (C) 1999-2013 Dieter Baron and Thomas Klausner +# +# This file is part of libzip, a library to manipulate ZIP archives. +# The authors can be contacted at +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. The names of the authors may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +if [ "$#" -ne 2 ] +then + echo "Usage: $0 in_file out_file" >&2 + echo " e.g. $0 zip.h zip_errors.mdoc" >&2 + exit 1 +fi + +if [ "$1" = "$2" ] +then + echo "$0: error: output file = input file" >&2 + exit 1 +fi + +date=`LC_TIME=en_US date '+%B %e, %Y' | sed 's/ / /'` + +cat <> "$2.$$" || exit 1 +.\" zip_errors.mdoc -- list of all libzip error codes +.\" Copyright (C) 1999-2013 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS \`\`AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" This file was generated automatically by $0 +.\" from $1; make changes there. +.\" +.Dd $date +.Dt ZIP_ERRORS 3 +.Os +.Sh NAME +.Nm zip_errors +.Nd list of all libzip error codes +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Sh DESCRIPTION +The following error codes are used by libzip: +.Bl -tag -width XZIPXERXCOMPNOTSUPPXX +EOF + +sed -n 's/^#define \(ZIP_ER_[A-Z_0-9]*\).*\/\* \(.\) \([^*]*\) \*\//.It Bq Er \1@\3./p' "$1" \ + | sort\ + | tr @ '\012' \ + >> "$2.$$" || exit 1 + +cat <> "$2.$$" || exit 1 +.El +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at +EOF + +mv "$2.$$" "$2" || exit 1 diff --git a/core/deps/libzip/man/mkdocset.pl b/core/deps/libzip/man/mkdocset.pl new file mode 100644 index 000000000..78be79b2f --- /dev/null +++ b/core/deps/libzip/man/mkdocset.pl @@ -0,0 +1,216 @@ +#!/usr/bin/env perl + +use strict; + +my $DOCSETUTIL = '/Applications/Xcode.app/Contents/Developer/usr/bin/docsetutil'; + +my $BASE_URL = 'http://nih.at/libzip'; +my $BUNDLE_ID = 'at.nih.libzip'; + +my $SRCDIR = $ENV{SRCDIR} // '.'; + +my @files = @ARGV; + +my $docset = 'at.nih.libzip.docset'; +my @sh_nodes = qw(zipcmp zipmerge ziptool); + +(system('rm', '-rf', $docset) == 0) or die "can't remove old version of docset: $!"; + +mkdir($docset) or die "can't create docset directory: $!"; +mkdir("$docset/Contents") or die "can't create docset directory: $!"; +mkdir("$docset/Contents/Resources") or die "can't create docset directory: $!"; +mkdir("$docset/Contents/Resources/Documents") or die "can't create docset directory: $!"; + +my $version = `sed -n 's/#define PACKAGE_VERSION "\\(.*\\)"/\\1/p' ../config.h`; +chomp $version; + +my $suffix = ''; +$suffix = '-hg' if ($version =~ /[a-z]$/); + +my $package_file = "$BUNDLE_ID-$version.xar"; +my $download_url = "$BASE_URL/$package_file"; +my $feed_url = "$BASE_URL/at.nih.libzip$suffix.atom"; + +open I, "> $docset/Contents/Info.plist" or die "can't create Info.plist: $!"; +print I < + + + + CFBundleIdentifier + $BUNDLE_ID.docset + CFBundleName + libzip + DocSetPublisherIdentifier + at.nih + DocSetPublisherName + NiH + NSHumanReadableCopyright + Copyright © 2016 Dieter Baron and Thomas Klausner + CFBundleVersion + $version + DocSetFeedURL + $feed_url + DocSetFeedName + libzip + + +EOF +close I; + +open N, "> $docset/Contents/Resources/Nodes.xml" or die "can't create Nodes.xml: $!"; + +my %tl_nodes = (libzip => 1); + +for (@sh_nodes) { + $tl_nodes{$_} = 1; +} + +my @tokens = (); + +print N < + + + + libzip package + + + Library + libzip.html + +EOF + + +my $id = 1001; + +for my $html (@files) { + my $name = $html; + $name =~ s/.html//; + + if ($tl_nodes{$name}) { + next; + } + + process_file($html, 'c', $id++); +} + +print N " \n"; +print N " \n"; +print N " \n"; +print N " Commands\n"; +print N " \n"; + +$id = 2; + +for my $name (@sh_nodes) { + process_file("$name.html", 'c', $id++); +} + +print N " \n"; +print N " \n"; +print N " \n"; +print N " \n"; +print N " \n"; +print N "\n"; + +close N; + +link("$SRCDIR/nih-man.css", "$docset/Contents/Resources/Documents/nih-man.css") or die "can't link css file: $!"; +copy_html('libzip.html', "$docset/Contents/Resources/Documents/libzip.html"); + +write_tokens(); + +system($DOCSETUTIL, 'index', $docset) == 0 or die "can't index docset: $!"; +system($DOCSETUTIL, 'validate', $docset) == 0 or die "can't validate docset: $!"; + +unlink("$docset/Contents/Resources/Nodes.xml"); +unlink("$docset/Contents/Resources/Tokens.xml"); + +system($DOCSETUTIL, 'package', '-output', "at.nih.libzip-$version.xar", '-atom', "at.nih.libzip$suffix.atom", '-download-url', "$BASE_URL/at.nih.libzip-$version.xar", $docset); + + +sub copy_html { + my ($src, $dst) = @_; + + my $content = `cat $src`; + $content =~ s,,,; + $content =~ s,../nih-man.css,nih-man.css,; + + # remove header and footer + $content =~ s,]*class="(heade?r?|foote?r?)".*?,,sg; + + $content =~ s,(
$dst" or die "can't create $dst: $!"; + print X $content; + close X; +} + +sub process_file { + my ($html, $lang, $id) = @_; + + my $name = $html; + $name =~ s/.html//; + my $mdoc = "$SRCDIR/$name.mdoc"; + + my $description; + my @names = (); + + open MD, "< $mdoc" or die "can't open $mdoc: $!"; + + while (my $line = ) { + if ($line =~ m/^.Nm (.*?)( ,)?$/) { + push @names, $1; + } + elsif ($line =~ m/^.Nd (.*)/) { + $description = $1; + } + elsif ($line =~ m/^.Sh SYNOPSIS/) { + last; + } + } + + close MD; + + print N " \n"; + print N " $name\n"; + print N " $html\n"; + print N " \n"; + + for my $name (@names) { + push @tokens, { type => "//apple_ref/$lang/func", + path => $html, + name => $name, + description => $description, + id => $id }; + } + + copy_html($html, "$docset/Contents/Resources/Documents/$html"); +} + +sub write_token { + my ($T, $token) = @_; + + print $T " \n"; + print $T " $token->{type}/$token->{name}\n"; + print $T " $token->{path}\n"; + print $T " $token->{description}\n"; + print $T " {id}\" />\n"; + print $T " \n"; +} + +sub write_tokens { + open my $T, "> $docset/Contents/Resources/Tokens.xml" or die "can't create Tokens.xml: $!"; + print $T "\n"; + print $T "\n"; + + for my $token (sort { $a->{name} cmp $b->{name} } @tokens) { + write_token($T, $token); + } + + print $T "\n"; + + close $T; +} diff --git a/core/deps/libzip/man/nih-man.css b/core/deps/libzip/man/nih-man.css new file mode 100644 index 000000000..efabb035b --- /dev/null +++ b/core/deps/libzip/man/nih-man.css @@ -0,0 +1,61 @@ +div.lit { + font-family: monospace; +} +div.sec-head, div.ssec-head, h1, h2 { + padding: 4pt; + border: solid; + border-width: 1px; + border-color: #555555; + background: #aaaaaa; + font-weight: bold; +} +div.sec-head, h1 { + font-size: large; +} +h2 { + font-size: medium; +} +div.sec-body, div.ssec-body { + margin-top: 1em; +} +span.arg { + font-style: italic; +} +span.define { +} +span.emph { +} +span.errno { +} +span.farg { + font-style: italic; +} +span.fname { + font-weight: bold; +} +span.ftype { + font-style: italic; +} +span.includes { + font-weight: bold; +} +span.name { + font-weight: bold; +} + +/* copied from nih's style.css */ +body { + background: #cccccc; +} +a { + text-decoration: none; +} +a:link { + color: #555555; +} +a:visited { + color: #666666; +} +a:hover { + color: #777777; +} diff --git a/core/deps/libzip/man/update-html.cmake b/core/deps/libzip/man/update-html.cmake new file mode 100644 index 000000000..82cacce35 --- /dev/null +++ b/core/deps/libzip/man/update-html.cmake @@ -0,0 +1,12 @@ +# expect variables IN, OUT, and DIR +EXECUTE_PROCESS(COMMAND mandoc -T html -Oman=%N.html,style=../nih-man.css ${DIR}/${IN} + OUTPUT_VARIABLE HTML) +SET(LINKBASE "http://pubs.opengroup.org/onlinepubs/9699919799/functions/") +STRING(REGEX REPLACE "()" "\\1${LINKBASE}\\2\\3" HTML "${HTML}") +STRING(REGEX REPLACE "${LINKBASE}(libzip|zip)" "\\1" HTML "${HTML}") +STRING(REGEX REPLACE "NetBSD [0-9.]*" "NiH" HTML "${HTML}") +FILE(WRITE ${DIR}/${OUT}.new "${HTML}") +CONFIGURE_FILE(${DIR}/${OUT}.new ${DIR}/${OUT} COPYONLY) +FILE(REMOVE ${DIR}/${OUT}.new) + + diff --git a/core/deps/libzip/man/update-man.cmake b/core/deps/libzip/man/update-man.cmake new file mode 100644 index 000000000..425471143 --- /dev/null +++ b/core/deps/libzip/man/update-man.cmake @@ -0,0 +1,7 @@ +# expect variables IN, OUT, and DIR +EXECUTE_PROCESS(COMMAND mandoc -T man ${DIR}/${IN} OUTPUT_VARIABLE MAN) +STRING(REGEX REPLACE "NetBSD [0-9.]*" "NiH" MAN "${MAN}") +FILE(WRITE ${DIR}/${OUT}.new "${MAN}") +CONFIGURE_FILE(${DIR}/${OUT}.new ${DIR}/${OUT} COPYONLY) +FILE(REMOVE ${DIR}/${OUT}.new) + diff --git a/core/deps/libzip/man/zip_add.html b/core/deps/libzip/man/zip_add.html new file mode 100644 index 000000000..511d0d303 --- /dev/null +++ b/core/deps/libzip/man/zip_add.html @@ -0,0 +1,121 @@ + + + + + + + ZIP_ADD(3) + + + + + + + + +
ZIP_ADD(3)Library Functions ManualZIP_ADD(3)
+
+
+

+zip_add, zip_replace — +
add file to zip archive or replace file in zip archive (obsolete + interface)
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int64_t +
+ zip_add(zip_t + *archive, const char + *name, zip_source_t + *source);

+

int +
+ zip_replace(zip_t + *archive, zip_uint64_t + index, zip_source_t + *source);

+
+
+

+The function zip_add() is the obsolete version of + zip_file_add(3). It is the same as + calling zip_file_add(3) with an + empty flags argument. Similarly, the + zip_replace() function is the obsolete version of + zip_file_replace(3). It is the + same as calling + zip_file_replace(3) with an + empty flags argument. +
+
+

+libzip(3), + zip_file_add(3), + zip_file_replace(3) +
+
+

+zip_add() was added in libzip 0.6. In libzip 0.10 the + return type was changed from int to + zip_int64_t. It was deprecated in libzip 0.11, use + zip_file_add() instead. +

zip_replace() was added in libzip 0.6. In + libzip 0.10 the type of index was changed from + int to zip_uint64_t. It was + deprecated in libzip 0.11, use zip_file_replace() + instead.

+
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_add.man b/core/deps/libzip/man/zip_add.man new file mode 100644 index 000000000..451645f41 --- /dev/null +++ b/core/deps/libzip/man/zip_add.man @@ -0,0 +1,106 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_add.mdoc -- add files to zip archive +.\" Copyright (C) 2004-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_ADD" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_add\fR, +\fBzip_replace\fR +\- add file to zip archive or replace file in zip archive (obsolete interface) +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int64_t\fR +.br +.PD 0 +.HP 4n +\fBzip_add\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *name\fR, \fIzip_source_t\ *source\fR); +.PD +.PP +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_replace\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_source_t\ *source\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_add\fR() +is the obsolete version of +zip_file_add(3). +It is the same as calling +zip_file_add(3) +with an empty +\fIflags\fR +argument. +Similarly, the +\fBzip_replace\fR() +function is the obsolete version of +zip_file_replace(3). +It is the same as calling +zip_file_replace(3) +with an empty +\fIflags\fR +argument. +.SH "SEE ALSO" +libzip(3), +zip_file_add(3), +zip_file_replace(3) +.SH "HISTORY" +\fBzip_add\fR() +was added in libzip 0.6. +In libzip 0.10 the return type was changed from +\fIint\fR +to +\fIzip_int64_t\fR. +It was deprecated in libzip 0.11, use +\fBzip_file_add\fR() +instead. +.PP +\fBzip_replace\fR() +was added in libzip 0.6. +In libzip 0.10 the type of +\fIindex\fR +was changed from +\fIint\fR +to +\fIzip_uint64_t\fR. +It was deprecated in libzip 0.11, use +\fBzip_file_replace\fR() +instead. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_add.mdoc b/core/deps/libzip/man/zip_add.mdoc new file mode 100644 index 000000000..27c531901 --- /dev/null +++ b/core/deps/libzip/man/zip_add.mdoc @@ -0,0 +1,96 @@ +.\" zip_add.mdoc -- add files to zip archive +.\" Copyright (C) 2004-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_ADD 3 +.Os +.Sh NAME +.Nm zip_add , +.Nm zip_replace +.Nd add file to zip archive or replace file in zip archive (obsolete interface) +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int64_t +.Fn zip_add "zip_t *archive" "const char *name" "zip_source_t *source" +.Ft int +.Fn zip_replace "zip_t *archive" "zip_uint64_t index" "zip_source_t *source" +.Sh DESCRIPTION +The function +.Fn zip_add +is the obsolete version of +.Xr zip_file_add 3 . +It is the same as calling +.Xr zip_file_add 3 +with an empty +.Ar flags +argument. +Similarly, the +.Fn zip_replace +function is the obsolete version of +.Xr zip_file_replace 3 . +It is the same as calling +.Xr zip_file_replace 3 +with an empty +.Ar flags +argument. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_add 3 , +.Xr zip_file_replace 3 +.Sh HISTORY +.Fn zip_add +was added in libzip 0.6. +In libzip 0.10 the return type was changed from +.Vt int +to +.Vt zip_int64_t . +It was deprecated in libzip 0.11, use +.Fn zip_file_add +instead. +.Pp +.Fn zip_replace +was added in libzip 0.6. +In libzip 0.10 the type of +.Ar index +was changed from +.Vt int +to +.Vt zip_uint64_t . +It was deprecated in libzip 0.11, use +.Fn zip_file_replace +instead. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_add_dir.html b/core/deps/libzip/man/zip_add_dir.html new file mode 100644 index 000000000..2025c289d --- /dev/null +++ b/core/deps/libzip/man/zip_add_dir.html @@ -0,0 +1,102 @@ + + + + + + + ZIP_ADD_DIR(3) + + + + + + + + +
ZIP_ADD_DIR(3)Library Functions ManualZIP_ADD_DIR(3)
+
+
+

+zip_add_dir — +
add directory to zip archive (obsolete interface)
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int64_t +
+ zip_add_dir(zip_t + *archive, const char + *name);

+
+
+

+The function zip_add_dir() is the obsolete version of + zip_dir_add(3). It is the same as + calling zip_dir_add(3) with an empty + flags argument. +
+
+

+libzip(3), + zip_dir_add(3) +
+
+

+zip_add_dir() was added in libzip 0.8. In libzip 0.10 + the return type was changed from int to + zip_int64_t. It was deprecated in libzip 0.11, use + zip_dir_add() instead. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_add_dir.man b/core/deps/libzip/man/zip_add_dir.man new file mode 100644 index 000000000..90f313d3f --- /dev/null +++ b/core/deps/libzip/man/zip_add_dir.man @@ -0,0 +1,74 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_add_dir.mdoc -- add directory to zip archive +.\" Copyright (C) 2006-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_ADD_DIR" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_add_dir\fR +\- add directory to zip archive (obsolete interface) +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int64_t\fR +.br +.PD 0 +.HP 4n +\fBzip_add_dir\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *name\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_add_dir\fR() +is the obsolete version of +zip_dir_add(3). +It is the same as calling +zip_dir_add(3) +with an empty flags argument. +.SH "SEE ALSO" +libzip(3), +zip_dir_add(3) +.SH "HISTORY" +\fBzip_add_dir\fR() +was added in libzip 0.8. +In libzip 0.10 the return type was changed from +\fIint\fR +to +\fIzip_int64_t\fR. +It was deprecated in libzip 0.11, use +\fBzip_dir_add\fR() +instead. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_add_dir.mdoc b/core/deps/libzip/man/zip_add_dir.mdoc new file mode 100644 index 000000000..f28d1d5b3 --- /dev/null +++ b/core/deps/libzip/man/zip_add_dir.mdoc @@ -0,0 +1,69 @@ +.\" zip_add_dir.mdoc -- add directory to zip archive +.\" Copyright (C) 2006-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_ADD_DIR 3 +.Os +.Sh NAME +.Nm zip_add_dir +.Nd add directory to zip archive (obsolete interface) +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int64_t +.Fn zip_add_dir "zip_t *archive" "const char *name" +.Sh DESCRIPTION +The function +.Fn zip_add_dir +is the obsolete version of +.Xr zip_dir_add 3 . +It is the same as calling +.Xr zip_dir_add 3 +with an empty flags argument. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_dir_add 3 +.Sh HISTORY +.Fn zip_add_dir +was added in libzip 0.8. +In libzip 0.10 the return type was changed from +.Vt int +to +.Vt zip_int64_t . +It was deprecated in libzip 0.11, use +.Fn zip_dir_add +instead. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_close.html b/core/deps/libzip/man/zip_close.html new file mode 100644 index 000000000..d8c185895 --- /dev/null +++ b/core/deps/libzip/man/zip_close.html @@ -0,0 +1,145 @@ + + + + + + + ZIP_CLOSE(3) + + + + + + + + +
ZIP_CLOSE(3)Library Functions ManualZIP_CLOSE(3)
+
+
+

+zip_close — +
close zip archive
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_close(zip_t + *archive);

+
+
+

+The zip_close() function writes any changes made to + archive to disk. If archive + contains no files, the file is completely removed (no empty archive is + written). If successful, archive is freed. Otherwise + archive is left unchanged and must still be freed. +

To close and free a zip archive without saving changes, use + zip_discard(3).

+
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error code in archive is set to indicate the error. +
+
+

+zip_close() will fail if: +
+
[]
+
Unexpected end-of-file found while reading from a file.
+
[]
+
The callback function of an added or replaced file returned an error but + failed to report which.
+
[]
+
The path argument is + NULL.
+
[]
+
Required memory could not be allocated.
+
[]
+
File is not a zip archive.
+
[]
+
A file read failed.
+
[]
+
A temporary file could not be renamed to its final name.
+
[]
+
A file seek failed.
+
[]
+
A temporary file could not be created.
+
[]
+
A file write failed.
+
[]
+
An error occurred while (de)compressing a stream with + zlib(3).
+
+Additionally, any errors returned by the callback function for added or replaced + files will be passed back. +
+
+

+libzip(3), + zip_discard(3), + zip_fdopen(3), + zip_get_error(3), + zip_open(3), + zip_register_progress_callback_with_state(3), + zip_strerror(3) +
+
+

+zip_close() was added in libzip 0.6. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
September 17, 2019NiH
+ + diff --git a/core/deps/libzip/man/zip_close.man b/core/deps/libzip/man/zip_close.man new file mode 100644 index 000000000..a5264eb09 --- /dev/null +++ b/core/deps/libzip/man/zip_close.man @@ -0,0 +1,134 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_close.mdoc -- close zip archive +.\" Copyright (C) 2003-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_CLOSE" "3" "September 17, 2019" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_close\fR +\- close zip archive +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_close\fR(\fIzip_t\ *archive\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_close\fR() +function writes any changes made to +\fIarchive\fR +to disk. +If +\fIarchive\fR +contains no files, the file is completely removed (no empty archive is +written). +If successful, +\fIarchive\fR +is freed. +Otherwise +\fIarchive\fR +is left unchanged and must still be freed. +.PP +To close and free a zip archive without saving changes, use +zip_discard(3). +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_close\fR() +will fail if: +.TP 19n +[\fRZIP_ER_EOF\fR] +Unexpected end-of-file found while reading from a file. +.TP 19n +[\fRZIP_ER_INTERNAL\fR] +The callback function of an added or replaced file returned an +error but failed to report which. +.TP 19n +[\fRZIP_ER_INVAL\fR] +The +\fIpath\fR +argument is +\fRNULL\fR. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.TP 19n +[\fRZIP_ER_NOZIP\fR] +File is not a zip archive. +.TP 19n +[\fRZIP_ER_READ\fR] +A file read failed. +.TP 19n +[\fRZIP_ER_RENAME\fR] +A temporary file could not be renamed to its final name. +.TP 19n +[\fRZIP_ER_SEEK\fR] +A file seek failed. +.TP 19n +[\fRZIP_ER_TMPOPEN\fR] +A temporary file could not be created. +.TP 19n +[\fRZIP_ER_WRITE\fR] +A file write failed. +.TP 19n +[\fRZIP_ER_ZLIB\fR] +An error occurred while (de)compressing a stream with +zlib(3). +.PD 0 +.PP +Additionally, any errors returned by the callback function +for added or replaced files will be passed back. +.PD +.SH "SEE ALSO" +libzip(3), +zip_discard(3), +zip_fdopen(3), +zip_get_error(3), +zip_open(3), +zip_register_progress_callback_with_state(3), +zip_strerror(3) +.SH "HISTORY" +\fBzip_close\fR() +was added in libzip 0.6. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_close.mdoc b/core/deps/libzip/man/zip_close.mdoc new file mode 100644 index 000000000..b5bfd216c --- /dev/null +++ b/core/deps/libzip/man/zip_close.mdoc @@ -0,0 +1,117 @@ +.\" zip_close.mdoc -- close zip archive +.\" Copyright (C) 2003-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 17, 2019 +.Dt ZIP_CLOSE 3 +.Os +.Sh NAME +.Nm zip_close +.Nd close zip archive +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_close "zip_t *archive" +.Sh DESCRIPTION +The +.Fn zip_close +function writes any changes made to +.Ar archive +to disk. +If +.Ar archive +contains no files, the file is completely removed (no empty archive is +written). +If successful, +.Ar archive +is freed. +Otherwise +.Ar archive +is left unchanged and must still be freed. +.Pp +To close and free a zip archive without saving changes, use +.Xr zip_discard 3 . +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_close +will fail if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_EOF +Unexpected end-of-file found while reading from a file. +.It Bq Er ZIP_ER_INTERNAL +The callback function of an added or replaced file returned an +error but failed to report which. +.It Bq Er ZIP_ER_INVAL +The +.Ar path +argument is +.Dv NULL . +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.It Bq Er ZIP_ER_NOZIP +File is not a zip archive. +.It Bq Er ZIP_ER_READ +A file read failed. +.It Bq Er ZIP_ER_RENAME +A temporary file could not be renamed to its final name. +.It Bq Er ZIP_ER_SEEK +A file seek failed. +.It Bq Er ZIP_ER_TMPOPEN +A temporary file could not be created. +.It Bq Er ZIP_ER_WRITE +A file write failed. +.It Bq Er ZIP_ER_ZLIB +An error occurred while (de)compressing a stream with +.Xr zlib 3 . +.El +Additionally, any errors returned by the callback function +for added or replaced files will be passed back. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_discard 3 , +.Xr zip_fdopen 3 , +.Xr zip_get_error 3 , +.Xr zip_open 3 , +.Xr zip_register_progress_callback_with_state 3 , +.Xr zip_strerror 3 +.Sh HISTORY +.Fn zip_close +was added in libzip 0.6. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_compression_method_supported.html b/core/deps/libzip/man/zip_compression_method_supported.html new file mode 100644 index 000000000..a0cfbfef3 --- /dev/null +++ b/core/deps/libzip/man/zip_compression_method_supported.html @@ -0,0 +1,105 @@ + + + + + + + ZIP_COMPRESSION_METHOD_SUPPORTED(3) + + + + + + + + +
ZIP_COMPRESSION_METHOD_SUPPORTED(3)Library Functions ManualZIP_COMPRESSION_METHOD_SUPPORTED(3)
+
+
+

+zip_compression_method_supported — +
return if a compression method is supported
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_compression_method_supported(zip_int32_t + method, int + compress);

+
+
+

+The zip_compression_method_supported() returns if the + compression method method is supported for compression + (if compress is zero) or decompression (otherwise). +
+
+

+Returns 1 if the method is supported, 0 otherwise. +
+
+

+libzip(3), + zip_encryption_method_supported(3), + zip_set_file_compression(3) +
+
+

+zip_compression_method_supported() was added in libzip + 1.7.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
April 2, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_compression_method_supported.man b/core/deps/libzip/man/zip_compression_method_supported.man new file mode 100644 index 000000000..44811f274 --- /dev/null +++ b/core/deps/libzip/man/zip_compression_method_supported.man @@ -0,0 +1,70 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_compression_method_supported.mdoc -- return if compression method is supported +.\" Copyright (C) 2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_COMPRESSION_METHOD_SUPPORTED" "3" "April 2, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_compression_method_supported\fR +\- return if a compression method is supported +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_compression_method_supported\fR(\fIzip_int32_t\ method\fR, \fIint\ compress\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_compression_method_supported\fR() +returns if the compression method +\fImethod\fR +is supported for compression (if +\fIcompress\fR +is zero) or decompression (otherwise). +.SH "RETURN VALUES" +Returns 1 if the method is supported, 0 otherwise. +.SH "SEE ALSO" +libzip(3), +zip_encryption_method_supported(3), +zip_set_file_compression(3) +.SH "HISTORY" +\fBzip_compression_method_supported\fR() +was added in libzip 1.7.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_compression_method_supported.mdoc b/core/deps/libzip/man/zip_compression_method_supported.mdoc new file mode 100644 index 000000000..b375a30b4 --- /dev/null +++ b/core/deps/libzip/man/zip_compression_method_supported.mdoc @@ -0,0 +1,65 @@ +.\" zip_compression_method_supported.mdoc -- return if compression method is supported +.\" Copyright (C) 2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd April 2, 2020 +.Dt ZIP_COMPRESSION_METHOD_SUPPORTED 3 +.Os +.Sh NAME +.Nm zip_compression_method_supported +.Nd return if a compression method is supported +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_compression_method_supported "zip_int32_t method" "int compress" +.Sh DESCRIPTION +The +.Fn zip_compression_method_supported +returns if the compression method +.Ar method +is supported for compression (if +.Ar compress +is zero) or decompression (otherwise). +.Sh RETURN VALUES +Returns 1 if the method is supported, 0 otherwise. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_encryption_method_supported 3 , +.Xr zip_set_file_compression 3 +.Sh HISTORY +.Fn zip_compression_method_supported +was added in libzip 1.7.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_delete.html b/core/deps/libzip/man/zip_delete.html new file mode 100644 index 000000000..fc2f69321 --- /dev/null +++ b/core/deps/libzip/man/zip_delete.html @@ -0,0 +1,114 @@ + + + + + + + ZIP_DELETE(3) + + + + + + + + +
ZIP_DELETE(3)Library Functions ManualZIP_DELETE(3)
+
+
+

+zip_delete — +
delete file from zip archive
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_delete(zip_t + *archive, zip_uint64_t + index);

+
+
+

+The file at position index in the zip archive + archive is marked as deleted. +
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error code in archive is set to indicate the error. +
+
+

+zip_delete() fails if: +
+
[]
+
index is not a valid file index in + archive.
+
+
+
+

+libzip(3), + zip_unchange(3) +
+
+

+zip_delete() was added in libzip 0.6. In libzip 0.10 the + type of index was changed from int + to zip_uint64_t. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_delete.man b/core/deps/libzip/man/zip_delete.man new file mode 100644 index 000000000..d607c1eae --- /dev/null +++ b/core/deps/libzip/man/zip_delete.man @@ -0,0 +1,84 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_delete.mdoc -- delete files from zip archive +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_DELETE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_delete\fR +\- delete file from zip archive +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_delete\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR); +.PD +.SH "DESCRIPTION" +The file at position +\fIindex\fR +in the zip archive +\fIarchive\fR +is marked as deleted. +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_delete\fR() +fails if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIindex\fR +is not a valid file index in +\fIarchive\fR. +.SH "SEE ALSO" +libzip(3), +zip_unchange(3) +.SH "HISTORY" +\fBzip_delete\fR() +was added in libzip 0.6. +In libzip 0.10 the type of +\fIindex\fR +was changed from +\fIint\fR +to +\fIzip_uint64_t\fR. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_delete.mdoc b/core/deps/libzip/man/zip_delete.mdoc new file mode 100644 index 000000000..dc8346e41 --- /dev/null +++ b/core/deps/libzip/man/zip_delete.mdoc @@ -0,0 +1,80 @@ +.\" zip_delete.mdoc -- delete files from zip archive +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_DELETE 3 +.Os +.Sh NAME +.Nm zip_delete +.Nd delete file from zip archive +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_delete "zip_t *archive" "zip_uint64_t index" +.Sh DESCRIPTION +The file at position +.Ar index +in the zip archive +.Ar archive +is marked as deleted. +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_delete +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +.Ar index +is not a valid file index in +.Ar archive . +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_unchange 3 +.Sh HISTORY +.Fn zip_delete +was added in libzip 0.6. +In libzip 0.10 the type of +.Ar index +was changed from +.Vt int +to +.Vt zip_uint64_t . +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_dir_add.html b/core/deps/libzip/man/zip_dir_add.html new file mode 100644 index 000000000..e297326be --- /dev/null +++ b/core/deps/libzip/man/zip_dir_add.html @@ -0,0 +1,134 @@ + + + + + + + ZIP_DIR_ADD(3) + + + + + + + + +
ZIP_DIR_ADD(3)Library Functions ManualZIP_DIR_ADD(3)
+
+
+

+zip_dir_add — +
add directory to zip archive
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int64_t +
+ zip_dir_add(zip_t + *archive, const char + *name, zip_flags_t + flags);

+
+
+

+The function zip_dir_add() adds a directory to a zip + archive. The argument archive specifies the zip archive + to which the directory should be added. name is the + directory's name in the zip archive. +

This function adds an entry to the archive. It does not check + whether a directory with that name exists in the file system, nor does it + add its contents if it does. The flags argument can be + any of:

+
+
+
Guess encoding of name (default). (Only CP-437 and + UTF-8 are recognized.)
+
+
Interpret name as UTF-8.
+
+
Interpret name as code page 437 (CP-437).
+
+
+
+

+Upon successful completion, the index of the new entry in the archive is + returned. Otherwise, -1 is returned and the error code in + archive is set to indicate the error. +
+
+

+zip_dir_add() fails if: +
+
[]
+
There is already an entry called name in the + archive.
+
[]
+
archive or name are + NULL, or invalid UTF-8 encoded file names.
+
[]
+
Required memory could not be allocated.
+
+
+
+

+libzip(3), + zip_file_add(3) +
+
+

+zip_dir_add() was added in libzip 0.11. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
September 20, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_dir_add.man b/core/deps/libzip/man/zip_dir_add.man new file mode 100644 index 000000000..4c863febe --- /dev/null +++ b/core/deps/libzip/man/zip_dir_add.man @@ -0,0 +1,116 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_dir_add.mdoc -- add directory to zip archive +.\" Copyright (C) 2006-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_DIR_ADD" "3" "September 20, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_dir_add\fR +\- add directory to zip archive +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int64_t\fR +.br +.PD 0 +.HP 4n +\fBzip_dir_add\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *name\fR, \fIzip_flags_t\ flags\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_dir_add\fR() +adds a directory to a zip archive. +The argument +\fIarchive\fR +specifies the zip archive to which the directory should be added. +\fIname\fR +is the directory's name in the zip archive. +.PP +This function adds an entry to the archive. +It does not check whether a directory with that name exists in the +file system, nor does it add its contents if it does. +The +\fIflags\fR +argument can be any of: +.TP 22n +\fRZIP_FL_ENC_GUESS\fR +Guess encoding of +\fIname\fR +(default). +(Only CP-437 and UTF-8 are recognized.) +.TP 22n +\fRZIP_FL_ENC_UTF_8\fR +Interpret +\fIname\fR +as UTF-8. +.TP 22n +\fRZIP_FL_ENC_CP437\fR +Interpret +\fIname\fR +as code page 437 (CP-437). +.SH "RETURN VALUES" +Upon successful completion, the index of the new entry in the archive +is returned. +Otherwise, \-1 is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_dir_add\fR() +fails if: +.TP 19n +[\fRZIP_ER_EXISTS\fR] +There is already an entry called +\fIname\fR +in the archive. +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIarchive\fR +or +\fIname\fR +are +\fRNULL\fR, +or invalid UTF-8 encoded file names. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.SH "SEE ALSO" +libzip(3), +zip_file_add(3) +.SH "HISTORY" +\fBzip_dir_add\fR() +was added in libzip 0.11. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_dir_add.mdoc b/core/deps/libzip/man/zip_dir_add.mdoc new file mode 100644 index 000000000..01e0a22bb --- /dev/null +++ b/core/deps/libzip/man/zip_dir_add.mdoc @@ -0,0 +1,109 @@ +.\" zip_dir_add.mdoc -- add directory to zip archive +.\" Copyright (C) 2006-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 20, 2020 +.Dt ZIP_DIR_ADD 3 +.Os +.Sh NAME +.Nm zip_dir_add +.Nd add directory to zip archive +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int64_t +.Fn zip_dir_add "zip_t *archive" "const char *name" "zip_flags_t flags" +.Sh DESCRIPTION +The function +.Fn zip_dir_add +adds a directory to a zip archive. +The argument +.Ar archive +specifies the zip archive to which the directory should be added. +.Ar name +is the directory's name in the zip archive. +.Pp +This function adds an entry to the archive. +It does not check whether a directory with that name exists in the +file system, nor does it add its contents if it does. +The +.Ar flags +argument can be any of: +.Bl -tag -width XZIPXFLXENCXSTRICTXX +.It Dv ZIP_FL_ENC_GUESS +Guess encoding of +.Ar name +(default). +(Only CP-437 and UTF-8 are recognized.) +.It Dv ZIP_FL_ENC_UTF_8 +Interpret +.Ar name +as UTF-8. +.It Dv ZIP_FL_ENC_CP437 +Interpret +.Ar name +as code page 437 (CP-437). +.El +.Sh RETURN VALUES +Upon successful completion, the index of the new entry in the archive +is returned. +Otherwise, \-1 is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_dir_add +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_EXISTS +There is already an entry called +.Ar name +in the archive. +.It Bq Er ZIP_ER_INVAL +.Ar archive +or +.Ar name +are +.Dv NULL , +or invalid UTF-8 encoded file names. +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_add 3 +.Sh HISTORY +.Fn zip_dir_add +was added in libzip 0.11. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_discard.html b/core/deps/libzip/man/zip_discard.html new file mode 100644 index 000000000..05502dd7a --- /dev/null +++ b/core/deps/libzip/man/zip_discard.html @@ -0,0 +1,97 @@ + + + + + + + ZIP_DISCARD(3) + + + + + + + + +
ZIP_DISCARD(3)Library Functions ManualZIP_DISCARD(3)
+
+
+

+zip_discard — +
close zip archive and discard changes
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

void +
+ zip_discard(zip_t + *archive);

+
+
+

+The zip_discard() function closes + archive and frees the memory allocated for it. Any + changes to the archive are not written to disk and discarded. +
+
+

+libzip(3), + zip_close(3) +
+
+

+zip_discard() was added in libzip 0.11. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_discard.man b/core/deps/libzip/man/zip_discard.man new file mode 100644 index 000000000..591f7735c --- /dev/null +++ b/core/deps/libzip/man/zip_discard.man @@ -0,0 +1,66 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_discard.mdoc -- close zip archive and discard changes +.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_DISCARD" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_discard\fR +\- close zip archive and discard changes +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_discard\fR(\fIzip_t\ *archive\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_discard\fR() +function closes +\fIarchive\fR +and frees the memory allocated for it. +Any changes to the archive are not written to disk and discarded. +.SH "SEE ALSO" +libzip(3), +zip_close(3) +.SH "HISTORY" +\fBzip_discard\fR() +was added in libzip 0.11. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_discard.mdoc b/core/deps/libzip/man/zip_discard.mdoc new file mode 100644 index 000000000..7404a4837 --- /dev/null +++ b/core/deps/libzip/man/zip_discard.mdoc @@ -0,0 +1,61 @@ +.\" zip_discard.mdoc -- close zip archive and discard changes +.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_DISCARD 3 +.Os +.Sh NAME +.Nm zip_discard +.Nd close zip archive and discard changes +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft void +.Fn zip_discard "zip_t *archive" +.Sh DESCRIPTION +The +.Fn zip_discard +function closes +.Ar archive +and frees the memory allocated for it. +Any changes to the archive are not written to disk and discarded. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_close 3 +.Sh HISTORY +.Fn zip_discard +was added in libzip 0.11. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_encryption_method_supported.html b/core/deps/libzip/man/zip_encryption_method_supported.html new file mode 100644 index 000000000..7b4603ebb --- /dev/null +++ b/core/deps/libzip/man/zip_encryption_method_supported.html @@ -0,0 +1,105 @@ + + + + + + + ZIP_ENCRYPTION_METHOD_SUPPORTED(3) + + + + + + + + +
ZIP_ENCRYPTION_METHOD_SUPPORTED(3)Library Functions ManualZIP_ENCRYPTION_METHOD_SUPPORTED(3)
+
+
+

+zip_encryption_method_supported — +
return if an encryption method is supported
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_encryption_method_supported(zip_int16_t + method, int + encrypt);

+
+
+

+The zip_encryption_method_supported() returns if the + encryption method method is supported for encryption (if + encrypt is zero) or decryption (otherwise). +
+
+

+Returns 1 if the method is supported, 0 otherwise. +
+
+

+libzip(3), + zip_compression_method_supported(3), + zip_file_set_encryption(3) +
+
+

+zip_encryption_method_supported() was added in libzip + 1.7.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
April 2, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_encryption_method_supported.man b/core/deps/libzip/man/zip_encryption_method_supported.man new file mode 100644 index 000000000..4ab4e3bce --- /dev/null +++ b/core/deps/libzip/man/zip_encryption_method_supported.man @@ -0,0 +1,70 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_encryption_method_supported.mdoc -- return if encryption method is supported +.\" Copyright (C) 2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_ENCRYPTION_METHOD_SUPPORTED" "3" "April 2, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_encryption_method_supported\fR +\- return if an encryption method is supported +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_encryption_method_supported\fR(\fIzip_int16_t\ method\fR, \fIint\ encrypt\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_encryption_method_supported\fR() +returns if the encryption method +\fImethod\fR +is supported for encryption (if +\fIencrypt\fR +is zero) or decryption (otherwise). +.SH "RETURN VALUES" +Returns 1 if the method is supported, 0 otherwise. +.SH "SEE ALSO" +libzip(3), +zip_compression_method_supported(3), +zip_file_set_encryption(3) +.SH "HISTORY" +\fBzip_encryption_method_supported\fR() +was added in libzip 1.7.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_encryption_method_supported.mdoc b/core/deps/libzip/man/zip_encryption_method_supported.mdoc new file mode 100644 index 000000000..43f6ff971 --- /dev/null +++ b/core/deps/libzip/man/zip_encryption_method_supported.mdoc @@ -0,0 +1,65 @@ +.\" zip_encryption_method_supported.mdoc -- return if encryption method is supported +.\" Copyright (C) 2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd April 2, 2020 +.Dt ZIP_ENCRYPTION_METHOD_SUPPORTED 3 +.Os +.Sh NAME +.Nm zip_encryption_method_supported +.Nd return if an encryption method is supported +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_encryption_method_supported "zip_int16_t method" "int encrypt" +.Sh DESCRIPTION +The +.Fn zip_encryption_method_supported +returns if the encryption method +.Ar method +is supported for encryption (if +.Ar encrypt +is zero) or decryption (otherwise). +.Sh RETURN VALUES +Returns 1 if the method is supported, 0 otherwise. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_compression_method_supported 3 , +.Xr zip_file_set_encryption 3 +.Sh HISTORY +.Fn zip_encryption_method_supported +was added in libzip 1.7.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_error_clear.html b/core/deps/libzip/man/zip_error_clear.html new file mode 100644 index 000000000..8d91d62ac --- /dev/null +++ b/core/deps/libzip/man/zip_error_clear.html @@ -0,0 +1,104 @@ + + + + + + + ZIP_ERROR_CLEAR(3) + + + + + + + + +
ZIP_ERROR_CLEAR(3)Library Functions ManualZIP_ERROR_CLEAR(3)
+
+
+

+zip_error_clear, + zip_file_error_clear — +
clear error state for archive or file
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

void +
+ zip_error_clear(zip_t + *archive);

+

void +
+ zip_file_error_clear(zip_file_t + *file);

+
+
+

+The zip_error_clear() function clears the error state + for the zip archive archive. +

The zip_file_error_clear() function does + the same for the zip file file.

+
+
+

+libzip(3), + zip_get_error(3) +
+
+

+zip_error_clear() and + zip_file_error_clear() were added in libzip 0.8. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_error_clear.man b/core/deps/libzip/man/zip_error_clear.man new file mode 100644 index 000000000..5ccda3f41 --- /dev/null +++ b/core/deps/libzip/man/zip_error_clear.man @@ -0,0 +1,79 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_error_clear.mdoc -- clear error state for archive or file +.\" Copyright (C) 2006-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_ERROR_CLEAR" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_error_clear\fR, +\fBzip_file_error_clear\fR +\- clear error state for archive or file +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_error_clear\fR(\fIzip_t\ *archive\fR); +.PD +.PP +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_file_error_clear\fR(\fIzip_file_t\ *file\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_error_clear\fR() +function clears the error state for the zip archive +\fIarchive\fR. +.PP +The +\fBzip_file_error_clear\fR() +function does the same for the zip file +\fIfile\fR. +.SH "SEE ALSO" +libzip(3), +zip_get_error(3) +.SH "HISTORY" +\fBzip_error_clear\fR() +and +\fBzip_file_error_clear\fR() +were added in libzip 0.8. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_error_clear.mdoc b/core/deps/libzip/man/zip_error_clear.mdoc new file mode 100644 index 000000000..39dceaf92 --- /dev/null +++ b/core/deps/libzip/man/zip_error_clear.mdoc @@ -0,0 +1,69 @@ +.\" zip_error_clear.mdoc -- clear error state for archive or file +.\" Copyright (C) 2006-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_ERROR_CLEAR 3 +.Os +.Sh NAME +.Nm zip_error_clear , +.Nm zip_file_error_clear +.Nd clear error state for archive or file +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft void +.Fn zip_error_clear "zip_t *archive" +.Ft void +.Fn zip_file_error_clear "zip_file_t *file" +.Sh DESCRIPTION +The +.Fn zip_error_clear +function clears the error state for the zip archive +.Ar archive . +.Pp +The +.Fn zip_file_error_clear +function does the same for the zip file +.Ar file . +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_get_error 3 +.Sh HISTORY +.Fn zip_error_clear +and +.Fn zip_file_error_clear +were added in libzip 0.8. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_error_code_system.html b/core/deps/libzip/man/zip_error_code_system.html new file mode 100644 index 000000000..783a19adb --- /dev/null +++ b/core/deps/libzip/man/zip_error_code_system.html @@ -0,0 +1,99 @@ + + + + + + + ZIP_ERROR_CODE_SYSTEM(3) + + + + + + + + +
ZIP_ERROR_CODE_SYSTEM(3)Library Functions ManualZIP_ERROR_CODE_SYSTEM(3)
+
+
+

+zip_error_code_system — +
get operating system error part of zip_error
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_error_code_system(const + zip_error_t *ze);

+
+
+

+The zip_error_code_system() function returns the system + specific part of the error from the zip_error error ze. + For finding out what system reported the error, use + zip_error_system_type(3). +
+
+

+libzip(3), + zip_error_code_zip(3), + zip_error_system_type(3) +
+
+

+zip_error_code_system() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_error_code_system.man b/core/deps/libzip/man/zip_error_code_system.man new file mode 100644 index 000000000..4eb0cad8d --- /dev/null +++ b/core/deps/libzip/man/zip_error_code_system.man @@ -0,0 +1,68 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_error_code_system.mdoc -- get system error part of zip_error +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_ERROR_CODE_SYSTEM" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_error_code_system\fR +\- get operating system error part of zip_error +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_error_code_system\fR(\fIconst\ zip_error_t\ *ze\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_error_code_system\fR() +function returns the system specific part of the error from the +zip_error error +\fIze\fR. +For finding out what system reported the error, use +zip_error_system_type(3). +.SH "SEE ALSO" +libzip(3), +zip_error_code_zip(3), +zip_error_system_type(3) +.SH "HISTORY" +\fBzip_error_code_system\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_error_code_system.mdoc b/core/deps/libzip/man/zip_error_code_system.mdoc new file mode 100644 index 000000000..c87a20692 --- /dev/null +++ b/core/deps/libzip/man/zip_error_code_system.mdoc @@ -0,0 +1,63 @@ +.\" zip_error_code_system.mdoc -- get system error part of zip_error +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_ERROR_CODE_SYSTEM 3 +.Os +.Sh NAME +.Nm zip_error_code_system +.Nd get operating system error part of zip_error +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_error_code_system "const zip_error_t *ze" +.Sh DESCRIPTION +The +.Fn zip_error_code_system +function returns the system specific part of the error from the +zip_error error +.Ar ze . +For finding out what system reported the error, use +.Xr zip_error_system_type 3 . +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_error_code_zip 3 , +.Xr zip_error_system_type 3 +.Sh HISTORY +.Fn zip_error_code_system +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_error_code_zip.html b/core/deps/libzip/man/zip_error_code_zip.html new file mode 100644 index 000000000..91f874a05 --- /dev/null +++ b/core/deps/libzip/man/zip_error_code_zip.html @@ -0,0 +1,96 @@ + + + + + + + ZIP_ERROR_CODE_ZIP(3) + + + + + + + + +
ZIP_ERROR_CODE_ZIP(3)Library Functions ManualZIP_ERROR_CODE_ZIP(3)
+
+
+

+zip_error_code_zip — +
get libzip error part of zip_error
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_error_code_zip(const + zip_error_t *ze);

+
+
+

+The zip_error_code_zip() function returns the libzip + specific part of the error from the zip_error error ze. +
+
+

+libzip(3), + zip_error_code_system(3) +
+
+

+zip_error_code_zip() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_error_code_zip.man b/core/deps/libzip/man/zip_error_code_zip.man new file mode 100644 index 000000000..2a5398148 --- /dev/null +++ b/core/deps/libzip/man/zip_error_code_zip.man @@ -0,0 +1,65 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_error_code_zip.mdoc -- get libzip error part of zip_error +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_ERROR_CODE_ZIP" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_error_code_zip\fR +\- get libzip error part of zip_error +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_error_code_zip\fR(\fIconst\ zip_error_t\ *ze\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_error_code_zip\fR() +function returns the libzip specific part of the error from the +zip_error error +\fIze\fR. +.SH "SEE ALSO" +libzip(3), +zip_error_code_system(3) +.SH "HISTORY" +\fBzip_error_code_zip\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_error_code_zip.mdoc b/core/deps/libzip/man/zip_error_code_zip.mdoc new file mode 100644 index 000000000..c68fff431 --- /dev/null +++ b/core/deps/libzip/man/zip_error_code_zip.mdoc @@ -0,0 +1,60 @@ +.\" zip_error_code_zip.mdoc -- get libzip error part of zip_error +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_ERROR_CODE_ZIP 3 +.Os +.Sh NAME +.Nm zip_error_code_zip +.Nd get libzip error part of zip_error +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_error_code_zip "const zip_error_t *ze" +.Sh DESCRIPTION +The +.Fn zip_error_code_zip +function returns the libzip specific part of the error from the +zip_error error +.Ar ze . +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_error_code_system 3 +.Sh HISTORY +.Fn zip_error_code_zip +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_error_fini.html b/core/deps/libzip/man/zip_error_fini.html new file mode 100644 index 000000000..7263ba34b --- /dev/null +++ b/core/deps/libzip/man/zip_error_fini.html @@ -0,0 +1,97 @@ + + + + + + + ZIP_ERROR_FINI(3) + + + + + + + + +
ZIP_ERROR_FINI(3)Library Functions ManualZIP_ERROR_FINI(3)
+
+
+

+zip_error_fini — +
clean up zip_error structure
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

void +
+ zip_error_fini(zip_error_t + *ze);

+
+
+

+The zip_error_fini() function cleans up and frees + internally allocated memory of the zip_error pointed to by + ze. +
+
+

+libzip(3), + zip_error_init(3) +
+
+

+zip_error_fini() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_error_fini.man b/core/deps/libzip/man/zip_error_fini.man new file mode 100644 index 000000000..2e4a1ae39 --- /dev/null +++ b/core/deps/libzip/man/zip_error_fini.man @@ -0,0 +1,65 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_error_fini.mdoc -- clean up zip_error +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_ERROR_FINI" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_error_fini\fR +\- clean up zip_error structure +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_error_fini\fR(\fIzip_error_t\ *ze\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_error_fini\fR() +function cleans up and frees internally allocated memory of the +zip_error pointed to by +\fIze\fR. +.SH "SEE ALSO" +libzip(3), +zip_error_init(3) +.SH "HISTORY" +\fBzip_error_fini\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_error_fini.mdoc b/core/deps/libzip/man/zip_error_fini.mdoc new file mode 100644 index 000000000..136db4ce4 --- /dev/null +++ b/core/deps/libzip/man/zip_error_fini.mdoc @@ -0,0 +1,60 @@ +.\" zip_error_fini.mdoc -- clean up zip_error +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_ERROR_FINI 3 +.Os +.Sh NAME +.Nm zip_error_fini +.Nd clean up zip_error structure +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft void +.Fn zip_error_fini "zip_error_t *ze" +.Sh DESCRIPTION +The +.Fn zip_error_fini +function cleans up and frees internally allocated memory of the +zip_error pointed to by +.Ar ze . +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_error_init 3 +.Sh HISTORY +.Fn zip_error_fini +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_error_get.html b/core/deps/libzip/man/zip_error_get.html new file mode 100644 index 000000000..575c42c63 --- /dev/null +++ b/core/deps/libzip/man/zip_error_get.html @@ -0,0 +1,150 @@ + + + + + + + ZIP_ERROR_GET(3) + + + + + + + + +
ZIP_ERROR_GET(3)Library Functions ManualZIP_ERROR_GET(3)
+
+
+

+zip_error_get, + zip_file_error_get — +
get error codes for archive or file (obsolete interface)
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

void +
+ zip_error_get(zip_t + *archive, int *zep, + int *sep);

+

void +
+ zip_file_error_get(zip_file_t + *file, int *zep, + int *sep);

+
+
+

+The functions zip_error_get() and + zip_file_error_get() are deprecated. Use + zip_error_code_system(3), + zip_error_code_zip(3), + zip_file_get_error(3), and + zip_get_error(3) instead. +

For zip_error_get(), replace

+
+
+int ze, se;
+zip_error_get(za, &ze, &se);
+
+
+with +
+
+int ze, se;
+zip_error_t *error = zip_get_error(za);
+ze = zip_error_code_zip(error);
+se = zip_error_code_system(error);
+
+
+For zip_file_error_get(), replace +
+
+int ze, se;
+zip_file_error_get(zf, &ze, &se);
+
+
+with +
+
+int ze, se;
+zip_error_t *error = zip_file_get_error(zf);
+ze = zip_error_code_zip(error);
+se = zip_error_code_system(error);
+
+
+
+
+

+libzip(3), + zip_error_code_system(3), + zip_error_code_zip(3), + zip_file_get_error(3), + zip_get_error(3) +
+
+

+zip_error_get() was added in libzip 0.6. It was + deprecated in libzip 1.0, use zip_get_error(), + zip_error_code_zip(), / + zip_error_code_system() instead. +

zip_file_error_get() was added in libzip + 0.6. It was deprecated in libzip 1.0, use + zip_file_get_error(), + zip_error_code_zip(), / + zip_error_code_system() instead.

+
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_error_get.man b/core/deps/libzip/man/zip_error_get.man new file mode 100644 index 000000000..43e2c0654 --- /dev/null +++ b/core/deps/libzip/man/zip_error_get.man @@ -0,0 +1,139 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_error_get.mdoc -- get error codes for archive or file +.\" Copyright (C) 2004-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_ERROR_GET" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_error_get\fR, +\fBzip_file_error_get\fR +\- get error codes for archive or file (obsolete interface) +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_error_get\fR(\fIzip_t\ *archive\fR, \fIint\ *zep\fR, \fIint\ *sep\fR); +.PD +.PP +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_file_error_get\fR(\fIzip_file_t\ *file\fR, \fIint\ *zep\fR, \fIint\ *sep\fR); +.PD +.SH "DESCRIPTION" +The functions +\fBzip_error_get\fR() +and +\fBzip_file_error_get\fR() +are deprecated. +Use +zip_error_code_system(3), +zip_error_code_zip(3), +zip_file_get_error(3), +and +zip_get_error(3) +instead. +.PP +For +\fBzip_error_get\fR(), +replace +.nf +.sp +.RS 6n +int ze, se; +zip_error_get(za, &ze, &se); +.RE +.fi +with +.nf +.sp +.RS 6n +int ze, se; +zip_error_t *error = zip_get_error(za); +ze = zip_error_code_zip(error); +se = zip_error_code_system(error); +.RE +.fi +For +\fBzip_file_error_get\fR(), +replace +.nf +.sp +.RS 6n +int ze, se; +zip_file_error_get(zf, &ze, &se); +.RE +.fi +with +.nf +.sp +.RS 6n +int ze, se; +zip_error_t *error = zip_file_get_error(zf); +ze = zip_error_code_zip(error); +se = zip_error_code_system(error); +.RE +.fi +.SH "SEE ALSO" +libzip(3), +zip_error_code_system(3), +zip_error_code_zip(3), +zip_file_get_error(3), +zip_get_error(3) +.SH "HISTORY" +\fBzip_error_get\fR() +was added in libzip 0.6. +It was deprecated in libzip 1.0, use +\fBzip_get_error\fR(), +\fBzip_error_code_zip\fR(), +/ +\fBzip_error_code_system\fR() +instead. +.PP +\fBzip_file_error_get\fR() +was added in libzip 0.6. +It was deprecated in libzip 1.0, use +\fBzip_file_get_error\fR(), +\fBzip_error_code_zip\fR(), +/ +\fBzip_error_code_system\fR() +instead. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_error_get.mdoc b/core/deps/libzip/man/zip_error_get.mdoc new file mode 100644 index 000000000..527139436 --- /dev/null +++ b/core/deps/libzip/man/zip_error_get.mdoc @@ -0,0 +1,117 @@ +.\" zip_error_get.mdoc -- get error codes for archive or file +.\" Copyright (C) 2004-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_ERROR_GET 3 +.Os +.Sh NAME +.Nm zip_error_get , +.Nm zip_file_error_get +.Nd get error codes for archive or file (obsolete interface) +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft void +.Fn zip_error_get "zip_t *archive" "int *zep" "int *sep" +.Ft void +.Fn zip_file_error_get "zip_file_t *file" "int *zep" "int *sep" +.Sh DESCRIPTION +The functions +.Fn zip_error_get +and +.Fn zip_file_error_get +are deprecated. +Use +.Xr zip_error_code_system 3 , +.Xr zip_error_code_zip 3 , +.Xr zip_file_get_error 3 , +and +.Xr zip_get_error 3 +instead. +.Pp +For +.Fn zip_error_get , +replace +.Bd -literal -offset indent +int ze, se; +zip_error_get(za, &ze, &se); +.Ed +with +.Bd -literal -offset indent +int ze, se; +zip_error_t *error = zip_get_error(za); +ze = zip_error_code_zip(error); +se = zip_error_code_system(error); +.Ed +For +.Fn zip_file_error_get , +replace +.Bd -literal -offset indent +int ze, se; +zip_file_error_get(zf, &ze, &se); +.Ed +with +.Bd -literal -offset indent +int ze, se; +zip_error_t *error = zip_file_get_error(zf); +ze = zip_error_code_zip(error); +se = zip_error_code_system(error); +.Ed +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_error_code_system 3 , +.Xr zip_error_code_zip 3 , +.Xr zip_file_get_error 3 , +.Xr zip_get_error 3 +.Sh HISTORY +.Fn zip_error_get +was added in libzip 0.6. +It was deprecated in libzip 1.0, use +.Fn zip_get_error , +.Fn zip_error_code_zip , +/ +.Fn zip_error_code_system +instead. +.Pp +.Fn zip_file_error_get +was added in libzip 0.6. +It was deprecated in libzip 1.0, use +.Fn zip_file_get_error , +.Fn zip_error_code_zip , +/ +.Fn zip_error_code_system +instead. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_error_get_sys_type.html b/core/deps/libzip/man/zip_error_get_sys_type.html new file mode 100644 index 000000000..1e67c9b99 --- /dev/null +++ b/core/deps/libzip/man/zip_error_get_sys_type.html @@ -0,0 +1,116 @@ + + + + + + + ZIP_ERROR_GET_SYS_TYPE(3) + + + + + + + + +
ZIP_ERROR_GET_SYS_TYPE(3)Library Functions ManualZIP_ERROR_GET_SYS_TYPE(3)
+
+
+

+zip_error_get_sys_type — +
get type of system error code (obsolete interface)
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_error_get_sys_type(int + ze);

+
+
+

+The function zip_error_get_sys_type() is deprecated; use + zip_error_init_with_code(3) + and + zip_error_system_type(3) + instead. +

Replace

+
+
+int i = zip_error_get_sys_type(ze);
+
+
+with +
+
+zip_error_t error;
+zip_error_init_with_code(&error, ze);
+int i = zip_error_system_type(&error);
+
+
+
+
+

+libzip(3), + zip_error_init_with_code(3), + zip_error_system_type(3) +
+
+

+zip_error_get_sys_type() was added in libzip 0.6. It was + deprecated in libzip 1.0, use zip_error_system_type() + instead. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_error_get_sys_type.man b/core/deps/libzip/man/zip_error_get_sys_type.man new file mode 100644 index 000000000..753a94cfe --- /dev/null +++ b/core/deps/libzip/man/zip_error_get_sys_type.man @@ -0,0 +1,88 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_error_get_sys_type.mdoc -- get type of error +.\" Copyright (C) 2004-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_ERROR_GET_SYS_TYPE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_error_get_sys_type\fR +\- get type of system error code (obsolete interface) +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_error_get_sys_type\fR(\fIint\ ze\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_error_get_sys_type\fR() +is deprecated; use +zip_error_init_with_code(3) +and +zip_error_system_type(3) +instead. +.PP +Replace +.nf +.sp +.RS 6n +int i = zip_error_get_sys_type(ze); +.RE +.fi +with +.nf +.sp +.RS 6n +zip_error_t error; +zip_error_init_with_code(&error, ze); +int i = zip_error_system_type(&error); +.RE +.fi +.SH "SEE ALSO" +libzip(3), +zip_error_init_with_code(3), +zip_error_system_type(3) +.SH "HISTORY" +\fBzip_error_get_sys_type\fR() +was added in libzip 0.6. +It was deprecated in libzip 1.0, use +\fBzip_error_system_type\fR() +instead. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_error_get_sys_type.mdoc b/core/deps/libzip/man/zip_error_get_sys_type.mdoc new file mode 100644 index 000000000..16d3af78d --- /dev/null +++ b/core/deps/libzip/man/zip_error_get_sys_type.mdoc @@ -0,0 +1,77 @@ +.\" zip_error_get_sys_type.mdoc -- get type of error +.\" Copyright (C) 2004-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_ERROR_GET_SYS_TYPE 3 +.Os +.Sh NAME +.Nm zip_error_get_sys_type +.Nd get type of system error code (obsolete interface) +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_error_get_sys_type "int ze" +.Sh DESCRIPTION +The function +.Fn zip_error_get_sys_type +is deprecated; use +.Xr zip_error_init_with_code 3 +and +.Xr zip_error_system_type 3 +instead. +.Pp +Replace +.Bd -literal -offset indent +int i = zip_error_get_sys_type(ze); +.Ed +with +.Bd -literal -offset indent +zip_error_t error; +zip_error_init_with_code(&error, ze); +int i = zip_error_system_type(&error); +.Ed +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_error_init_with_code 3 , +.Xr zip_error_system_type 3 +.Sh HISTORY +.Fn zip_error_get_sys_type +was added in libzip 0.6. +It was deprecated in libzip 1.0, use +.Fn zip_error_system_type +instead. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_error_init.html b/core/deps/libzip/man/zip_error_init.html new file mode 100644 index 000000000..18e22bb9d --- /dev/null +++ b/core/deps/libzip/man/zip_error_init.html @@ -0,0 +1,108 @@ + + + + + + + ZIP_ERROR_INIT(3) + + + + + + + + +
ZIP_ERROR_INIT(3)Library Functions ManualZIP_ERROR_INIT(3)
+
+
+

+zip_error_init, + zip_error_init_with_code — +
initialize zip_error structure
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

void +
+ zip_error_init(zip_error_t + *error);

+

void +
+ zip_error_init_with_code(zip_error_t + *error, int + ze);

+
+
+

+The zip_error_init() function initializes the zip_error + pointed to by error. *error must + be allocated before calling zip_error_init(). +

The zip_error_init_with_code() function + does the same, but additionally sets the zip error code to + ze and sets the system error code to the current + errno(3) value, if appropriate.

+
+
+

+libzip(3), + zip_error_fini(3) +
+
+

+zip_error_init() and + zip_error_init_with_code() were added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_error_init.man b/core/deps/libzip/man/zip_error_init.man new file mode 100644 index 000000000..7623e982f --- /dev/null +++ b/core/deps/libzip/man/zip_error_init.man @@ -0,0 +1,85 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_error_init.mdoc -- initialize zip_error +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_ERROR_INIT" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_error_init\fR, +\fBzip_error_init_with_code\fR +\- initialize zip_error structure +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_error_init\fR(\fIzip_error_t\ *error\fR); +.PD +.PP +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_error_init_with_code\fR(\fIzip_error_t\ *error\fR, \fIint\ ze\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_error_init\fR() +function initializes the zip_error pointed to by +\fIerror\fR. +\fI*error\fR +must be allocated before calling +\fBzip_error_init\fR(). +.PP +The +\fBzip_error_init_with_code\fR() +function does the same, but additionally sets the zip error code to +\fIze\fR +and sets the system error code to the current +errno(3) +value, if appropriate. +.SH "SEE ALSO" +libzip(3), +zip_error_fini(3) +.SH "HISTORY" +\fBzip_error_init\fR() +and +\fBzip_error_init_with_code\fR() +were added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_error_init.mdoc b/core/deps/libzip/man/zip_error_init.mdoc new file mode 100644 index 000000000..b524303ef --- /dev/null +++ b/core/deps/libzip/man/zip_error_init.mdoc @@ -0,0 +1,76 @@ +.\" zip_error_init.mdoc -- initialize zip_error +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_ERROR_INIT 3 +.Os +.Sh NAME +.Nm zip_error_init , +.Nm zip_error_init_with_code +.Nd initialize zip_error structure +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft void +.Fn zip_error_init "zip_error_t *error" +.Ft void +.Fn zip_error_init_with_code "zip_error_t *error" "int ze" +.Sh DESCRIPTION +The +.Fn zip_error_init +function initializes the zip_error pointed to by +.Ar error . +.Ar *error +must be allocated before calling +.Fn zip_error_init . +.Pp +The +.Fn zip_error_init_with_code +function does the same, but additionally sets the zip error code to +.Ar ze +and sets the system error code to the current +.Xr errno 3 +value, if appropriate. +.\" TODO: describe when you would need to call this at all +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_error_fini 3 +.Sh HISTORY +.Fn zip_error_init +and +.Fn zip_error_init_with_code +were added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_error_set.html b/core/deps/libzip/man/zip_error_set.html new file mode 100644 index 000000000..b9bd08fd2 --- /dev/null +++ b/core/deps/libzip/man/zip_error_set.html @@ -0,0 +1,101 @@ + + + + + + + ZIP_ERROR_SET(3) + + + + + + + + +
ZIP_ERROR_SET(3)Library Functions ManualZIP_ERROR_SET(3)
+
+
+

+zip_error_set — +
fill in zip_error structure
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

void +
+ zip_error_set(zip_error_t + *ze, int le, + int se);

+
+
+

+The zip_error_set() function sets the zip_error pointed + to by ze to the libzip error code + le and the system error code se. +

ze must be allocated and initialized with + zip_error_init(3) before + calling zip_error(set).

+
+
+

+libzip(3), + zip_error_init(3) +
+
+

+zip_error_set() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
April 2, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_error_set.man b/core/deps/libzip/man/zip_error_set.man new file mode 100644 index 000000000..9bc4cb816 --- /dev/null +++ b/core/deps/libzip/man/zip_error_set.man @@ -0,0 +1,74 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_error_set.mdoc -- set zip_error +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_ERROR_SET" "3" "April 2, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_error_set\fR +\- fill in zip_error structure +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_error_set\fR(\fIzip_error_t\ *ze\fR, \fIint\ le\fR, \fIint\ se\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_error_set\fR() +function sets the zip_error pointed to by +\fIze\fR +to the libzip error code +\fIle\fR +and the system error code +\fIse\fR. +.PP +\fIze\fR +must be allocated and initialized with +zip_error_init(3) +before calling +\fBzip_error\fR(\fIset\fR). +.SH "SEE ALSO" +libzip(3), +zip_error_init(3) +.SH "HISTORY" +\fBzip_error_set\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_error_set.mdoc b/core/deps/libzip/man/zip_error_set.mdoc new file mode 100644 index 000000000..f48a2058e --- /dev/null +++ b/core/deps/libzip/man/zip_error_set.mdoc @@ -0,0 +1,69 @@ +.\" zip_error_set.mdoc -- set zip_error +.\" Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd April 2, 2020 +.Dt ZIP_ERROR_SET 3 +.Os +.Sh NAME +.Nm zip_error_set +.Nd fill in zip_error structure +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft void +.Fn zip_error_set "zip_error_t *ze" "int le" "int se" +.Sh DESCRIPTION +The +.Fn zip_error_set +function sets the zip_error pointed to by +.Ar ze +to the libzip error code +.Ar le +and the system error code +.Ar se . +.Pp +.Ar ze +must be allocated and initialized with +.Xr zip_error_init 3 +before calling +.Fn zip_error set . +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_error_init 3 +.Sh HISTORY +.Fn zip_error_set +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_error_strerror.html b/core/deps/libzip/man/zip_error_strerror.html new file mode 100644 index 000000000..b1379f268 --- /dev/null +++ b/core/deps/libzip/man/zip_error_strerror.html @@ -0,0 +1,101 @@ + + + + + + + ZIP_ERROR_STRERROR(3) + + + + + + + + +
ZIP_ERROR_STRERROR(3)Library Functions ManualZIP_ERROR_STRERROR(3)
+
+
+

+zip_error_strerror — +
create human-readable string for zip_error
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

const char * +
+ zip_error_strerror(zip_error_t + *ze);

+
+
+

+The zip_error_strerror() function returns an error + message string corresponding to ze like + strerror(3). This string will stay + valid until the next call to zip_error_strerror() or + until zip_error_fini(3) is + called. +
+
+

+libzip(3), + strerror(3), + zip_error_fini(3) +
+
+

+zip_error_strerror() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_error_strerror.man b/core/deps/libzip/man/zip_error_strerror.man new file mode 100644 index 000000000..f1396ce35 --- /dev/null +++ b/core/deps/libzip/man/zip_error_strerror.man @@ -0,0 +1,72 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_error_strerror.mdoc -- create human-readable version of zip_error +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_ERROR_STRERROR" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_error_strerror\fR +\- create human-readable string for zip_error +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIconst char *\fR +.br +.PD 0 +.HP 4n +\fBzip_error_strerror\fR(\fIzip_error_t\ *ze\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_error_strerror\fR() +function returns an error message string corresponding to +\fIze\fR +like +strerror(3). +This string will stay valid until the next call to +\fBzip_error_strerror\fR() +or until +zip_error_fini(3) +is called. +.SH "SEE ALSO" +libzip(3), +strerror(3), +zip_error_fini(3) +.SH "HISTORY" +\fBzip_error_strerror\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_error_strerror.mdoc b/core/deps/libzip/man/zip_error_strerror.mdoc new file mode 100644 index 000000000..8d44c993f --- /dev/null +++ b/core/deps/libzip/man/zip_error_strerror.mdoc @@ -0,0 +1,67 @@ +.\" zip_error_strerror.mdoc -- create human-readable version of zip_error +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_ERROR_STRERROR 3 +.Os +.Sh NAME +.Nm zip_error_strerror +.Nd create human-readable string for zip_error +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft const char * +.Fn zip_error_strerror "zip_error_t *ze" +.Sh DESCRIPTION +The +.Fn zip_error_strerror +function returns an error message string corresponding to +.Ar ze +like +.Xr strerror 3 . +This string will stay valid until the next call to +.Fn zip_error_strerror +or until +.Xr zip_error_fini 3 +is called. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr strerror 3 , +.Xr zip_error_fini 3 +.Sh HISTORY +.Fn zip_error_strerror +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_error_system_type.html b/core/deps/libzip/man/zip_error_system_type.html new file mode 100644 index 000000000..463b50c6c --- /dev/null +++ b/core/deps/libzip/man/zip_error_system_type.html @@ -0,0 +1,107 @@ + + + + + + + ZIP_ERROR_SYSTEM_TYPE(3) + + + + + + + + +
ZIP_ERROR_SYSTEM_TYPE(3)Library Functions ManualZIP_ERROR_SYSTEM_TYPE(3)
+
+
+

+zip_error_system_type — +
return type of system error
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_error_system_type(const + zip_error_t *ze);

+
+
+

+The zip_error_system_type() function returns the type of + the system specific part for the zip_error ze. + Currently, the following system types are defined: +
+
+
System specific part of ze is unused.
+
+
System specific part of ze is an + errno(2).
+
+
System specific part of ze is a + zlib(3) error.
+
+
+
+

+libzip(3), + zip_error_code_system(3) +
+
+

+zip_error_system_type() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_error_system_type.man b/core/deps/libzip/man/zip_error_system_type.man new file mode 100644 index 000000000..0d55f4a3b --- /dev/null +++ b/core/deps/libzip/man/zip_error_system_type.man @@ -0,0 +1,83 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_error_system_type.mdoc -- return system type for error +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_ERROR_SYSTEM_TYPE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_error_system_type\fR +\- return type of system error +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_error_system_type\fR(\fIconst\ zip_error_t\ *ze\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_error_system_type\fR() +function returns the type of the system specific part for the zip_error +\fIze\fR. +Currently, the following system types are defined: +.TP 13n +\fRZIP_ET_NONE\fR +System specific part of +\fIze\fR +is unused. +.TP 13n +\fRZIP_ET_SYS\fR +System specific part of +\fIze\fR +is an +errno(2). +.TP 13n +\fRZIP_ET_ZLIB\fR +System specific part of +\fIze\fR +is a +zlib(3) +error. +.SH "SEE ALSO" +libzip(3), +zip_error_code_system(3) +.SH "HISTORY" +\fBzip_error_system_type\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_error_system_type.mdoc b/core/deps/libzip/man/zip_error_system_type.mdoc new file mode 100644 index 000000000..f9fbfce5e --- /dev/null +++ b/core/deps/libzip/man/zip_error_system_type.mdoc @@ -0,0 +1,77 @@ +.\" zip_error_system_type.mdoc -- return system type for error +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_ERROR_SYSTEM_TYPE 3 +.Os +.Sh NAME +.Nm zip_error_system_type +.Nd return type of system error +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_error_system_type "const zip_error_t *ze" +.Sh DESCRIPTION +The +.Fn zip_error_system_type +function returns the type of the system specific part for the zip_error +.Ar ze . +Currently, the following system types are defined: +.Bl -tag -width ZIP_ET_NONE +.It Dv ZIP_ET_NONE +System specific part of +.Ar ze +is unused. +.It Dv ZIP_ET_SYS +System specific part of +.Ar ze +is an +.Xr errno 2 . +.It Dv ZIP_ET_ZLIB +System specific part of +.Ar ze +is a +.Xr zlib 3 +error. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_error_code_system 3 +.Sh HISTORY +.Fn zip_error_system_type +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_error_to_data.html b/core/deps/libzip/man/zip_error_to_data.html new file mode 100644 index 000000000..6ec45f5a7 --- /dev/null +++ b/core/deps/libzip/man/zip_error_to_data.html @@ -0,0 +1,108 @@ + + + + + + + ZIP_ERROR_TO_DATA(3) + + + + + + + + +
ZIP_ERROR_TO_DATA(3)Library Functions ManualZIP_ERROR_TO_DATA(3)
+
+
+

+zip_error_to_data — +
convert zip_error to return value suitable for + ZIP_SOURCE_ERROR
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int64_t +
+ zip_error_to_data(const + zip_error_t *ze, void + *data, zip_uint64_t + len);

+
+
+

+zip_error_to_data() function converts the zip_error + ze into data suitable as return value for + ZIP_SOURCE_ERROR. The data is written into the buffer + data of size len. If the buffer is + not large enough to hold 2 ints, an error is returned. +
+
+

+zip_error_to_data() returns 2*(sizeof int) on success, + and -1 on error. +
+
+

+libzip(3), + zip_source_function(3) +
+
+

+zip_error_to_data() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_error_to_data.man b/core/deps/libzip/man/zip_error_to_data.man new file mode 100644 index 000000000..f6551292f --- /dev/null +++ b/core/deps/libzip/man/zip_error_to_data.man @@ -0,0 +1,74 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_error_to_data.mdoc -- create error data for ZIP_SOURCE_ERROR +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_ERROR_TO_DATA" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_error_to_data\fR +\- convert zip_error to return value suitable for ZIP_SOURCE_ERROR +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int64_t\fR +.br +.PD 0 +.HP 4n +\fBzip_error_to_data\fR(\fIconst\ zip_error_t\ *ze\fR, \fIvoid\ *data\fR, \fIzip_uint64_t\ len\fR); +.PD +.SH "DESCRIPTION" +\fBzip_error_to_data\fR() +function converts the zip_error +\fIze\fR +into data suitable as return value for +\fRZIP_SOURCE_ERROR\fR. +The data is written into the buffer +\fIdata\fR +of size +\fIlen\fR. +If the buffer is not large enough to hold 2 ints, an error is +returned. +.SH "RETURN VALUES" +\fBzip_error_to_data\fR() +returns 2*(sizeof int) on success, and \-1 on error. +.SH "SEE ALSO" +libzip(3), +zip_source_function(3) +.SH "HISTORY" +\fBzip_error_to_data\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_error_to_data.mdoc b/core/deps/libzip/man/zip_error_to_data.mdoc new file mode 100644 index 000000000..e7ba170b1 --- /dev/null +++ b/core/deps/libzip/man/zip_error_to_data.mdoc @@ -0,0 +1,69 @@ +.\" zip_error_to_data.mdoc -- create error data for ZIP_SOURCE_ERROR +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_ERROR_TO_DATA 3 +.Os +.Sh NAME +.Nm zip_error_to_data +.Nd convert zip_error to return value suitable for ZIP_SOURCE_ERROR +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int64_t +.Fn zip_error_to_data "const zip_error_t *ze" "void *data" "zip_uint64_t len" +.Sh DESCRIPTION +.Fn zip_error_to_data +function converts the zip_error +.Ar ze +into data suitable as return value for +.Dv ZIP_SOURCE_ERROR . +The data is written into the buffer +.Ar data +of size +.Ar len . +If the buffer is not large enough to hold 2 ints, an error is +returned. +.Sh RETURN VALUES +.Fn zip_error_to_data +returns 2*(sizeof int) on success, and \-1 on error. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source_function 3 +.Sh HISTORY +.Fn zip_error_to_data +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_error_to_str.html b/core/deps/libzip/man/zip_error_to_str.html new file mode 100644 index 000000000..cf6ce642d --- /dev/null +++ b/core/deps/libzip/man/zip_error_to_str.html @@ -0,0 +1,124 @@ + + + + + + + ZIP_ERROR_TO_STR(3) + + + + + + + + +
ZIP_ERROR_TO_STR(3)Library Functions ManualZIP_ERROR_TO_STR(3)
+
+
+

+zip_error_to_str — +
get string representation of zip error (obsolete + interface)
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_error_to_str(char + *buf, zip_uint64_t + len, int ze, + int se);

+
+
+

+The function zip_error_to_str() is deprecated; use + zip_error_init_with_code(3) + and zip_error_strerror(3) + instead. +

Replace

+
+
+char buf[BUFSIZE];
+zip_error_to_str(buf, sizeof(buf), ze, se);
+printf("%s", buf);
+
+
+with +
+
+zip_error_t error;
+zip_error_init_with_code(&error, ze);
+printf("%s", zip_error_strerror(&error));
+zip_error_fini(&error);
+
+
+
+
+

+libzip(3), + zip_error_init_with_code(3), + zip_error_strerror(3) +
+
+

+zip_error_to_str() was added in libzip 0.6. In libzip + 0.10 the type of len was changed from + size_t to zip_uint64_t. It was + deprecated in libzip 1.0, use + zip_error_init_with_code() and + zip_error_strerror() instead. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_error_to_str.man b/core/deps/libzip/man/zip_error_to_str.man new file mode 100644 index 000000000..0db434aa5 --- /dev/null +++ b/core/deps/libzip/man/zip_error_to_str.man @@ -0,0 +1,99 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_error_to_str.mdoc -- get string representation of zip error code +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_ERROR_TO_STR" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_error_to_str\fR +\- get string representation of zip error (obsolete interface) +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_error_to_str\fR(\fIchar\ *buf\fR, \fIzip_uint64_t\ len\fR, \fIint\ ze\fR, \fIint\ se\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_error_to_str\fR() +is deprecated; use +zip_error_init_with_code(3) +and +zip_error_strerror(3) +instead. +.PP +Replace +.nf +.sp +.RS 6n +char buf[BUFSIZE]; +zip_error_to_str(buf, sizeof(buf), ze, se); +printf("%s", buf); +.RE +.fi +with +.nf +.sp +.RS 6n +zip_error_t error; +zip_error_init_with_code(&error, ze); +printf("%s", zip_error_strerror(&error)); +zip_error_fini(&error); +.RE +.fi +.SH "SEE ALSO" +libzip(3), +zip_error_init_with_code(3), +zip_error_strerror(3) +.SH "HISTORY" +\fBzip_error_to_str\fR() +was added in libzip 0.6. +In libzip 0.10 the type of +\fIlen\fR +was changed from +\fIsize_t\fR +to +\fIzip_uint64_t\fR. +It was deprecated in libzip 1.0, use +\fBzip_error_init_with_code\fR() +and +\fBzip_error_strerror\fR() +instead. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_error_to_str.mdoc b/core/deps/libzip/man/zip_error_to_str.mdoc new file mode 100644 index 000000000..7054d3e43 --- /dev/null +++ b/core/deps/libzip/man/zip_error_to_str.mdoc @@ -0,0 +1,88 @@ +.\" zip_error_to_str.mdoc -- get string representation of zip error code +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_ERROR_TO_STR 3 +.Os +.Sh NAME +.Nm zip_error_to_str +.Nd get string representation of zip error (obsolete interface) +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_error_to_str "char *buf" "zip_uint64_t len" "int ze" "int se" +.Sh DESCRIPTION +The function +.Fn zip_error_to_str +is deprecated; use +.Xr zip_error_init_with_code 3 +and +.Xr zip_error_strerror 3 +instead. +.Pp +Replace +.Bd -literal -offset indent +char buf[BUFSIZE]; +zip_error_to_str(buf, sizeof(buf), ze, se); +printf("%s", buf); +.Ed +with +.Bd -literal -offset indent +zip_error_t error; +zip_error_init_with_code(&error, ze); +printf("%s", zip_error_strerror(&error)); +zip_error_fini(&error); +.Ed +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_error_init_with_code 3 , +.Xr zip_error_strerror 3 +.Sh HISTORY +.Fn zip_error_to_str +was added in libzip 0.6. +In libzip 0.10 the type of +.Ar len +was changed from +.Vt size_t +to +.Vt zip_uint64_t . +It was deprecated in libzip 1.0, use +.Fn zip_error_init_with_code +and +.Fn zip_error_strerror +instead. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_errors.html b/core/deps/libzip/man/zip_errors.html new file mode 100644 index 000000000..e7ad24074 --- /dev/null +++ b/core/deps/libzip/man/zip_errors.html @@ -0,0 +1,150 @@ + + + + + + + ZIP_ERRORS(3) + + + + + + + + +
ZIP_ERRORS(3)Library Functions ManualZIP_ERRORS(3)
+
+
+

+zip_errors — +
list of all libzip error codes
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +
+
+

+The following error codes are used by libzip: +
+
[ZIP_ER_CHANGED]
+
Entry has been changed.
+
[ZIP_ER_CLOSE]
+
Closing zip archive failed.
+
[ZIP_ER_COMPNOTSUPP]
+
Compression method not supported.
+
[ZIP_ER_COMPRESSED_DATA]
+
Compressed data invalid.
+
[ZIP_ER_CRC]
+
CRC error.
+
[ZIP_ER_DELETED]
+
Entry has been deleted.
+
[ZIP_ER_ENCRNOTSUPP]
+
Encryption method not supported.
+
[ZIP_ER_EOF]
+
Premature end of file.
+
[ZIP_ER_EXISTS]
+
File already exists.
+
[ZIP_ER_INCONS]
+
Zip archive inconsistent.
+
[ZIP_ER_INTERNAL]
+
Internal error.
+
[ZIP_ER_INUSE]
+
Resource still in use.
+
[ZIP_ER_INVAL]
+
Invalid argument.
+
[ZIP_ER_MEMORY]
+
Malloc failure.
+
[ZIP_ER_MULTIDISK]
+
Multi-disk zip archives not supported.
+
[ZIP_ER_NOENT]
+
No such file.
+
[ZIP_ER_NOPASSWD]
+
No password provided.
+
[ZIP_ER_NOZIP]
+
Not a zip archive.
+
[ZIP_ER_OK]
+
No error.
+
[ZIP_ER_OPEN]
+
Can't open file.
+
[ZIP_ER_OPNOTSUPP]
+
Operation not supported.
+
[ZIP_ER_RDONLY]
+
Read-only archive.
+
[ZIP_ER_READ]
+
Read error.
+
[ZIP_ER_REMOVE]
+
Can't remove file.
+
[ZIP_ER_RENAME]
+
Renaming temporary file failed.
+
[ZIP_ER_SEEK]
+
Seek error.
+
[ZIP_ER_TELL]
+
Tell error.
+
[ZIP_ER_TMPOPEN]
+
Failure to create temporary file.
+
[ZIP_ER_WRITE]
+
Write error.
+
[ZIP_ER_WRONGPASSWD]
+
Wrong password provided.
+
[ZIP_ER_ZIPCLOSED]
+
Containing zip archive was closed.
+
[ZIP_ER_ZLIB]
+
Zlib error.
+
+
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_errors.man b/core/deps/libzip/man/zip_errors.man new file mode 100644 index 000000000..ba9ae9b71 --- /dev/null +++ b/core/deps/libzip/man/zip_errors.man @@ -0,0 +1,147 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_errors.mdoc -- list of all libzip error codes +.\" Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" This file was generated automatically by ./make_zip_errors.sh +.\" from ./../lib/zip.h; make changes there. +.\" +.TH "ZIP_ERRORS" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_errors\fR +\- list of all libzip error codes +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.SH "DESCRIPTION" +The following error codes are used by libzip: +.TP 26n +[\fRZIP_ER_CHANGED\fR] +Entry has been changed. +.TP 26n +[\fRZIP_ER_CLOSE\fR] +Closing zip archive failed. +.TP 26n +[\fRZIP_ER_COMPNOTSUPP\fR] +Compression method not supported. +.TP 26n +[\fRZIP_ER_COMPRESSED_DATA\fR] +Compressed data invalid. +.TP 26n +[\fRZIP_ER_CRC\fR] +CRC error. +.TP 26n +[\fRZIP_ER_DELETED\fR] +Entry has been deleted. +.TP 26n +[\fRZIP_ER_ENCRNOTSUPP\fR] +Encryption method not supported. +.TP 26n +[\fRZIP_ER_EOF\fR] +Premature end of file. +.TP 26n +[\fRZIP_ER_EXISTS\fR] +File already exists. +.TP 26n +[\fRZIP_ER_INCONS\fR] +Zip archive inconsistent. +.TP 26n +[\fRZIP_ER_INTERNAL\fR] +Internal error. +.TP 26n +[\fRZIP_ER_INUSE\fR] +Resource still in use. +.TP 26n +[\fRZIP_ER_INVAL\fR] +Invalid argument. +.TP 26n +[\fRZIP_ER_MEMORY\fR] +Malloc failure. +.TP 26n +[\fRZIP_ER_MULTIDISK\fR] +Multi-disk zip archives not supported. +.TP 26n +[\fRZIP_ER_NOENT\fR] +No such file. +.TP 26n +[\fRZIP_ER_NOPASSWD\fR] +No password provided. +.TP 26n +[\fRZIP_ER_NOZIP\fR] +Not a zip archive. +.TP 26n +[\fRZIP_ER_OK\fR] +No error. +.TP 26n +[\fRZIP_ER_OPEN\fR] +Can't open file. +.TP 26n +[\fRZIP_ER_OPNOTSUPP\fR] +Operation not supported. +.TP 26n +[\fRZIP_ER_RDONLY\fR] +Read-only archive. +.TP 26n +[\fRZIP_ER_READ\fR] +Read error. +.TP 26n +[\fRZIP_ER_REMOVE\fR] +Can't remove file. +.TP 26n +[\fRZIP_ER_RENAME\fR] +Renaming temporary file failed. +.TP 26n +[\fRZIP_ER_SEEK\fR] +Seek error. +.TP 26n +[\fRZIP_ER_TELL\fR] +Tell error. +.TP 26n +[\fRZIP_ER_TMPOPEN\fR] +Failure to create temporary file. +.TP 26n +[\fRZIP_ER_WRITE\fR] +Write error. +.TP 26n +[\fRZIP_ER_WRONGPASSWD\fR] +Wrong password provided. +.TP 26n +[\fRZIP_ER_ZIPCLOSED\fR] +Containing zip archive was closed. +.TP 26n +[\fRZIP_ER_ZLIB\fR] +Zlib error. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_errors.mdoc b/core/deps/libzip/man/zip_errors.mdoc new file mode 100644 index 000000000..dfc59791f --- /dev/null +++ b/core/deps/libzip/man/zip_errors.mdoc @@ -0,0 +1,117 @@ +.\" zip_errors.mdoc -- list of all libzip error codes +.\" Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" This file was generated automatically by ./make_zip_errors.sh +.\" from ./../lib/zip.h; make changes there. +.\" +.Dd December 18, 2017 +.Dt ZIP_ERRORS 3 +.Os +.Sh NAME +.Nm zip_errors +.Nd list of all libzip error codes +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Sh DESCRIPTION +The following error codes are used by libzip: +.Bl -tag -width XZIP_ER_COMPRESSED_DATAX +.It Bq Er ZIP_ER_CHANGED +Entry has been changed. +.It Bq Er ZIP_ER_CLOSE +Closing zip archive failed. +.It Bq Er ZIP_ER_COMPNOTSUPP +Compression method not supported. +.It Bq Er ZIP_ER_COMPRESSED_DATA +Compressed data invalid. +.It Bq Er ZIP_ER_CRC +CRC error. +.It Bq Er ZIP_ER_DELETED +Entry has been deleted. +.It Bq Er ZIP_ER_ENCRNOTSUPP +Encryption method not supported. +.It Bq Er ZIP_ER_EOF +Premature end of file. +.It Bq Er ZIP_ER_EXISTS +File already exists. +.It Bq Er ZIP_ER_INCONS +Zip archive inconsistent. +.It Bq Er ZIP_ER_INTERNAL +Internal error. +.It Bq Er ZIP_ER_INUSE +Resource still in use. +.It Bq Er ZIP_ER_INVAL +Invalid argument. +.It Bq Er ZIP_ER_MEMORY +Malloc failure. +.It Bq Er ZIP_ER_MULTIDISK +Multi-disk zip archives not supported. +.It Bq Er ZIP_ER_NOENT +No such file. +.It Bq Er ZIP_ER_NOPASSWD +No password provided. +.It Bq Er ZIP_ER_NOZIP +Not a zip archive. +.It Bq Er ZIP_ER_OK +No error. +.It Bq Er ZIP_ER_OPEN +Can't open file. +.It Bq Er ZIP_ER_OPNOTSUPP +Operation not supported. +.It Bq Er ZIP_ER_RDONLY +Read-only archive. +.It Bq Er ZIP_ER_READ +Read error. +.It Bq Er ZIP_ER_REMOVE +Can't remove file. +.It Bq Er ZIP_ER_RENAME +Renaming temporary file failed. +.It Bq Er ZIP_ER_SEEK +Seek error. +.It Bq Er ZIP_ER_TELL +Tell error. +.It Bq Er ZIP_ER_TMPOPEN +Failure to create temporary file. +.It Bq Er ZIP_ER_WRITE +Write error. +.It Bq Er ZIP_ER_WRONGPASSWD +Wrong password provided. +.It Bq Er ZIP_ER_ZIPCLOSED +Containing zip archive was closed. +.It Bq Er ZIP_ER_ZLIB +Zlib error. +.El +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_fclose.html b/core/deps/libzip/man/zip_fclose.html new file mode 100644 index 000000000..4c5736405 --- /dev/null +++ b/core/deps/libzip/man/zip_fclose.html @@ -0,0 +1,103 @@ + + + + + + + ZIP_FCLOSE(3) + + + + + + + + +
ZIP_FCLOSE(3)Library Functions ManualZIP_FCLOSE(3)
+
+
+

+zip_fclose — +
close file in zip archive
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_fclose(zip_file_t + *file);

+
+
+

+The zip_fclose() function closes + file and frees the memory allocated for it. +
+
+

+Upon successful completion 0 is returned. Otherwise, the error code is returned. +
+
+

+libzip(3), + zip_fopen(3), + zip_fread(3), + zip_fseek(3) +
+
+

+zip_fclose() was added in libzip 0.6. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_fclose.man b/core/deps/libzip/man/zip_fclose.man new file mode 100644 index 000000000..977a7b777 --- /dev/null +++ b/core/deps/libzip/man/zip_fclose.man @@ -0,0 +1,70 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_fclose.mdoc -- close file in zip archive +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FCLOSE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_fclose\fR +\- close file in zip archive +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_fclose\fR(\fIzip_file_t\ *file\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_fclose\fR() +function closes +\fIfile\fR +and frees the memory allocated for it. +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, the error code is returned. +.SH "SEE ALSO" +libzip(3), +zip_fopen(3), +zip_fread(3), +zip_fseek(3) +.SH "HISTORY" +\fBzip_fclose\fR() +was added in libzip 0.6. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_fclose.mdoc b/core/deps/libzip/man/zip_fclose.mdoc new file mode 100644 index 000000000..0bbeee7cd --- /dev/null +++ b/core/deps/libzip/man/zip_fclose.mdoc @@ -0,0 +1,65 @@ +.\" zip_fclose.mdoc -- close file in zip archive +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_FCLOSE 3 +.Os +.Sh NAME +.Nm zip_fclose +.Nd close file in zip archive +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_fclose "zip_file_t *file" +.Sh DESCRIPTION +The +.Fn zip_fclose +function closes +.Ar file +and frees the memory allocated for it. +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, the error code is returned. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_fopen 3 , +.Xr zip_fread 3 , +.Xr zip_fseek 3 +.Sh HISTORY +.Fn zip_fclose +was added in libzip 0.6. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_fdopen.html b/core/deps/libzip/man/zip_fdopen.html new file mode 100644 index 000000000..7cbb6adb2 --- /dev/null +++ b/core/deps/libzip/man/zip_fdopen.html @@ -0,0 +1,154 @@ + + + + + + + ZIP_FDOPEN(3) + + + + + + + + +
ZIP_FDOPEN(3)Library Functions ManualZIP_FDOPEN(3)
+
+
+

+zip_fdopen — +
open zip archive using open file descriptor
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_t * +
+ zip_fdopen(int + fd, int flags, + int *errorp);

+
+
+

+The zip archive specified by the open file descriptor fd + is opened and a pointer to a struct zip, used to + manipulate the archive, is returned. In contrast to + zip_open(3), using + zip_fdopen the archive can only be opened in read-only + mode. The fd argument may not be used any longer after + calling zip_fdopen. The flags + are specified by or'ing the + following values, or 0 for none of them. +
+
+
+
Perform additional stricter consistency checks on the archive, and error + if they fail.
+
+
+

If an error occurs and errorp is + non-NULL, it will be set to + the corresponding error code.

+
+
+

+Upon successful completion zip_fdopen() returns a + struct zip pointer, and fd should + not be used any longer, nor passed to + close(2). Otherwise, + NULL is returned and *errorp is + set to indicate the error. In the error case, fd remains + unchanged. +
+
+

+The file specified by fd is prepared for use by + libzip(3) unless: +
+
[]
+
Inconsistencies were found in the file specified by + path. This error is often caused by specifying + ZIP_CHECKCONS but can also happen without it.
+
[]
+
The flags argument is invalid. Not all + zip_open(3) flags are allowed for + zip_fdopen, see + DESCRIPTION.
+
[]
+
Required memory could not be allocated.
+
[]
+
The file specified by fd is not a zip archive.
+
[]
+
The file specified by fd could not be prepared for + use by libzip(3).
+
[]
+
A read error occurred; see errno for details.
+
[]
+
The file specified by fd does not allow seeks.
+
+
+
+

+libzip(3), + zip_close(3), + zip_error_strerror(3), + zip_open(3) +
+
+

+zip_fdopen() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_fdopen.man b/core/deps/libzip/man/zip_fdopen.man new file mode 100644 index 000000000..359e5ce8f --- /dev/null +++ b/core/deps/libzip/man/zip_fdopen.man @@ -0,0 +1,158 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_fdopen.mdoc -- open zip archive using existing file descriptor +.\" Copyright (C) 2009-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FDOPEN" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_fdopen\fR +\- open zip archive using open file descriptor +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_fdopen\fR(\fIint\ fd\fR, \fIint\ flags\fR, \fIint\ *errorp\fR); +.PD +.SH "DESCRIPTION" +The zip archive specified by the open file descriptor +\fIfd\fR +is opened and a pointer to a +\fIstruct zip\fR, +used to manipulate the archive, is returned. +In contrast to +zip_open(3), +using +\fBzip_fdopen\fR +the archive can only be opened in read-only mode. +The +\fIfd\fR +argument may not be used any longer after calling +\fBzip_fdopen\fR. +The +\fIflags\fR +are specified by +\fIor\fR'ing +the following values, or 0 for none of them. +.RS 6n +.TP 15n +\fRZIP_CHECKCONS\fR +Perform additional stricter consistency checks on the archive, and +error if they fail. +.RE +.PP +If an error occurs and +\fIerrorp\fR +is +non-\fRNULL\fR, +it will be set to the corresponding error code. +.SH "RETURN VALUES" +Upon successful completion +\fBzip_fdopen\fR() +returns a +\fIstruct zip\fR +pointer, and +\fIfd\fR +should not be used any longer, nor passed to +close(2). +Otherwise, +\fRNULL\fR +is returned and +\fI*errorp\fR +is set to indicate the error. +In the error case, +\fIfd\fR +remains unchanged. +.SH "ERRORS" +The file specified by +\fIfd\fR +is prepared for use by +libzip(3) +unless: +.TP 19n +[\fRZIP_ER_INCONS\fR] +Inconsistencies were found in the file specified by +\fIpath\fR. +This error is often caused by specifying +\fRZIP_CHECKCONS\fR +but can also happen without it. +.TP 19n +[\fRZIP_ER_INVAL\fR] +The +\fIflags\fR +argument is invalid. +Not all +zip_open(3) +flags are allowed for +\fBzip_fdopen\fR, +see +\fIDESCRIPTION\fR. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.TP 19n +[\fRZIP_ER_NOZIP\fR] +The file specified by +\fIfd\fR +is not a zip archive. +.TP 19n +[\fRZIP_ER_OPEN\fR] +The file specified by +\fIfd\fR +could not be prepared for use by +libzip(3). +.TP 19n +[\fRZIP_ER_READ\fR] +A read error occurred; see +\fIerrno\fR +for details. +.TP 19n +[\fRZIP_ER_SEEK\fR] +The file specified by +\fIfd\fR +does not allow seeks. +.SH "SEE ALSO" +libzip(3), +zip_close(3), +zip_error_strerror(3), +zip_open(3) +.SH "HISTORY" +\fBzip_fdopen\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_fdopen.mdoc b/core/deps/libzip/man/zip_fdopen.mdoc new file mode 100644 index 000000000..80ccca083 --- /dev/null +++ b/core/deps/libzip/man/zip_fdopen.mdoc @@ -0,0 +1,147 @@ +.\" zip_fdopen.mdoc -- open zip archive using existing file descriptor +.\" Copyright (C) 2009-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_FDOPEN 3 +.Os +.Sh NAME +.Nm zip_fdopen +.Nd open zip archive using open file descriptor +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_t * +.Fn zip_fdopen "int fd" "int flags" "int *errorp" +.Sh DESCRIPTION +The zip archive specified by the open file descriptor +.Ar fd +is opened and a pointer to a +.Ft struct zip , +used to manipulate the archive, is returned. +In contrast to +.Xr zip_open 3 , +using +.Nm zip_fdopen +the archive can only be opened in read-only mode. +The +.Ar fd +argument may not be used any longer after calling +.Nm zip_fdopen . +The +.Fa flags +are specified by +.Em or Ns No 'ing +the following values, or 0 for none of them. +.Bl -tag -offset indent -width ZIP_CHECKCONS +.It Dv ZIP_CHECKCONS +Perform additional stricter consistency checks on the archive, and +error if they fail. +.El +.Pp +If an error occurs and +.Ar errorp +is +.No non- Ns Dv NULL , +it will be set to the corresponding error code. +.Sh RETURN VALUES +Upon successful completion +.Fn zip_fdopen +returns a +.Ft struct zip +pointer, and +.Ar fd +should not be used any longer, nor passed to +.Xr close 2 . +Otherwise, +.Dv NULL +is returned and +.Ar *errorp +is set to indicate the error. +In the error case, +.Ar fd +remains unchanged. +.Sh ERRORS +The file specified by +.Ar fd +is prepared for use by +.Xr libzip 3 +unless: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INCONS +Inconsistencies were found in the file specified by +.Ar path . +This error is often caused by specifying +.Dv ZIP_CHECKCONS +but can also happen without it. +.It Bq Er ZIP_ER_INVAL +The +.Ar flags +argument is invalid. +Not all +.Xr zip_open 3 +flags are allowed for +.Nm zip_fdopen , +see +.Sx DESCRIPTION . +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.It Bq Er ZIP_ER_NOZIP +The file specified by +.Ar fd +is not a zip archive. +.It Bq Er ZIP_ER_OPEN +The file specified by +.Ar fd +could not be prepared for use by +.Xr libzip 3 . +.It Bq Er ZIP_ER_READ +A read error occurred; see +.Va errno +for details. +.It Bq Er ZIP_ER_SEEK +The file specified by +.Ar fd +does not allow seeks. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_close 3 , +.Xr zip_error_strerror 3 , +.Xr zip_open 3 +.Sh HISTORY +.Fn zip_fdopen +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_file_add.html b/core/deps/libzip/man/zip_file_add.html new file mode 100644 index 000000000..162faeea3 --- /dev/null +++ b/core/deps/libzip/man/zip_file_add.html @@ -0,0 +1,178 @@ + + + + + + + ZIP_FILE_ADD(3) + + + + + + + + +
ZIP_FILE_ADD(3)Library Functions ManualZIP_FILE_ADD(3)
+
+
+

+zip_file_add, zip_file_replace + — +
add file to zip archive or replace file in zip archive
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int64_t +
+ zip_file_add(zip_t + *archive, const char + *name, zip_source_t + *source, zip_flags_t + flags);

+

int +
+ zip_file_replace(zip_t + *archive, zip_uint64_t + index, zip_source_t + *source, zip_flags_t + flags);

+
+
+

+The function zip_file_add() adds a file to a zip + archive, while zip_file_replace() replaces an existing + file in a zip archive. The argument archive specifies + the zip archive to which the file should be added. name + is the file's name in the zip archive (for + zip_file_add()), while index + specifies which file should be replaced (for + zip_file_replace()). The flags + argument can be any combination of ZIP_FL_OVERWRITE + with one of ZIP_FL_ENC_*: +
+
+
Overwrite any existing file of the same name. For + zip_file_add only.
+
+
Guess encoding of name (default). (Only CP-437 and + UTF-8 are recognized.)
+
+
Interpret name as UTF-8.
+
+
Interpret name as code page 437 (CP-437).
+
+The data is obtained from the source argument, see + zip_source(3). +

NOTE: + zip_source_free(3) should not + be called on a source after it was used successfully + in a zip_file_add or + zip_file_replace call.

+
+
+

+Upon successful completion, zip_file_add() returns the + index of the new file in the archive, and + zip_file_replace() returns 0. Otherwise, -1 is + returned and the error code in archive is set to + indicate the error. +
+
+

+
+
+zip_source_t *s;
+const char buf[]="teststring";
+
+if ((s=zip_source_buffer(archive, buf, sizeof(buf), 0)) == NULL ||
+    zip_file_add(archive, name, s, ZIP_FL_ENC_UTF_8) < 0) {
+    zip_source_free(s);
+    printf("error adding file: %s\n", zip_strerror(archive));
+}
+
+
+
+
+

+zip_file_add() and + zip_file_replace() fail if: +
+
[]
+
There is already a file called name in the archive. + (Only applies to zip_file_add(), and only if + ZIP_FL_OVERWRITE is not provided).
+
[]
+
source or name are + NULL, or index is + invalid.
+
[]
+
Required memory could not be allocated.
+
[]
+
Archive was opened in read-only mode.
+
+
+
+

+libzip(3), + zip_source(3) +
+
+

+zip_file_add() and + zip_file_replace() were added in libzip 0.11. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
September 22, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_file_add.man b/core/deps/libzip/man/zip_file_add.man new file mode 100644 index 000000000..7962b2ef6 --- /dev/null +++ b/core/deps/libzip/man/zip_file_add.man @@ -0,0 +1,183 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_file_add.mdoc -- add files to zip archive +.\" Copyright (C) 2004-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FILE_ADD" "3" "September 22, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_file_add\fR, +\fBzip_file_replace\fR +\- add file to zip archive or replace file in zip archive +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int64_t\fR +.br +.PD 0 +.HP 4n +\fBzip_file_add\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *name\fR, \fIzip_source_t\ *source\fR, \fIzip_flags_t\ flags\fR); +.PD +.PP +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_file_replace\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_source_t\ *source\fR, \fIzip_flags_t\ flags\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_file_add\fR() +adds a file to a zip archive, while +\fBzip_file_replace\fR() +replaces an existing file in a zip archive. +The argument +\fIarchive\fR +specifies the zip archive to which the file should be added. +\fIname\fR +is the file's name in the zip archive (for +\fBzip_file_add\fR()), +while +\fIindex\fR +specifies which file should be replaced (for +\fBzip_file_replace\fR()). +The +\fIflags\fR +argument can be any combination of +\fRZIP_FL_OVERWRITE\fR +with one of +\fRZIP_FL_ENC_*\fR: +.TP 22n +\fRZIP_FL_OVERWRITE\fR +Overwrite any existing file of the same name. +For +\fBzip_file_add\fR +only. +.TP 22n +\fRZIP_FL_ENC_GUESS\fR +Guess encoding of +\fIname\fR +(default). +(Only CP-437 and UTF-8 are recognized.) +.TP 22n +\fRZIP_FL_ENC_UTF_8\fR +Interpret +\fIname\fR +as UTF-8. +.TP 22n +\fRZIP_FL_ENC_CP437\fR +Interpret +\fIname\fR +as code page 437 (CP-437). +.PD 0 +.PP +The data is obtained from the +\fIsource\fR +argument, see +zip_source(3). +.PD +.PP +\fINOTE\fR: +zip_source_free(3) +should not be called on a +\fIsource\fR +after it was used successfully in a +\fBzip_file_add\fR +or +\fBzip_file_replace\fR +call. +.SH "RETURN VALUES" +Upon successful completion, +\fBzip_file_add\fR() +returns the index of the new file in the archive, and +\fBzip_file_replace\fR() +returns 0. +Otherwise, \-1 is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "EXAMPLES" +.nf +.RS 6n +zip_source_t *s; +const char buf[]="teststring"; + +if ((s=zip_source_buffer(archive, buf, sizeof(buf), 0)) == NULL || + zip_file_add(archive, name, s, ZIP_FL_ENC_UTF_8) < 0) { + zip_source_free(s); + printf("error adding file: %s\en", zip_strerror(archive)); +} +.RE +.fi +.SH "ERRORS" +\fBzip_file_add\fR() +and +\fBzip_file_replace\fR() +fail if: +.TP 19n +[\fRZIP_ER_EXISTS\fR] +There is already a file called +\fIname\fR +in the archive. +(Only applies to +\fBzip_file_add\fR(), +and only if +\fRZIP_FL_OVERWRITE\fR +is not provided). +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIsource\fR +or +\fIname\fR +are +\fRNULL\fR, +or +\fIindex\fR +is invalid. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.TP 19n +[\fRZIP_ER_RDONLY\fR] +Archive was opened in read-only mode. +.SH "SEE ALSO" +libzip(3), +zip_source(3) +.SH "HISTORY" +\fBzip_file_add\fR() +and +\fBzip_file_replace\fR() +were added in libzip 0.11. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_file_add.mdoc b/core/deps/libzip/man/zip_file_add.mdoc new file mode 100644 index 000000000..1492dea01 --- /dev/null +++ b/core/deps/libzip/man/zip_file_add.mdoc @@ -0,0 +1,164 @@ +.\" zip_file_add.mdoc -- add files to zip archive +.\" Copyright (C) 2004-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 22, 2020 +.Dt ZIP_FILE_ADD 3 +.Os +.Sh NAME +.Nm zip_file_add , +.Nm zip_file_replace +.Nd add file to zip archive or replace file in zip archive +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int64_t +.Fn zip_file_add "zip_t *archive" "const char *name" "zip_source_t *source" "zip_flags_t flags" +.Ft int +.Fn zip_file_replace "zip_t *archive" "zip_uint64_t index" "zip_source_t *source" "zip_flags_t flags" +.Sh DESCRIPTION +The function +.Fn zip_file_add +adds a file to a zip archive, while +.Fn zip_file_replace +replaces an existing file in a zip archive. +The argument +.Ar archive +specifies the zip archive to which the file should be added. +.Ar name +is the file's name in the zip archive (for +.Fn zip_file_add ) , +while +.Ar index +specifies which file should be replaced (for +.Fn zip_file_replace ) . +The +.Ar flags +argument can be any combination of +.Dv ZIP_FL_OVERWRITE +with one of +.Dv ZIP_FL_ENC_* : +.Bl -tag -width XZIPXFLXENCXSTRICTXX +.It Dv ZIP_FL_OVERWRITE +Overwrite any existing file of the same name. +For +.Nm zip_file_add +only. +.It Dv ZIP_FL_ENC_GUESS +Guess encoding of +.Ar name +(default). +(Only CP-437 and UTF-8 are recognized.) +.It Dv ZIP_FL_ENC_UTF_8 +Interpret +.Ar name +as UTF-8. +.It Dv ZIP_FL_ENC_CP437 +Interpret +.Ar name +as code page 437 (CP-437). +.El +The data is obtained from the +.Ar source +argument, see +.Xr zip_source 3 . +.Pp +.Em NOTE : +.Xr zip_source_free 3 +should not be called on a +.Ar source +after it was used successfully in a +.Nm zip_file_add +or +.Nm zip_file_replace +call. +.Sh RETURN VALUES +Upon successful completion, +.Fn zip_file_add +returns the index of the new file in the archive, and +.Fn zip_file_replace +returns 0. +Otherwise, \-1 is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh EXAMPLES +.Bd -literal -offset indent +zip_source_t *s; +const char buf[]="teststring"; + +if ((s=zip_source_buffer(archive, buf, sizeof(buf), 0)) == NULL || + zip_file_add(archive, name, s, ZIP_FL_ENC_UTF_8) < 0) { + zip_source_free(s); + printf("error adding file: %s\en", zip_strerror(archive)); +} +.Ed +.Sh ERRORS +.Fn zip_file_add +and +.Fn zip_file_replace +fail if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_EXISTS +There is already a file called +.Ar name +in the archive. +(Only applies to +.Fn zip_file_add , +and only if +.Dv ZIP_FL_OVERWRITE +is not provided). +.It Bq Er ZIP_ER_INVAL +.Ar source +or +.Ar name +are +.Dv NULL , +or +.Ar index +is invalid. +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.It Bq Er ZIP_ER_RDONLY +Archive was opened in read-only mode. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 +.Sh HISTORY +.Fn zip_file_add +and +.Fn zip_file_replace +were added in libzip 0.11. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_file_attributes_init.html b/core/deps/libzip/man/zip_file_attributes_init.html new file mode 100644 index 000000000..14f31db0b --- /dev/null +++ b/core/deps/libzip/man/zip_file_attributes_init.html @@ -0,0 +1,97 @@ + + + + + + + ZIP_FILE_ATTRIBUTES_INIT(3) + + + + + + + + +
ZIP_FILE_ATTRIBUTES_INIT(3)Library Functions ManualZIP_FILE_ATTRIBUTES_INIT(3)
+
+
+

+zip_file_attributes_init — +
initialize zip file attributes structure
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

void +
+ zip_file_attributes_init(zip_file_attributes_t + *attributes);

+
+
+

+The zip_file_attributes_init() initializes a + zip_file_attributes_t structure with default values. It + must be called before modifying such a structure for the first time. +
+
+

+libzip(3), + zip_source_function(3) +
+
+

+zip_file_attributes_init() was added in libzip 1.7.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
April 17, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_file_attributes_init.man b/core/deps/libzip/man/zip_file_attributes_init.man new file mode 100644 index 000000000..ca28199cb --- /dev/null +++ b/core/deps/libzip/man/zip_file_attributes_init.man @@ -0,0 +1,66 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_file_attributes_init.mdoc -- initialize attributes structure +.\" Copyright (C) 2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FILE_ATTRIBUTES_INIT" "3" "April 17, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_file_attributes_init\fR +\- initialize zip file attributes structure +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_file_attributes_init\fR(\fIzip_file_attributes_t\ *attributes\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_file_attributes_init\fR() +initializes a +\fIzip_file_attributes_t\fR +structure with default values. +It must be called before modifying such a structure for the first time. +.SH "SEE ALSO" +libzip(3), +zip_source_function(3) +.SH "HISTORY" +\fBzip_file_attributes_init\fR() +was added in libzip 1.7.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_file_attributes_init.mdoc b/core/deps/libzip/man/zip_file_attributes_init.mdoc new file mode 100644 index 000000000..7a5e06c60 --- /dev/null +++ b/core/deps/libzip/man/zip_file_attributes_init.mdoc @@ -0,0 +1,61 @@ +.\" zip_file_attributes_init.mdoc -- initialize attributes structure +.\" Copyright (C) 2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd April 17, 2020 +.Dt ZIP_FILE_ATTRIBUTES_INIT 3 +.Os +.Sh NAME +.Nm zip_file_attributes_init +.Nd initialize zip file attributes structure +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft void +.Fn zip_file_attributes_init "zip_file_attributes_t *attributes" +.Sh DESCRIPTION +The +.Fn zip_file_attributes_init +initializes a +.Vt zip_file_attributes_t +structure with default values. +It must be called before modifying such a structure for the first time. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source_function 3 +.Sh HISTORY +.Fn zip_file_attributes_init +was added in libzip 1.7.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_file_extra_field_delete.html b/core/deps/libzip/man/zip_file_extra_field_delete.html new file mode 100644 index 000000000..fb6715900 --- /dev/null +++ b/core/deps/libzip/man/zip_file_extra_field_delete.html @@ -0,0 +1,159 @@ + + + + + + + ZIP_FILE_EXTRA_FIELD_DELETE(3) + + + + + + + + +
ZIP_FILE_EXTRA_FIELD_DELETE(3)Library Functions ManualZIP_FILE_EXTRA_FIELD_DELETE(3)
+
+
+

+zip_file_extra_field_delete, + zip_file_extra_field_delete_by_id — +
delete extra field for file in zip
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_file_extra_field_delete(zip_t + *archive, zip_uint64_t + index, zip_uint16_t + extra_field_index, + zip_flags_t flags);

+

int +
+ zip_file_extra_field_delete_by_id(zip_t + *archive, zip_uint64_t + index, zip_uint16_t + extra_field_id, + zip_uint16_t + extra_field_index, + zip_flags_t flags);

+
+
+

+The zip_file_extra_field_delete() function deletes the + extra field with index extra_field_index for the file at + position index in the zip archive. +

If extra_field_index is + ZIP_EXTRA_FIELD_ALL, then all extra fields will be + deleted.

+

The following flags are supported:

+
+
+
+
Delete extra fields from the archive's central directory.
+
+
Delete extra fields from the local file headers.
+
+
+

The zip_file_extra_field_delete_by_id() + function deletes the extra field with ID (two-byte signature) + extra_field_id and index + extra_field_index (in other words, the + extra_field_index'th extra + field with ID extra_field_id) The other arguments are + the same as for zip_file_extra_field_delete() + (ZIP_EXTRA_FIELD_ALL will delete all extra fields of + the specified ID).

+

Please note that due to the library design, the index of an extra + field may be different between central directory and local file headers. For + this reason, it is not allowed to specify both + ZIP_FL_CENTRAL and + ZIP_FL_LOCAL in flags, except + when deleting all extra fields (i.e., + extra_field_index being + ZIP_EXTRA_FIELD_ALL).

+
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error code in archive is set to indicate the error. +
+
+

+zip_file_extra_field_delete() and + zip_file_extra_field_delete_by_id() fail if: +
+
[]
+
index is not a valid file index in + archive.
+
+
+
+

+libzip(3), + zip_file_extra_field_get(3), + zip_file_extra_field_set(3), + zip_file_extra_fields_count(3) +
+
+

+zip_file_extra_field_delete() and + zip_file_extra_field_delete_by_id() were added in + libzip 0.11. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_file_extra_field_delete.man b/core/deps/libzip/man/zip_file_extra_field_delete.man new file mode 100644 index 000000000..ccc5071d7 --- /dev/null +++ b/core/deps/libzip/man/zip_file_extra_field_delete.man @@ -0,0 +1,141 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_file_extra_field_delete.mdoc -- delete extra field for file in zip +.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FILE_EXTRA_FIELD_DELETE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_file_extra_field_delete\fR, +\fBzip_file_extra_field_delete_by_id\fR +\- delete extra field for file in zip +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_file_extra_field_delete\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_index\fR, \fIzip_flags_t\ flags\fR); +.PD +.PP +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_file_extra_field_delete_by_id\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_id\fR, \fIzip_uint16_t\ extra_field_index\fR, \fIzip_flags_t\ flags\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_file_extra_field_delete\fR() +function deletes the extra field with index +\fIextra_field_index\fR +for the file at position +\fIindex\fR +in the zip archive. +.PP +If +\fIextra_field_index\fR +is +\fRZIP_EXTRA_FIELD_ALL\fR, +then all extra fields will be deleted. +.PP +The following +\fIflags\fR +are supported: +.RS 6n +.TP 18n +\fRZIP_FL_CENTRAL\fR +Delete extra fields from the archive's central directory. +.TP 18n +\fRZIP_FL_LOCAL\fR +Delete extra fields from the local file headers. +.RE +.PP +The +\fBzip_file_extra_field_delete_by_id\fR() +function deletes the extra field with ID (two-byte signature) +\fIextra_field_id\fR +and index +\fIextra_field_index\fR +(in other words, the +\fIextra_field_index\fR'th +extra field with ID +\fIextra_field_id\fR) +The other arguments are the same as for +\fBzip_file_extra_field_delete\fR() +(\fRZIP_EXTRA_FIELD_ALL\fR +will delete all extra fields of the specified ID). +.PP +Please note that due to the library design, the index of an extra +field may be different between central directory and local file +headers. +For this reason, it is not allowed to specify both +\fRZIP_FL_CENTRAL\fR +and +\fRZIP_FL_LOCAL\fR +in +\fIflags\fR, +except when deleting all extra fields (i.e., +\fIextra_field_index\fR +being +\fRZIP_EXTRA_FIELD_ALL\fR). +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_file_extra_field_delete\fR() +and +\fBzip_file_extra_field_delete_by_id\fR() +fail if: +.TP 19n +[\fRZIP_ER_NOENT\fR] +\fIindex\fR +is not a valid file index in +\fIarchive\fR. +.SH "SEE ALSO" +libzip(3), +zip_file_extra_field_get(3), +zip_file_extra_field_set(3), +zip_file_extra_fields_count(3) +.SH "HISTORY" +\fBzip_file_extra_field_delete\fR() +and +\fBzip_file_extra_field_delete_by_id\fR() +were added in libzip 0.11. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_file_extra_field_delete.mdoc b/core/deps/libzip/man/zip_file_extra_field_delete.mdoc new file mode 100644 index 000000000..005e7470b --- /dev/null +++ b/core/deps/libzip/man/zip_file_extra_field_delete.mdoc @@ -0,0 +1,130 @@ +.\" zip_file_extra_field_delete.mdoc -- delete extra field for file in zip +.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_FILE_EXTRA_FIELD_DELETE 3 +.Os +.Sh NAME +.Nm zip_file_extra_field_delete , +.Nm zip_file_extra_field_delete_by_id +.Nd delete extra field for file in zip +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_file_extra_field_delete "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_index" "zip_flags_t flags" +.Ft int +.Fn zip_file_extra_field_delete_by_id "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_id" "zip_uint16_t extra_field_index" "zip_flags_t flags" +.Sh DESCRIPTION +The +.Fn zip_file_extra_field_delete +function deletes the extra field with index +.Ar extra_field_index +for the file at position +.Ar index +in the zip archive. +.Pp +If +.Ar extra_field_index +is +.Dv ZIP_EXTRA_FIELD_ALL , +then all extra fields will be deleted. +.Pp +The following +.Ar flags +are supported: +.Bl -tag -width ZIP_FL_CENTRALXX -offset indent +.It Dv ZIP_FL_CENTRAL +Delete extra fields from the archive's central directory. +.It Dv ZIP_FL_LOCAL +Delete extra fields from the local file headers. +.El +.Pp +The +.Fn zip_file_extra_field_delete_by_id +function deletes the extra field with ID (two-byte signature) +.Ar extra_field_id +and index +.Ar extra_field_index +(in other words, the +.Ar extra_field_index Ns No 'th +extra field with ID +.Ar extra_field_id ) +The other arguments are the same as for +.Fn zip_file_extra_field_delete +.Dv ( ZIP_EXTRA_FIELD_ALL +will delete all extra fields of the specified ID). +.Pp +Please note that due to the library design, the index of an extra +field may be different between central directory and local file +headers. +For this reason, it is not allowed to specify both +.Dv ZIP_FL_CENTRAL +and +.Dv ZIP_FL_LOCAL +in +.Ar flags , +except when deleting all extra fields (i.e., +.Ar extra_field_index +being +.Dv ZIP_EXTRA_FIELD_ALL ) . +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_file_extra_field_delete +and +.Fn zip_file_extra_field_delete_by_id +fail if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_NOENT +.Ar index +is not a valid file index in +.Ar archive . +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_extra_field_get 3 , +.Xr zip_file_extra_field_set 3 , +.Xr zip_file_extra_fields_count 3 +.Sh HISTORY +.Fn zip_file_extra_field_delete +and +.Fn zip_file_extra_field_delete_by_id +were added in libzip 0.11. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_file_extra_field_get.html b/core/deps/libzip/man/zip_file_extra_field_get.html new file mode 100644 index 000000000..0d7b305d6 --- /dev/null +++ b/core/deps/libzip/man/zip_file_extra_field_get.html @@ -0,0 +1,176 @@ + + + + + + + ZIP_FILE_EXTRA_FIELD_GET(3) + + + + + + + + +
ZIP_FILE_EXTRA_FIELD_GET(3)Library Functions ManualZIP_FILE_EXTRA_FIELD_GET(3)
+
+
+

+zip_file_extra_field_get, + zip_file_extra_field_get_by_id — +
get extra field for file in zip
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

const zip_uint8_t * +
+ zip_file_extra_field_get(zip_t + *archive, zip_uint64_t + index, zip_uint16_t + extra_field_index, + zip_uint16_t *idp, + zip_uint16_t *lenp, + zip_flags_t flags);

+

const zip_uint8_t * +
+ zip_file_extra_field_get_by_id(zip_t + *archive, zip_uint64_t + index, zip_uint16_t + extra_field_id, + zip_uint16_t + extra_field_index, + zip_uint16_t *lenp, + zip_flags_t flags);

+
+
+

+The zip_file_extra_field_get() function returns the + extra field with index extra_field_index for the file at + position index in the zip archive. This pointer should + not be modified or free(3)'d, and becomes + invalid when archive is closed. If + idp is not NULL, the integer to + which it points will be set to the ID (two-byte signature) of the selected + extra field. If lenp is not + NULL, the integer to which it points will be set to + the length of the extra field. Generally speaking, lenp + and idp should be passed since only the extra field data + is returned (i.e., neither the ID nor the length, if the + idp and lenp arguments are not + provided). +

The following flags are supported:

+
+
+
+
Return extra fields from the archive's central directory.
+
+
Return extra fields from the local file headers.
+
+
Return the original unchanged extra fields, ignoring any changes + made.
+
+
+

The zip_file_extra_field_get_by_id() + function returns the extra field with ID (two-byte signature) + extra_field_id and index + extra_field_index (in other words, the + extra_field_index'th extra + field with ID extra_field_id) The other arguments are + the same as for zip_file_extra_field_get().

+
+
+

+Upon successful completion, a pointer to an extra field is returned, or + NULL if there is no extra field with that + extra_field_index for the file with index + index. In case of an error, NULL + is returned and the error code in archive is set to + indicate the error. +
+
+

+zip_file_extra_field_get() and + zip_file_extra_field_get_by_id() fail if: +
+
[]
+
index is not a valid file index in + archive, or extra_field_index + is not a valid extra file index (for ID + extra_field_id).
+
+
+
+

+libzip(3), + zip_file_extra_field_delete(3), + zip_file_extra_field_set(3), + zip_file_extra_fields_count(3) +
+
+

+zip_file_extra_field_get() and + zip_file_extra_field_get_by_id() were added in libzip + 0.11. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+

+Please note that the extra field IDs 0x0001 (ZIP64 extension), 0x6375 (Infozip + UTF-8 comment), and 0x7075 (Infozip UTF-8 file name) can not be read using + zip_file_extra_field_get() since they are used by + libzip(3) internally. +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_file_extra_field_get.man b/core/deps/libzip/man/zip_file_extra_field_get.man new file mode 100644 index 000000000..39c54284f --- /dev/null +++ b/core/deps/libzip/man/zip_file_extra_field_get.man @@ -0,0 +1,169 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_file_extra_field_get.mdoc -- get extra field for file in zip +.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FILE_EXTRA_FIELD_GET" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_file_extra_field_get\fR, +\fBzip_file_extra_field_get_by_id\fR +\- get extra field for file in zip +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIconst zip_uint8_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_file_extra_field_get\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_index\fR, \fIzip_uint16_t\ *idp\fR, \fIzip_uint16_t\ *lenp\fR, \fIzip_flags_t\ flags\fR); +.PD +.PP +\fIconst zip_uint8_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_file_extra_field_get_by_id\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_id\fR, \fIzip_uint16_t\ extra_field_index\fR, \fIzip_uint16_t\ *lenp\fR, \fIzip_flags_t\ flags\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_file_extra_field_get\fR() +function returns the extra field with index +\fIextra_field_index\fR +for the file at position +\fIindex\fR +in the zip archive. +This pointer should not be modified or +free(3)'d, +and becomes invalid when +\fIarchive\fR +is closed. +If +\fIidp\fR +is not +\fRNULL\fR, +the integer to which it points will be set to the ID (two-byte +signature) of the selected extra field. +If +\fIlenp\fR +is not +\fRNULL\fR, +the integer to which it points will be set to the length of the +extra field. +Generally speaking, +\fIlenp\fR +and +\fIidp\fR +should be passed since only the extra field data is returned (i.e., +neither the ID nor the length, if the +\fIidp\fR +and +\fIlenp\fR +arguments are not provided). +.PP +The following +\fIflags\fR +are supported: +.RS 6n +.TP 20n +\fRZIP_FL_CENTRAL\fR +Return extra fields from the archive's central directory. +.TP 20n +\fRZIP_FL_LOCAL\fR +Return extra fields from the local file headers. +.TP 20n +\fRZIP_FL_UNCHANGED\fR +Return the original unchanged extra fields, ignoring any changes made. +.RE +.PP +The +\fBzip_file_extra_field_get_by_id\fR() +function returns the extra field with ID (two-byte signature) +\fIextra_field_id\fR +and index +\fIextra_field_index\fR +(in other words, the +\fIextra_field_index\fR'th +extra field with ID +\fIextra_field_id\fR) +The other arguments are the same as for +\fBzip_file_extra_field_get\fR(). +.SH "RETURN VALUES" +Upon successful completion, a pointer to an extra field is returned, +or +\fRNULL\fR +if there is no extra field with that +\fIextra_field_index\fR +for the file with index +\fIindex\fR. +In case of an error, +\fRNULL\fR +is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_file_extra_field_get\fR() +and +\fBzip_file_extra_field_get_by_id\fR() +fail if: +.TP 19n +[\fRZIP_ER_NOENT\fR] +\fIindex\fR +is not a valid file index in +\fIarchive\fR, +or +\fIextra_field_index\fR +is not a valid extra file index (for ID +\fIextra_field_id\fR). +.SH "SEE ALSO" +libzip(3), +zip_file_extra_field_delete(3), +zip_file_extra_field_set(3), +zip_file_extra_fields_count(3) +.SH "HISTORY" +\fBzip_file_extra_field_get\fR() +and +\fBzip_file_extra_field_get_by_id\fR() +were added in libzip 0.11. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> +.SH "CAVEATS" +Please note that the extra field IDs 0x0001 (ZIP64 extension), +0x6375 (Infozip UTF-8 comment), and +0x7075 (Infozip UTF-8 file name) can not be read using +\fBzip_file_extra_field_get\fR() +since they are used by +libzip(3) +internally. diff --git a/core/deps/libzip/man/zip_file_extra_field_get.mdoc b/core/deps/libzip/man/zip_file_extra_field_get.mdoc new file mode 100644 index 000000000..72b2c873b --- /dev/null +++ b/core/deps/libzip/man/zip_file_extra_field_get.mdoc @@ -0,0 +1,157 @@ +.\" zip_file_extra_field_get.mdoc -- get extra field for file in zip +.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_FILE_EXTRA_FIELD_GET 3 +.Os +.Sh NAME +.Nm zip_file_extra_field_get , +.Nm zip_file_extra_field_get_by_id +.Nd get extra field for file in zip +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft const zip_uint8_t * +.Fn zip_file_extra_field_get "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_index" "zip_uint16_t *idp" "zip_uint16_t *lenp" "zip_flags_t flags" +.Ft const zip_uint8_t * +.Fn zip_file_extra_field_get_by_id "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_id" "zip_uint16_t extra_field_index" "zip_uint16_t *lenp" "zip_flags_t flags" +.Sh DESCRIPTION +The +.Fn zip_file_extra_field_get +function returns the extra field with index +.Ar extra_field_index +for the file at position +.Ar index +in the zip archive. +This pointer should not be modified or +.Xr free 3 Ap d , +and becomes invalid when +.Ar archive +is closed. +If +.Ar idp +is not +.Dv NULL , +the integer to which it points will be set to the ID (two-byte +signature) of the selected extra field. +If +.Ar lenp +is not +.Dv NULL , +the integer to which it points will be set to the length of the +extra field. +Generally speaking, +.Ar lenp +and +.Ar idp +should be passed since only the extra field data is returned (i.e., +neither the ID nor the length, if the +.Ar idp +and +.Ar lenp +arguments are not provided). +.Pp +The following +.Ar flags +are supported: +.Bl -tag -width ZIP_FL_UNCHANGEDXX -offset indent +.It Dv ZIP_FL_CENTRAL +Return extra fields from the archive's central directory. +.It Dv ZIP_FL_LOCAL +Return extra fields from the local file headers. +.It Dv ZIP_FL_UNCHANGED +Return the original unchanged extra fields, ignoring any changes made. +.El +.Pp +The +.Fn zip_file_extra_field_get_by_id +function returns the extra field with ID (two-byte signature) +.Ar extra_field_id +and index +.Ar extra_field_index +(in other words, the +.Ar extra_field_index Ns No 'th +extra field with ID +.Ar extra_field_id ) +The other arguments are the same as for +.Fn zip_file_extra_field_get . +.Sh RETURN VALUES +Upon successful completion, a pointer to an extra field is returned, +or +.Dv NULL +if there is no extra field with that +.Ar extra_field_index +for the file with index +.Ar index . +In case of an error, +.Dv NULL +is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_file_extra_field_get +and +.Fn zip_file_extra_field_get_by_id +fail if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_NOENT +.Ar index +is not a valid file index in +.Ar archive , +or +.Ar extra_field_index +is not a valid extra file index (for ID +.Ar extra_field_id ) . +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_extra_field_delete 3 , +.Xr zip_file_extra_field_set 3 , +.Xr zip_file_extra_fields_count 3 +.Sh HISTORY +.Fn zip_file_extra_field_get +and +.Fn zip_file_extra_field_get_by_id +were added in libzip 0.11. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at +.Sh CAVEATS +Please note that the extra field IDs 0x0001 (ZIP64 extension), +0x6375 (Infozip UTF-8 comment), and +0x7075 (Infozip UTF-8 file name) can not be read using +.Fn zip_file_extra_field_get +since they are used by +.Xr libzip 3 +internally. diff --git a/core/deps/libzip/man/zip_file_extra_field_set.html b/core/deps/libzip/man/zip_file_extra_field_set.html new file mode 100644 index 000000000..e9decdb7c --- /dev/null +++ b/core/deps/libzip/man/zip_file_extra_field_set.html @@ -0,0 +1,148 @@ + + + + + + + ZIP_FILE_EXTRA_FIELD_SET(3) + + + + + + + + +
ZIP_FILE_EXTRA_FIELD_SET(3)Library Functions ManualZIP_FILE_EXTRA_FIELD_SET(3)
+
+
+

+zip_file_extra_field_set — +
set extra field for file in zip
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_file_extra_field_set(zip_t + *archive, zip_uint64_t + index, zip_uint16_t + extra_field_id, + zip_uint16_t + extra_field_index, const + zip_uint8_t *extra_field_data, + zip_uint16_t len, + zip_flags_t flags);

+
+
+

+The zip_file_extra_field_set() function sets the extra + field with ID (two-byte signature) extra_field_id and + index extra_field_index for the file at position + index in the zip archive. The extra field's data will be + set to extra_field_data and length + len. If a new entry shall be appended, set + extra_field_index to + ZIP_EXTRA_FIELD_NEW. +

At least one of the following flags must be + set:

+
+
+
+
Set extra field in the archive's central directory.
+
+
Set extra field in the local file headers.
+
+
+

Please note that the extra field IDs 0x0001 (ZIP64 extension), + 0x6375 (Infozip UTF-8 comment), and 0x7075 (Infozip UTF-8 file name) can not + be set using zip_file_extra_field_set() since they + are set by libzip(3) automatically when + needed.

+
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error code in archive is set to indicate the error. +
+
+

+zip_file_extra_field_set() fails if: +
+
[]
+
The extra field size is too large (ID and length need 4 bytes; the maximum + length of all extra fields for one file combined is 65536 bytes). This + error also occurs if extra_field_index is too + large.
+
[]
+
Required memory could not be allocated.
+
[]
+
index is not a valid file index in + archive.
+
+
+
+

+libzip(3), + zip_file_extra_field_delete(3), + zip_file_extra_field_get(3), + zip_file_extra_fields_count(3) +
+
+

+zip_file_extra_field_set() was added in libzip 0.11. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_file_extra_field_set.man b/core/deps/libzip/man/zip_file_extra_field_set.man new file mode 100644 index 000000000..3db94fe43 --- /dev/null +++ b/core/deps/libzip/man/zip_file_extra_field_set.man @@ -0,0 +1,123 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_file_extra_field_set.mdoc -- set extra field for file in zip +.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FILE_EXTRA_FIELD_SET" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_file_extra_field_set\fR +\- set extra field for file in zip +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_file_extra_field_set\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_id\fR, \fIzip_uint16_t\ extra_field_index\fR, \fIconst\ zip_uint8_t\ *extra_field_data\fR, \fIzip_uint16_t\ len\fR, \fIzip_flags_t\ flags\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_file_extra_field_set\fR() +function sets the extra field with ID (two-byte signature) +\fIextra_field_id\fR +and index +\fIextra_field_index\fR +for the file at position +\fIindex\fR +in the zip archive. +The extra field's data will be set to +\fIextra_field_data\fR +and length +\fIlen\fR. +If a new entry shall be appended, set +\fIextra_field_index\fR +to +\fRZIP_EXTRA_FIELD_NEW\fR. +.PP +At least one of the following +\fIflags\fR +must be set: +.RS 6n +.TP 18n +\fRZIP_FL_CENTRAL\fR +Set extra field in the archive's central directory. +.TP 18n +\fRZIP_FL_LOCAL\fR +Set extra field in the local file headers. +.RE +.PP +Please note that the extra field IDs 0x0001 (ZIP64 extension), +0x6375 (Infozip UTF-8 comment), and +0x7075 (Infozip UTF-8 file name) can not be set using +\fBzip_file_extra_field_set\fR() +since they are set by +libzip(3) +automatically when needed. +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_file_extra_field_set\fR() +fails if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +The extra field size is too large (ID and length need 4 bytes; the +maximum length of all extra fields for one file combined is 65536 +bytes). +This error also occurs if +\fIextra_field_index\fR +is too large. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.TP 19n +[\fRZIP_ER_NOENT\fR] +\fIindex\fR +is not a valid file index in +\fIarchive\fR. +.SH "SEE ALSO" +libzip(3), +zip_file_extra_field_delete(3), +zip_file_extra_field_get(3), +zip_file_extra_fields_count(3) +.SH "HISTORY" +\fBzip_file_extra_field_set\fR() +was added in libzip 0.11. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_file_extra_field_set.mdoc b/core/deps/libzip/man/zip_file_extra_field_set.mdoc new file mode 100644 index 000000000..3e6abc116 --- /dev/null +++ b/core/deps/libzip/man/zip_file_extra_field_set.mdoc @@ -0,0 +1,115 @@ +.\" zip_file_extra_field_set.mdoc -- set extra field for file in zip +.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_FILE_EXTRA_FIELD_SET 3 +.Os +.Sh NAME +.Nm zip_file_extra_field_set +.Nd set extra field for file in zip +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_file_extra_field_set "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_id" "zip_uint16_t extra_field_index" "const zip_uint8_t *extra_field_data" "zip_uint16_t len" "zip_flags_t flags" +.Sh DESCRIPTION +The +.Fn zip_file_extra_field_set +function sets the extra field with ID (two-byte signature) +.Ar extra_field_id +and index +.Ar extra_field_index +for the file at position +.Ar index +in the zip archive. +The extra field's data will be set to +.Ar extra_field_data +and length +.Ar len . +If a new entry shall be appended, set +.Ar extra_field_index +to +.Dv ZIP_EXTRA_FIELD_NEW . +.Pp +At least one of the following +.Ar flags +must be set: +.Bl -tag -width ZIP_FL_CENTRALXX -offset indent +.It Dv ZIP_FL_CENTRAL +Set extra field in the archive's central directory. +.It Dv ZIP_FL_LOCAL +Set extra field in the local file headers. +.El +.Pp +Please note that the extra field IDs 0x0001 (ZIP64 extension), +0x6375 (Infozip UTF-8 comment), and +0x7075 (Infozip UTF-8 file name) can not be set using +.Fn zip_file_extra_field_set +since they are set by +.Xr libzip 3 +automatically when needed. +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_file_extra_field_set +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +The extra field size is too large (ID and length need 4 bytes; the +maximum length of all extra fields for one file combined is 65536 +bytes). +This error also occurs if +.Ar extra_field_index +is too large. +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.It Bq Er ZIP_ER_NOENT +.Ar index +is not a valid file index in +.Ar archive . +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_extra_field_delete 3 , +.Xr zip_file_extra_field_get 3 , +.Xr zip_file_extra_fields_count 3 +.Sh HISTORY +.Fn zip_file_extra_field_set +was added in libzip 0.11. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_file_extra_fields_count.html b/core/deps/libzip/man/zip_file_extra_fields_count.html new file mode 100644 index 000000000..591f0215e --- /dev/null +++ b/core/deps/libzip/man/zip_file_extra_fields_count.html @@ -0,0 +1,149 @@ + + + + + + + ZIP_FILE_EXTRA_FIELDS_COUNT(3) + + + + + + + + +
ZIP_FILE_EXTRA_FIELDS_COUNT(3)Library Functions ManualZIP_FILE_EXTRA_FIELDS_COUNT(3)
+
+
+

+zip_file_extra_fields_count, + zip_file_extra_fields_count_by_id — +
count extra fields for file in zip
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int16_t +
+ zip_file_extra_fields_count(zip_t + *archive, zip_uint64_t + index, zip_flags_t + flags);

+

zip_int16_t +
+ zip_file_extra_fields_count_by_id(zip_t + *archive, zip_uint64_t + index, zip_uint16_t + extra_field_id, + zip_flags_t flags);

+
+
+

+The zip_file_extra_fields_count() function counts the + extra fields for the file at position index in the zip + archive. +

The following flags are supported:

+
+
+
+
Count extra fields from the archive's central directory.
+
+
Count extra fields from the local file headers.
+
+
Count the original unchanged extra fields, ignoring any changes made.
+
+
+

The zip_file_extra_fields_count_by_id() + function counts the extra fields with ID (two-byte signature) + extra_field_id. The other arguments are the same as + for zip_file_extra_fields_count().

+

Extra fields that are the same in the central directory and the + local file header are merged into one. Therefore, the counts with + ZIP_FL_CENTRAL and + ZIP_FL_LOCAL do not need to add up to the same value + as when given ZIP_FL_CENTRAL|ZIP_FL_LOCAL at the + same time.

+
+
+

+Upon successful completion, the requested number of extra fields is returned. + Otherwise, -1 is returned and the error code in archive + is set to indicate the error. +
+
+

+zip_file_extra_fields_count() and + zip_file_extra_fields_count_by_id() fail if: +
+
[]
+
index is not a valid file index in + archive.
+
+
+
+

+libzip(3), + zip_file_extra_field_delete(3), + zip_file_extra_field_get(3), + zip_file_extra_field_set(3) +
+
+

+zip_file_extra_fields_count() and + zip_file_extra_fields_count_by_id() were added in + libzip 0.11. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_file_extra_fields_count.man b/core/deps/libzip/man/zip_file_extra_fields_count.man new file mode 100644 index 000000000..35a85e147 --- /dev/null +++ b/core/deps/libzip/man/zip_file_extra_fields_count.man @@ -0,0 +1,124 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_file_extra_fields_count.mdoc -- count extra field for file in zip +.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FILE_EXTRA_FIELDS_COUNT" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_file_extra_fields_count\fR, +\fBzip_file_extra_fields_count_by_id\fR +\- count extra fields for file in zip +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int16_t\fR +.br +.PD 0 +.HP 4n +\fBzip_file_extra_fields_count\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR); +.PD +.PP +\fIzip_int16_t\fR +.br +.PD 0 +.HP 4n +\fBzip_file_extra_fields_count_by_id\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_id\fR, \fIzip_flags_t\ flags\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_file_extra_fields_count\fR() +function counts the extra fields for the file at position +\fIindex\fR +in the zip archive. +.PP +The following +\fIflags\fR +are supported: +.RS 6n +.TP 18n +\fRZIP_FL_CENTRAL\fR +Count extra fields from the archive's central directory. +.TP 18n +\fRZIP_FL_LOCAL\fR +Count extra fields from the local file headers. +.TP 18n +\fRZIP_FL_UNCHANGED\fR +Count the original unchanged extra fields, ignoring any changes made. +.RE +.PP +The +\fBzip_file_extra_fields_count_by_id\fR() +function counts the extra fields with ID (two-byte signature) +\fIextra_field_id\fR. +The other arguments are the same as for +\fBzip_file_extra_fields_count\fR(). +.PP +Extra fields that are the same in the central directory and the local file +header are merged into one. +Therefore, the counts with +\fRZIP_FL_CENTRAL\fR +and +\fRZIP_FL_LOCAL\fR +do not need to add up to the same value as when given +\fRZIP_FL_CENTRAL|ZIP_FL_LOCAL\fR +at the same time. +.SH "RETURN VALUES" +Upon successful completion, the requested number of extra fields is returned. +Otherwise, \-1 is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_file_extra_fields_count\fR() +and +\fBzip_file_extra_fields_count_by_id\fR() +fail if: +.TP 19n +[\fRZIP_ER_NOENT\fR] +\fIindex\fR +is not a valid file index in +\fIarchive\fR. +.SH "SEE ALSO" +libzip(3), +zip_file_extra_field_delete(3), +zip_file_extra_field_get(3), +zip_file_extra_field_set(3) +.SH "HISTORY" +\fBzip_file_extra_fields_count\fR() +and +\fBzip_file_extra_fields_count_by_id\fR() +were added in libzip 0.11. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_file_extra_fields_count.mdoc b/core/deps/libzip/man/zip_file_extra_fields_count.mdoc new file mode 100644 index 000000000..47bb9a3f0 --- /dev/null +++ b/core/deps/libzip/man/zip_file_extra_fields_count.mdoc @@ -0,0 +1,113 @@ +.\" zip_file_extra_fields_count.mdoc -- count extra field for file in zip +.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_FILE_EXTRA_FIELDS_COUNT 3 +.Os +.Sh NAME +.Nm zip_file_extra_fields_count , +.Nm zip_file_extra_fields_count_by_id +.Nd count extra fields for file in zip +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int16_t +.Fn zip_file_extra_fields_count "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags" +.Ft zip_int16_t +.Fn zip_file_extra_fields_count_by_id "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_id" "zip_flags_t flags" +.Sh DESCRIPTION +The +.Fn zip_file_extra_fields_count +function counts the extra fields for the file at position +.Ar index +in the zip archive. +.Pp +The following +.Ar flags +are supported: +.Bl -tag -width ZIP_FL_CENTRALXX -offset indent +.It Dv ZIP_FL_CENTRAL +Count extra fields from the archive's central directory. +.It Dv ZIP_FL_LOCAL +Count extra fields from the local file headers. +.It Dv ZIP_FL_UNCHANGED +Count the original unchanged extra fields, ignoring any changes made. +.El +.Pp +The +.Fn zip_file_extra_fields_count_by_id +function counts the extra fields with ID (two-byte signature) +.Ar extra_field_id . +The other arguments are the same as for +.Fn zip_file_extra_fields_count . +.Pp +Extra fields that are the same in the central directory and the local file +header are merged into one. +Therefore, the counts with +.Dv ZIP_FL_CENTRAL +and +.Dv ZIP_FL_LOCAL +do not need to add up to the same value as when given +.Dv ZIP_FL_CENTRAL|ZIP_FL_LOCAL +at the same time. +.Sh RETURN VALUES +Upon successful completion, the requested number of extra fields is returned. +Otherwise, \-1 is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_file_extra_fields_count +and +.Fn zip_file_extra_fields_count_by_id +fail if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_NOENT +.Ar index +is not a valid file index in +.Ar archive . +.\" TODO: _zip_read_local_ef errors +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_extra_field_delete 3 , +.Xr zip_file_extra_field_get 3 , +.Xr zip_file_extra_field_set 3 +.Sh HISTORY +.Fn zip_file_extra_fields_count +and +.Fn zip_file_extra_fields_count_by_id +were added in libzip 0.11. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_file_get_comment.html b/core/deps/libzip/man/zip_file_get_comment.html new file mode 100644 index 000000000..49de8acfd --- /dev/null +++ b/core/deps/libzip/man/zip_file_get_comment.html @@ -0,0 +1,143 @@ + + + + + + + ZIP_FILE_GET_COMMENT(3) + + + + + + + + +
ZIP_FILE_GET_COMMENT(3)Library Functions ManualZIP_FILE_GET_COMMENT(3)
+
+
+

+zip_file_get_comment — +
get comment for file in zip
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

const char * +
+ zip_file_get_comment(zip_t + *archive, zip_uint64_t + index, zip_uint32_t + *lenp, zip_flags_t + flags);

+
+
+

+The zip_file_get_comment() function returns the comment + for the file at position index in the zip archive. The + name is in UTF-8 encoding unless ZIP_FL_ENC_RAW was + specified (see below). This pointer should not be modified or + free(3)'d, and becomes invalid when + archive is closed. If lenp is not + NULL, the integer to which it points will be set to + the length of the comment. If flags is set to + ZIP_FL_UNCHANGED, the original unchanged comment is + returned. +

Additionally, the following flags are + supported:

+
+
+
+
Return the unmodified comment as it is in the ZIP archive.
+
+
(Default.) Guess the encoding of the comment in the ZIP archive and + convert it to UTF-8, if necessary. (Only CP-437 and UTF-8 are + recognized.)
+
+
Follow the ZIP specification for file names and extend it to file + comments, expecting them to be encoded in CP-437 in the ZIP archive + (except if it is a UTF-8 comment from the special extra field). Convert it + to UTF-8.
+
+
+Note: ASCII is a subset of both CP-437 and UTF-8. +
+
+

+Upon successful completion, a pointer to the comment is returned, or + NULL if there is no comment. In case of an error, + NULL is returned and the error code in + archive is set to indicate the error. +
+
+

+zip_file_get_comment() fails if: +
+
[]
+
index is not a valid file index in + archive.
+
+
+
+

+libzip(3), + zip_file_set_comment(3), + zip_get_archive_comment(3) +
+
+

+zip_file_get_comment() was added in libzip 0.11. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
September 22, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_file_get_comment.man b/core/deps/libzip/man/zip_file_get_comment.man new file mode 100644 index 000000000..67506f7c8 --- /dev/null +++ b/core/deps/libzip/man/zip_file_get_comment.man @@ -0,0 +1,126 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_file_get_comment.mdoc -- get comment for file in zip +.\" Copyright (C) 2006-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FILE_GET_COMMENT" "3" "September 22, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_file_get_comment\fR +\- get comment for file in zip +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIconst char *\fR +.br +.PD 0 +.HP 4n +\fBzip_file_get_comment\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint32_t\ *lenp\fR, \fIzip_flags_t\ flags\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_file_get_comment\fR() +function returns the comment for the file at position +\fIindex\fR +in the zip archive. +The name is in UTF-8 encoding unless +\fRZIP_FL_ENC_RAW\fR +was specified (see below). +This pointer should not be modified or +free(3)'d, +and becomes invalid when +\fIarchive\fR +is closed. +If +\fIlenp\fR +is not +\fRNULL\fR, +the integer to which it points will be set to the length of the +comment. +If +\fIflags\fR +is set to +\fRZIP_FL_UNCHANGED\fR, +the original unchanged comment is returned. +.PP +Additionally, the following +\fIflags\fR +are supported: +.RS 6n +.TP 21n +\fRZIP_FL_ENC_RAW\fR +Return the unmodified comment as it is in the ZIP archive. +.TP 21n +\fRZIP_FL_ENC_GUESS\fR +(Default.) +Guess the encoding of the comment in the ZIP archive and convert it +to UTF-8, if necessary. +(Only CP-437 and UTF-8 are recognized.) +.TP 21n +\fRZIP_FL_ENC_STRICT\fR +Follow the ZIP specification for file names and extend it to file +comments, expecting them to be encoded in CP-437 in the ZIP archive +(except if it is a UTF-8 comment from the special extra field). +Convert it to UTF-8. +.RE +\fINote\fR: +ASCII is a subset of both CP-437 and UTF-8. +.SH "RETURN VALUES" +Upon successful completion, a pointer to the comment is returned, +or +\fRNULL\fR +if there is no comment. +In case of an error, +\fRNULL\fR +is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_file_get_comment\fR() +fails if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIindex\fR +is not a valid file index in +\fIarchive\fR. +.SH "SEE ALSO" +libzip(3), +zip_file_set_comment(3), +zip_get_archive_comment(3) +.SH "HISTORY" +\fBzip_file_get_comment\fR() +was added in libzip 0.11. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_file_get_comment.mdoc b/core/deps/libzip/man/zip_file_get_comment.mdoc new file mode 100644 index 000000000..4722b9ec8 --- /dev/null +++ b/core/deps/libzip/man/zip_file_get_comment.mdoc @@ -0,0 +1,119 @@ +.\" zip_file_get_comment.mdoc -- get comment for file in zip +.\" Copyright (C) 2006-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 22, 2020 +.Dt ZIP_FILE_GET_COMMENT 3 +.Os +.Sh NAME +.Nm zip_file_get_comment +.Nd get comment for file in zip +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft const char * +.Fn zip_file_get_comment "zip_t *archive" "zip_uint64_t index" "zip_uint32_t *lenp" "zip_flags_t flags" +.Sh DESCRIPTION +The +.Fn zip_file_get_comment +function returns the comment for the file at position +.Ar index +in the zip archive. +The name is in UTF-8 encoding unless +.Dv ZIP_FL_ENC_RAW +was specified (see below). +This pointer should not be modified or +.Xr free 3 Ap d , +and becomes invalid when +.Ar archive +is closed. +If +.Ar lenp +is not +.Dv NULL , +the integer to which it points will be set to the length of the +comment. +If +.Ar flags +is set to +.Dv ZIP_FL_UNCHANGED , +the original unchanged comment is returned. +.Pp +Additionally, the following +.Ar flags +are supported: +.Bl -tag -width ZIP_FL_ENC_STRICTXX -offset indent +.It Dv ZIP_FL_ENC_RAW +Return the unmodified comment as it is in the ZIP archive. +.It Dv ZIP_FL_ENC_GUESS +(Default.) +Guess the encoding of the comment in the ZIP archive and convert it +to UTF-8, if necessary. +(Only CP-437 and UTF-8 are recognized.) +.It Dv ZIP_FL_ENC_STRICT +Follow the ZIP specification for file names and extend it to file +comments, expecting them to be encoded in CP-437 in the ZIP archive +(except if it is a UTF-8 comment from the special extra field). +Convert it to UTF-8. +.El +.Em Note : +ASCII is a subset of both CP-437 and UTF-8. +.Sh RETURN VALUES +Upon successful completion, a pointer to the comment is returned, +or +.Dv NULL +if there is no comment. +In case of an error, +.Dv NULL +is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_file_get_comment +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +.Ar index +is not a valid file index in +.Ar archive . +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_set_comment 3 , +.Xr zip_get_archive_comment 3 +.Sh HISTORY +.Fn zip_file_get_comment +was added in libzip 0.11. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_file_get_error.html b/core/deps/libzip/man/zip_file_get_error.html new file mode 100644 index 000000000..d52f83a46 --- /dev/null +++ b/core/deps/libzip/man/zip_file_get_error.html @@ -0,0 +1,95 @@ + + + + + + + ZIP_FILE_GET_ERROR(3) + + + + + + + + +
ZIP_FILE_GET_ERROR(3)Library Functions ManualZIP_FILE_GET_ERROR(3)
+
+
+

+zip_file_get_error — +
extract zip_error from zip_file
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_error_t * +
+ zip_file_get_error(zip_file_t + *zf);

+
+
+

+zip_file_get_error() function returns the zip_error + associated with the zip_file zf. +
+
+

+libzip(3) +
+
+

+zip_file_get_error() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_file_get_error.man b/core/deps/libzip/man/zip_file_get_error.man new file mode 100644 index 000000000..d364ac08f --- /dev/null +++ b/core/deps/libzip/man/zip_file_get_error.man @@ -0,0 +1,62 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_file_get_error.mdoc -- extract zip_error from zip_file +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FILE_GET_ERROR" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_file_get_error\fR +\- extract zip_error from zip_file +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_error_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_file_get_error\fR(\fIzip_file_t\ *zf\fR); +.PD +.SH "DESCRIPTION" +\fBzip_file_get_error\fR() +function returns the zip_error associated with the zip_file +\fIzf\fR. +.SH "SEE ALSO" +libzip(3) +.SH "HISTORY" +\fBzip_file_get_error\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_file_get_error.mdoc b/core/deps/libzip/man/zip_file_get_error.mdoc new file mode 100644 index 000000000..56628a1c7 --- /dev/null +++ b/core/deps/libzip/man/zip_file_get_error.mdoc @@ -0,0 +1,57 @@ +.\" zip_file_get_error.mdoc -- extract zip_error from zip_file +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_FILE_GET_ERROR 3 +.Os +.Sh NAME +.Nm zip_file_get_error +.Nd extract zip_error from zip_file +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_error_t * +.Fn zip_file_get_error "zip_file_t *zf" +.Sh DESCRIPTION +.Fn zip_file_get_error +function returns the zip_error associated with the zip_file +.Ar zf . +.Sh SEE ALSO +.Xr libzip 3 +.Sh HISTORY +.Fn zip_file_get_error +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_file_get_external_attributes.html b/core/deps/libzip/man/zip_file_get_external_attributes.html new file mode 100644 index 000000000..d5ce85919 --- /dev/null +++ b/core/deps/libzip/man/zip_file_get_external_attributes.html @@ -0,0 +1,176 @@ + + + + + + + ZIP_FILE_GET_EXTERNAL_ATTRIBUTES(3) + + + + + + + + +
ZIP_FILE_GET_EXTERNAL_ATTRIBUTES(3)Library Functions ManualZIP_FILE_GET_EXTERNAL_ATTRIBUTES(3)
+
+
+

+zip_file_get_external_attributes — +
get external attributes for file in zip
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_file_get_external_attributes(zip_t + *archive, zip_uint64_t + index, zip_flags_t + flags, zip_uint8_t + *opsys, zip_uint32_t + *attributes);

+
+
+

+The zip_file_get_external_attributes() function returns + the operating system and external attributes for the file at position + index in the zip archive. The external attributes + usually contain the operating system-specific file permissions. If + flags is set to + ZIP_FL_UNCHANGED, the original unchanged values are + returned. If opsys or attributes + are NULL, they are not filled in. +

The following operating systems are defined by the zip + specification:

+ +

The defines above follow the PKWARE Inc. Appnote; please note that + the InfoZIP Appnote has a slightly different mapping.

+
+
+

+Upon successful completion, 0 is returned. In case of an error, + -1 is returned and the error code in + archive is set to indicate the error. +
+
+

+The following code can be used to expand attributes if the + operating system is ZIP_OPSYS_DOS. +
+
+#include <sys/stat.h>
+
+#define FA_RDONLY       0x01            // FILE_ATTRIBUTE_READONLY
+#define FA_DIREC        0x10            // FILE_ATTRIBUTE_DIRECTORY
+
+static mode_t
+_zip_dos_attr2mode(zip_uint32_t attr)
+{
+   mode_t m = S_IRUSR | S_IRGRP | S_IROTH;
+   if (0 == (attr & FA_RDONLY))
+      m |= S_IWUSR | S_IWGRP | S_IWOTH;
+
+   if (attr & FA_DIREC)
+      m = (S_IFDIR | (m & ~S_IFMT)) | S_IXUSR | S_IXGRP | S_IXOTH;
+
+   return m;
+}
+
+
+
+
+

+zip_file_get_external_attributes() fails if: +
+
[]
+
index is not a valid file index in + archive.
+
+
+
+

+libzip(3), + zip_file_set_external_attributes(3) +
+
+

+zip_file_get_external_attributes() was added in libzip + 0.11.2. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_file_get_external_attributes.man b/core/deps/libzip/man/zip_file_get_external_attributes.man new file mode 100644 index 000000000..acd3fbb49 --- /dev/null +++ b/core/deps/libzip/man/zip_file_get_external_attributes.man @@ -0,0 +1,174 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_file_get_external_attributes.mdoc -- get external attributes for file in zip +.\" Copyright (C) 2013-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FILE_GET_EXTERNAL_ATTRIBUTES" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_file_get_external_attributes\fR +\- get external attributes for file in zip +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_file_get_external_attributes\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR, \fIzip_uint8_t\ *opsys\fR, \fIzip_uint32_t\ *attributes\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_file_get_external_attributes\fR() +function returns the operating system and external attributes for the +file at position +\fIindex\fR +in the zip archive. +The external attributes usually contain the operating system-specific +file permissions. +If +\fIflags\fR +is set to +\fRZIP_FL_UNCHANGED\fR, +the original unchanged values are returned. +If +\fIopsys\fR +or +\fIattributes\fR +are +\fRNULL\fR, +they are not filled in. +.PP +The following operating systems are defined by the zip specification: +.RS 6n +.PD 0 +.PP +\fRZIP_OPSYS_ACORN_RISC\fR +.PP +\fRZIP_OPSYS_ALTERNATE_MVS\fR +.PP +\fRZIP_OPSYS_AMIGA\fR +.PP +\fRZIP_OPSYS_ATARI_ST\fR +.PP +\fRZIP_OPSYS_BEOS\fR +.PP +\fRZIP_OPSYS_CPM\fR +.PP +\fRZIP_OPSYS_DOS\fR +.PP +\fRZIP_OPSYS_MACINTOSH\fR +.PP +\fRZIP_OPSYS_MVS\fR +.PP +\fRZIP_OPSYS_OPENVMS\fR +.PP +\fRZIP_OPSYS_OS_2\fR +.PP +\fRZIP_OPSYS_OS_400\fR +.PP +\fRZIP_OPSYS_OS_X\fR +.PP +\fRZIP_OPSYS_TANDEM\fR +.PP +\fRZIP_OPSYS_UNIX\fR +.PP +\fRZIP_OPSYS_VFAT\fR +.PP +\fRZIP_OPSYS_VM_CMS\fR +.PP +\fRZIP_OPSYS_VSE\fR +.PP +\fRZIP_OPSYS_WINDOWS_NTFS\fR +(uncommon, use +\fRZIP_OPSYS_DOS\fR +instead) +.PP +\fRZIP_OPSYS_Z_SYSTEM\fR +.RE +.PD +.PP +The defines above follow the PKWARE Inc. Appnote; please note that +the InfoZIP Appnote has a slightly different mapping. +.SH "RETURN VALUES" +Upon successful completion, 0 is returned. +In case of an error, +\fR\-1\fR +is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "EXAMPLES" +The following code can be used to expand +\fIattributes\fR +if the operating system is +\fRZIP_OPSYS_DOS\fR. +.nf +.sp +.RS 0n +#include + +#define FA_RDONLY 0x01 // FILE_ATTRIBUTE_READONLY +#define FA_DIREC 0x10 // FILE_ATTRIBUTE_DIRECTORY + +static mode_t +_zip_dos_attr2mode(zip_uint32_t attr) +{ + mode_t m = S_IRUSR | S_IRGRP | S_IROTH; + if (0 == (attr & FA_RDONLY)) + m |= S_IWUSR | S_IWGRP | S_IWOTH; + + if (attr & FA_DIREC) + m = (S_IFDIR | (m & ~S_IFMT)) | S_IXUSR | S_IXGRP | S_IXOTH; + + return m; +} +.RE +.fi +.SH "ERRORS" +\fBzip_file_get_external_attributes\fR() +fails if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIindex\fR +is not a valid file index in +\fIarchive\fR. +.SH "SEE ALSO" +libzip(3), +zip_file_set_external_attributes(3) +.SH "HISTORY" +\fBzip_file_get_external_attributes\fR() +was added in libzip 0.11.2. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_file_get_external_attributes.mdoc b/core/deps/libzip/man/zip_file_get_external_attributes.mdoc new file mode 100644 index 000000000..5b3cdcc81 --- /dev/null +++ b/core/deps/libzip/man/zip_file_get_external_attributes.mdoc @@ -0,0 +1,165 @@ +.\" zip_file_get_external_attributes.mdoc -- get external attributes for file in zip +.\" Copyright (C) 2013-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_FILE_GET_EXTERNAL_ATTRIBUTES 3 +.Os +.Sh NAME +.Nm zip_file_get_external_attributes +.Nd get external attributes for file in zip +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_file_get_external_attributes "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags" "zip_uint8_t *opsys" "zip_uint32_t *attributes" +.Sh DESCRIPTION +The +.Fn zip_file_get_external_attributes +function returns the operating system and external attributes for the +file at position +.Ar index +in the zip archive. +The external attributes usually contain the operating system-specific +file permissions. +If +.Ar flags +is set to +.Dv ZIP_FL_UNCHANGED , +the original unchanged values are returned. +If +.Ar opsys +or +.Ar attributes +are +.Dv NULL , +they are not filled in. +.Pp +The following operating systems are defined by the zip specification: +.Bl -item -compact -offset indent +.It +.Dv ZIP_OPSYS_ACORN_RISC +.It +.Dv ZIP_OPSYS_ALTERNATE_MVS +.It +.Dv ZIP_OPSYS_AMIGA +.It +.Dv ZIP_OPSYS_ATARI_ST +.It +.Dv ZIP_OPSYS_BEOS +.It +.Dv ZIP_OPSYS_CPM +.It +.Dv ZIP_OPSYS_DOS +.It +.Dv ZIP_OPSYS_MACINTOSH +.It +.Dv ZIP_OPSYS_MVS +.It +.Dv ZIP_OPSYS_OPENVMS +.It +.Dv ZIP_OPSYS_OS_2 +.It +.Dv ZIP_OPSYS_OS_400 +.It +.Dv ZIP_OPSYS_OS_X +.It +.Dv ZIP_OPSYS_TANDEM +.It +.Dv ZIP_OPSYS_UNIX +.It +.Dv ZIP_OPSYS_VFAT +.It +.Dv ZIP_OPSYS_VM_CMS +.It +.Dv ZIP_OPSYS_VSE +.It +.Dv ZIP_OPSYS_WINDOWS_NTFS +(uncommon, use +.Dv ZIP_OPSYS_DOS +instead) +.It +.Dv ZIP_OPSYS_Z_SYSTEM +.El +.Pp +The defines above follow the PKWARE Inc. Appnote; please note that +the InfoZIP Appnote has a slightly different mapping. +.Sh RETURN VALUES +Upon successful completion, 0 is returned. +In case of an error, +.Dv \-1 +is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh EXAMPLES +The following code can be used to expand +.Ar attributes +if the operating system is +.Dv ZIP_OPSYS_DOS . +.Bd -literal +#include + +#define FA_RDONLY 0x01 // FILE_ATTRIBUTE_READONLY +#define FA_DIREC 0x10 // FILE_ATTRIBUTE_DIRECTORY + +static mode_t +_zip_dos_attr2mode(zip_uint32_t attr) +{ + mode_t m = S_IRUSR | S_IRGRP | S_IROTH; + if (0 == (attr & FA_RDONLY)) + m |= S_IWUSR | S_IWGRP | S_IWOTH; + + if (attr & FA_DIREC) + m = (S_IFDIR | (m & ~S_IFMT)) | S_IXUSR | S_IXGRP | S_IXOTH; + + return m; +} +.Ed +.Sh ERRORS +.Fn zip_file_get_external_attributes +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +.Ar index +is not a valid file index in +.Ar archive . +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_set_external_attributes 3 +.Sh HISTORY +.Fn zip_file_get_external_attributes +was added in libzip 0.11.2. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_file_rename.html b/core/deps/libzip/man/zip_file_rename.html new file mode 100644 index 000000000..b4f23360c --- /dev/null +++ b/core/deps/libzip/man/zip_file_rename.html @@ -0,0 +1,132 @@ + + + + + + + ZIP_FILE_RENAME(3) + + + + + + + + +
ZIP_FILE_RENAME(3)Library Functions ManualZIP_FILE_RENAME(3)
+
+
+

+zip_file_rename — +
rename file in zip archive
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_file_rename(zip_t + *archive, zip_uint64_t + index, const char + *name, zip_flags_t + flags);

+
+
+

+The file at position index in the zip archive + archive is renamed to name. The + flags argument can be any of: +
+
+
Guess encoding of name (default). (Only CP-437 and + UTF-8 are recognized.)
+
+
Interpret name as UTF-8.
+
+
Interpret name as code page 437 (CP-437).
+
+
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error code in archive is set to indicate the error. +
+
+

+zip_file_rename() fails if: +
+
[]
+
The file to be renamed has been deleted from the archive.
+
[]
+
There is already a file called name in the + archive.
+
[]
+
index is not a valid file index in + archive, name is + NULL, the empty string, or not a valid UTF-8 + encoded string. Also a file cannot be renamed to a directory or vice + versa. Directories are denoted by a trailing slash.
+
+
+
+

+libzip(3), + zip_unchange(3) +
+
+

+zip_file_rename() was added in libzip 0.11. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
September 22, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_file_rename.man b/core/deps/libzip/man/zip_file_rename.man new file mode 100644 index 000000000..580e5184c --- /dev/null +++ b/core/deps/libzip/man/zip_file_rename.man @@ -0,0 +1,111 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_file_rename.mdoc -- rename file in zip archive +.\" Copyright (C) 2003-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FILE_RENAME" "3" "September 22, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_file_rename\fR +\- rename file in zip archive +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_file_rename\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIconst\ char\ *name\fR, \fIzip_flags_t\ flags\fR); +.PD +.SH "DESCRIPTION" +The file at position +\fIindex\fR +in the zip archive +\fIarchive\fR +is renamed to +\fIname\fR. +The +\fIflags\fR +argument can be any of: +.TP 22n +\fRZIP_FL_ENC_GUESS\fR +Guess encoding of +\fIname\fR +(default). +(Only CP-437 and UTF-8 are recognized.) +.TP 22n +\fRZIP_FL_ENC_UTF_8\fR +Interpret +\fIname\fR +as UTF-8. +.TP 22n +\fRZIP_FL_ENC_CP437\fR +Interpret +\fIname\fR +as code page 437 (CP-437). +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_file_rename\fR() +fails if: +.TP 19n +[\fRZIP_ER_DELETED\fR] +The file to be renamed has been deleted from the archive. +.TP 19n +[\fRZIP_ER_EXISTS\fR] +There is already a file called +\fIname\fR +in the archive. +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIindex\fR +is not a valid file index in +\fIarchive\fR, +\fIname is\fR +\fRNULL\fR, +the empty string, or not a valid UTF-8 encoded string. +Also a file cannot be renamed to a directory or vice versa. +Directories are denoted by a trailing slash. +.SH "SEE ALSO" +libzip(3), +zip_unchange(3) +.SH "HISTORY" +\fBzip_file_rename\fR() +was added in libzip 0.11. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_file_rename.mdoc b/core/deps/libzip/man/zip_file_rename.mdoc new file mode 100644 index 000000000..52c9eb2d4 --- /dev/null +++ b/core/deps/libzip/man/zip_file_rename.mdoc @@ -0,0 +1,104 @@ +.\" zip_file_rename.mdoc -- rename file in zip archive +.\" Copyright (C) 2003-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 22, 2020 +.Dt ZIP_FILE_RENAME 3 +.Os +.Sh NAME +.Nm zip_file_rename +.Nd rename file in zip archive +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_file_rename "zip_t *archive" "zip_uint64_t index" "const char *name" "zip_flags_t flags" +.Sh DESCRIPTION +The file at position +.Ar index +in the zip archive +.Ar archive +is renamed to +.Ar name . +The +.Ar flags +argument can be any of: +.Bl -tag -width XZIPXFLXENCXSTRICTXX +.It Dv ZIP_FL_ENC_GUESS +Guess encoding of +.Ar name +(default). +(Only CP-437 and UTF-8 are recognized.) +.It Dv ZIP_FL_ENC_UTF_8 +Interpret +.Ar name +as UTF-8. +.It Dv ZIP_FL_ENC_CP437 +Interpret +.Ar name +as code page 437 (CP-437). +.El +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_file_rename +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_DELETED +The file to be renamed has been deleted from the archive. +.It Bq Er ZIP_ER_EXISTS +There is already a file called +.Ar name +in the archive. +.It Bq Er ZIP_ER_INVAL +.Ar index +is not a valid file index in +.Ar archive , +.Ar name is +.Dv NULL , +the empty string, or not a valid UTF-8 encoded string. +Also a file cannot be renamed to a directory or vice versa. +Directories are denoted by a trailing slash. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_unchange 3 +.Sh HISTORY +.Fn zip_file_rename +was added in libzip 0.11. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_file_set_comment.html b/core/deps/libzip/man/zip_file_set_comment.html new file mode 100644 index 000000000..9ea7604e1 --- /dev/null +++ b/core/deps/libzip/man/zip_file_set_comment.html @@ -0,0 +1,137 @@ + + + + + + + ZIP_FILE_SET_COMMENT(3) + + + + + + + + +
ZIP_FILE_SET_COMMENT(3)Library Functions ManualZIP_FILE_SET_COMMENT(3)
+
+
+

+zip_file_set_comment — +
set comment for file in zip
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_file_set_comment(zip_t + *archive, zip_uint64_t + index, const char + *comment, zip_uint16_t + len, zip_flags_t + flags);

+
+
+

+The zip_file_set_comment() function sets the comment for + the file at position index in the zip archive to + comment of length len. If + comment is NULL and + len is 0, the file comment will be removed. The + flags argument can be any of: +
+
+
Guess encoding of comment (default). (Only CP-437 + and UTF-8 are recognized.)
+
+
Interpret comment as UTF-8.
+
+
Interpret comment as code page 437 (CP-437).
+
+
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in archive is set to indicate the + error. +
+
+

+zip_file_set_comment() fails if: +
+
[]
+
index is not a valid file index in + archive, or len is less than 0 + or longer than the maximum comment length in a zip file (65535), or + comment is not a valid UTF-8 encoded string.
+
[]
+
Required memory could not be allocated.
+
[]
+
The archive was opened in read-only mode.
+
+
+
+

+libzip(3), + zip_file_get_comment(3), + zip_get_archive_comment(3), + zip_set_archive_comment(3) +
+
+

+zip_file_set_comment() was added in libzip 0.11. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
September 22, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_file_set_comment.man b/core/deps/libzip/man/zip_file_set_comment.man new file mode 100644 index 000000000..0c65168ed --- /dev/null +++ b/core/deps/libzip/man/zip_file_set_comment.man @@ -0,0 +1,123 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_file_set_comment.mdoc -- set comment for file in zip +.\" Copyright (C) 2006-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FILE_SET_COMMENT" "3" "September 22, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_file_set_comment\fR +\- set comment for file in zip +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_file_set_comment\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIconst\ char\ *comment\fR, \fIzip_uint16_t\ len\fR, \fIzip_flags_t\ flags\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_file_set_comment\fR() +function sets the comment for the file at position +\fIindex\fR +in the zip archive to +\fIcomment\fR +of length +\fIlen\fR. +If +\fIcomment\fR +is +\fRNULL\fR +and +\fIlen\fR +is 0, the file comment will be removed. +The +\fIflags\fR +argument can be any of: +.TP 22n +\fRZIP_FL_ENC_GUESS\fR +Guess encoding of +\fIcomment\fR +(default). +(Only CP-437 and UTF-8 are recognized.) +.TP 22n +\fRZIP_FL_ENC_UTF_8\fR +Interpret +\fIcomment\fR +as UTF-8. +.TP 22n +\fRZIP_FL_ENC_CP437\fR +Interpret +\fIcomment\fR +as code page 437 (CP-437). +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_file_set_comment\fR() +fails if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIindex\fR +is not a valid file index in +\fIarchive\fR, +or +\fIlen\fR +is less than 0 or longer than the maximum comment length in a zip file +(65535), or +\fIcomment\fR +is not a valid UTF-8 encoded string. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.TP 19n +[\fRZIP_ER_RDONLY\fR] +The +\fIarchive\fR +was opened in read-only mode. +.SH "SEE ALSO" +libzip(3), +zip_file_get_comment(3), +zip_get_archive_comment(3), +zip_set_archive_comment(3) +.SH "HISTORY" +\fBzip_file_set_comment\fR() +was added in libzip 0.11. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_file_set_comment.mdoc b/core/deps/libzip/man/zip_file_set_comment.mdoc new file mode 100644 index 000000000..fab0bc72b --- /dev/null +++ b/core/deps/libzip/man/zip_file_set_comment.mdoc @@ -0,0 +1,116 @@ +.\" zip_file_set_comment.mdoc -- set comment for file in zip +.\" Copyright (C) 2006-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 22, 2020 +.Dt ZIP_FILE_SET_COMMENT 3 +.Os +.Sh NAME +.Nm zip_file_set_comment +.Nd set comment for file in zip +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_file_set_comment "zip_t *archive" "zip_uint64_t index" "const char *comment" "zip_uint16_t len" "zip_flags_t flags" +.Sh DESCRIPTION +The +.Fn zip_file_set_comment +function sets the comment for the file at position +.Ar index +in the zip archive to +.Ar comment +of length +.Ar len . +If +.Ar comment +is +.Dv NULL +and +.Ar len +is 0, the file comment will be removed. +The +.Ar flags +argument can be any of: +.Bl -tag -width XZIPXFLXENCXSTRICTXX +.It Dv ZIP_FL_ENC_GUESS +Guess encoding of +.Ar comment +(default). +(Only CP-437 and UTF-8 are recognized.) +.It Dv ZIP_FL_ENC_UTF_8 +Interpret +.Ar comment +as UTF-8. +.It Dv ZIP_FL_ENC_CP437 +Interpret +.Ar comment +as code page 437 (CP-437). +.El +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_file_set_comment +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +.Ar index +is not a valid file index in +.Ar archive , +or +.Ar len +is less than 0 or longer than the maximum comment length in a zip file +(65535), or +.Ar comment +is not a valid UTF-8 encoded string. +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.It Bq Er ZIP_ER_RDONLY +The +.Ar archive +was opened in read-only mode. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_get_comment 3 , +.Xr zip_get_archive_comment 3 , +.Xr zip_set_archive_comment 3 +.Sh HISTORY +.Fn zip_file_set_comment +was added in libzip 0.11. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_file_set_encryption.html b/core/deps/libzip/man/zip_file_set_encryption.html new file mode 100644 index 000000000..a64d5e09f --- /dev/null +++ b/core/deps/libzip/man/zip_file_set_encryption.html @@ -0,0 +1,150 @@ + + + + + + + ZIP_FILE_SET_ENCRYPTION(3) + + + + + + + + +
ZIP_FILE_SET_ENCRYPTION(3)Library Functions ManualZIP_FILE_SET_ENCRYPTION(3)
+
+
+

+zip_file_set_encryption — +
set encryption method for file in zip
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_file_set_encryption(zip_t + *archive, zip_uint64_t + index, zip_uint16_t + method, const char + *password);

+
+
+

+The zip_file_set_encryption() function sets the + encryption method for the file at position index in the + zip archive to method using the password + password. The method is the same + as returned by zip_stat(3). For the + method argument, currently only the following values are + supported: +
+
+
No encryption.
+
+
Winzip AES-128 encryption.
+
+
Winzip AES-192 encryption.
+
+
Winzip AES-256 encryption.
+
+
Traditional PKWare encryption. Do not use this method, it is not secure. + It is only provided for backwards compatibility.
+
+

If password is NULL, + the default password provided by + zip_set_default_password(3) + is used.

+

The current encryption method for a file in a zip archive can be + determined using zip_stat(3).

+
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in archive is set to indicate the + error. +
+
+

+zip_file_set_encryption() fails if: +
+
[]
+
Unsupported compression method requested.
+
[]
+
index is not a valid file index in + archive, or the argument combination is + invalid.
+
[]
+
Required memory could not be allocated.
+
[]
+
Read-only zip file, no changes allowed.
+
+
+
+

+libzip(3), + zip_encryption_method_supported(3), + zip_fopen_encrypted(3), + zip_fopen_index_encrypted(3), + zip_set_default_password(3), + zip_stat(3) +
+
+

+zip_file_set_encryption() was added in libzip 1.2.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
April 2, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_file_set_encryption.man b/core/deps/libzip/man/zip_file_set_encryption.man new file mode 100644 index 000000000..da983f9df --- /dev/null +++ b/core/deps/libzip/man/zip_file_set_encryption.man @@ -0,0 +1,132 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_file_set_encryption.mdoc -- set encryption method for file +.\" Copyright (C) 2016-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FILE_SET_ENCRYPTION" "3" "April 2, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_file_set_encryption\fR +\- set encryption method for file in zip +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_file_set_encryption\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ method\fR, \fIconst\ char\ *password\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_file_set_encryption\fR() +function sets the encryption method for the file at position +\fIindex\fR +in the zip archive to +\fImethod\fR +using the password +\fIpassword\fR. +The +\fImethod\fR +is the same as returned by +zip_stat(3). +For the +\fImethod\fR +argument, currently only the following values are supported: +.TP 19n +\fRZIP_EM_NONE\fR +No encryption. +.TP 19n +\fRZIP_EM_AES_128\fR +Winzip AES-128 encryption. +.TP 19n +\fRZIP_EM_AES_192\fR +Winzip AES-192 encryption. +.TP 19n +\fRZIP_EM_AES_256\fR +Winzip AES-256 encryption. +.TP 19n +\fRZIP_EM_TRAD_PKWARE\fR +.br +Traditional PKWare encryption. +Do not use this method, it is not secure. +It is only provided for backwards compatibility. +.PP +If +\fIpassword\fR +is +\fRNULL\fR, +the default password provided by +zip_set_default_password(3) +is used. +.PP +The current encryption method for a file in a zip archive can be +determined using +zip_stat(3). +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_file_set_encryption\fR() +fails if: +.TP 19n +[\fRZIP_ER_ENCRNOTSUPP\fR] +Unsupported compression method requested. +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIindex\fR +is not a valid file index in +\fIarchive\fR, +or the argument combination is invalid. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.TP 19n +[\fRZIP_ER_RDONLY\fR] +Read-only zip file, no changes allowed. +.SH "SEE ALSO" +libzip(3), +zip_encryption_method_supported(3), +zip_fopen_encrypted(3), +zip_fopen_index_encrypted(3), +zip_set_default_password(3), +zip_stat(3) +.SH "HISTORY" +\fBzip_file_set_encryption\fR() +was added in libzip 1.2.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_file_set_encryption.mdoc b/core/deps/libzip/man/zip_file_set_encryption.mdoc new file mode 100644 index 000000000..7f3755968 --- /dev/null +++ b/core/deps/libzip/man/zip_file_set_encryption.mdoc @@ -0,0 +1,121 @@ +.\" zip_file_set_encryption.mdoc -- set encryption method for file +.\" Copyright (C) 2016-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd April 2, 2020 +.Dt ZIP_FILE_SET_ENCRYPTION 3 +.Os +.Sh NAME +.Nm zip_file_set_encryption +.Nd set encryption method for file in zip +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_file_set_encryption "zip_t *archive" "zip_uint64_t index" "zip_uint16_t method" "const char *password" +.Sh DESCRIPTION +The +.Fn zip_file_set_encryption +function sets the encryption method for the file at position +.Ar index +in the zip archive to +.Ar method +using the password +.Ar password . +The +.Ar method +is the same as returned by +.Xr zip_stat 3 . +For the +.Ar method +argument, currently only the following values are supported: +.Bl -tag -width ZIP_CM_DEFLATE_XX +.It Dv ZIP_EM_NONE +No encryption. +.It Dv ZIP_EM_AES_128 +Winzip AES-128 encryption. +.It Dv ZIP_EM_AES_192 +Winzip AES-192 encryption. +.It Dv ZIP_EM_AES_256 +Winzip AES-256 encryption. +.It Dv ZIP_EM_TRAD_PKWARE +Traditional PKWare encryption. +Do not use this method, it is not secure. +It is only provided for backwards compatibility. +.El +.Pp +If +.Ar password +is +.Dv NULL , +the default password provided by +.Xr zip_set_default_password 3 +is used. +.Pp +The current encryption method for a file in a zip archive can be +determined using +.Xr zip_stat 3 . +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_file_set_encryption +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_ENCRNOTSUPP +Unsupported compression method requested. +.It Bq Er ZIP_ER_INVAL +.Ar index +is not a valid file index in +.Ar archive , +or the argument combination is invalid. +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.It Bq Er ZIP_ER_RDONLY +Read-only zip file, no changes allowed. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_encryption_method_supported 3 , +.Xr zip_fopen_encrypted 3 , +.Xr zip_fopen_index_encrypted 3 , +.Xr zip_set_default_password 3 , +.Xr zip_stat 3 +.Sh HISTORY +.Fn zip_file_set_encryption +was added in libzip 1.2.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_file_set_external_attributes.html b/core/deps/libzip/man/zip_file_set_external_attributes.html new file mode 100644 index 000000000..87a9f97ff --- /dev/null +++ b/core/deps/libzip/man/zip_file_set_external_attributes.html @@ -0,0 +1,125 @@ + + + + + + + ZIP_FILE_SET_EXTERNAL_ATTRIBUTES(3) + + + + + + + + +
ZIP_FILE_SET_EXTERNAL_ATTRIBUTES(3)Library Functions ManualZIP_FILE_SET_EXTERNAL_ATTRIBUTES(3)
+
+
+

+zip_file_set_external_attributes — +
set external attributes for file in zip
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_file_set_external_attributes(zip_t + *archive, zip_uint64_t + index, zip_flags_t + flags, zip_uint8_t + opsys, zip_uint32_t + attributes);

+
+
+

+The zip_file_set_external_attributes() function sets the + operating system and external attributes for the file at position + index in the zip archive. Currently, no + flags are supported. +

For a list of known opsys values, see + zip_file_get_external_attributes(3).

+
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in archive is set to indicate the + error. +
+
+

+zip_file_set_external_attributes() fails if: +
+
[]
+
index is not a valid file index in + archive.
+
[]
+
Required memory could not be allocated.
+
[]
+
The archive was opened in read-only mode.
+
+
+
+

+libzip(3), + zip_file_get_external_attributes(3) +
+
+

+zip_file_set_external_attributes() was added in libzip + 0.11.2. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_file_set_external_attributes.man b/core/deps/libzip/man/zip_file_set_external_attributes.man new file mode 100644 index 000000000..76c375ed8 --- /dev/null +++ b/core/deps/libzip/man/zip_file_set_external_attributes.man @@ -0,0 +1,95 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_file_set_external_attributes.mdoc -- set external attributes for file in zip +.\" Copyright (C) 2013-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FILE_SET_EXTERNAL_ATTRIBUTES" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_file_set_external_attributes\fR +\- set external attributes for file in zip +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_file_set_external_attributes\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR, \fIzip_uint8_t\ opsys\fR, \fIzip_uint32_t\ attributes\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_file_set_external_attributes\fR() +function sets the operating system and external attributes for the +file at position +\fIindex\fR +in the zip archive. +Currently, no +\fIflags\fR +are supported. +.PP +For a list of known +\fIopsys\fR +values, see +zip_file_get_external_attributes(3). +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_file_set_external_attributes\fR() +fails if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIindex\fR +is not a valid file index in +\fIarchive\fR. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.TP 19n +[\fRZIP_ER_RDONLY\fR] +The +\fIarchive\fR +was opened in read-only mode. +.SH "SEE ALSO" +libzip(3), +zip_file_get_external_attributes(3) +.SH "HISTORY" +\fBzip_file_set_external_attributes\fR() +was added in libzip 0.11.2. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_file_set_external_attributes.mdoc b/core/deps/libzip/man/zip_file_set_external_attributes.mdoc new file mode 100644 index 000000000..d7fa08233 --- /dev/null +++ b/core/deps/libzip/man/zip_file_set_external_attributes.mdoc @@ -0,0 +1,89 @@ +.\" zip_file_set_external_attributes.mdoc -- set external attributes for file in zip +.\" Copyright (C) 2013-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_FILE_SET_EXTERNAL_ATTRIBUTES 3 +.Os +.Sh NAME +.Nm zip_file_set_external_attributes +.Nd set external attributes for file in zip +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_file_set_external_attributes "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags" "zip_uint8_t opsys" "zip_uint32_t attributes" +.Sh DESCRIPTION +The +.Fn zip_file_set_external_attributes +function sets the operating system and external attributes for the +file at position +.Ar index +in the zip archive. +Currently, no +.Ar flags +are supported. +.Pp +For a list of known +.Ar opsys +values, see +.Xr zip_file_get_external_attributes 3 . +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_file_set_external_attributes +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +.Ar index +is not a valid file index in +.Ar archive . +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.It Bq Er ZIP_ER_RDONLY +The +.Ar archive +was opened in read-only mode. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_get_external_attributes 3 +.Sh HISTORY +.Fn zip_file_set_external_attributes +was added in libzip 0.11.2. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_file_set_mtime.html b/core/deps/libzip/man/zip_file_set_mtime.html new file mode 100644 index 000000000..c7b479d44 --- /dev/null +++ b/core/deps/libzip/man/zip_file_set_mtime.html @@ -0,0 +1,164 @@ + + + + + + + ZIP_FILE_SET_MTIME(3) + + + + + + + + +
ZIP_FILE_SET_MTIME(3)Library Functions ManualZIP_FILE_SET_MTIME(3)
+
+
+

+zip_file_set_dostime, + zip_file_set_mtime — +
set last modification time (mtime) for file in zip
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_file_set_dostime(zip_t + *archive, zip_uint64_t + index, zip_uint16_t + dostime, zip_uint16_t + dosdate, zip_flags_t + flags);

+

int +
+ zip_file_set_mtime(zip_t + *archive, zip_uint64_t + index, time_t + mtime, zip_flags_t + flags);

+
+
+

+The zip_file_set_mtime() function sets the last + modification time (mtime) for the file at position index + in the zip archive to mtime. Currently, no support for + any flags is implemented. +

In the zip archive, the time and date are saved as two 16-bit + integers. To set the values directly, call the + zip_file_set_dostime() function. The values of the + time bytes are defined as follows:

+
+
+
0-4
+
seconds divided by two (1-2 = 1, 3-4 = 2, ...)
+
5-10
+
minute (0-59)
+
11-15
+
hour (0-23)
+
+
+

The values of the date bytes are defined as follows:

+
+
+
0-4
+
day of the month (1-31)
+
5-8
+
month (January = 1, February = 2, ...)
+
9-15
+
year offset from 1980 (1980 = 0, 1981 = 1, ...)
+
+
+
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in archive is set to indicate the + error. +
+
+

+zip_file_set_dostime() and + zip_file_set_mtime() fail if: +
+
[]
+
index is not a valid file index in + archive.
+
[]
+
Required memory could not be allocated.
+
[]
+
The archive was opened in read-only mode.
+
+
+
+

+libzip(3), + zip_stat(3) +
+
+

+zip_file_set_mtime() was added in libzip 1.0. + zip_file_set_dostime() was added in libzip 1.6. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+

+Following historical practice, the zip_file_set_mtime() + function translates the time from the zip archive into the local time zone. If + you want to avoid this, use the zip_file_set_dostime() + function instead. +
+
+ + + + + +
August 24, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_file_set_mtime.man b/core/deps/libzip/man/zip_file_set_mtime.man new file mode 100644 index 000000000..d3928bcbb --- /dev/null +++ b/core/deps/libzip/man/zip_file_set_mtime.man @@ -0,0 +1,141 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_file_set_mtime.mdoc -- set mtime for file in zip +.\" Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FILE_SET_MTIME" "3" "August 24, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_file_set_dostime\fR, +\fBzip_file_set_mtime\fR +\- set last modification time (mtime) for file in zip +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_file_set_dostime\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ dostime\fR, \fIzip_uint16_t\ dosdate\fR, \fIzip_flags_t\ flags\fR); +.PD +.PP +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_file_set_mtime\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fItime_t\ mtime\fR, \fIzip_flags_t\ flags\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_file_set_mtime\fR() +function sets the last modification time (mtime) for the file at +position +\fIindex\fR +in the zip archive to +\fImtime\fR. +Currently, no support for any +\fIflags\fR +is implemented. +.PP +In the zip archive, the time and date are saved as two 16-bit integers. +To set the values directly, call the +\fBzip_file_set_dostime\fR() +function. +The values of the time bytes are defined as follows: +.RS 6n +.TP 7n +0-4 +seconds divided by two (1-2 = 1, 3-4 = 2, ...) +.TP 7n +5-10 +minute (0-59) +.TP 7n +11-15 +hour (0-23) +.RE +.PP +The values of the date bytes are defined as follows: +.RS 6n +.TP 7n +0-4 +day of the month (1-31) +.TP 7n +5-8 +month (January = 1, February = 2, ...) +.TP 7n +9-15 +year offset from 1980 (1980 = 0, 1981 = 1, ...) +.RE +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_file_set_dostime\fR() +and +\fBzip_file_set_mtime\fR() +fail if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIindex\fR +is not a valid file index in +\fIarchive\fR. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.TP 19n +[\fRZIP_ER_RDONLY\fR] +The +\fIarchive\fR +was opened in read-only mode. +.SH "SEE ALSO" +libzip(3), +zip_stat(3) +.SH "HISTORY" +\fBzip_file_set_mtime\fR() +was added in libzip 1.0. +\fBzip_file_set_dostime\fR() +was added in libzip 1.6. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> +.SH "CAVEATS" +Following historical practice, the +\fBzip_file_set_mtime\fR() +function translates the time from the zip archive into the local time +zone. +If you want to avoid this, use the +\fBzip_file_set_dostime\fR() +function instead. diff --git a/core/deps/libzip/man/zip_file_set_mtime.mdoc b/core/deps/libzip/man/zip_file_set_mtime.mdoc new file mode 100644 index 000000000..f47c6b118 --- /dev/null +++ b/core/deps/libzip/man/zip_file_set_mtime.mdoc @@ -0,0 +1,124 @@ +.\" zip_file_set_mtime.mdoc -- set mtime for file in zip +.\" Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd August 24, 2020 +.Dt ZIP_FILE_SET_MTIME 3 +.Os +.Sh NAME +.Nm zip_file_set_dostime , +.Nm zip_file_set_mtime +.Nd set last modification time (mtime) for file in zip +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_file_set_dostime "zip_t *archive" "zip_uint64_t index" "zip_uint16_t dostime" "zip_uint16_t dosdate" "zip_flags_t flags" +.Ft int +.Fn zip_file_set_mtime "zip_t *archive" "zip_uint64_t index" "time_t mtime" "zip_flags_t flags" +.Sh DESCRIPTION +The +.Fn zip_file_set_mtime +function sets the last modification time (mtime) for the file at +position +.Ar index +in the zip archive to +.Ar mtime . +Currently, no support for any +.Ar flags +is implemented. +.Pp +In the zip archive, the time and date are saved as two 16-bit integers. +To set the values directly, call the +.Fn zip_file_set_dostime +function. +The values of the time bytes are defined as follows: +.Bl -tag -width 5n -offset indent +.It 0-4 +seconds divided by two (1-2 = 1, 3-4 = 2, ...) +.It 5-10 +minute (0-59) +.It 11-15 +hour (0-23) +.El +.Pp +The values of the date bytes are defined as follows: +.Bl -tag -width 5n -offset indent +.It 0-4 +day of the month (1-31) +.It 5-8 +month (January = 1, February = 2, ...) +.It 9-15 +year offset from 1980 (1980 = 0, 1981 = 1, ...) +.El +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_file_set_dostime +and +.Fn zip_file_set_mtime +fail if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +.Ar index +is not a valid file index in +.Ar archive . +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.It Bq Er ZIP_ER_RDONLY +The +.Ar archive +was opened in read-only mode. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_stat 3 +.Sh HISTORY +.Fn zip_file_set_mtime +was added in libzip 1.0. +.Fn zip_file_set_dostime +was added in libzip 1.6. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at +.Sh CAVEATS +Following historical practice, the +.Fn zip_file_set_mtime +function translates the time from the zip archive into the local time +zone. +If you want to avoid this, use the +.Fn zip_file_set_dostime +function instead. diff --git a/core/deps/libzip/man/zip_file_strerror.html b/core/deps/libzip/man/zip_file_strerror.html new file mode 100644 index 000000000..019efe02e --- /dev/null +++ b/core/deps/libzip/man/zip_file_strerror.html @@ -0,0 +1,115 @@ + + + + + + + ZIP_FILE_STRERROR(3) + + + + + + + + +
ZIP_FILE_STRERROR(3)Library Functions ManualZIP_FILE_STRERROR(3)
+
+
+

+zip_file_strerror, zip_strerror + — +
get string representation for a zip error
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

const char * +
+ zip_file_strerror(zip_file_t + *file);

+

const char * +
+ zip_strerror(zip_t + *archive);

+
+
+

+The zip_strerror() function returns a string describing + the last error for the zip archive archive, while the + zip_file_strerror() function does the same for a zip + file file (one file in an archive). The returned string + must not be modified or freed, and becomes invalid when + archive or file, respectively, is + closed or on the next call to zip_strerror() or + zip_file_strerror(), respectively, for the same + archive. +
+
+

+zip_file_strerror() and + zip_strerror() return a pointer to the error string. +
+
+

+libzip(3), + zip_error_strerror(3) +
+
+

+zip_file_strerror() and + zip_strerror() were added in libzip 0.6. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_file_strerror.man b/core/deps/libzip/man/zip_file_strerror.man new file mode 100644 index 000000000..db2b16da8 --- /dev/null +++ b/core/deps/libzip/man/zip_file_strerror.man @@ -0,0 +1,95 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_file_strerror.mdoc -- get string representation for a zip error +.\" Copyright (C) 2003-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FILE_STRERROR" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_file_strerror\fR, +\fBzip_strerror\fR +\- get string representation for a zip error +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIconst char *\fR +.br +.PD 0 +.HP 4n +\fBzip_file_strerror\fR(\fIzip_file_t\ *file\fR); +.PD +.PP +\fIconst char *\fR +.br +.PD 0 +.HP 4n +\fBzip_strerror\fR(\fIzip_t\ *archive\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_strerror\fR() +function returns a string describing the last error for the zip archive +\fIarchive\fR, +while the +\fBzip_file_strerror\fR() +function does the same for a zip file +\fIfile\fR +(one file in an archive). +The returned string must not be modified or freed, and becomes invalid when +\fIarchive\fR +or +\fIfile\fR, +respectively, +is closed or on the next call to +\fBzip_strerror\fR() +or +\fBzip_file_strerror\fR(), +respectively, +for the same archive. +.SH "RETURN VALUES" +\fBzip_file_strerror\fR() +and +\fBzip_strerror\fR() +return a pointer to the error string. +.SH "SEE ALSO" +libzip(3), +zip_error_strerror(3) +.SH "HISTORY" +\fBzip_file_strerror\fR() +and +\fBzip_strerror\fR() +were added in libzip 0.6. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_file_strerror.mdoc b/core/deps/libzip/man/zip_file_strerror.mdoc new file mode 100644 index 000000000..de727d70a --- /dev/null +++ b/core/deps/libzip/man/zip_file_strerror.mdoc @@ -0,0 +1,85 @@ +.\" zip_file_strerror.mdoc -- get string representation for a zip error +.\" Copyright (C) 2003-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_FILE_STRERROR 3 +.Os +.Sh NAME +.Nm zip_file_strerror , +.Nm zip_strerror +.Nd get string representation for a zip error +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft const char * +.Fn zip_file_strerror "zip_file_t *file" +.Ft const char * +.Fn zip_strerror "zip_t *archive" +.Sh DESCRIPTION +The +.Fn zip_strerror +function returns a string describing the last error for the zip archive +.Ar archive , +while the +.Fn zip_file_strerror +function does the same for a zip file +.Ar file +(one file in an archive). +The returned string must not be modified or freed, and becomes invalid when +.Ar archive +or +.Ar file , +respectively, +is closed or on the next call to +.Fn zip_strerror +or +.Fn zip_file_strerror , +respectively, +for the same archive. +.Sh RETURN VALUES +.Fn zip_file_strerror +and +.Fn zip_strerror +return a pointer to the error string. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_error_strerror 3 +.Sh HISTORY +.Fn zip_file_strerror +and +.Fn zip_strerror +were added in libzip 0.6. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_fopen.html b/core/deps/libzip/man/zip_fopen.html new file mode 100644 index 000000000..a34ac9d68 --- /dev/null +++ b/core/deps/libzip/man/zip_fopen.html @@ -0,0 +1,171 @@ + + + + + + + ZIP_FOPEN(3) + + + + + + + + +
ZIP_FOPEN(3)Library Functions ManualZIP_FOPEN(3)
+
+
+

+zip_fopen, zip_fopen_index + — +
open file in zip archive for reading
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_file_t * +
+ zip_fopen(zip_t + *archive, const char + *fname, zip_flags_t + flags);

+

zip_file_t * +
+ zip_fopen_index(zip_t + *archive, zip_uint64_t + index, zip_flags_t + flags);

+
+
+

+The zip_fopen() function opens the file name + fname in archive. The + flags argument specifies how the name lookup should be + done, according to the values are described in + zip_name_locate(3). Also, the + following values may be or'ed to it. +
+
+
+
Read the compressed data. Otherwise the data is uncompressed by + zip_fread().
+
+
Read the original data from the zip archive, ignoring any changes made to + the file.
+
+
+

The zip_fopen_index() function opens the + file at position index.

+

If encrypted data is encountered, the functions call + zip_fopen_encrypted(3) or + zip_fopen_index_encrypted(3) + respectively, using the default password set with + zip_set_default_password(3).

+
+
+

+Upon successful completion, a struct zip_file pointer is + returned. Otherwise, NULL is returned and the error + code in archive is set to indicate the error. +
+
+

+
+
[]
+
The file data has been changed.
+
[]
+
The compression method used is not supported.
+
[]
+
The encryption method used is not supported.
+
[]
+
Required memory could not be allocated.
+
[]
+
The file is encrypted, but no password has been provided.
+
[]
+
A file read error occurred.
+
[]
+
A file seek error occurred.
+
[]
+
The provided password does not match the password used for encryption. + Note that some incorrect passwords are not detected by the check done by + zip_fopen().
+
[]
+
Initializing the zlib stream failed.
+
+

The function zip_fopen() may also fail and + set zip_err for any of the errors specified for the + routine + zip_name_locate(3).

+

The function zip_fopen_index() may also + fail with ZIP_ER_INVAL if + index is invalid.

+
+
+

+libzip(3), + zip_fclose(3), + zip_fread(3), + zip_fseek(3), + zip_get_num_entries(3), + zip_name_locate(3), + zip_set_default_password(3) +
+
+

+zip_fopen() and + zip_fopen_index() were added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_fopen.man b/core/deps/libzip/man/zip_fopen.man new file mode 100644 index 000000000..95e010007 --- /dev/null +++ b/core/deps/libzip/man/zip_fopen.man @@ -0,0 +1,166 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_fopen.mdoc -- open file in zip archive for reading +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FOPEN" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_fopen\fR, +\fBzip_fopen_index\fR +\- open file in zip archive for reading +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_file_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_fopen\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_flags_t\ flags\fR); +.PD +.PP +\fIzip_file_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_fopen_index\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_fopen\fR() +function opens the file name +\fIfname\fR +in +\fIarchive\fR. +The +\fIflags\fR +argument specifies how the name lookup should be done, according to +the values are described in +zip_name_locate(3). +Also, the following values may be +\fIor\fR'ed +to it. +.RS 6n +.TP 19n +\fRZIP_FL_COMPRESSED\fR +Read the compressed data. +Otherwise the data is uncompressed by +\fBzip_fread\fR(). +.TP 19n +\fRZIP_FL_UNCHANGED\fR +Read the original data from the zip archive, ignoring any changes made +to the file. +.RE +.PP +The +\fBzip_fopen_index\fR() +function opens the file at position +\fIindex\fR. +.PP +If encrypted data is encountered, the functions call +zip_fopen_encrypted(3) +or +zip_fopen_index_encrypted(3) +respectively, using the default password set with +zip_set_default_password(3). +.SH "RETURN VALUES" +Upon successful completion, a +\fIstruct zip_file\fR +pointer is returned. +Otherwise, +\fRNULL\fR +is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +.TP 19n +[\fRZIP_ER_CHANGED\fR] +The file data has been changed. +.TP 19n +[\fRZIP_ER_COMPNOTSUPP\fR] +The compression method used is not supported. +.TP 19n +[\fRZIP_ER_ENCRNOTSUPP\fR] +The encryption method used is not supported. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.TP 19n +[\fRZIP_ER_NOPASSWD\fR] +The file is encrypted, but no password has been provided. +.TP 19n +[\fRZIP_ER_READ\fR] +A file read error occurred. +.TP 19n +[\fRZIP_ER_SEEK\fR] +A file seek error occurred. +.TP 19n +[\fRZIP_ER_WRONGPASSWD\fR] +The provided password does not match the password used for encryption. +Note that some incorrect passwords are not detected by the check done by +\fBzip_fopen\fR(). +.TP 19n +[\fRZIP_ER_ZLIB\fR] +Initializing the zlib stream failed. +.PP +The function +\fBzip_fopen\fR() +may also fail and set +\fIzip_err\fR +for any of the errors specified for the routine +zip_name_locate(3). +.PP +The function +\fBzip_fopen_index\fR() +may also fail with +\fRZIP_ER_INVAL\fR +if +\fIindex\fR +is invalid. +.SH "SEE ALSO" +libzip(3), +zip_fclose(3), +zip_fread(3), +zip_fseek(3), +zip_get_num_entries(3), +zip_name_locate(3), +zip_set_default_password(3) +.SH "HISTORY" +\fBzip_fopen\fR() +and +\fBzip_fopen_index\fR() +were added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_fopen.mdoc b/core/deps/libzip/man/zip_fopen.mdoc new file mode 100644 index 000000000..fb54f87c6 --- /dev/null +++ b/core/deps/libzip/man/zip_fopen.mdoc @@ -0,0 +1,147 @@ +.\" zip_fopen.mdoc -- open file in zip archive for reading +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_FOPEN 3 +.Os +.Sh NAME +.Nm zip_fopen , +.Nm zip_fopen_index +.Nd open file in zip archive for reading +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_file_t * +.Fn zip_fopen "zip_t *archive" "const char *fname" "zip_flags_t flags" +.Ft zip_file_t * +.Fn zip_fopen_index "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags" +.Sh DESCRIPTION +The +.Fn zip_fopen +function opens the file name +.Ar fname +in +.Ar archive . +The +.Ar flags +argument specifies how the name lookup should be done, according to +the values are described in +.Xr zip_name_locate 3 . +Also, the following values may be +.Em or Ns No 'ed +to it. +.Bl -tag -offset indent -width ZIP_FL_COMPRESSED +.It Dv ZIP_FL_COMPRESSED +Read the compressed data. +Otherwise the data is uncompressed by +.Fn zip_fread . +.It Dv ZIP_FL_UNCHANGED +Read the original data from the zip archive, ignoring any changes made +to the file. +.El +.Pp +The +.Fn zip_fopen_index +function opens the file at position +.Ar index . +.Pp +If encrypted data is encountered, the functions call +.Xr zip_fopen_encrypted 3 +or +.Xr zip_fopen_index_encrypted 3 +respectively, using the default password set with +.Xr zip_set_default_password 3 . +.Sh RETURN VALUES +Upon successful completion, a +.Ft struct zip_file +pointer is returned. +Otherwise, +.Dv NULL +is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Bl -tag -width Er +.It Bq Er ZIP_ER_CHANGED +The file data has been changed. +.It Bq Er ZIP_ER_COMPNOTSUPP +The compression method used is not supported. +.It Bq Er ZIP_ER_ENCRNOTSUPP +The encryption method used is not supported. +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.It Bq Er ZIP_ER_NOPASSWD +The file is encrypted, but no password has been provided. +.It Bq Er ZIP_ER_READ +A file read error occurred. +.It Bq Er ZIP_ER_SEEK +A file seek error occurred. +.It Bq Er ZIP_ER_WRONGPASSWD +The provided password does not match the password used for encryption. +Note that some incorrect passwords are not detected by the check done by +.Fn zip_fopen . +.It Bq Er ZIP_ER_ZLIB +Initializing the zlib stream failed. +.El +.Pp +The function +.Fn zip_fopen +may also fail and set +.Va zip_err +for any of the errors specified for the routine +.Xr zip_name_locate 3 . +.Pp +The function +.Fn zip_fopen_index +may also fail with +.Er ZIP_ER_INVAL +if +.Ar index +is invalid. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_fclose 3 , +.Xr zip_fread 3 , +.Xr zip_fseek 3 , +.Xr zip_get_num_entries 3 , +.Xr zip_name_locate 3 , +.Xr zip_set_default_password 3 +.Sh HISTORY +.Fn zip_fopen +and +.Fn zip_fopen_index +were added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_fopen_encrypted.html b/core/deps/libzip/man/zip_fopen_encrypted.html new file mode 100644 index 000000000..fd4ec772c --- /dev/null +++ b/core/deps/libzip/man/zip_fopen_encrypted.html @@ -0,0 +1,158 @@ + + + + + + + ZIP_FOPEN_ENCRYPTED(3) + + + + + + + + +
ZIP_FOPEN_ENCRYPTED(3)Library Functions ManualZIP_FOPEN_ENCRYPTED(3)
+
+
+

+zip_fopen_encrypted, + zip_fopen_index_encrypted — +
open encrypted file in zip archive for reading
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_file_t * +
+ zip_fopen_encrypted(zip_t + *archive, const char + *fname, zip_flags_t + flags, const char + *password);

+

zip_file_t * +
+ zip_fopen_index_encrypted(zip_t + *archive, zip_uint64_t + index, zip_flags_t + flags, const char + *password);

+
+
+

+The zip_fopen_encrypted() function opens the encrypted + file name fname in archive using + the password given in the password argument. If + password is NULL or the empty + string, the default password is used (see + zip_set_default_password(3)). + The flags argument are the same as for + zip_fopen(3). +

The zip_fopen_index_encrypted() function + opens the file at position index, see + zip_fopen_index(3). These + functions are called automatically by + zip_fopen(3); you only need to call + them if you want to specify a non-default password (see + zip_set_default_password(3)).

+
+
+

+Upon successful completion, a struct zip_file pointer is + returned. Otherwise, NULL is returned and the error + code in archive is set to indicate the error. +
+
+

+
+
[]
+
No password was provided.
+
+

The function zip_fopen_encrypted() may + also fail and set zip_err for any of the errors + specified for the routine + zip_fopen(3).

+

The function zip_fopen_index_encrypted() + may also fail and set zip_err for any of the errors + specified for the routine + zip_fopen_index(3).

+
+
+

+libzip(3), + zip_fclose(3), + zip_fopen(3), + zip_fread(3), + zip_get_num_entries(3), + zip_name_locate(3) +
+
+

+zip_fopen_encrypted() and + zip_fopen_index_encrypted() were added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+

+The zip file format provides very limited possibility for password verification + (a short hash of is compared against one byte in the zip archive). For this + reason, reading a file while using an incorrect password may immediately fail + with ZIP_ER_WRONGPASSWD, but if the mismatch is not + detected, a zlib error may be returned later instead. Since zlib errors can + also be caused by broken compressed data, there is no way to make sure if the + password was incorrect or if it was correct, but the compressed data was + invalid. +
+
+ + + + + +
September 15, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_fopen_encrypted.man b/core/deps/libzip/man/zip_fopen_encrypted.man new file mode 100644 index 000000000..dfa5ab060 --- /dev/null +++ b/core/deps/libzip/man/zip_fopen_encrypted.man @@ -0,0 +1,144 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_fopen_encrypted.mdoc -- open encrypted file in zip archive for reading +.\" Copyright (C) 2011-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FOPEN_ENCRYPTED" "3" "September 15, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_fopen_encrypted\fR, +\fBzip_fopen_index_encrypted\fR +\- open encrypted file in zip archive for reading +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_file_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_fopen_encrypted\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_flags_t\ flags\fR, \fIconst\ char\ *password\fR); +.PD +.PP +\fIzip_file_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_fopen_index_encrypted\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR, \fIconst\ char\ *password\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_fopen_encrypted\fR() +function opens the encrypted file name +\fIfname\fR +in +\fIarchive\fR +using the password given in the +\fIpassword\fR +argument. +If +\fIpassword\fR +is +\fRNULL\fR +or the empty string, the default password is used (see +zip_set_default_password(3)). +The +\fIflags\fR +argument are the same as for +zip_fopen(3). +.PP +The +\fBzip_fopen_index_encrypted\fR() +function opens the file at position +\fIindex\fR, +see +zip_fopen_index(3). +These functions are called automatically by +zip_fopen(3); +you only need to call them if you want to specify a non-default password +(see +zip_set_default_password(3)). +.SH "RETURN VALUES" +Upon successful completion, a +\fIstruct zip_file\fR +pointer is returned. +Otherwise, +\fRNULL\fR +is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +.TP 22n +[\fRZIP_ER_NOPASSWD\fR] +No password was provided. +.PP +The function +\fBzip_fopen_encrypted\fR() +may also fail and set +\fIzip_err\fR +for any of the errors specified for the routine +zip_fopen(3). +.PP +The function +\fBzip_fopen_index_encrypted\fR() +may also fail and set +\fIzip_err\fR +for any of the errors specified for the routine +zip_fopen_index(3). +.SH "SEE ALSO" +libzip(3), +zip_fclose(3), +zip_fopen(3), +zip_fread(3), +zip_get_num_entries(3), +zip_name_locate(3) +.SH "HISTORY" +\fBzip_fopen_encrypted\fR() +and +\fBzip_fopen_index_encrypted\fR() +were added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> +.SH "CAVEATS" +The zip file format provides very limited possibility for password +verification (a short hash of is compared against one byte in the zip +archive). +For this reason, reading a file while using an incorrect password may +immediately fail with +\fRZIP_ER_WRONGPASSWD\fR, +but if the mismatch is not detected, a zlib error may be returned +later instead. +Since zlib errors can also be caused by broken compressed data, there +is no way to make sure if the password was incorrect or if it was +correct, but the compressed data was invalid. diff --git a/core/deps/libzip/man/zip_fopen_encrypted.mdoc b/core/deps/libzip/man/zip_fopen_encrypted.mdoc new file mode 100644 index 000000000..bdb94e03e --- /dev/null +++ b/core/deps/libzip/man/zip_fopen_encrypted.mdoc @@ -0,0 +1,135 @@ +.\" zip_fopen_encrypted.mdoc -- open encrypted file in zip archive for reading +.\" Copyright (C) 2011-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 15, 2020 +.Dt ZIP_FOPEN_ENCRYPTED 3 +.Os +.Sh NAME +.Nm zip_fopen_encrypted , +.Nm zip_fopen_index_encrypted +.Nd open encrypted file in zip archive for reading +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_file_t * +.Fn zip_fopen_encrypted "zip_t *archive" "const char *fname" "zip_flags_t flags" "const char *password" +.Ft zip_file_t * +.Fn zip_fopen_index_encrypted "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags" "const char *password" +.Sh DESCRIPTION +The +.Fn zip_fopen_encrypted +function opens the encrypted file name +.Ar fname +in +.Ar archive +using the password given in the +.Ar password +argument. +If +.Ar password +is +.Dv NULL +or the empty string, the default password is used (see +.Xr zip_set_default_password 3 ) . +The +.Ar flags +argument are the same as for +.Xr zip_fopen 3 . +.Pp +The +.Fn zip_fopen_index_encrypted +function opens the file at position +.Ar index , +see +.Xr zip_fopen_index 3 . +These functions are called automatically by +.Xr zip_fopen 3 ; +you only need to call them if you want to specify a non-default password +(see +.Xr zip_set_default_password 3 ) . +.Sh RETURN VALUES +Upon successful completion, a +.Ft struct zip_file +pointer is returned. +Otherwise, +.Dv NULL +is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Bl -tag -width ZIP_ER_ENCRNOTSUPPXX +.It Bq Er ZIP_ER_NOPASSWD +No password was provided. +.El +.Pp +The function +.Fn zip_fopen_encrypted +may also fail and set +.Va zip_err +for any of the errors specified for the routine +.Xr zip_fopen 3 . +.Pp +The function +.Fn zip_fopen_index_encrypted +may also fail and set +.Va zip_err +for any of the errors specified for the routine +.Xr zip_fopen_index 3 . +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_fclose 3 , +.Xr zip_fopen 3 , +.Xr zip_fread 3 , +.Xr zip_get_num_entries 3 , +.Xr zip_name_locate 3 +.Sh HISTORY +.Fn zip_fopen_encrypted +and +.Fn zip_fopen_index_encrypted +were added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at +.Sh CAVEATS +The zip file format provides very limited possibility for password +verification (a short hash of is compared against one byte in the zip +archive). +For this reason, reading a file while using an incorrect password may +immediately fail with +.Er ZIP_ER_WRONGPASSWD , +but if the mismatch is not detected, a zlib error may be returned +later instead. +Since zlib errors can also be caused by broken compressed data, there +is no way to make sure if the password was incorrect or if it was +correct, but the compressed data was invalid. diff --git a/core/deps/libzip/man/zip_fread.html b/core/deps/libzip/man/zip_fread.html new file mode 100644 index 000000000..eda3ebc83 --- /dev/null +++ b/core/deps/libzip/man/zip_fread.html @@ -0,0 +1,110 @@ + + + + + + + ZIP_FREAD(3) + + + + + + + + +
ZIP_FREAD(3)Library Functions ManualZIP_FREAD(3)
+
+
+

+zip_fread — +
read from file
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int64_t +
+ zip_fread(zip_file_t + *file, void *buf, + zip_uint64_t nbytes);

+
+
+

+The zip_fread() function reads at most + nbytes bytes from file into + buf. +
+
+

+If successful, the number of bytes actually read is returned. Otherwise, -1 is + returned. +
+
+

+libzip(3), + zip_fclose(3), + zip_fopen(3), + zip_fseek(3) +
+
+

+zip_fread() was added in libzip 0.6. In libzip 0.10 the + return type was changed from ssize_t to + zip_int64_t. In libzip 0.10 the type of + nbytes was changed from size_t to + zip_uint64_t. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_fread.man b/core/deps/libzip/man/zip_fread.man new file mode 100644 index 000000000..d0eb517e9 --- /dev/null +++ b/core/deps/libzip/man/zip_fread.man @@ -0,0 +1,83 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_fread.mdoc -- read from file +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FREAD" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_fread\fR +\- read from file +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int64_t\fR +.br +.PD 0 +.HP 4n +\fBzip_fread\fR(\fIzip_file_t\ *file\fR, \fIvoid\ *buf\fR, \fIzip_uint64_t\ nbytes\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_fread\fR() +function reads at most +\fInbytes\fR +bytes from +\fIfile\fR +into +\fIbuf\fR. +.SH "RETURN VALUES" +If successful, the number of bytes actually read is returned. +Otherwise, \-1 is returned. +.SH "SEE ALSO" +libzip(3), +zip_fclose(3), +zip_fopen(3), +zip_fseek(3) +.SH "HISTORY" +\fBzip_fread\fR() +was added in libzip 0.6. +In libzip 0.10 the return type was changed from +\fIssize_t\fR +to +\fIzip_int64_t\fR. +In libzip 0.10 the type of +\fInbytes\fR +was changed from +\fIsize_t\fR +to +\fIzip_uint64_t\fR. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_fread.mdoc b/core/deps/libzip/man/zip_fread.mdoc new file mode 100644 index 000000000..4d3e8d6c7 --- /dev/null +++ b/core/deps/libzip/man/zip_fread.mdoc @@ -0,0 +1,78 @@ +.\" zip_fread.mdoc -- read from file +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_FREAD 3 +.Os +.Sh NAME +.Nm zip_fread +.Nd read from file +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int64_t +.Fn zip_fread "zip_file_t *file" "void *buf" "zip_uint64_t nbytes" +.Sh DESCRIPTION +The +.Fn zip_fread +function reads at most +.Ar nbytes +bytes from +.Ar file +into +.Ar buf . +.Sh RETURN VALUES +If successful, the number of bytes actually read is returned. +Otherwise, \-1 is returned. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_fclose 3 , +.Xr zip_fopen 3 , +.Xr zip_fseek 3 +.Sh HISTORY +.Fn zip_fread +was added in libzip 0.6. +In libzip 0.10 the return type was changed from +.Vt ssize_t +to +.Vt zip_int64_t . +In libzip 0.10 the type of +.Ar nbytes +was changed from +.Vt size_t +to +.Vt zip_uint64_t . +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_fseek.html b/core/deps/libzip/man/zip_fseek.html new file mode 100644 index 000000000..43900659f --- /dev/null +++ b/core/deps/libzip/man/zip_fseek.html @@ -0,0 +1,110 @@ + + + + + + + ZIP_FSEEK(3) + + + + + + + + +
ZIP_FSEEK(3)Library Functions ManualZIP_FSEEK(3)
+
+
+

+zip_fseek — +
seek in file
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int8_t +
+ zip_fseek(zip_file_t + *file, zip_int64_t + offset, int + whence);

+
+
+

+The zip_fseek() function seeks to the specified + offset relative to whence, just + like fseek(3). +

zip_fseek only works on uncompressed + (stored) data. When called on compressed data it will return an error.

+
+
+

+If successful, zip_fseek returns 0. Otherwise, -1 is + returned. +
+
+

+libzip(3), + zip_fclose(3), + zip_fopen(3), + zip_fread(3), + zip_ftell(3) +
+
+

+zip_fseek() was added in libzip 1.2.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_fseek.man b/core/deps/libzip/man/zip_fseek.man new file mode 100644 index 000000000..d69e0e6f4 --- /dev/null +++ b/core/deps/libzip/man/zip_fseek.man @@ -0,0 +1,80 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_fseek.mdoc -- seek in file +.\" Copyright (C) 2016-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FSEEK" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_fseek\fR +\- seek in file +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int8_t\fR +.br +.PD 0 +.HP 4n +\fBzip_fseek\fR(\fIzip_file_t\ *file\fR, \fIzip_int64_t\ offset\fR, \fIint\ whence\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_fseek\fR() +function seeks to the specified +\fIoffset\fR +relative to +\fIwhence\fR, +just like +fseek(3). +.PP +\fBzip_fseek\fR +only works on uncompressed (stored) data. +When called on compressed data it will return an error. +.SH "RETURN VALUES" +If successful, +\fBzip_fseek\fR +returns 0. +Otherwise, \-1 is returned. +.SH "SEE ALSO" +libzip(3), +zip_fclose(3), +zip_fopen(3), +zip_fread(3), +zip_ftell(3) +.SH "HISTORY" +\fBzip_fseek\fR() +was added in libzip 1.2.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_fseek.mdoc b/core/deps/libzip/man/zip_fseek.mdoc new file mode 100644 index 000000000..756ca2726 --- /dev/null +++ b/core/deps/libzip/man/zip_fseek.mdoc @@ -0,0 +1,75 @@ +.\" zip_fseek.mdoc -- seek in file +.\" Copyright (C) 2016-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_FSEEK 3 +.Os +.Sh NAME +.Nm zip_fseek +.Nd seek in file +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int8_t +.Fn zip_fseek "zip_file_t *file" "zip_int64_t offset" "int whence" +.Sh DESCRIPTION +The +.Fn zip_fseek +function seeks to the specified +.Ar offset +relative to +.Ar whence , +just like +.Xr fseek 3 . +.Pp +.Nm +only works on uncompressed (stored) data. +When called on compressed data it will return an error. +.Sh RETURN VALUES +If successful, +.Nm +returns 0. +Otherwise, \-1 is returned. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_fclose 3 , +.Xr zip_fopen 3 , +.Xr zip_fread 3 , +.Xr zip_ftell 3 +.Sh HISTORY +.Fn zip_fseek +was added in libzip 1.2.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_ftell.html b/core/deps/libzip/man/zip_ftell.html new file mode 100644 index 000000000..94f19e950 --- /dev/null +++ b/core/deps/libzip/man/zip_ftell.html @@ -0,0 +1,105 @@ + + + + + + + ZIP_FTELL(3) + + + + + + + + +
ZIP_FTELL(3)Library Functions ManualZIP_FTELL(3)
+
+
+

+zip_ftell — +
tell position in file
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int64_t +
+ zip_ftell(zip_file_t + *file);

+
+
+

+The zip_ftell() function reports the current offset in + the file. +
+
+

+If successful, zip_ftell returns the current file + position. Otherwise, -1 is returned. +
+
+

+libzip(3), + zip_fclose(3), + zip_fopen(3), + zip_fread(3), + zip_fseek(3) +
+
+

+zip_ftell() was added in libzip 1.2.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
July 21, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_ftell.man b/core/deps/libzip/man/zip_ftell.man new file mode 100644 index 000000000..d3b6a2ee7 --- /dev/null +++ b/core/deps/libzip/man/zip_ftell.man @@ -0,0 +1,71 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_ftell.mdoc -- tell position in file +.\" Copyright (C) 2016-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_FTELL" "3" "July 21, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_ftell\fR +\- tell position in file +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int64_t\fR +.br +.PD 0 +.HP 4n +\fBzip_ftell\fR(\fIzip_file_t\ *file\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_ftell\fR() +function reports the current offset in the file. +.SH "RETURN VALUES" +If successful, +\fBzip_ftell\fR +returns the current file position. +Otherwise, \-1 is returned. +.SH "SEE ALSO" +libzip(3), +zip_fclose(3), +zip_fopen(3), +zip_fread(3), +zip_fseek(3) +.SH "HISTORY" +\fBzip_ftell\fR() +was added in libzip 1.2.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_ftell.mdoc b/core/deps/libzip/man/zip_ftell.mdoc new file mode 100644 index 000000000..01c52450c --- /dev/null +++ b/core/deps/libzip/man/zip_ftell.mdoc @@ -0,0 +1,66 @@ +.\" zip_ftell.mdoc -- tell position in file +.\" Copyright (C) 2016-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd July 21, 2020 +.Dt ZIP_FTELL 3 +.Os +.Sh NAME +.Nm zip_ftell +.Nd tell position in file +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int64_t +.Fn zip_ftell "zip_file_t *file" +.Sh DESCRIPTION +The +.Fn zip_ftell +function reports the current offset in the file. +.Sh RETURN VALUES +If successful, +.Nm +returns the current file position. +Otherwise, \-1 is returned. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_fclose 3 , +.Xr zip_fopen 3 , +.Xr zip_fread 3 , +.Xr zip_fseek 3 +.Sh HISTORY +.Fn zip_ftell +was added in libzip 1.2.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_get_archive_comment.html b/core/deps/libzip/man/zip_get_archive_comment.html new file mode 100644 index 000000000..f8d6483ec --- /dev/null +++ b/core/deps/libzip/man/zip_get_archive_comment.html @@ -0,0 +1,131 @@ + + + + + + + ZIP_GET_ARCHIVE_COMMENT(3) + + + + + + + + +
ZIP_GET_ARCHIVE_COMMENT(3)Library Functions ManualZIP_GET_ARCHIVE_COMMENT(3)
+
+
+

+zip_get_archive_comment — +
get zip archive comment
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

const char * +
+ zip_get_archive_comment(zip_t + *archive, int + *lenp, zip_flags_t + flags);

+
+
+

+The zip_get_archive_comment() function returns the + comment for the entire zip archive. The return value is in UTF-8 encoding + unless ZIP_FL_ENC_RAW was specified (see below). This + pointer should not be modified or + free(3)'d, and becomes invalid when + archive is closed. If lenp is not + NULL, the integer to which it points will be set to + the length of the comment. If flags is set to + ZIP_FL_UNCHANGED, the original unchanged comment is + returned. +

Additionally, the following flags are + supported:

+
+
+
+
Return the unmodified archive comment as it is in the ZIP archive.
+
+
(Default.) Guess the encoding of the archive comment in the ZIP archive + and convert it to UTF-8, if necessary. (Only CP-437 and UTF-8 are + recognized.)
+
+
Follow the ZIP specification for file names and extend it to the archive + comment, thus also expecting it in CP-437 encoding. Convert it to + UTF-8.
+
+
+Note: ASCII is a subset of both CP-437 and UTF-8. +
+
+

+Upon successful completion, a pointer to the comment is returned, or + NULL if there is no comment. +
+
+

+libzip(3), + zip_file_get_comment(3) +
+
+

+zip_get_archive_comment() was added in libzip 0.7. In + libzip 0.11 the type of flags was changed from + int to zip_flags_t. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
September 22, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_get_archive_comment.man b/core/deps/libzip/man/zip_get_archive_comment.man new file mode 100644 index 000000000..0c1cfa1fc --- /dev/null +++ b/core/deps/libzip/man/zip_get_archive_comment.man @@ -0,0 +1,115 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_get_archive_comment.mdoc -- get zip archive comment +.\" Copyright (C) 2006-2018 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_GET_ARCHIVE_COMMENT" "3" "September 22, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_get_archive_comment\fR +\- get zip archive comment +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIconst char *\fR +.br +.PD 0 +.HP 4n +\fBzip_get_archive_comment\fR(\fIzip_t\ *archive\fR, \fIint\ *lenp\fR, \fIzip_flags_t\ flags\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_get_archive_comment\fR() +function returns the comment for the entire zip archive. +The return value is in UTF-8 encoding unless +\fRZIP_FL_ENC_RAW\fR +was specified (see below). +This pointer should not be modified or +free(3)'d, +and becomes invalid when +\fIarchive\fR +is closed. +If +\fIlenp\fR +is not +\fRNULL\fR, +the integer to which it points will be set to the length of the +comment. +If +\fIflags\fR +is set to +\fRZIP_FL_UNCHANGED\fR, +the original unchanged comment is returned. +.PP +Additionally, the following +\fIflags\fR +are supported: +.RS 6n +.TP 21n +\fRZIP_FL_ENC_RAW\fR +Return the unmodified archive comment as it is in the ZIP archive. +.TP 21n +\fRZIP_FL_ENC_GUESS\fR +(Default.) +Guess the encoding of the archive comment in the ZIP archive and convert it +to UTF-8, if necessary. +(Only CP-437 and UTF-8 are recognized.) +.TP 21n +\fRZIP_FL_ENC_STRICT\fR +Follow the ZIP specification for file names and extend it to the +archive comment, thus also expecting it in CP-437 encoding. +Convert it to UTF-8. +.RE +\fINote\fR: +ASCII is a subset of both CP-437 and UTF-8. +.SH "RETURN VALUES" +Upon successful completion, a pointer to the comment is returned, +or +\fRNULL\fR +if there is no comment. +.SH "SEE ALSO" +libzip(3), +zip_file_get_comment(3) +.SH "HISTORY" +\fBzip_get_archive_comment\fR() +was added in libzip 0.7. +In libzip 0.11 the type of +\fIflags\fR +was changed from +\fIint\fR +to +\fIzip_flags_t\fR. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_get_archive_comment.mdoc b/core/deps/libzip/man/zip_get_archive_comment.mdoc new file mode 100644 index 000000000..7c3be295d --- /dev/null +++ b/core/deps/libzip/man/zip_get_archive_comment.mdoc @@ -0,0 +1,112 @@ +.\" zip_get_archive_comment.mdoc -- get zip archive comment +.\" Copyright (C) 2006-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 22, 2020 +.Dt ZIP_GET_ARCHIVE_COMMENT 3 +.Os +.Sh NAME +.Nm zip_get_archive_comment +.Nd get zip archive comment +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft const char * +.Fn zip_get_archive_comment "zip_t *archive" "int *lenp" "zip_flags_t flags" +.Sh DESCRIPTION +The +.Fn zip_get_archive_comment +function returns the comment for the entire zip archive. +The return value is in UTF-8 encoding unless +.Dv ZIP_FL_ENC_RAW +was specified (see below). +This pointer should not be modified or +.Xr free 3 Ap d , +and becomes invalid when +.Ar archive +is closed. +If +.Ar lenp +is not +.Dv NULL , +the integer to which it points will be set to the length of the +comment. +If +.Ar flags +is set to +.Dv ZIP_FL_UNCHANGED , +the original unchanged comment is returned. +.Pp +Additionally, the following +.Ar flags +are supported: +.Bl -tag -width ZIP_FL_ENC_STRICTXX -offset indent +.It Dv ZIP_FL_ENC_RAW +Return the unmodified archive comment as it is in the ZIP archive. +.It Dv ZIP_FL_ENC_GUESS +(Default.) +Guess the encoding of the archive comment in the ZIP archive and convert it +to UTF-8, if necessary. +(Only CP-437 and UTF-8 are recognized.) +.It Dv ZIP_FL_ENC_STRICT +Follow the ZIP specification for file names and extend it to the +archive comment, thus also expecting it in CP-437 encoding. +Convert it to UTF-8. +.El +.Em Note : +ASCII is a subset of both CP-437 and UTF-8. +.Sh RETURN VALUES +Upon successful completion, a pointer to the comment is returned, +or +.Dv NULL +if there is no comment. +.\" In case of an error, +.\" .Dv NULL +.\" is returned and the error code in +.\" .Ar archive +.\" is set to indicate the error. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_get_comment 3 +.Sh HISTORY +.Fn zip_get_archive_comment +was added in libzip 0.7. +In libzip 0.11 the type of +.Ar flags +was changed from +.Vt int +to +.Vt zip_flags_t . +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_get_archive_flag.html b/core/deps/libzip/man/zip_get_archive_flag.html new file mode 100644 index 000000000..9c0be9494 --- /dev/null +++ b/core/deps/libzip/man/zip_get_archive_flag.html @@ -0,0 +1,118 @@ + + + + + + + ZIP_GET_ARCHIVE_FLAG(3) + + + + + + + + +
ZIP_GET_ARCHIVE_FLAG(3)Library Functions ManualZIP_GET_ARCHIVE_FLAG(3)
+
+
+

+zip_get_archive_flag — +
get status flags for zip
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_get_archive_flag(zip_t + *archive, zip_flags_t + flag, zip_flags_t + flags);

+
+
+

+The zip_get_archive_flag() function returns if the flag + flag is set for the archive + archive. The archive flags might have been changed with + zip_set_archive_flag(); if flags + is set to ZIP_FL_UNCHANGED, the original unchanged + flags are tested. +

Supported flags are:

+
+
+
The archive is read-only.
+
+
+
+

+zip_get_archive_flag() returns 1 if + flag is set for archive, 0 if not, + and -1 if an error occurred. +
+
+

+libzip(3), + zip_set_archive_flag(3) +
+
+

+zip_get_archive_flag() was added in libzip 0.9. In + libzip 0.11 the type of flag was changed from + int to zip_flags_t m and the type + of flags was changed from int to + zip_flags_t. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_get_archive_flag.man b/core/deps/libzip/man/zip_get_archive_flag.man new file mode 100644 index 000000000..4f9d08b16 --- /dev/null +++ b/core/deps/libzip/man/zip_get_archive_flag.man @@ -0,0 +1,98 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_get_archive_flag.mdoc -- get comment for file in zip +.\" Copyright (C) 2008-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_GET_ARCHIVE_FLAG" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_get_archive_flag\fR +\- get status flags for zip +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_get_archive_flag\fR(\fIzip_t\ *archive\fR, \fIzip_flags_t\ flag\fR, \fIzip_flags_t\ flags\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_get_archive_flag\fR() +function returns if the flag +\fIflag\fR +is set for the archive +\fIarchive\fR. +The archive flags might have been changed with +\fBzip_set_archive_flag\fR(); +if +\fIflags\fR +is set to +\fRZIP_FL_UNCHANGED\fR, +the original unchanged flags are tested. +.PP +Supported flags are: +.TP 20n +\fRZIP_AFL_RDONLY\fR +The archive is read-only. +.SH "RETURN VALUES" +\fBzip_get_archive_flag\fR() +returns 1 if +\fIflag\fR +is set for +\fIarchive\fR, +0 if not, +and \-1 if an error occurred. +.SH "SEE ALSO" +libzip(3), +zip_set_archive_flag(3) +.SH "HISTORY" +\fBzip_get_archive_flag\fR() +was added in libzip 0.9. +In libzip 0.11 the type of +\fIflag\fR +was changed from +\fIint\fR +to +\fIzip_flags_t m\fR +and the type of +\fIflags\fR +was changed from +\fIint\fR +to +\fIzip_flags_t\fR. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_get_archive_flag.mdoc b/core/deps/libzip/man/zip_get_archive_flag.mdoc new file mode 100644 index 000000000..baf6b0596 --- /dev/null +++ b/core/deps/libzip/man/zip_get_archive_flag.mdoc @@ -0,0 +1,94 @@ +.\" zip_get_archive_flag.mdoc -- get comment for file in zip +.\" Copyright (C) 2008-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_GET_ARCHIVE_FLAG 3 +.Os +.Sh NAME +.Nm zip_get_archive_flag +.Nd get status flags for zip +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_get_archive_flag "zip_t *archive" "zip_flags_t flag" "zip_flags_t flags" +.Sh DESCRIPTION +The +.Fn zip_get_archive_flag +function returns if the flag +.Ar flag +is set for the archive +.Ar archive . +The archive flags might have been changed with +.Fn zip_set_archive_flag ; +if +.Ar flags +is set to +.Dv ZIP_FL_UNCHANGED , +the original unchanged flags are tested. +.Pp +Supported flags are: +.Bl -tag -width XZIPXAFLXRDONLYXXX +.It Dv ZIP_AFL_RDONLY +The archive is read-only. +.El +.Sh RETURN VALUES +.Fn zip_get_archive_flag +returns 1 if +.Ar flag +is set for +.Ar archive , +0 if not, +and \-1 if an error occurred. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_set_archive_flag 3 +.Sh HISTORY +.Fn zip_get_archive_flag +was added in libzip 0.9. +In libzip 0.11 the type of +.Ar flag +was changed from +.Vt int +to +.Vt zip_flags_t m +and the type of +.Ar flags +was changed from +.Vt int +to +.Vt zip_flags_t . +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_get_error.html b/core/deps/libzip/man/zip_get_error.html new file mode 100644 index 000000000..7ba946807 --- /dev/null +++ b/core/deps/libzip/man/zip_get_error.html @@ -0,0 +1,97 @@ + + + + + + + ZIP_GET_ERROR(3) + + + + + + + + +
ZIP_GET_ERROR(3)Library Functions ManualZIP_GET_ERROR(3)
+
+
+

+zip_get_error — +
get zip error for archive
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_error_t * +
+ zip_get_error(zip_t + *archive);

+
+
+

+The zip_get_error() function returns the zip error for + the zip archive archive. +
+
+

+libzip(3), + zip_error_code_system(3), + zip_error_code_zip(3) +
+
+

+zip_get_error() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_get_error.man b/core/deps/libzip/man/zip_get_error.man new file mode 100644 index 000000000..9cddbc2a3 --- /dev/null +++ b/core/deps/libzip/man/zip_get_error.man @@ -0,0 +1,65 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_get_error.mdoc -- get zip_error for archive +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_GET_ERROR" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_get_error\fR +\- get zip error for archive +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_error_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_get_error\fR(\fIzip_t\ *archive\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_get_error\fR() +function returns the zip error for the zip archive +\fIarchive\fR. +.SH "SEE ALSO" +libzip(3), +zip_error_code_system(3), +zip_error_code_zip(3) +.SH "HISTORY" +\fBzip_get_error\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_get_error.mdoc b/core/deps/libzip/man/zip_get_error.mdoc new file mode 100644 index 000000000..8ce2ea5e8 --- /dev/null +++ b/core/deps/libzip/man/zip_get_error.mdoc @@ -0,0 +1,60 @@ +.\" zip_get_error.mdoc -- get zip_error for archive +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_GET_ERROR 3 +.Os +.Sh NAME +.Nm zip_get_error +.Nd get zip error for archive +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_error_t * +.Fn zip_get_error "zip_t *archive" +.Sh DESCRIPTION +The +.Fn zip_get_error +function returns the zip error for the zip archive +.Ar archive . +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_error_code_system 3 , +.Xr zip_error_code_zip 3 +.Sh HISTORY +.Fn zip_get_error +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_get_file_comment.html b/core/deps/libzip/man/zip_get_file_comment.html new file mode 100644 index 000000000..fe7492f24 --- /dev/null +++ b/core/deps/libzip/man/zip_get_file_comment.html @@ -0,0 +1,105 @@ + + + + + + + ZIP_GET_FILE_COMMENT(3) + + + + + + + + +
ZIP_GET_FILE_COMMENT(3)Library Functions ManualZIP_GET_FILE_COMMENT(3)
+
+
+

+zip_get_file_comment — +
get comment for file in zip (obsolete interface)
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

const char * +
+ zip_get_file_comment(zip_t + *archive, zip_uint64_t + index, int *lenp, + int flags);

+
+
+

+The zip_get_file_comment() function is the obsolete + version of + zip_file_get_comment(3). + The only differences are the types of the lenp and + flags arguments. +
+
+

+libzip(3), + zip_file_get_comment(3) +
+
+

+zip_get_file_comment() was added in libzip 0.7. In + libzip 0.10 the type of index was changed from + int to zip_uint64_t. It was + deprecated in libzip 0.11, use zip_file_get_comment() + instead. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_get_file_comment.man b/core/deps/libzip/man/zip_get_file_comment.man new file mode 100644 index 000000000..011871daa --- /dev/null +++ b/core/deps/libzip/man/zip_get_file_comment.man @@ -0,0 +1,78 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_get_file_comment.mdoc -- get comment for file in zip +.\" Copyright (C) 2006-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_GET_FILE_COMMENT" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_get_file_comment\fR +\- get comment for file in zip (obsolete interface) +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIconst char *\fR +.br +.PD 0 +.HP 4n +\fBzip_get_file_comment\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIint\ *lenp\fR, \fIint\ flags\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_get_file_comment\fR() +function is the obsolete version of +zip_file_get_comment(3). +The only differences are the types of the +\fIlenp\fR +and +\fIflags\fR +arguments. +.SH "SEE ALSO" +libzip(3), +zip_file_get_comment(3) +.SH "HISTORY" +\fBzip_get_file_comment\fR() +was added in libzip 0.7. +In libzip 0.10 the type of +\fIindex\fR +was changed from +\fIint\fR +to +\fIzip_uint64_t\fR. +It was deprecated in libzip 0.11, use +\fBzip_file_get_comment\fR() +instead. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_get_file_comment.mdoc b/core/deps/libzip/man/zip_get_file_comment.mdoc new file mode 100644 index 000000000..a22159e52 --- /dev/null +++ b/core/deps/libzip/man/zip_get_file_comment.mdoc @@ -0,0 +1,73 @@ +.\" zip_get_file_comment.mdoc -- get comment for file in zip +.\" Copyright (C) 2006-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_GET_FILE_COMMENT 3 +.Os +.Sh NAME +.Nm zip_get_file_comment +.Nd get comment for file in zip (obsolete interface) +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft const char * +.Fn zip_get_file_comment "zip_t *archive" "zip_uint64_t index" "int *lenp" "int flags" +.Sh DESCRIPTION +The +.Fn zip_get_file_comment +function is the obsolete version of +.Xr zip_file_get_comment 3 . +The only differences are the types of the +.Ar lenp +and +.Ar flags +arguments. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_get_comment 3 +.Sh HISTORY +.Fn zip_get_file_comment +was added in libzip 0.7. +In libzip 0.10 the type of +.Ar index +was changed from +.Vt int +to +.Vt zip_uint64_t . +It was deprecated in libzip 0.11, use +.Fn zip_file_get_comment +instead. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_get_name.html b/core/deps/libzip/man/zip_get_name.html new file mode 100644 index 000000000..f0c37db29 --- /dev/null +++ b/core/deps/libzip/man/zip_get_name.html @@ -0,0 +1,146 @@ + + + + + + + ZIP_GET_NAME(3) + + + + + + + + +
ZIP_GET_NAME(3)Library Functions ManualZIP_GET_NAME(3)
+
+
+

+zip_get_name — +
get name of file by index
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

const char * +
+ zip_get_name(zip_t + *archive, zip_uint64_t + index, zip_flags_t + flags);

+
+
+

+The zip_get_name() function returns the name of the file + at position index in archive. The + name is in UTF-8 encoding unless ZIP_FL_ENC_RAW was + specified (see below). +

If flags is set to + ZIP_FL_UNCHANGED, the original unchanged filename is + returned. The returned string must not be modified or freed, and becomes + invalid when archive is closed.

+

Additionally, the following flags are + supported:

+
+
+
+
Return the unmodified names as it is in the ZIP archive.
+
+
(Default.) Guess the encoding of the name in the ZIP archive and convert + it to UTF-8, if necessary. (Only CP-437 and UTF-8 are recognized.)
+
+
Follow the ZIP specification and expect CP-437 encoded names in the ZIP + archive (except if they are explicitly marked as UTF-8). Convert it to + UTF-8.
+
+
+Note: ASCII is a subset of both CP-437 and UTF-8. +
+
+

+Upon successful completion, a pointer to the name is returned. Otherwise, + NULL and the error code in + archive is set to indicate the error. +
+
+

+zip_get_name() fails if: +
+
[]
+
index refers to a file that has been deleted (see + zip_delete(3)).
+
[]
+
index is not a valid file index in + archive, or index points to an + added file and ZIP_FL_UNCHANGED is set.
+
[]
+
Required memory could not be allocated.
+
+
+
+

+libzip(3), + zip_name_locate(3) +
+
+

+zip_get_name() was added in libzip 0.6. In libzip 0.10 + the type of index was changed from + int to zip_uint64_t. In libzip + 0.11 the type of flags was changed from + int to zip_flags_t. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
September 22, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_get_name.man b/core/deps/libzip/man/zip_get_name.man new file mode 100644 index 000000000..74ec79250 --- /dev/null +++ b/core/deps/libzip/man/zip_get_name.man @@ -0,0 +1,141 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_get_name.mdoc -- get name of file by index +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_GET_NAME" "3" "September 22, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_get_name\fR +\- get name of file by index +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIconst char *\fR +.br +.PD 0 +.HP 4n +\fBzip_get_name\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_get_name\fR() +function returns the name of the file at position +\fIindex\fR +in +\fIarchive\fR. +The name is in UTF-8 encoding unless +\fRZIP_FL_ENC_RAW\fR +was specified (see below). +.PP +If +\fIflags\fR +is set to +\fRZIP_FL_UNCHANGED\fR, +the original unchanged filename is returned. +The returned string must not be modified or freed, and becomes invalid when +\fIarchive\fR +is closed. +.PP +Additionally, the following +\fIflags\fR +are supported: +.RS 6n +.TP 21n +\fRZIP_FL_ENC_RAW\fR +Return the unmodified names as it is in the ZIP archive. +.TP 21n +\fRZIP_FL_ENC_GUESS\fR +(Default.) +Guess the encoding of the name in the ZIP archive and convert it +to UTF-8, if necessary. +(Only CP-437 and UTF-8 are recognized.) +.TP 21n +\fRZIP_FL_ENC_STRICT\fR +Follow the ZIP specification and expect CP-437 encoded names in +the ZIP archive (except if they are explicitly marked as UTF-8). +Convert it to UTF-8. +.RE +\fINote\fR: +ASCII is a subset of both CP-437 and UTF-8. +.SH "RETURN VALUES" +Upon successful completion, a pointer to the name is returned. +Otherwise, +\fRNULL\fR +and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_get_name\fR() +fails if: +.TP 19n +[\fRZIP_ER_DELETED\fR] +\fIindex\fR +refers to a file that has been deleted +(see +zip_delete(3)). +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIindex\fR +is not a valid file index in +\fIarchive\fR, +or +\fIindex\fR +points to an added file and +\fRZIP_FL_UNCHANGED\fR +is set. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.SH "SEE ALSO" +libzip(3), +zip_name_locate(3) +.SH "HISTORY" +\fBzip_get_name\fR() +was added in libzip 0.6. +In libzip 0.10 the type of +\fIindex\fR +was changed from +\fIint\fR +to +\fIzip_uint64_t\fR. +In libzip 0.11 the type of +\fIflags\fR +was changed from +\fIint\fR +to +\fIzip_flags_t\fR. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_get_name.mdoc b/core/deps/libzip/man/zip_get_name.mdoc new file mode 100644 index 000000000..ac60655d2 --- /dev/null +++ b/core/deps/libzip/man/zip_get_name.mdoc @@ -0,0 +1,132 @@ +.\" zip_get_name.mdoc -- get name of file by index +.\" Copyright (C) 2003-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 22, 2020 +.Dt ZIP_GET_NAME 3 +.Os +.Sh NAME +.Nm zip_get_name +.Nd get name of file by index +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft const char * +.Fn zip_get_name "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags" +.Sh DESCRIPTION +The +.Fn zip_get_name +function returns the name of the file at position +.Ar index +in +.Ar archive . +The name is in UTF-8 encoding unless +.Dv ZIP_FL_ENC_RAW +was specified (see below). +.Pp +If +.Ar flags +is set to +.Dv ZIP_FL_UNCHANGED , +the original unchanged filename is returned. +The returned string must not be modified or freed, and becomes invalid when +.Ar archive +is closed. +.Pp +Additionally, the following +.Ar flags +are supported: +.Bl -tag -width ZIP_FL_ENC_STRICTXX -offset indent +.It Dv ZIP_FL_ENC_RAW +Return the unmodified names as it is in the ZIP archive. +.It Dv ZIP_FL_ENC_GUESS +(Default.) +Guess the encoding of the name in the ZIP archive and convert it +to UTF-8, if necessary. +(Only CP-437 and UTF-8 are recognized.) +.It Dv ZIP_FL_ENC_STRICT +Follow the ZIP specification and expect CP-437 encoded names in +the ZIP archive (except if they are explicitly marked as UTF-8). +Convert it to UTF-8. +.El +.Em Note : +ASCII is a subset of both CP-437 and UTF-8. +.Sh RETURN VALUES +Upon successful completion, a pointer to the name is returned. +Otherwise, +.Dv NULL +and the error code in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_get_name +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_DELETED +.Ar index +refers to a file that has been deleted +(see +.Xr zip_delete 3 ) . +.It Bq Er ZIP_ER_INVAL +.Ar index +is not a valid file index in +.Ar archive , +or +.Ar index +points to an added file and +.Dv ZIP_FL_UNCHANGED +is set. +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_name_locate 3 +.Sh HISTORY +.Fn zip_get_name +was added in libzip 0.6. +In libzip 0.10 the type of +.Ar index +was changed from +.Vt int +to +.Vt zip_uint64_t . +In libzip 0.11 the type of +.Ar flags +was changed from +.Vt int +to +.Vt zip_flags_t . +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_get_num_entries.html b/core/deps/libzip/man/zip_get_num_entries.html new file mode 100644 index 000000000..5c20530b0 --- /dev/null +++ b/core/deps/libzip/man/zip_get_num_entries.html @@ -0,0 +1,111 @@ + + + + + + + ZIP_GET_NUM_ENTRIES(3) + + + + + + + + +
ZIP_GET_NUM_ENTRIES(3)Library Functions ManualZIP_GET_NUM_ENTRIES(3)
+
+
+

+zip_get_num_entries — +
get number of files in archive
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int64_t +
+ zip_get_num_entries(zip_t + *archive, zip_flags_t + flags);

+
+
+

+The zip_get_num_entries() function returns the number of + files in archive. If flags is set + to ZIP_FL_UNCHANGED, the original number of entries is + returned. +
+
+

+zip_get_num_entries() returns the number of files in the + zip archive, or -1 if archive is + NULL. +
+
+

+libzip(3), + zip_fopen_index(3), + zip_stat_index(3) +
+
+

+zip_get_num_entries() was added in libzip 0.10. In + libzip 0.11 the return type was changed from + zip_uint64_t to zip_int64_t. In + libzip 0.11 the type of flags was changed from + int to zip_flags_t. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_get_num_entries.man b/core/deps/libzip/man/zip_get_num_entries.man new file mode 100644 index 000000000..f33f6ecf4 --- /dev/null +++ b/core/deps/libzip/man/zip_get_num_entries.man @@ -0,0 +1,87 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_get_num_entries.mdoc -- get number of files in archive +.\" Copyright (C) 2011-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_GET_NUM_ENTRIES" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_get_num_entries\fR +\- get number of files in archive +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int64_t\fR +.br +.PD 0 +.HP 4n +\fBzip_get_num_entries\fR(\fIzip_t\ *archive\fR, \fIzip_flags_t\ flags\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_get_num_entries\fR() +function returns the number of files in +\fIarchive\fR. +If +\fIflags\fR +is set to +\fRZIP_FL_UNCHANGED\fR, +the original number of entries is returned. +.SH "RETURN VALUES" +\fBzip_get_num_entries\fR() +returns the number of files in the zip archive, +or \-1 if +\fIarchive\fR +is +\fRNULL\fR. +.SH "SEE ALSO" +libzip(3), +zip_fopen_index(3), +zip_stat_index(3) +.SH "HISTORY" +\fBzip_get_num_entries\fR() +was added in libzip 0.10. +In libzip 0.11 the return type was changed from +\fIzip_uint64_t\fR +to +\fIzip_int64_t\fR. +In libzip 0.11 the type of +\fIflags\fR +was changed from +\fIint\fR +to +\fIzip_flags_t\fR. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_get_num_entries.mdoc b/core/deps/libzip/man/zip_get_num_entries.mdoc new file mode 100644 index 000000000..bfc70050f --- /dev/null +++ b/core/deps/libzip/man/zip_get_num_entries.mdoc @@ -0,0 +1,82 @@ +.\" zip_get_num_entries.mdoc -- get number of files in archive +.\" Copyright (C) 2011-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_GET_NUM_ENTRIES 3 +.Os +.Sh NAME +.Nm zip_get_num_entries +.Nd get number of files in archive +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int64_t +.Fn zip_get_num_entries "zip_t *archive" "zip_flags_t flags" +.Sh DESCRIPTION +The +.Fn zip_get_num_entries +function returns the number of files in +.Ar archive . +If +.Ar flags +is set to +.Dv ZIP_FL_UNCHANGED , +the original number of entries is returned. +.Sh RETURN VALUES +.Fn zip_get_num_entries +returns the number of files in the zip archive, +or \-1 if +.Ar archive +is +.Dv NULL . +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_fopen_index 3 , +.Xr zip_stat_index 3 +.Sh HISTORY +.Fn zip_get_num_entries +was added in libzip 0.10. +In libzip 0.11 the return type was changed from +.Vt zip_uint64_t +to +.Vt zip_int64_t . +In libzip 0.11 the type of +.Ar flags +was changed from +.Vt int +to +.Vt zip_flags_t . +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_get_num_files.html b/core/deps/libzip/man/zip_get_num_files.html new file mode 100644 index 000000000..d2f75fda4 --- /dev/null +++ b/core/deps/libzip/man/zip_get_num_files.html @@ -0,0 +1,110 @@ + + + + + + + ZIP_GET_NUM_FILES(3) + + + + + + + + +
ZIP_GET_NUM_FILES(3)Library Functions ManualZIP_GET_NUM_FILES(3)
+
+
+

+zip_get_num_files — +
get number of files in archive (obsolete interface)
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_get_num_files(zip_t + *archive);

+
+
+

+This function is deprecated. Use + zip_get_num_entries(3) + instead. +

The zip_get_num_files() function returns + the number of files in archive.

+
+
+

+zip_get_num_files() returns the number of files in the + zip archive, or -1 if archive is + NULL. +
+
+

+libzip(3), + zip_fopen_index(3), + zip_stat_index(3) +
+
+

+zip_get_num_files() was added in libzip 0.6. It was + deprecated in libzip 0.11, use + zip_get_num_entries(instead) + instead. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_get_num_files.man b/core/deps/libzip/man/zip_get_num_files.man new file mode 100644 index 000000000..0760eeda5 --- /dev/null +++ b/core/deps/libzip/man/zip_get_num_files.man @@ -0,0 +1,80 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_get_num_files.mdoc -- get number of files in archive +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_GET_NUM_FILES" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_get_num_files\fR +\- get number of files in archive (obsolete interface) +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_get_num_files\fR(\fIzip_t\ *archive\fR); +.PD +.SH "DESCRIPTION" +\fIThis function is deprecated\fR. +\fIUse\fR +zip_get_num_entries(3) +\fIinstead\fR. +.PP +The +\fBzip_get_num_files\fR() +function returns the number of files in +\fIarchive\fR. +.SH "RETURN VALUES" +\fBzip_get_num_files\fR() +returns the number of files in the zip archive, +or \-1 if +\fIarchive\fR +is +\fRNULL\fR. +.SH "SEE ALSO" +libzip(3), +zip_fopen_index(3), +zip_stat_index(3) +.SH "HISTORY" +\fBzip_get_num_files\fR() +was added in libzip 0.6. +It was deprecated in libzip 0.11, use +\fBzip_get_num_entries\fR(\fIinstead\fR) +instead. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_get_num_files.mdoc b/core/deps/libzip/man/zip_get_num_files.mdoc new file mode 100644 index 000000000..30ebbc38c --- /dev/null +++ b/core/deps/libzip/man/zip_get_num_files.mdoc @@ -0,0 +1,75 @@ +.\" zip_get_num_files.mdoc -- get number of files in archive +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_GET_NUM_FILES 3 +.Os +.Sh NAME +.Nm zip_get_num_files +.Nd get number of files in archive (obsolete interface) +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_get_num_files "zip_t *archive" +.Sh DESCRIPTION +.Em This function is deprecated . +.Em Use +.Xr zip_get_num_entries 3 +.Em instead . +.Pp +The +.Fn zip_get_num_files +function returns the number of files in +.Ar archive . +.Sh RETURN VALUES +.Fn zip_get_num_files +returns the number of files in the zip archive, +or \-1 if +.Ar archive +is +.Dv NULL . +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_fopen_index 3 , +.Xr zip_stat_index 3 +.Sh HISTORY +.Fn zip_get_num_files +was added in libzip 0.6. +It was deprecated in libzip 0.11, use +.Fn zip_get_num_entries instead +instead. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_libzip_version.html b/core/deps/libzip/man/zip_libzip_version.html new file mode 100644 index 000000000..3e454ca7b --- /dev/null +++ b/core/deps/libzip/man/zip_libzip_version.html @@ -0,0 +1,98 @@ + + + + + + + ZIP_LIBZIP_VERSION(3) + + + + + + + + +
ZIP_LIBZIP_VERSION(3)Library Functions ManualZIP_LIBZIP_VERSION(3)
+
+
+

+zip_libzip_version — +
return run-time version of library
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

const char * +
+ zip_libzip_version(void);

+
+
+

+zip_libzip_version returns the version number of the + library as string in the format “$MAJOR.$MINOR.$MICRO$SUFFIX” + where $MAJOR is the major version, + $MINOR the minor, $MICRO the + micro, and $SUFFIX a suffix that's only set for + development versions. +
+
+

+libzip(3) +
+
+

+zip_libzip_version() was added in libzip 1.3.1. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_libzip_version.man b/core/deps/libzip/man/zip_libzip_version.man new file mode 100644 index 000000000..3b2bcee86 --- /dev/null +++ b/core/deps/libzip/man/zip_libzip_version.man @@ -0,0 +1,71 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_libzip_version.mdoc -- return run-time version of library +.\" Copyright (C) 2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_LIBZIP_VERSION" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_libzip_version\fR +\- return run-time version of library +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIconst char *\fR +.br +.PD 0 +.HP 4n +\fBzip_libzip_version\fR(\fIvoid\fR); +.PD +.SH "DESCRIPTION" +\fBzip_libzip_version\fR +returns the version number of the library as string in the format +\(lq$MAJOR.$MINOR.$MICRO$SUFFIX\(rq +where +\fI$MAJOR\fR +is the major version, +\fI$MINOR\fR +the minor, +\fI$MICRO\fR +the micro, and +\fI$SUFFIX\fR +a suffix that's only set for development versions. +.SH "SEE ALSO" +libzip(3) +.SH "HISTORY" +\fBzip_libzip_version\fR() +was added in libzip 1.3.1. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_libzip_version.mdoc b/core/deps/libzip/man/zip_libzip_version.mdoc new file mode 100644 index 000000000..89737368c --- /dev/null +++ b/core/deps/libzip/man/zip_libzip_version.mdoc @@ -0,0 +1,66 @@ +.\" zip_libzip_version.mdoc -- return run-time version of library +.\" Copyright (C) 2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_LIBZIP_VERSION 3 +.Os +.Sh NAME +.Nm zip_libzip_version +.Nd return run-time version of library +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft const char * +.Fn zip_libzip_version void +.Sh DESCRIPTION +.Nm +returns the version number of the library as string in the format +.Dq $MAJOR.$MINOR.$MICRO$SUFFIX +where +.Ar $MAJOR +is the major version, +.Ar $MINOR +the minor, +.Ar $MICRO +the micro, and +.Ar $SUFFIX +a suffix that's only set for development versions. +.Sh SEE ALSO +.Xr libzip 3 +.Sh HISTORY +.Fn zip_libzip_version +was added in libzip 1.3.1. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_name_locate.html b/core/deps/libzip/man/zip_name_locate.html new file mode 100644 index 000000000..acb69d0de --- /dev/null +++ b/core/deps/libzip/man/zip_name_locate.html @@ -0,0 +1,149 @@ + + + + + + + ZIP_NAME_LOCATE(3) + + + + + + + + +
ZIP_NAME_LOCATE(3)Library Functions ManualZIP_NAME_LOCATE(3)
+
+
+

+zip_name_locate — +
get index of file by name
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int64_t +
+ zip_name_locate(zip_t + *archive, const char + *fname, zip_flags_t + flags);

+
+
+

+The zip_name_locate() function returns the index of the + file named fname in archive. If + archive does not contain a file with that name, -1 is + returned. The flags are specified by + or'ing the following values, or 0 + for none of them. +
+
+
+
Ignore case distinctions. (Will only work well if the file names are + ASCII.) With this flag, zip_name_locate() will be + slow for archives with many files.
+
+
Ignore directory part of file name in archive. With this flag, + zip_name_locate() will be slow for archives with + many files.
+
+
Compare against the unmodified names as it is in the ZIP archive.
+
+
(Default.) Guess the encoding of the name in the ZIP archive and convert + it to UTF-8, if necessary, before comparing. (Only CP-437 and UTF-8 are + recognized.)
+
+
Follow the ZIP specification and expect CP-437 encoded names in the ZIP + archive (except if they are explicitly marked as UTF-8). Convert it to + UTF-8 before comparing.
+
+
+Note: ASCII is a subset of both CP-437 and UTF-8. +
+
+

+zip_name_locate() returns the index of the file named + fname or -1, if archive does not + contain an entry of that name. +
+
+

+zip_name_locate() fails if: +
+
[]
+
One of the arguments is invalid.
+
[]
+
Required memory could not be allocated.
+
[]
+
No entry of the name fname is found in the + archive.
+
+
+
+

+libzip(3), + zip_get_name(3) +
+
+

+zip_name_locate() was added in libzip 0.6. In libzip + 0.11 the return type was changed from int to + zip_int64_t. In libzip 0.11 the type of + flags was changed from int to + zip_flags_t. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
September 22, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_name_locate.man b/core/deps/libzip/man/zip_name_locate.man new file mode 100644 index 000000000..1d07565c4 --- /dev/null +++ b/core/deps/libzip/man/zip_name_locate.man @@ -0,0 +1,137 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_name_locate.mdoc -- get index of file by name +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_NAME_LOCATE" "3" "September 22, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_name_locate\fR +\- get index of file by name +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int64_t\fR +.br +.PD 0 +.HP 4n +\fBzip_name_locate\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_flags_t\ flags\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_name_locate\fR() +function returns the index of the file named +\fIfname\fR +in +\fIarchive\fR. +If +\fIarchive\fR +does not contain a file with that name, \-1 is returned. +The +\fIflags\fR +are specified by +\fIor\fR'ing +the following values, or 0 for none of them. +.RS 6n +.TP 15n +\fRZIP_FL_NOCASE\fR +Ignore case distinctions. +(Will only work well if the file names are ASCII.) +With this flag, +\fBzip_name_locate\fR() +will be slow for archives with many files. +.TP 15n +\fRZIP_FL_NODIR\fR +Ignore directory part of file name in archive. +With this flag, +\fBzip_name_locate\fR() +will be slow for archives with many files. +.TP 15n +\fRZIP_FL_ENC_RAW\fR +.br +Compare against the unmodified names as it is in the ZIP archive. +.TP 15n +\fRZIP_FL_ENC_GUESS\fR +(Default.) +Guess the encoding of the name in the ZIP archive and convert it +to UTF-8, if necessary, before comparing. +(Only CP-437 and UTF-8 are recognized.) +.TP 15n +\fRZIP_FL_ENC_STRICT\fR +Follow the ZIP specification and expect CP-437 encoded names in +the ZIP archive (except if they are explicitly marked as UTF-8). +Convert it to UTF-8 before comparing. +.RE +\fINote\fR: +ASCII is a subset of both CP-437 and UTF-8. +.SH "RETURN VALUES" +\fBzip_name_locate\fR() +returns the index of the file named +\fIfname\fR +or \-1, if +\fIarchive\fR +does not contain an entry of that name. +.SH "ERRORS" +\fBzip_name_locate\fR() +fails if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +One of the arguments is invalid. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.TP 19n +[\fRZIP_ER_NOENT\fR] +No entry of the name +\fIfname\fR +is found in the archive. +.SH "SEE ALSO" +libzip(3), +zip_get_name(3) +.SH "HISTORY" +\fBzip_name_locate\fR() +was added in libzip 0.6. +In libzip 0.11 the return type was changed from +\fIint\fR +to +\fIzip_int64_t\fR. +In libzip 0.11 the type of +\fIflags\fR +was changed from +\fIint\fR +to +\fIzip_flags_t\fR. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_name_locate.mdoc b/core/deps/libzip/man/zip_name_locate.mdoc new file mode 100644 index 000000000..74fc94e0b --- /dev/null +++ b/core/deps/libzip/man/zip_name_locate.mdoc @@ -0,0 +1,125 @@ +.\" zip_name_locate.mdoc -- get index of file by name +.\" Copyright (C) 2003-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 22, 2020 +.Dt ZIP_NAME_LOCATE 3 +.Os +.Sh NAME +.Nm zip_name_locate +.Nd get index of file by name +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int64_t +.Fn zip_name_locate "zip_t *archive" "const char *fname" "zip_flags_t flags" +.Sh DESCRIPTION +The +.Fn zip_name_locate +function returns the index of the file named +.Ar fname +in +.Ar archive . +If +.Ar archive +does not contain a file with that name, \-1 is returned. +The +.Fa flags +are specified by +.Em or Ns No 'ing +the following values, or 0 for none of them. +.Bl -tag -offset indent -width ZIP_FL_NOCASE +.It Dv ZIP_FL_NOCASE +Ignore case distinctions. +(Will only work well if the file names are ASCII.) +With this flag, +.Fn zip_name_locate +will be slow for archives with many files. +.It Dv ZIP_FL_NODIR +Ignore directory part of file name in archive. +With this flag, +.Fn zip_name_locate +will be slow for archives with many files. +.It Dv ZIP_FL_ENC_RAW +Compare against the unmodified names as it is in the ZIP archive. +.It Dv ZIP_FL_ENC_GUESS +(Default.) +Guess the encoding of the name in the ZIP archive and convert it +to UTF-8, if necessary, before comparing. +(Only CP-437 and UTF-8 are recognized.) +.It Dv ZIP_FL_ENC_STRICT +Follow the ZIP specification and expect CP-437 encoded names in +the ZIP archive (except if they are explicitly marked as UTF-8). +Convert it to UTF-8 before comparing. +.El +.Em Note : +ASCII is a subset of both CP-437 and UTF-8. +.Sh RETURN VALUES +.Fn zip_name_locate +returns the index of the file named +.Ar fname +or \-1, if +.Ar archive +does not contain an entry of that name. +.Sh ERRORS +.Fn zip_name_locate +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +One of the arguments is invalid. +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.It Bq Er ZIP_ER_NOENT +No entry of the name +.Ar fname +is found in the archive. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_get_name 3 +.Sh HISTORY +.Fn zip_name_locate +was added in libzip 0.6. +In libzip 0.11 the return type was changed from +.Vt int +to +.Vt zip_int64_t . +In libzip 0.11 the type of +.Ar flags +was changed from +.Vt int +to +.Vt zip_flags_t . +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_open.html b/core/deps/libzip/man/zip_open.html new file mode 100644 index 000000000..667073767 --- /dev/null +++ b/core/deps/libzip/man/zip_open.html @@ -0,0 +1,176 @@ + + + + + + + ZIP_OPEN(3) + + + + + + + + +
ZIP_OPEN(3)Library Functions ManualZIP_OPEN(3)
+
+
+

+zip_open, zip_open_from_source + — +
open zip archive
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_t * +
+ zip_open(const + char *path, int + flags, int + *errorp);

+

zip_t * +
+ zip_open_from_source(zip_source_t + *zs, int flags, + zip_error_t *ze);

+
+
+

+The zip_open() function opens the zip archive specified + by path and returns a pointer to a + struct zip, used to manipulate the archive. The + flags are specified by + or'ing the following values, or 0 + for none of them. +
+
+
+
Perform additional stricter consistency checks on the archive, and error + if they fail.
+
+
Create the archive if it does not exist.
+
+
Error if archive already exists.
+
+
If archive exists, ignore its current contents. In other words, handle it + the same way as an empty archive.
+
+
Open archive in read-only mode.
+
+
+

If an error occurs and errorp is + non-NULL, it will be set to the corresponding error + code.

+

The zip_open_from_source() function opens + a zip archive encapsulated by the zip_source zs using + the provided flags. In case of error, the zip_error + ze is filled in.

+
+
+

+Upon successful completion zip_open() and + zip_open_from_source() return a struct + zip pointer. Otherwise, NULL is returned and + zip_open() sets *errorp to + indicate the error, while + zip_open_from(source) sets + ze to indicate the error. +
+
+

+The archive specified by path is opened unless: +
+
[]
+
The file specified by path exists and + ZIP_EXCL is set.
+
[]
+
Inconsistencies were found in the file specified by + path. This error is often caused by specifying + ZIP_CHECKCONS but can also happen without it.
+
[]
+
The path argument is + NULL.
+
[]
+
Required memory could not be allocated.
+
[]
+
The file specified by path does not exist and + ZIP_CREATE is not set.
+
[]
+
The file specified by path is not a zip + archive.
+
[]
+
The file specified by path could not be opened.
+
[]
+
A read error occurred; see errno for details.
+
[]
+
The file specified by path does not allow + seeks.
+
+
+
+

+libzip(3), + zip_close(3), + zip_error_strerror(3), + zip_fdopen(3) +
+
+

+zip_open() and + zip_open_from_source() were added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_open.man b/core/deps/libzip/man/zip_open.man new file mode 100644 index 000000000..5bf7cb336 --- /dev/null +++ b/core/deps/libzip/man/zip_open.man @@ -0,0 +1,192 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_open.mdoc -- open zip archive +.\" Copyright (C) 2003-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_OPEN" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_open\fR, +\fBzip_open_from_source\fR +\- open zip archive +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_open\fR(\fIconst\ char\ *path\fR, \fIint\ flags\fR, \fIint\ *errorp\fR); +.PD +.PP +\fIzip_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_open_from_source\fR(\fIzip_source_t\ *zs\fR, \fIint\ flags\fR, \fIzip_error_t\ *ze\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_open\fR() +function opens the zip archive specified by +\fIpath\fR +and returns a pointer to a +\fIstruct zip\fR, +used to manipulate the archive. +The +\fIflags\fR +are specified by +\fIor\fR'ing +the following values, or 0 for none of them. +.RS 6n +.TP 15n +\fRZIP_CHECKCONS\fR +Perform additional stricter consistency checks on the archive, and +error if they fail. +.TP 15n +\fRZIP_CREATE\fR +Create the archive if it does not exist. +.TP 15n +\fRZIP_EXCL\fR +Error if archive already exists. +.TP 15n +\fRZIP_TRUNCATE\fR +If archive exists, ignore its current contents. +In other words, handle it the same way as an empty archive. +.TP 15n +\fRZIP_RDONLY\fR +Open archive in read-only mode. +.RE +.PP +If an error occurs and +\fIerrorp\fR +is +non-\fRNULL\fR, +it will be set to the corresponding error code. +.PP +The +\fBzip_open_from_source\fR() +function opens a zip archive encapsulated by the zip_source +\fIzs\fR +using the provided +\fIflags\fR. +In case of error, the zip_error +\fIze\fR +is filled in. +.SH "RETURN VALUES" +Upon successful completion +\fBzip_open\fR() +and +\fBzip_open_from_source\fR() +return a +\fIstruct zip\fR +pointer. +Otherwise, +\fRNULL\fR +is returned and +\fBzip_open\fR() +sets +\fI*errorp\fR +to indicate the error, while +\fBzip_open_from\fR(\fIsource\fR) +sets +\fIze\fR +to indicate the error. +.SH "ERRORS" +The archive specified by +\fIpath\fR +is opened unless: +.TP 19n +[\fRZIP_ER_EXISTS\fR] +The file specified by +\fIpath\fR +exists and +\fRZIP_EXCL\fR +is set. +.TP 19n +[\fRZIP_ER_INCONS\fR] +Inconsistencies were found in the file specified by +\fIpath\fR. +This error is often caused by specifying +\fRZIP_CHECKCONS\fR +but can also happen without it. +.TP 19n +[\fRZIP_ER_INVAL\fR] +The +\fIpath\fR +argument is +\fRNULL\fR. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.TP 19n +[\fRZIP_ER_NOENT\fR] +The file specified by +\fIpath\fR +does not exist and +\fRZIP_CREATE\fR +is not set. +.TP 19n +[\fRZIP_ER_NOZIP\fR] +The file specified by +\fIpath\fR +is not a zip archive. +.TP 19n +[\fRZIP_ER_OPEN\fR] +The file specified by +\fIpath\fR +could not be opened. +.TP 19n +[\fRZIP_ER_READ\fR] +A read error occurred; see +\fIerrno\fR +for details. +.TP 19n +[\fRZIP_ER_SEEK\fR] +The file specified by +\fIpath\fR +does not allow seeks. +.SH "SEE ALSO" +libzip(3), +zip_close(3), +zip_error_strerror(3), +zip_fdopen(3) +.SH "HISTORY" +\fBzip_open\fR() +and +\fBzip_open_from_source\fR() +were added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_open.mdoc b/core/deps/libzip/man/zip_open.mdoc new file mode 100644 index 000000000..14e587564 --- /dev/null +++ b/core/deps/libzip/man/zip_open.mdoc @@ -0,0 +1,170 @@ +.\" zip_open.mdoc -- open zip archive +.\" Copyright (C) 2003-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_OPEN 3 +.Os +.Sh NAME +.Nm zip_open , +.Nm zip_open_from_source +.Nd open zip archive +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_t * +.Fn zip_open "const char *path" "int flags" "int *errorp" +.Ft zip_t * +.Fn zip_open_from_source "zip_source_t *zs" "int flags" "zip_error_t *ze" +.Sh DESCRIPTION +The +.Fn zip_open +function opens the zip archive specified by +.Ar path +and returns a pointer to a +.Ft struct zip , +used to manipulate the archive. +The +.Fa flags +are specified by +.Em or Ns No 'ing +the following values, or 0 for none of them. +.Bl -tag -offset indent -width ZIP_CHECKCONS +.It Dv ZIP_CHECKCONS +Perform additional stricter consistency checks on the archive, and +error if they fail. +.It Dv ZIP_CREATE +Create the archive if it does not exist. +.It Dv ZIP_EXCL +Error if archive already exists. +.It Dv ZIP_TRUNCATE +If archive exists, ignore its current contents. +In other words, handle it the same way as an empty archive. +.It Dv ZIP_RDONLY +Open archive in read-only mode. +.El +.Pp +If an error occurs and +.Ar errorp +is +.Pf non- Dv NULL , +it will be set to the corresponding error code. +.Pp +The +.Fn zip_open_from_source +function opens a zip archive encapsulated by the zip_source +.Fa zs +using the provided +.Fa flags . +In case of error, the zip_error +.Fa ze +is filled in. +.Sh RETURN VALUES +Upon successful completion +.Fn zip_open +and +.Fn zip_open_from_source +return a +.Ft struct zip +pointer. +Otherwise, +.Dv NULL +is returned and +.Fn zip_open +sets +.Ar *errorp +to indicate the error, while +.Fn zip_open_from source +sets +.Ar ze +to indicate the error. +.Sh ERRORS +The archive specified by +.Ar path +is opened unless: +.Bl -tag -width Er +.It Bq Er ZIP_ER_EXISTS +The file specified by +.Ar path +exists and +.Dv ZIP_EXCL +is set. +.It Bq Er ZIP_ER_INCONS +Inconsistencies were found in the file specified by +.Ar path . +This error is often caused by specifying +.Dv ZIP_CHECKCONS +but can also happen without it. +.It Bq Er ZIP_ER_INVAL +The +.Ar path +argument is +.Dv NULL . +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.It Bq Er ZIP_ER_NOENT +The file specified by +.Ar path +does not exist and +.Dv ZIP_CREATE +is not set. +.It Bq Er ZIP_ER_NOZIP +The file specified by +.Ar path +is not a zip archive. +.It Bq Er ZIP_ER_OPEN +The file specified by +.Ar path +could not be opened. +.It Bq Er ZIP_ER_READ +A read error occurred; see +.Va errno +for details. +.It Bq Er ZIP_ER_SEEK +The file specified by +.Ar path +does not allow seeks. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_close 3 , +.Xr zip_error_strerror 3 , +.Xr zip_fdopen 3 +.Sh HISTORY +.Fn zip_open +and +.Fn zip_open_from_source +were added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_register_progress_callback.html b/core/deps/libzip/man/zip_register_progress_callback.html new file mode 100644 index 000000000..e61b7ceb9 --- /dev/null +++ b/core/deps/libzip/man/zip_register_progress_callback.html @@ -0,0 +1,111 @@ + + + + + + + ZIP_REGISTER_PROGRESS_CALLBACK(3) + + + + + + + + +
ZIP_REGISTER_PROGRESS_CALLBACK(3)Library Functions ManualZIP_REGISTER_PROGRESS_CALLBACK(3)
+
+
+

+zip_register_progress_callback — +
provide updates during zip_close (obsolete interface)
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

typedef void + (*zip_progress_callback_t)(double);

+

void +
+ zip_register_progress_callback(zip_t + *archive, + zip_progress_callback_t + progress_callback);

+
+
+

+The function zip_register_progress_callback() is the + obsolete version of + zip_register_progress_callback_with_state(3). +

The zip_register_progress_callback() + function registers a callback function + progress_callback for the zip archive + archive. This function is called during + zip_close(3) after every zip archive + entry that's completely written to disk. The value is a + double in the range from 0.0 to 1.0. This can be used + to provide progress indicators for user interfaces.

+
+
+

+libzip(3), + zip_close(3) +
+
+

+zip_register_progress_callback() was added in libzip + 1.2.0. It was deprecated in libzip 1.3.0, use + zip_register_progress_callback_with_state() instead. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_register_progress_callback.man b/core/deps/libzip/man/zip_register_progress_callback.man new file mode 100644 index 000000000..3d0e5b94d --- /dev/null +++ b/core/deps/libzip/man/zip_register_progress_callback.man @@ -0,0 +1,83 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_register_progress_callback.mdoc -- provide updates during zip_close +.\" Copyright (C) 2016-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_REGISTER_PROGRESS_CALLBACK" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_register_progress_callback\fR +\- provide updates during zip_close (obsolete interface) +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fItypedef void (*zip_progress_callback_t)(double);\fR +.sp +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_register_progress_callback\fR(\fIzip_t\ *archive\fR, \fIzip_progress_callback_t\ progress_callback\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_register_progress_callback\fR() +is the obsolete version of +zip_register_progress_callback_with_state(3). +.PP +The +\fBzip_register_progress_callback\fR() +function registers a callback function +\fIprogress_callback\fR +for the zip archive +\fIarchive\fR. +This function is called during +zip_close(3) +after every zip archive entry that's completely written to disk. +The value is a +\fIdouble\fR +in the range from 0.0 to 1.0. +This can be used to provide progress indicators for user interfaces. +.SH "SEE ALSO" +libzip(3), +zip_close(3) +.SH "HISTORY" +\fBzip_register_progress_callback\fR() +was added in libzip 1.2.0. +It was deprecated in libzip 1.3.0, use +\fBzip_register_progress_callback_with_state\fR() +instead. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_register_progress_callback.mdoc b/core/deps/libzip/man/zip_register_progress_callback.mdoc new file mode 100644 index 000000000..9fd0cd0d7 --- /dev/null +++ b/core/deps/libzip/man/zip_register_progress_callback.mdoc @@ -0,0 +1,77 @@ +.\" zip_register_progress_callback.mdoc -- provide updates during zip_close +.\" Copyright (C) 2016-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_REGISTER_PROGRESS_CALLBACK 3 +.Os +.Sh NAME +.Nm zip_register_progress_callback +.Nd provide updates during zip_close (obsolete interface) +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Vt typedef void (*zip_progress_callback_t)(double); +.Ft void +.Fn zip_register_progress_callback "zip_t *archive" "zip_progress_callback_t progress_callback" +.Sh DESCRIPTION +The function +.Fn zip_register_progress_callback +is the obsolete version of +.Xr zip_register_progress_callback_with_state 3 . +.Pp +The +.Fn zip_register_progress_callback +function registers a callback function +.Ar progress_callback +for the zip archive +.Ar archive . +This function is called during +.Xr zip_close 3 +after every zip archive entry that's completely written to disk. +The value is a +.Vt double +in the range from 0.0 to 1.0. +This can be used to provide progress indicators for user interfaces. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_close 3 +.Sh HISTORY +.Fn zip_register_progress_callback +was added in libzip 1.2.0. +It was deprecated in libzip 1.3.0, use +.Fn zip_register_progress_callback_with_state +instead. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_register_progress_callback_with_state.html b/core/deps/libzip/man/zip_register_progress_callback_with_state.html new file mode 100644 index 000000000..4faf331d5 --- /dev/null +++ b/core/deps/libzip/man/zip_register_progress_callback_with_state.html @@ -0,0 +1,118 @@ + + + + + + + ZIP_REGISTER_PROGRESS_CALLBACK_WITH_STATE(3) + + + + + + + + +
ZIP_REGISTER_PROGRESS_CALLBACK_WITH_STATE(3)Library Functions ManualZIP_REGISTER_PROGRESS_CALLBACK_WITH_STATE(3)
+
+
+

+zip_register_progress_callback_with_state — +
provide updates during zip_close
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

typedef void (*zip_progress_callback)(zip_t *, + double, void *);

+

void +
+ zip_register_progress_callback_with_state(zip_t + *archive, double + precision, + zip_progress_callback + callback, void + (*ud_free)(void *), void + *ud);

+
+
+

+The zip_register_progress_callback_with_state() function + registers a callback function callback for the zip + archive archive. The precision + argument is a double in the range from 0.00 to 1.0 that defines the smallest + change for which the callback should be called (to avoid too frequent calls). + The ud_free function is called during cleanup for + deleting the userdata supplied in ud. +

The callback function is called during + zip_close(3) in regular intervals + (after every zip archive entry that's completely written to disk, and while + writing data for entries) with zip archive archive, + the current progression state as a double, and the + user-provided user-data ud as arguments. The + progression state is a double in the range from 0.0 to + 1.0. This can be used to provide progress indicators for user + interfaces.

+
+
+

+libzip(3), + zip_close(3) +
+
+

+zip_register_progress_callback_with_state() was added in + libzip 1.3.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_register_progress_callback_with_state.man b/core/deps/libzip/man/zip_register_progress_callback_with_state.man new file mode 100644 index 000000000..f24905bab --- /dev/null +++ b/core/deps/libzip/man/zip_register_progress_callback_with_state.man @@ -0,0 +1,92 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_register_progress_callback_with_state.mdoc -- provide updates during zip_close +.\" Copyright (C) 2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_REGISTER_PROGRESS_CALLBACK_WITH_STATE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_register_progress_callback_with_state\fR +\- provide updates during zip_close +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fItypedef void (*zip_progress_callback)(zip_t *, double, void *);\fR +.sp +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_register_progress_callback_with_state\fR(\fIzip_t\ *archive\fR, \fIdouble\ precision\fR, \fIzip_progress_callback\ callback\fR, \fIvoid\ (*ud_free)(void\ *)\fR, \fIvoid\ *ud\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_register_progress_callback_with_state\fR() +function registers a callback function +\fIcallback\fR +for the zip archive +\fIarchive\fR. +The +\fIprecision\fR +argument is a double in the range from 0.00 to 1.0 that defines the +smallest change for which the callback should be called (to avoid too +frequent calls). +The +\fIud_free\fR +function is called during cleanup for deleting the userdata supplied in +\fIud\fR. +.PP +The callback function is called during +zip_close(3) +in regular intervals (after every zip archive entry that's completely +written to disk, and while writing data for entries) with zip archive +\fIarchive\fR, +the current progression state as a +\fIdouble\fR, +and the user-provided user-data +\fIud\fR +as arguments. +The progression state is a +\fIdouble\fR +in the range from 0.0 to 1.0. +This can be used to provide progress indicators for user interfaces. +.SH "SEE ALSO" +libzip(3), +zip_close(3) +.SH "HISTORY" +\fBzip_register_progress_callback_with_state\fR() +was added in libzip 1.3.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_register_progress_callback_with_state.mdoc b/core/deps/libzip/man/zip_register_progress_callback_with_state.mdoc new file mode 100644 index 000000000..7eea3d669 --- /dev/null +++ b/core/deps/libzip/man/zip_register_progress_callback_with_state.mdoc @@ -0,0 +1,86 @@ +.\" zip_register_progress_callback_with_state.mdoc -- provide updates during zip_close +.\" Copyright (C) 2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_REGISTER_PROGRESS_CALLBACK_WITH_STATE 3 +.Os +.Sh NAME +.Nm zip_register_progress_callback_with_state +.Nd provide updates during zip_close +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Vt typedef void (*zip_progress_callback)(zip_t *, double, void *); +.Ft void +.Fn zip_register_progress_callback_with_state "zip_t *archive" "double precision" "zip_progress_callback callback" "void (*ud_free)(void *)" "void *ud" +.Sh DESCRIPTION +The +.Fn zip_register_progress_callback_with_state +function registers a callback function +.Ar callback +for the zip archive +.Ar archive . +The +.Ar precision +argument is a double in the range from 0.00 to 1.0 that defines the +smallest change for which the callback should be called (to avoid too +frequent calls). +The +.Ar ud_free +function is called during cleanup for deleting the userdata supplied in +.Ar ud . +.Pp +The callback function is called during +.Xr zip_close 3 +in regular intervals (after every zip archive entry that's completely +written to disk, and while writing data for entries) with zip archive +.Ar archive , +the current progression state as a +.Vt double , +and the user-provided user-data +.Ar ud +as arguments. +The progression state is a +.Vt double +in the range from 0.0 to 1.0. +This can be used to provide progress indicators for user interfaces. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_close 3 +.Sh HISTORY +.Fn zip_register_progress_callback_with_state +was added in libzip 1.3.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_rename.html b/core/deps/libzip/man/zip_rename.html new file mode 100644 index 000000000..22d9b454c --- /dev/null +++ b/core/deps/libzip/man/zip_rename.html @@ -0,0 +1,104 @@ + + + + + + + ZIP_RENAME(3) + + + + + + + + +
ZIP_RENAME(3)Library Functions ManualZIP_RENAME(3)
+
+
+

+zip_rename — +
rename file in zip archive (obsolete interface)
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_rename(zip_t + *archive, zip_uint64_t + index, const char + *name);

+
+
+

+zip_rename() is the obsolete version of + zip_file_rename(3). It is the + same as calling + zip_file_rename(3) with an empty + flags argument. +
+
+

+libzip(3), + zip_file_rename(3) +
+
+

+zip_rename() was added in libzip 0.6. In libzip 0.10 the + type of index was changed from int + to zip_uint64_t. It was deprecated in libzip 0.11, use + zip_file_rename() instead. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_rename.man b/core/deps/libzip/man/zip_rename.man new file mode 100644 index 000000000..ea8b8c08b --- /dev/null +++ b/core/deps/libzip/man/zip_rename.man @@ -0,0 +1,75 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_rename.mdoc -- rename file in zip archive +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_RENAME" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_rename\fR +\- rename file in zip archive (obsolete interface) +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_rename\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIconst\ char\ *name\fR); +.PD +.SH "DESCRIPTION" +\fBzip_rename\fR() +is the obsolete version of +zip_file_rename(3). +It is the same as calling +zip_file_rename(3) +with an empty flags argument. +.SH "SEE ALSO" +libzip(3), +zip_file_rename(3) +.SH "HISTORY" +\fBzip_rename\fR() +was added in libzip 0.6. +In libzip 0.10 the type of +\fIindex\fR +was changed from +\fIint\fR +to +\fIzip_uint64_t\fR. +It was deprecated in libzip 0.11, use +\fBzip_file_rename\fR() +instead. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_rename.mdoc b/core/deps/libzip/man/zip_rename.mdoc new file mode 100644 index 000000000..ce3a748cf --- /dev/null +++ b/core/deps/libzip/man/zip_rename.mdoc @@ -0,0 +1,70 @@ +.\" zip_rename.mdoc -- rename file in zip archive +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_RENAME 3 +.Os +.Sh NAME +.Nm zip_rename +.Nd rename file in zip archive (obsolete interface) +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_rename "zip_t *archive" "zip_uint64_t index" "const char *name" +.Sh DESCRIPTION +.Fn zip_rename +is the obsolete version of +.Xr zip_file_rename 3 . +It is the same as calling +.Xr zip_file_rename 3 +with an empty flags argument. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_rename 3 +.Sh HISTORY +.Fn zip_rename +was added in libzip 0.6. +In libzip 0.10 the type of +.Ar index +was changed from +.Vt int +to +.Vt zip_uint64_t . +It was deprecated in libzip 0.11, use +.Fn zip_file_rename +instead. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_set_archive_comment.html b/core/deps/libzip/man/zip_set_archive_comment.html new file mode 100644 index 000000000..4f9b113d4 --- /dev/null +++ b/core/deps/libzip/man/zip_set_archive_comment.html @@ -0,0 +1,124 @@ + + + + + + + ZIP_SET_ARCHIVE_COMMENT(3) + + + + + + + + +
ZIP_SET_ARCHIVE_COMMENT(3)Library Functions ManualZIP_SET_ARCHIVE_COMMENT(3)
+
+
+

+zip_set_archive_comment — +
set zip archive comment
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_set_archive_comment(zip_t + *archive, const char + *comment, zip_uint16_t + len);

+
+
+

+The zip_set_archive_comment() function sets the comment + for the entire zip archive. If comment is + NULL and len is 0, the archive + comment will be removed. comment must be encoded in + ASCII or UTF-8. +
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in archive is set to indicate the + error. +
+
+

+zip_set_archive_comment() fails if: +
+
[]
+
len is less than 0 or longer than the maximum + comment length in a zip file (65535), or comment is + not a valid UTF-8 encoded string.
+
[]
+
Required memory could not be allocated.
+
+
+
+

+libzip(3), + zip_file_get_comment(3), + zip_file_set_comment(3), + zip_get_archive_comment(3) +
+
+

+zip_set_archive_comment() was added in libzip 0.7. In + libzip 0.11 the type of len was changed from + int to zip_uint16_t. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_set_archive_comment.man b/core/deps/libzip/man/zip_set_archive_comment.man new file mode 100644 index 000000000..2b5d9d206 --- /dev/null +++ b/core/deps/libzip/man/zip_set_archive_comment.man @@ -0,0 +1,98 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_set_archive_comment.mdoc -- set zip archive comment +.\" Copyright (C) 2006-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SET_ARCHIVE_COMMENT" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_set_archive_comment\fR +\- set zip archive comment +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_set_archive_comment\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *comment\fR, \fIzip_uint16_t\ len\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_set_archive_comment\fR() +function sets the comment for the entire zip archive. +If +\fIcomment\fR +is +\fRNULL\fR +and +\fIlen\fR +is 0, the archive comment will be removed. +\fIcomment\fR +must be encoded in ASCII or UTF-8. +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_set_archive_comment\fR() +fails if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIlen\fR +is less than 0 or longer than the maximum comment length in a zip file +(65535), or +\fIcomment\fR +is not a valid UTF-8 encoded string. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.SH "SEE ALSO" +libzip(3), +zip_file_get_comment(3), +zip_file_set_comment(3), +zip_get_archive_comment(3) +.SH "HISTORY" +\fBzip_set_archive_comment\fR() +was added in libzip 0.7. +In libzip 0.11 the type of +\fIlen\fR +was changed from +\fIint\fR +to +\fIzip_uint16_t\fR. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_set_archive_comment.mdoc b/core/deps/libzip/man/zip_set_archive_comment.mdoc new file mode 100644 index 000000000..467a81162 --- /dev/null +++ b/core/deps/libzip/man/zip_set_archive_comment.mdoc @@ -0,0 +1,93 @@ +.\" zip_set_archive_comment.mdoc -- set zip archive comment +.\" Copyright (C) 2006-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SET_ARCHIVE_COMMENT 3 +.Os +.Sh NAME +.Nm zip_set_archive_comment +.Nd set zip archive comment +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_set_archive_comment "zip_t *archive" "const char *comment" "zip_uint16_t len" +.Sh DESCRIPTION +The +.Fn zip_set_archive_comment +function sets the comment for the entire zip archive. +If +.Ar comment +is +.Dv NULL +and +.Ar len +is 0, the archive comment will be removed. +.Ar comment +must be encoded in ASCII or UTF-8. +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_set_archive_comment +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +.Ar len +is less than 0 or longer than the maximum comment length in a zip file +(65535), or +.Ar comment +is not a valid UTF-8 encoded string. +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_get_comment 3 , +.Xr zip_file_set_comment 3 , +.Xr zip_get_archive_comment 3 +.Sh HISTORY +.Fn zip_set_archive_comment +was added in libzip 0.7. +In libzip 0.11 the type of +.Ar len +was changed from +.Vt int +to +.Vt zip_uint16_t . +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_set_archive_flag.html b/core/deps/libzip/man/zip_set_archive_flag.html new file mode 100644 index 000000000..3cdebd90d --- /dev/null +++ b/core/deps/libzip/man/zip_set_archive_flag.html @@ -0,0 +1,107 @@ + + + + + + + ZIP_SET_ARCHIVE_FLAG(3) + + + + + + + + +
ZIP_SET_ARCHIVE_FLAG(3)Library Functions ManualZIP_SET_ARCHIVE_FLAG(3)
+
+
+

+zip_set_archive_flag — +
set zip archive flag
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_set_archive_flag(zip_t + *archive, zip_flags_t + flag, int + value);

+
+
+

+The zip_set_archive_flag() function sets the flag + flag for the archive archive to + the value value. +

Currently there are no supported flags.

+
+
+

+Upon successful completion 0 is returned, and -1 if an error occurred. +
+
+

+libzip(3), + zip_get_archive_flag(3) +
+
+

+zip_set_archive_flag() was added in libzip 0.9. In + libzip 0.11 the type of flag was changed from + int to zip_flags_t. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_set_archive_flag.man b/core/deps/libzip/man/zip_set_archive_flag.man new file mode 100644 index 000000000..0cacf4c94 --- /dev/null +++ b/core/deps/libzip/man/zip_set_archive_flag.man @@ -0,0 +1,79 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_set_archive_flag.mdoc -- set zip archive flag +.\" Copyright (C) 2008-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SET_ARCHIVE_FLAG" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_set_archive_flag\fR +\- set zip archive flag +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_set_archive_flag\fR(\fIzip_t\ *archive\fR, \fIzip_flags_t\ flag\fR, \fIint\ value\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_set_archive_flag\fR() +function sets the flag +\fIflag\fR +for the archive +\fIarchive\fR +to the value +\fIvalue\fR. +.PP +Currently there are no supported flags. +.SH "RETURN VALUES" +Upon successful completion 0 is returned, and \-1 if an error +occurred. +.SH "SEE ALSO" +libzip(3), +zip_get_archive_flag(3) +.SH "HISTORY" +\fBzip_set_archive_flag\fR() +was added in libzip 0.9. +In libzip 0.11 the type of +\fIflag\fR +was changed from +\fIint\fR +to +\fIzip_flags_t\fR. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_set_archive_flag.mdoc b/core/deps/libzip/man/zip_set_archive_flag.mdoc new file mode 100644 index 000000000..116a340ff --- /dev/null +++ b/core/deps/libzip/man/zip_set_archive_flag.mdoc @@ -0,0 +1,74 @@ +.\" zip_set_archive_flag.mdoc -- set zip archive flag +.\" Copyright (C) 2008-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SET_ARCHIVE_FLAG 3 +.Os +.Sh NAME +.Nm zip_set_archive_flag +.Nd set zip archive flag +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_set_archive_flag "zip_t *archive" "zip_flags_t flag" "int value" +.Sh DESCRIPTION +The +.Fn zip_set_archive_flag +function sets the flag +.Ar flag +for the archive +.Ar archive +to the value +.Ar value . +.Pp +Currently there are no supported flags. +.Sh RETURN VALUES +Upon successful completion 0 is returned, and \-1 if an error +occurred. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_get_archive_flag 3 +.Sh HISTORY +.Fn zip_set_archive_flag +was added in libzip 0.9. +In libzip 0.11 the type of +.Ar flag +was changed from +.Vt int +to +.Vt zip_flags_t . +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_set_default_password.html b/core/deps/libzip/man/zip_set_default_password.html new file mode 100644 index 000000000..8349fae43 --- /dev/null +++ b/core/deps/libzip/man/zip_set_default_password.html @@ -0,0 +1,123 @@ + + + + + + + ZIP_SET_DEFAULT_PASSWORD(3) + + + + + + + + +
ZIP_SET_DEFAULT_PASSWORD(3)Library Functions ManualZIP_SET_DEFAULT_PASSWORD(3)
+
+
+

+zip_set_default_password — +
set default password for encrypted files in zip
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_set_default_password(zip_t + *archive, const char + *password);

+
+
+

+The zip_set_default_password() function sets the default + password used when accessing encrypted files. If + password is NULL or the empty + string, the default password is unset. +

If you prefer a different password for single files, use + zip_fopen_encrypted(3) + instead of zip_fopen(3). Usually, + however, the same password is used for every file in an zip archive.

+

The password is not verified when calling this function. See the + CAVEATS section in + zip_fopen_encrypted(3) for + more details about password handling.

+
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in archive is set to indicate the + error. +
+
+

+zip_set_default_password() fails if: +
+
[]
+
Required memory could not be allocated.
+
+
+
+

+libzip(3), + zip_fopen(3), + zip_fopen_encrypted(3) +
+
+

+zip_set_default_password() was added in libzip 0.10. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
September 15, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_set_default_password.man b/core/deps/libzip/man/zip_set_default_password.man new file mode 100644 index 000000000..36acad859 --- /dev/null +++ b/core/deps/libzip/man/zip_set_default_password.man @@ -0,0 +1,94 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_set_default_password.mdoc -- set default password for zip +.\" Copyright (C) 2011-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SET_DEFAULT_PASSWORD" "3" "September 15, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_set_default_password\fR +\- set default password for encrypted files in zip +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_set_default_password\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *password\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_set_default_password\fR() +function sets the default password used when accessing encrypted files. +If +\fIpassword\fR +is +\fRNULL\fR +or the empty string, the default password is unset. +.PP +If you prefer a different password for single files, use +zip_fopen_encrypted(3) +instead of +zip_fopen(3). +Usually, however, the same password is used for every file in an +zip archive. +.PP +The password is not verified when calling this function. +See the +\fICAVEATS\fR +section in +zip_fopen_encrypted(3) +for more details about password handling. +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_set_default_password\fR() +fails if: +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.SH "SEE ALSO" +libzip(3), +zip_fopen(3), +zip_fopen_encrypted(3) +.SH "HISTORY" +\fBzip_set_default_password\fR() +was added in libzip 0.10. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_set_default_password.mdoc b/core/deps/libzip/man/zip_set_default_password.mdoc new file mode 100644 index 000000000..6381195ab --- /dev/null +++ b/core/deps/libzip/man/zip_set_default_password.mdoc @@ -0,0 +1,90 @@ +.\" zip_set_default_password.mdoc -- set default password for zip +.\" Copyright (C) 2011-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 15, 2020 +.Dt ZIP_SET_DEFAULT_PASSWORD 3 +.Os +.Sh NAME +.Nm zip_set_default_password +.Nd set default password for encrypted files in zip +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_set_default_password "zip_t *archive" "const char *password" +.Sh DESCRIPTION +The +.Fn zip_set_default_password +function sets the default password used when accessing encrypted files. +If +.Ar password +is +.Dv NULL +or the empty string, the default password is unset. +.Pp +If you prefer a different password for single files, use +.Xr zip_fopen_encrypted 3 +instead of +.Xr zip_fopen 3 . +Usually, however, the same password is used for every file in an +zip archive. +.Pp +The password is not verified when calling this function. +See the +.Sx CAVEATS +section in +.Xr zip_fopen_encrypted 3 +for more details about password handling. +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_set_default_password +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_fopen 3 , +.Xr zip_fopen_encrypted 3 +.Sh HISTORY +.Fn zip_set_default_password +was added in libzip 0.10. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_set_file_comment.html b/core/deps/libzip/man/zip_set_file_comment.html new file mode 100644 index 000000000..048dc373d --- /dev/null +++ b/core/deps/libzip/man/zip_set_file_comment.html @@ -0,0 +1,109 @@ + + + + + + + ZIP_SET_FILE_COMMENT(3) + + + + + + + + +
ZIP_SET_FILE_COMMENT(3)Library Functions ManualZIP_SET_FILE_COMMENT(3)
+
+
+

+zip_set_file_comment — +
set comment for file in zip (obsolete interface)
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_set_file_comment(zip_t + *archive, zip_uint64_t + index, const char + *comment, int + len);

+
+
+

+The zip_set_file_comment() function is the obsolete + version of + zip_file_set_comment(3). + The only differences are the type of the len argument + and the additional flags argument. + zip_set_file_comment() is the same as calling + zip_file_set_comment(3) + with an empty flags argument. +
+
+

+libzip(3), + zip_file_set_comment(3) +
+
+

+zip_set_file_comment() was added in libzip 0.7. In + libzip 0.10 the type of index was changed from + int to zip_uint64_t. It was + deprecated in libzip 0.11, use zip_file_set_comment() + instead. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_set_file_comment.man b/core/deps/libzip/man/zip_set_file_comment.man new file mode 100644 index 000000000..2ba8a7c9f --- /dev/null +++ b/core/deps/libzip/man/zip_set_file_comment.man @@ -0,0 +1,84 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_set_file_comment.mdoc -- set comment for file in zip +.\" Copyright (C) 2006-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SET_FILE_COMMENT" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_set_file_comment\fR +\- set comment for file in zip (obsolete interface) +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_set_file_comment\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIconst\ char\ *comment\fR, \fIint\ len\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_set_file_comment\fR() +function is the obsolete version of +zip_file_set_comment(3). +The only differences are the type of the +\fIlen\fR +argument and the additional +\fIflags\fR +argument. +\fBzip_set_file_comment\fR() +is the same as calling +zip_file_set_comment(3) +with an empty +\fIflags\fR +argument. +.SH "SEE ALSO" +libzip(3), +zip_file_set_comment(3) +.SH "HISTORY" +\fBzip_set_file_comment\fR() +was added in libzip 0.7. +In libzip 0.10 the type of +\fIindex\fR +was changed from +\fIint\fR +to +\fIzip_uint64_t\fR. +It was deprecated in libzip 0.11, use +\fBzip_file_set_comment\fR() +instead. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_set_file_comment.mdoc b/core/deps/libzip/man/zip_set_file_comment.mdoc new file mode 100644 index 000000000..f6e2b378a --- /dev/null +++ b/core/deps/libzip/man/zip_set_file_comment.mdoc @@ -0,0 +1,79 @@ +.\" zip_set_file_comment.mdoc -- set comment for file in zip +.\" Copyright (C) 2006-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SET_FILE_COMMENT 3 +.Os +.Sh NAME +.Nm zip_set_file_comment +.Nd set comment for file in zip (obsolete interface) +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_set_file_comment "zip_t *archive" "zip_uint64_t index" "const char *comment" "int len" +.Sh DESCRIPTION +The +.Fn zip_set_file_comment +function is the obsolete version of +.Xr zip_file_set_comment 3 . +The only differences are the type of the +.Ar len +argument and the additional +.Ar flags +argument. +.Fn zip_set_file_comment +is the same as calling +.Xr zip_file_set_comment 3 +with an empty +.Ar flags +argument. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_set_comment 3 +.Sh HISTORY +.Fn zip_set_file_comment +was added in libzip 0.7. +In libzip 0.10 the type of +.Ar index +was changed from +.Vt int +to +.Vt zip_uint64_t . +It was deprecated in libzip 0.11, use +.Fn zip_file_set_comment +instead. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_set_file_compression.html b/core/deps/libzip/man/zip_set_file_compression.html new file mode 100644 index 000000000..887c35ca4 --- /dev/null +++ b/core/deps/libzip/man/zip_set_file_compression.html @@ -0,0 +1,149 @@ + + + + + + + ZIP_SET_FILE_COMPRESSION(3) + + + + + + + + +
ZIP_SET_FILE_COMPRESSION(3)Library Functions ManualZIP_SET_FILE_COMPRESSION(3)
+
+
+

+zip_set_file_compression — +
set compression method for file in zip
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_set_file_compression(zip_t + *archive, zip_uint64_t + index, zip_int32_t + comp, zip_uint32_t + comp_flags);

+
+
+

+The zip_set_file_compression() function sets the + compression method for the file at position index in the + zip archive to comp with the compression method specific + comp_flags. The comp is the same + as returned by zip_stat(3). For the + comp argument, currently only the following values are + supported: +
+
+
default compression; currently the same as + ZIP_CM_DEFLATE, but flags + are ignored.
+
+
Store the file uncompressed.
+
+
Compress the file using the bzip2(1) + algorithm.
+
+
Deflate the file with the zlib(3) + algorithm and default options.
+
+

NOTE: Only the deflate and store methods can be + assumed to be universally supported.

+

The comp_flags argument defines the + compression level, 1 being fastest compression and 9 highest. Allowed values + are 0 (which uses the default compression for the algorithm) and 1-9, other + values are undefined. Further compression method specific flags might be + added over time.

+

The current compression method for a file in a zip archive can be + determined using zip_stat(3).

+
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in archive is set to indicate the + error. +
+
+

+zip_set_file_compression() fails if: +
+
[]
+
Unsupported compression method requested.
+
[]
+
index is not a valid file index in + archive, or the argument combination is + invalid.
+
[]
+
Read-only zip file, no changes allowed.
+
+
+
+

+libzip(3), + zip_compression_method_supported(3), + zip_stat(3) +
+
+

+zip_set_file_compression() was added in libzip 0.11. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
April 2, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_set_file_compression.man b/core/deps/libzip/man/zip_set_file_compression.man new file mode 100644 index 000000000..15bacde74 --- /dev/null +++ b/core/deps/libzip/man/zip_set_file_compression.man @@ -0,0 +1,132 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_set_file_compression.mdoc -- set compression method and its flags +.\" Copyright (C) 2012-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SET_FILE_COMPRESSION" "3" "April 2, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_set_file_compression\fR +\- set compression method for file in zip +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_set_file_compression\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_int32_t\ comp\fR, \fIzip_uint32_t\ comp_flags\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_set_file_compression\fR() +function sets the compression method for the file at position +\fIindex\fR +in the zip archive to +\fIcomp\fR +with the compression method specific +\fIcomp_flags\fR. +The +\fIcomp\fR +is the same as returned by +zip_stat(3). +For the +\fIcomp\fR +argument, currently only the following values are supported: +.TP 19n +\fRZIP_CM_DEFAULT\fR +default compression; currently the same as +\fRZIP_CM_DEFLATE\fR, +but +\fIflags\fR +are ignored. +.TP 19n +\fRZIP_CM_STORE\fR +Store the file uncompressed. +.TP 19n +\fRZIP_CM_BZIP2\fR +Compress the file using the +bzip2(1) +algorithm. +.TP 19n +\fRZIP_CM_DEFLATE\fR +Deflate the file with the +zlib(3) +algorithm and default options. +.PP +\fINOTE\fR: +Only the deflate and store methods can be assumed to be universally +supported. +.PP +The +\fIcomp_flags\fR +argument defines the compression level, 1 being fastest compression +and 9 highest. +Allowed values are 0 (which uses the default compression for the +algorithm) and 1-9, other values are undefined. +Further compression method specific flags might be added over time. +.PP +The current compression method for a file in a zip archive can be +determined using +zip_stat(3). +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_set_file_compression\fR() +fails if: +.TP 19n +[\fRZIP_ER_COMPNOTSUPP\fR] +Unsupported compression method requested. +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIindex\fR +is not a valid file index in +\fIarchive\fR, +or the argument combination is invalid. +.TP 19n +[\fRZIP_ER_RDONLY\fR] +Read-only zip file, no changes allowed. +.SH "SEE ALSO" +libzip(3), +zip_compression_method_supported(3), +zip_stat(3) +.SH "HISTORY" +\fBzip_set_file_compression\fR() +was added in libzip 0.11. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_set_file_compression.mdoc b/core/deps/libzip/man/zip_set_file_compression.mdoc new file mode 100644 index 000000000..1e30417dd --- /dev/null +++ b/core/deps/libzip/man/zip_set_file_compression.mdoc @@ -0,0 +1,124 @@ +.\" zip_set_file_compression.mdoc -- set compression method and its flags +.\" Copyright (C) 2012-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd April 2, 2020 +.Dt ZIP_SET_FILE_COMPRESSION 3 +.Os +.Sh NAME +.Nm zip_set_file_compression +.Nd set compression method for file in zip +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_set_file_compression "zip_t *archive" "zip_uint64_t index" "zip_int32_t comp" "zip_uint32_t comp_flags" +.Sh DESCRIPTION +The +.Fn zip_set_file_compression +function sets the compression method for the file at position +.Ar index +in the zip archive to +.Ar comp +with the compression method specific +.Ar comp_flags . +The +.Ar comp +is the same as returned by +.Xr zip_stat 3 . +For the +.Ar comp +argument, currently only the following values are supported: +.Bl -tag -width ZIP_CM_DEFLATE_XX +.It Dv ZIP_CM_DEFAULT +default compression; currently the same as +.Dv ZIP_CM_DEFLATE , +but +.Ar flags +are ignored. +.It Dv ZIP_CM_STORE +Store the file uncompressed. +.It Dv ZIP_CM_BZIP2 +Compress the file using the +.Xr bzip2 1 +algorithm. +.It Dv ZIP_CM_DEFLATE +Deflate the file with the +.Xr zlib 3 +algorithm and default options. +.El +.Pp +.Em NOTE : +Only the deflate and store methods can be assumed to be universally +supported. +.Pp +The +.Ar comp_flags +argument defines the compression level, 1 being fastest compression +and 9 highest. +Allowed values are 0 (which uses the default compression for the +algorithm) and 1-9, other values are undefined. +Further compression method specific flags might be added over time. +.Pp +The current compression method for a file in a zip archive can be +determined using +.Xr zip_stat 3 . +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_set_file_compression +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_COMPNOTSUPP +Unsupported compression method requested. +.It Bq Er ZIP_ER_INVAL +.Ar index +is not a valid file index in +.Ar archive , +or the argument combination is invalid. +.It Bq Er ZIP_ER_RDONLY +Read-only zip file, no changes allowed. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_compression_method_supported 3 , +.Xr zip_stat 3 +.Sh HISTORY +.Fn zip_set_file_compression +was added in libzip 0.11. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source.html b/core/deps/libzip/man/zip_source.html new file mode 100644 index 000000000..2877ed38d --- /dev/null +++ b/core/deps/libzip/man/zip_source.html @@ -0,0 +1,117 @@ + + + + + + + ZIP_SOURCE(3) + + + + + + + + +
ZIP_SOURCE(3)Library Functions ManualZIP_SOURCE(3)
+
+
+

+zip_source — +
zip data source structure
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_source_t *zs;

+
+
+

+A struct zip_source is a data source used by + libzip(3) for adding or replacing file + contents for a file in a zip archive. If the source supports seeking, it can + also be used to open zip archives from. It is created by calling one of + zip_source_buffer(3), + zip_source_buffer_create(3), + zip_source_file(3), + zip_source_file_create(3), + zip_source_filep(3), + zip_source_filep_create(3), + zip_source_function(3), + zip_source_function_create(3), + or zip_source_zip(3). + zip_source_t is reference counted, and created with a + reference count of 1. + zip_open_from_source(3), + zip_file_add(3), and + zip_file_replace(3) will + decrement the reference count of the zip_source_t when + they are done using it, so + zip_source_free(3) only needs to + be called when these functions return an error. Use + zip_source_keep(3) to increase + the reference count, for example if you need the source after + zip_close(3). +
+
+

+libzip(3), + zip_source_buffer(3), + zip_source_file(3), + zip_source_filep(3), + zip_source_free(3), + zip_source_function(3), + zip_source_zip(3) +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source.man b/core/deps/libzip/man/zip_source.man new file mode 100644 index 000000000..6b3098d73 --- /dev/null +++ b/core/deps/libzip/man/zip_source.man @@ -0,0 +1,89 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source.mdoc -- description of zip data source +.\" Copyright (C) 2014-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source\fR +\- zip data source structure +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_source_t *zs\fR; +.SH "DESCRIPTION" +A +\fIstruct zip_source\fR +is a data source used by +libzip(3) +for adding or replacing file contents for a file in a zip archive. +If the source supports seeking, it can also be used to open zip archives from. +It is created by calling one of +zip_source_buffer(3), +zip_source_buffer_create(3), +zip_source_file(3), +zip_source_file_create(3), +zip_source_filep(3), +zip_source_filep_create(3), +zip_source_function(3), +zip_source_function_create(3), +or +zip_source_zip(3). +\fIzip_source_t\fR +is reference counted, and created with a reference count of 1. +zip_open_from_source(3), +zip_file_add(3), +and +zip_file_replace(3) +will decrement the reference count of the +\fIzip_source_t\fR +when they are done using it, so +zip_source_free(3) +only needs to be called when these functions return an error. +Use +zip_source_keep(3) +to increase the reference count, for example if you need the source after +zip_close(3). +.SH "SEE ALSO" +libzip(3), +zip_source_buffer(3), +zip_source_file(3), +zip_source_filep(3), +zip_source_free(3), +zip_source_function(3), +zip_source_zip(3) +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source.mdoc b/core/deps/libzip/man/zip_source.mdoc new file mode 100644 index 000000000..9b0249b81 --- /dev/null +++ b/core/deps/libzip/man/zip_source.mdoc @@ -0,0 +1,88 @@ +.\" zip_source.mdoc -- description of zip data source +.\" Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE 3 +.Os +.Sh NAME +.Nm zip_source +.Nd zip data source structure +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Vt zip_source_t *zs ; +.Sh DESCRIPTION +A +.Vt struct zip_source +is a data source used by +.Xr libzip 3 +for adding or replacing file contents for a file in a zip archive. +If the source supports seeking, it can also be used to open zip archives from. +It is created by calling one of +.Xr zip_source_buffer 3 , +.Xr zip_source_buffer_create 3 , +.Xr zip_source_file 3 , +.Xr zip_source_file_create 3 , +.Xr zip_source_filep 3 , +.Xr zip_source_filep_create 3 , +.Xr zip_source_function 3 , +.Xr zip_source_function_create 3 , +or +.Xr zip_source_zip 3 . +.Vt zip_source_t +is reference counted, and created with a reference count of 1. +.Xr zip_open_from_source 3 , +.Xr zip_file_add 3 , +and +.Xr zip_file_replace 3 +will decrement the reference count of the +.Vt zip_source_t +when they are done using it, so +.Xr zip_source_free 3 +only needs to be called when these functions return an error. +Use +.Xr zip_source_keep 3 +to increase the reference count, for example if you need the source after +.Xr zip_close 3 . +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source_buffer 3 , +.Xr zip_source_file 3 , +.Xr zip_source_filep 3 , +.Xr zip_source_free 3 , +.Xr zip_source_function 3 , +.Xr zip_source_zip 3 +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_begin_write.html b/core/deps/libzip/man/zip_source_begin_write.html new file mode 100644 index 000000000..b65682a56 --- /dev/null +++ b/core/deps/libzip/man/zip_source_begin_write.html @@ -0,0 +1,123 @@ + + + + + + + ZIP_SOURCE_BEGIN_WRITE(3) + + + + + + + + +
ZIP_SOURCE_BEGIN_WRITE(3)Library Functions ManualZIP_SOURCE_BEGIN_WRITE(3)
+
+
+

+zip_source_begin_write, + zip_source_begin_write_cloning — +
prepare zip source for writing
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_source_begin_write(zip_source_t + *source);

+

int +
+ zip_source_begin_write_cloning(zip_source_t + *source, zip_uint64_t + offset);

+
+
+

+The functions zip_source_begin_write() and + zip_source_begin_write_cloning() prepare + source for writing. Usually this involves creating + temporary files or allocating buffers. +

zip_source_begin_write_cloning() preserves + the first offset bytes of the original file. This is + done efficiently, and writes to source won't overwrite + the original data until zip_commit_write() is + called.

+
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in source is set to indicate the + error. +
+
+

+libzip(3), + zip_source(3), + zip_source_commit_write(3), + zip_source_rollback_write(3), + zip_source_seek_write(3), + zip_source_tell_write(3), + zip_source_write(3) +
+
+

+zip_source_begin_write() was added in libzip 1.0. +

zip_source_begin_write_cloning() was added + in libzip 1.4.0.

+
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_begin_write.man b/core/deps/libzip/man/zip_source_begin_write.man new file mode 100644 index 000000000..a0a21c521 --- /dev/null +++ b/core/deps/libzip/man/zip_source_begin_write.man @@ -0,0 +1,99 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_begin_write.mdoc -- prepare zip source for writing +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_BEGIN_WRITE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_begin_write\fR, +\fBzip_source_begin_write_cloning\fR +\- prepare zip source for writing +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_source_begin_write\fR(\fIzip_source_t\ *source\fR); +.PD +.PP +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_source_begin_write_cloning\fR(\fIzip_source_t\ *source\fR, \fIzip_uint64_t\ offset\fR); +.PD +.SH "DESCRIPTION" +The functions +\fBzip_source_begin_write\fR() +and +\fBzip_source_begin_write_cloning\fR() +prepare +\fIsource\fR +for writing. +Usually this involves creating temporary files or allocating buffers. +.PP +\fBzip_source_begin_write_cloning\fR() +preserves the first +\fIoffset\fR +bytes of the original file. +This is done efficiently, and writes to +\fIsource\fR +won't overwrite the original data until +\fBzip_commit_write\fR() +is called. +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +\fIsource\fR +is set to indicate the error. +.SH "SEE ALSO" +libzip(3), +zip_source(3), +zip_source_commit_write(3), +zip_source_rollback_write(3), +zip_source_seek_write(3), +zip_source_tell_write(3), +zip_source_write(3) +.SH "HISTORY" +\fBzip_source_begin_write\fR() +was added in libzip 1.0. +.PP +\fBzip_source_begin_write_cloning\fR() +was added in libzip 1.4.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_begin_write.mdoc b/core/deps/libzip/man/zip_source_begin_write.mdoc new file mode 100644 index 000000000..bef77e262 --- /dev/null +++ b/core/deps/libzip/man/zip_source_begin_write.mdoc @@ -0,0 +1,89 @@ +.\" zip_source_begin_write.mdoc -- prepare zip source for writing +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_BEGIN_WRITE 3 +.Os +.Sh NAME +.Nm zip_source_begin_write , +.Nm zip_source_begin_write_cloning +.Nd prepare zip source for writing +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_source_begin_write "zip_source_t *source" +.Ft int +.Fn zip_source_begin_write_cloning "zip_source_t *source" "zip_uint64_t offset" +.Sh DESCRIPTION +The functions +.Fn zip_source_begin_write +and +.Fn zip_source_begin_write_cloning +prepare +.Fa source +for writing. +Usually this involves creating temporary files or allocating buffers. +.Pp +.Fn zip_source_begin_write_cloning +preserves the first +.Ar offset +bytes of the original file. +This is done efficiently, and writes to +.Ar source +won't overwrite the original data until +.Fn zip_commit_write +is called. +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +.Ar source +is set to indicate the error. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 , +.Xr zip_source_commit_write 3 , +.Xr zip_source_rollback_write 3 , +.Xr zip_source_seek_write 3 , +.Xr zip_source_tell_write 3 , +.Xr zip_source_write 3 +.Sh HISTORY +.Fn zip_source_begin_write +was added in libzip 1.0. +.Pp +.Fn zip_source_begin_write_cloning +was added in libzip 1.4.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_buffer.html b/core/deps/libzip/man/zip_source_buffer.html new file mode 100644 index 000000000..b49174743 --- /dev/null +++ b/core/deps/libzip/man/zip_source_buffer.html @@ -0,0 +1,135 @@ + + + + + + + ZIP_SOURCE_BUFFER(3) + + + + + + + + +
ZIP_SOURCE_BUFFER(3)Library Functions ManualZIP_SOURCE_BUFFER(3)
+
+
+

+zip_source_buffer, + zip_source_buffer_create — +
create zip data source from buffer
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_source_t * +
+ zip_source_buffer(zip_t + *archive, const void + *data, zip_uint64_t + len, int + freep);

+

zip_source_t * +
+ zip_source_buffer_create(const + void *data, zip_uint64_t + len, int freep, + zip_error_t *error);

+
+
+

+The functions zip_source_buffer() and + zip_source_buffer_create() create a zip source from + the buffer data of size len. If + freep is non-zero, the buffer will be freed when it is + no longer needed. data must remain valid for the + lifetime of the created source. +

The source can be used to open a zip archive from.

+
+
+

+Upon successful completion, the created source is returned. Otherwise, + NULL is returned and the error code in + archive or error is set to + indicate the error. +
+
+

+zip_source_buffer() and + zip_source_buffer_create() fail if: +
+
[]
+
len is greater than zero and + data is NULL.
+
[]
+
Required memory could not be allocated.
+
+
+
+

+libzip(3), + zip_file_add(3), + zip_file_replace(3), + zip_open_from_source(3), + zip_source(3) +
+
+

+zip_source_buffer() and + zip_source_buffer_create() were added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_buffer.man b/core/deps/libzip/man/zip_source_buffer.man new file mode 100644 index 000000000..2d6909cbb --- /dev/null +++ b/core/deps/libzip/man/zip_source_buffer.man @@ -0,0 +1,112 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_buffer.mdoc -- create zip data source from buffer +.\" Copyright (C) 2004-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_BUFFER" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_buffer\fR, +\fBzip_source_buffer_create\fR +\- create zip data source from buffer +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_buffer\fR(\fIzip_t\ *archive\fR, \fIconst\ void\ *data\fR, \fIzip_uint64_t\ len\fR, \fIint\ freep\fR); +.PD +.PP +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_buffer_create\fR(\fIconst\ void\ *data\fR, \fIzip_uint64_t\ len\fR, \fIint\ freep\fR, \fIzip_error_t\ *error\fR); +.PD +.SH "DESCRIPTION" +The functions +\fBzip_source_buffer\fR() +and +\fBzip_source_buffer_create\fR() +create a zip source from the buffer +\fIdata\fR +of size +\fIlen\fR. +If +\fIfreep\fR +is non-zero, the buffer will be freed when it is no longer needed. +\fIdata\fR +must remain valid for the lifetime of the created source. +.PP +The source can be used to open a zip archive from. +.SH "RETURN VALUES" +Upon successful completion, the created source is returned. +Otherwise, +\fRNULL\fR +is returned and the error code in +\fIarchive\fR +or +\fIerror\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_source_buffer\fR() +and +\fBzip_source_buffer_create\fR() +fail if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIlen\fR +is greater than zero and +\fIdata\fR +is +\fRNULL\fR. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.SH "SEE ALSO" +libzip(3), +zip_file_add(3), +zip_file_replace(3), +zip_open_from_source(3), +zip_source(3) +.SH "HISTORY" +\fBzip_source_buffer\fR() +and +\fBzip_source_buffer_create\fR() +were added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_buffer.mdoc b/core/deps/libzip/man/zip_source_buffer.mdoc new file mode 100644 index 000000000..441bdc3e0 --- /dev/null +++ b/core/deps/libzip/man/zip_source_buffer.mdoc @@ -0,0 +1,102 @@ +.\" zip_source_buffer.mdoc -- create zip data source from buffer +.\" Copyright (C) 2004-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_BUFFER 3 +.Os +.Sh NAME +.Nm zip_source_buffer , +.Nm zip_source_buffer_create +.Nd create zip data source from buffer +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_source_t * +.Fn zip_source_buffer "zip_t *archive" "const void *data" "zip_uint64_t len" "int freep" +.Ft zip_source_t * +.Fn zip_source_buffer_create "const void *data" "zip_uint64_t len" "int freep" "zip_error_t *error" +.Sh DESCRIPTION +The functions +.Fn zip_source_buffer +and +.Fn zip_source_buffer_create +create a zip source from the buffer +.Ar data +of size +.Ar len . +If +.Ar freep +is non-zero, the buffer will be freed when it is no longer needed. +.Ar data +must remain valid for the lifetime of the created source. +.Pp +The source can be used to open a zip archive from. +.Sh RETURN VALUES +Upon successful completion, the created source is returned. +Otherwise, +.Dv NULL +is returned and the error code in +.Ar archive +or +.Ar error +is set to indicate the error. +.Sh ERRORS +.Fn zip_source_buffer +and +.Fn zip_source_buffer_create +fail if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +.Ar len +is greater than zero and +.Ar data +is +.Dv NULL . +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_add 3 , +.Xr zip_file_replace 3 , +.Xr zip_open_from_source 3 , +.Xr zip_source 3 +.Sh HISTORY +.Fn zip_source_buffer +and +.Fn zip_source_buffer_create +were added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_buffer_fragment.html b/core/deps/libzip/man/zip_source_buffer_fragment.html new file mode 100644 index 000000000..74645609b --- /dev/null +++ b/core/deps/libzip/man/zip_source_buffer_fragment.html @@ -0,0 +1,150 @@ + + + + + + + ZIP_SOURCE_BUFFER_FRAGMENT(3) + + + + + + + + +
ZIP_SOURCE_BUFFER_FRAGMENT(3)Library Functions ManualZIP_SOURCE_BUFFER_FRAGMENT(3)
+
+
+

+zip_source_buffer_fragment, + zip_source_buffer_fragment_create — +
create zip data source from multiple buffer
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_source_t * +
+ zip_source_buffer_fragment(zip_t + *archive, + zip_buffer_fragment_t + *fragments, zip_uint64_t + nfragments, int + freep);

+

zip_source_t * +
+ zip_source_buffer_fragment_create(zip_buffer_fragment_t + *fragments, zip_uint64_t + nfragments, int + freep, zip_error_t + *error);

+
+
+

+The functions zip_source_buffer_fragment() and + zip_source_buffer_fragment_create() create a zip + source from the data in fragments. + nfragments specifies the number of fragments. If + freep is non-zero, the data will be freed when it is no + longer needed. +
+
+struct zip_stat {
+    zip_uint8_t *data;    /* pointer to the actual data */
+    zip_uint64_t length;  /* length of this fragment */
+};
+
+
+

The data fragments point to must remain + valid for the lifetime of the created source. + fragments itself can be discarded once the source is + created.

+

The source can be used to open a zip archive from.

+
+
+

+Upon successful completion, the created source is returned. Otherwise, + NULL is returned and the error code in + archive or error is set to + indicate the error. +
+
+

+zip_source_buffer() and + zip_source_buffer_create() fail if: +
+
[]
+
nfragments is greater than zero and + fragments is NULL.
+
[]
+
Required memory could not be allocated.
+
+
+
+

+libzip(3), + zip_file_add(3), + zip_file_replace(3), + zip_open_from_source(3), + zip_source(3) +
+
+

+zip_source_buffer_fragment() and + zip_source_buffer_fragment_create() were added in + libzip 1.4.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_buffer_fragment.man b/core/deps/libzip/man/zip_source_buffer_fragment.man new file mode 100644 index 000000000..772df190b --- /dev/null +++ b/core/deps/libzip/man/zip_source_buffer_fragment.man @@ -0,0 +1,125 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_buffer_fragment.mdoc -- create zip data source from multiple buffers +.\" Copyright (C) 2004-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_BUFFER_FRAGMENT" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_buffer_fragment\fR, +\fBzip_source_buffer_fragment_create\fR +\- create zip data source from multiple buffer +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_buffer_fragment\fR(\fIzip_t\ *archive\fR, \fIzip_buffer_fragment_t\ *fragments\fR, \fIzip_uint64_t\ nfragments\fR, \fIint\ freep\fR); +.PD +.PP +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_buffer_fragment_create\fR(\fIzip_buffer_fragment_t\ *fragments\fR, \fIzip_uint64_t\ nfragments\fR, \fIint\ freep\fR, \fIzip_error_t\ *error\fR); +.PD +.SH "DESCRIPTION" +The functions +\fBzip_source_buffer_fragment\fR() +and +\fBzip_source_buffer_fragment_create\fR() +create a zip source from the data in +\fIfragments\fR. +\fInfragments\fR +specifies the number of fragments. +If +\fIfreep\fR +is non-zero, the data will be freed when it is no longer needed. +.nf +.sp +.RS 0n +struct zip_stat { + zip_uint8_t *data; /* pointer to the actual data */ + zip_uint64_t length; /* length of this fragment */ +}; +.RE +.fi +.PP +The data +\fIfragments\fR +point to must remain valid for the lifetime of the created source. +\fIfragments\fR +itself can be discarded once the source is created. +.PP +The source can be used to open a zip archive from. +.SH "RETURN VALUES" +Upon successful completion, the created source is returned. +Otherwise, +\fRNULL\fR +is returned and the error code in +\fIarchive\fR +or +\fIerror\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_source_buffer\fR() +and +\fBzip_source_buffer_create\fR() +fail if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fInfragments\fR +is greater than zero and +\fIfragments\fR +is +\fRNULL\fR. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.SH "SEE ALSO" +libzip(3), +zip_file_add(3), +zip_file_replace(3), +zip_open_from_source(3), +zip_source(3) +.SH "HISTORY" +\fBzip_source_buffer_fragment\fR() +and +\fBzip_source_buffer_fragment_create\fR() +were added in libzip 1.4.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_buffer_fragment.mdoc b/core/deps/libzip/man/zip_source_buffer_fragment.mdoc new file mode 100644 index 000000000..2829c4e0c --- /dev/null +++ b/core/deps/libzip/man/zip_source_buffer_fragment.mdoc @@ -0,0 +1,112 @@ +.\" zip_source_buffer_fragment.mdoc -- create zip data source from multiple buffers +.\" Copyright (C) 2004-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_BUFFER_FRAGMENT 3 +.Os +.Sh NAME +.Nm zip_source_buffer_fragment , +.Nm zip_source_buffer_fragment_create +.Nd create zip data source from multiple buffer +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_source_t * +.Fn zip_source_buffer_fragment "zip_t *archive" "zip_buffer_fragment_t *fragments" "zip_uint64_t nfragments" "int freep" +.Ft zip_source_t * +.Fn zip_source_buffer_fragment_create "zip_buffer_fragment_t *fragments" "zip_uint64_t nfragments" "int freep" "zip_error_t *error" +.Sh DESCRIPTION +The functions +.Fn zip_source_buffer_fragment +and +.Fn zip_source_buffer_fragment_create +create a zip source from the data in +.Ar fragments . +.Ar nfragments +specifies the number of fragments. +If +.Ar freep +is non-zero, the data will be freed when it is no longer needed. +.Bd -literal +struct zip_stat { + zip_uint8_t *data; /* pointer to the actual data */ + zip_uint64_t length; /* length of this fragment */ +}; +.Ed +.Pp +The data +.Ar fragments +point to must remain valid for the lifetime of the created source. +.Ar fragments +itself can be discarded once the source is created. +.Pp +The source can be used to open a zip archive from. +.Sh RETURN VALUES +Upon successful completion, the created source is returned. +Otherwise, +.Dv NULL +is returned and the error code in +.Ar archive +or +.Ar error +is set to indicate the error. +.Sh ERRORS +.Fn zip_source_buffer +and +.Fn zip_source_buffer_create +fail if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +.Ar nfragments +is greater than zero and +.Ar fragments +is +.Dv NULL . +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_add 3 , +.Xr zip_file_replace 3 , +.Xr zip_open_from_source 3 , +.Xr zip_source 3 +.Sh HISTORY +.Fn zip_source_buffer_fragment +and +.Fn zip_source_buffer_fragment_create +were added in libzip 1.4.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_close.html b/core/deps/libzip/man/zip_source_close.html new file mode 100644 index 000000000..7a565bf91 --- /dev/null +++ b/core/deps/libzip/man/zip_source_close.html @@ -0,0 +1,105 @@ + + + + + + + ZIP_SOURCE_CLOSE(3) + + + + + + + + +
ZIP_SOURCE_CLOSE(3)Library Functions ManualZIP_SOURCE_CLOSE(3)
+
+
+

+zip_source_close — +
close zip_source (which was open for reading)
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_source_close(zip_source_t + *source);

+
+
+

+The function zip_source_close() closes + source, indicating that no more data will be read. +
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in source is set to indicate the + error. +
+
+

+libzip(3), + zip_source(3), + zip_source_free(3), + zip_source_open(3) +
+
+

+zip_source_close() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_close.man b/core/deps/libzip/man/zip_source_close.man new file mode 100644 index 000000000..0fa873c19 --- /dev/null +++ b/core/deps/libzip/man/zip_source_close.man @@ -0,0 +1,72 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_close.mdoc -- close zip source (open for reading) +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_CLOSE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_close\fR +\- close zip_source (which was open for reading) +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_source_close\fR(\fIzip_source_t\ *source\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_source_close\fR() +closes +\fIsource\fR, +indicating that no more data will be read. +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +\fIsource\fR +is set to indicate the error. +.SH "SEE ALSO" +libzip(3), +zip_source(3), +zip_source_free(3), +zip_source_open(3) +.SH "HISTORY" +\fBzip_source_close\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_close.mdoc b/core/deps/libzip/man/zip_source_close.mdoc new file mode 100644 index 000000000..57f2629c4 --- /dev/null +++ b/core/deps/libzip/man/zip_source_close.mdoc @@ -0,0 +1,67 @@ +.\" zip_source_close.mdoc -- close zip source (open for reading) +.\" Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_CLOSE 3 +.Os +.Sh NAME +.Nm zip_source_close +.Nd close zip_source (which was open for reading) +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_source_close "zip_source_t *source" +.Sh DESCRIPTION +The function +.Fn zip_source_close +closes +.Fa source , +indicating that no more data will be read. +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +.Ar source +is set to indicate the error. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 , +.Xr zip_source_free 3 , +.Xr zip_source_open 3 +.Sh HISTORY +.Fn zip_source_close +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_commit_write.html b/core/deps/libzip/man/zip_source_commit_write.html new file mode 100644 index 000000000..0ac6950e1 --- /dev/null +++ b/core/deps/libzip/man/zip_source_commit_write.html @@ -0,0 +1,109 @@ + + + + + + + ZIP_SOURCE_COMMIT_WRITE(3) + + + + + + + + +
ZIP_SOURCE_COMMIT_WRITE(3)Library Functions ManualZIP_SOURCE_COMMIT_WRITE(3)
+
+
+

+zip_source_commit_write — +
finalize changes to zip source
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_source_commit_write(zip_source_t + *source);

+
+
+

+The function zip_source_commit_write() finishes writing + data to source and replaces the original with the newly + written data. +
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in source is set to indicate the + error. +
+
+

+libzip(3), + zip_source(3), + zip_source_begin_write(3), + zip_source_rollback_write(3), + zip_source_seek_write(3), + zip_source_tell_write(3), + zip_source_write(3) +
+
+

+zip_source_commit_write() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_commit_write.man b/core/deps/libzip/man/zip_source_commit_write.man new file mode 100644 index 000000000..2df6abb57 --- /dev/null +++ b/core/deps/libzip/man/zip_source_commit_write.man @@ -0,0 +1,75 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_commit_write.mdoc -- finalize changes to zip source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_COMMIT_WRITE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_commit_write\fR +\- finalize changes to zip source +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_source_commit_write\fR(\fIzip_source_t\ *source\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_source_commit_write\fR() +finishes writing data to +\fIsource\fR +and replaces the original with the newly written data. +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +\fIsource\fR +is set to indicate the error. +.SH "SEE ALSO" +libzip(3), +zip_source(3), +zip_source_begin_write(3), +zip_source_rollback_write(3), +zip_source_seek_write(3), +zip_source_tell_write(3), +zip_source_write(3) +.SH "HISTORY" +\fBzip_source_commit_write\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_commit_write.mdoc b/core/deps/libzip/man/zip_source_commit_write.mdoc new file mode 100644 index 000000000..69c4f1b35 --- /dev/null +++ b/core/deps/libzip/man/zip_source_commit_write.mdoc @@ -0,0 +1,70 @@ +.\" zip_source_commit_write.mdoc -- finalize changes to zip source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_COMMIT_WRITE 3 +.Os +.Sh NAME +.Nm zip_source_commit_write +.Nd finalize changes to zip source +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_source_commit_write "zip_source_t *source" +.Sh DESCRIPTION +The function +.Fn zip_source_commit_write +finishes writing data to +.Fa source +and replaces the original with the newly written data. +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +.Ar source +is set to indicate the error. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 , +.Xr zip_source_begin_write 3 , +.Xr zip_source_rollback_write 3 , +.Xr zip_source_seek_write 3 , +.Xr zip_source_tell_write 3 , +.Xr zip_source_write 3 +.Sh HISTORY +.Fn zip_source_commit_write +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_error.html b/core/deps/libzip/man/zip_source_error.html new file mode 100644 index 000000000..492cf6fd7 --- /dev/null +++ b/core/deps/libzip/man/zip_source_error.html @@ -0,0 +1,97 @@ + + + + + + + ZIP_SOURCE_ERROR(3) + + + + + + + + +
ZIP_SOURCE_ERROR(3)Library Functions ManualZIP_SOURCE_ERROR(3)
+
+
+

+zip_source_error — +
get zip error for data source
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_error_t * +
+ zip_source_error(zip_source_t + *source);

+
+
+

+The zip_source_error() function returns the zip error + for the data source source. +
+
+

+libzip(3), + zip_error_code_system(3), + zip_error_code_zip(3) +
+
+

+zip_source_error() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_error.man b/core/deps/libzip/man/zip_source_error.man new file mode 100644 index 000000000..62e7544b7 --- /dev/null +++ b/core/deps/libzip/man/zip_source_error.man @@ -0,0 +1,65 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_error.mdoc -- get zip_error for data source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_ERROR" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_error\fR +\- get zip error for data source +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_error_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_error\fR(\fIzip_source_t\ *source\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_source_error\fR() +function returns the zip error for the data source +\fIsource\fR. +.SH "SEE ALSO" +libzip(3), +zip_error_code_system(3), +zip_error_code_zip(3) +.SH "HISTORY" +\fBzip_source_error\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_error.mdoc b/core/deps/libzip/man/zip_source_error.mdoc new file mode 100644 index 000000000..af098d1bc --- /dev/null +++ b/core/deps/libzip/man/zip_source_error.mdoc @@ -0,0 +1,60 @@ +.\" zip_source_error.mdoc -- get zip_error for data source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_ERROR 3 +.Os +.Sh NAME +.Nm zip_source_error +.Nd get zip error for data source +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_error_t * +.Fn zip_source_error "zip_source_t *source" +.Sh DESCRIPTION +The +.Fn zip_source_error +function returns the zip error for the data source +.Ar source . +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_error_code_system 3 , +.Xr zip_error_code_zip 3 +.Sh HISTORY +.Fn zip_source_error +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_file.html b/core/deps/libzip/man/zip_source_file.html new file mode 100644 index 000000000..e6643f901 --- /dev/null +++ b/core/deps/libzip/man/zip_source_file.html @@ -0,0 +1,141 @@ + + + + + + + ZIP_SOURCE_FILE(3) + + + + + + + + +
ZIP_SOURCE_FILE(3)Library Functions ManualZIP_SOURCE_FILE(3)
+
+
+

+zip_source_file, + zip_source_file_create — +
create data source from a file
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_source_t * +
+ zip_source_file(zip_t + *archive, const char + *fname, zip_uint64_t + start, zip_int64_t + len);

+

zip_source_t * +
+ zip_source_file_create(const + char *fname, zip_uint64_t + start, zip_int64_t + len, zip_error_t + *error);

+
+
+

+The functions zip_source_file() and + zip_source_file_create() create a zip source from a + file. They open fname and read len + bytes from offset start from it. If + len is 0 or -1, the whole file (starting from + start) is used. +

If the file supports seek, the source can be used to open a zip + archive from.

+

The file is opened and read when the data from the source is used, + usually by zip_close() or + zip_open_from_source().

+
+
+

+Upon successful completion, the created source is returned. Otherwise, + NULL is returned and the error code in + archive or error is set to + indicate the error. +
+
+

+zip_source_file() and + zip_source_file_create() fail if: +
+
[]
+
fname, start, or + len are invalid.
+
[]
+
Required memory could not be allocated.
+
[]
+
Opening fname failed.
+
+
+
+

+libzip(3), + zip_file_add(3), + zip_file_replace(3), + zip_source(3) +
+
+

+zip_source_file() and + zip_source_file_create() were added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_file.man b/core/deps/libzip/man/zip_source_file.man new file mode 100644 index 000000000..307c2a767 --- /dev/null +++ b/core/deps/libzip/man/zip_source_file.man @@ -0,0 +1,125 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_file.mdoc -- create data source from a file +.\" Copyright (C) 2004-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_FILE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_file\fR, +\fBzip_source_file_create\fR +\- create data source from a file +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_file\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR); +.PD +.PP +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_file_create\fR(\fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR); +.PD +.SH "DESCRIPTION" +The functions +\fBzip_source_file\fR() +and +\fBzip_source_file_create\fR() +create a zip source from a file. +They open +\fIfname\fR +and read +\fIlen\fR +bytes from offset +\fIstart\fR +from it. +If +\fIlen\fR +is 0 or \-1, the whole file (starting from +\fIstart\fR) +is used. +.PP +If the file supports seek, the source can be used to open a zip archive from. +.PP +The file is opened and read when the data from the source is used, usually by +\fBzip_close\fR() +or +\fBzip_open_from_source\fR(). +.SH "RETURN VALUES" +Upon successful completion, the created source is returned. +Otherwise, +\fRNULL\fR +is returned and the error code in +\fIarchive\fR +or +\fIerror\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_source_file\fR() +and +\fBzip_source_file_create\fR() +fail if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIfname\fR, +\fIstart\fR, +or +\fIlen\fR +are invalid. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.TP 19n +[\fRZIP_ER_OPEN\fR] +Opening +\fIfname\fR +failed. +.SH "SEE ALSO" +libzip(3), +zip_file_add(3), +zip_file_replace(3), +zip_source(3) +.SH "HISTORY" +\fBzip_source_file\fR() +and +\fBzip_source_file_create\fR() +were added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_file.mdoc b/core/deps/libzip/man/zip_source_file.mdoc new file mode 100644 index 000000000..a4ae6554f --- /dev/null +++ b/core/deps/libzip/man/zip_source_file.mdoc @@ -0,0 +1,114 @@ +.\" zip_source_file.mdoc -- create data source from a file +.\" Copyright (C) 2004-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_FILE 3 +.Os +.Sh NAME +.Nm zip_source_file , +.Nm zip_source_file_create +.Nd create data source from a file +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_source_t * +.Fn zip_source_file "zip_t *archive" "const char *fname" "zip_uint64_t start" "zip_int64_t len" +.Ft zip_source_t * +.Fn zip_source_file_create "const char *fname" "zip_uint64_t start" "zip_int64_t len" "zip_error_t *error" +.Sh DESCRIPTION +The functions +.Fn zip_source_file +and +.Fn zip_source_file_create +create a zip source from a file. +They open +.Ar fname +and read +.Ar len +bytes from offset +.Ar start +from it. +If +.Ar len +is 0 or \-1, the whole file (starting from +.Ar start ) +is used. +.Pp +If the file supports seek, the source can be used to open a zip archive from. +.Pp +The file is opened and read when the data from the source is used, usually by +.Fn zip_close +or +.Fn zip_open_from_source . +.Sh RETURN VALUES +Upon successful completion, the created source is returned. +Otherwise, +.Dv NULL +is returned and the error code in +.Ar archive +or +.Ar error +is set to indicate the error. +.Sh ERRORS +.Fn zip_source_file +and +.Fn zip_source_file_create +fail if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +.Ar fname , +.Ar start , +or +.Ar len +are invalid. +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.It Bq Er ZIP_ER_OPEN +Opening +.Ar fname +failed. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_add 3 , +.Xr zip_file_replace 3 , +.Xr zip_source 3 +.Sh HISTORY +.Fn zip_source_file +and +.Fn zip_source_file_create +were added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_filep.html b/core/deps/libzip/man/zip_source_filep.html new file mode 100644 index 000000000..f7d91e9fa --- /dev/null +++ b/core/deps/libzip/man/zip_source_filep.html @@ -0,0 +1,137 @@ + + + + + + + ZIP_SOURCE_FILEP(3) + + + + + + + + +
ZIP_SOURCE_FILEP(3)Library Functions ManualZIP_SOURCE_FILEP(3)
+
+
+

+zip_source_filep, + zip_source_filep_create — +
create data source from FILE *
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_source_t * +
+ zip_source_filep(zip_t + *archive, FILE + *file, zip_uint64_t + start, zip_int64_t + len);

+

zip_source_t * +
+ zip_source_filep_create(FILE + *file, zip_uint64_t + start, zip_int64_t + len, zip_error_t + *error);

+
+
+

+The functions zip_source_filep() and + zip_source_filep_create() create a zip source from a + file stream. They read len bytes from offset + start from the open file stream + file. If len is 0 or -1, the whole + file (starting from start) is used. +

If the file stream supports seeking, the source can be used to + open a read-only zip archive from.

+

The file stream is closed when the source is being freed, usually + by zip_close(3).

+
+
+

+Upon successful completion, the created source is returned. Otherwise, + NULL is returned and the error code in + archive or error is set to + indicate the error. +
+
+

+zip_source_filep() fails if: +
+
[]
+
file, start, or + len are invalid.
+
[]
+
Required memory could not be allocated.
+
+
+
+

+libzip(3), + zip_file_add(3), + zip_file_replace(3), + zip_source(3) +
+
+

+zip_source_filep() and + zip_source_filep_create() were added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_filep.man b/core/deps/libzip/man/zip_source_filep.man new file mode 100644 index 000000000..c9d185344 --- /dev/null +++ b/core/deps/libzip/man/zip_source_filep.man @@ -0,0 +1,117 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_filep.mdoc -- create data source from a file stream +.\" Copyright (C) 2004-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_FILEP" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_filep\fR, +\fBzip_source_filep_create\fR +\- create data source from FILE * +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_filep\fR(\fIzip_t\ *archive\fR, \fIFILE\ *file\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR); +.PD +.PP +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_filep_create\fR(\fIFILE\ *file\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR); +.PD +.SH "DESCRIPTION" +The functions +\fBzip_source_filep\fR() +and +\fBzip_source_filep_create\fR() +create a zip source from a file stream. +They read +\fIlen\fR +bytes from offset +\fIstart\fR +from the open file stream +\fIfile\fR. +If +\fIlen\fR +is 0 or \-1, the whole file (starting from +\fIstart\fR) +is used. +.PP +If the file stream supports seeking, the source can be used to open +a read-only zip archive from. +.PP +The file stream is closed when the source is being freed, usually +by +zip_close(3). +.SH "RETURN VALUES" +Upon successful completion, the created source is returned. +Otherwise, +\fRNULL\fR +is returned and the error code in +\fIarchive\fR +or +\fIerror\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_source_filep\fR() +fails if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIfile\fR, +\fIstart\fR, +or +\fIlen\fR +are invalid. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.SH "SEE ALSO" +libzip(3), +zip_file_add(3), +zip_file_replace(3), +zip_source(3) +.SH "HISTORY" +\fBzip_source_filep\fR() +and +\fBzip_source_filep_create\fR() +were added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_filep.mdoc b/core/deps/libzip/man/zip_source_filep.mdoc new file mode 100644 index 000000000..17d1319e5 --- /dev/null +++ b/core/deps/libzip/man/zip_source_filep.mdoc @@ -0,0 +1,107 @@ +.\" zip_source_filep.mdoc -- create data source from a file stream +.\" Copyright (C) 2004-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_FILEP 3 +.Os +.Sh NAME +.Nm zip_source_filep , +.Nm zip_source_filep_create +.Nd create data source from FILE * +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_source_t * +.Fn zip_source_filep "zip_t *archive" "FILE *file" "zip_uint64_t start" "zip_int64_t len" +.Ft zip_source_t * +.Fn zip_source_filep_create "FILE *file" "zip_uint64_t start" "zip_int64_t len" "zip_error_t *error" +.Sh DESCRIPTION +The functions +.Fn zip_source_filep +and +.Fn zip_source_filep_create +create a zip source from a file stream. +They read +.Ar len +bytes from offset +.Ar start +from the open file stream +.Ar file . +If +.Ar len +is 0 or \-1, the whole file (starting from +.Ar start ) +is used. +.Pp +If the file stream supports seeking, the source can be used to open +a read-only zip archive from. +.Pp +The file stream is closed when the source is being freed, usually +by +.Xr zip_close 3 . +.Sh RETURN VALUES +Upon successful completion, the created source is returned. +Otherwise, +.Dv NULL +is returned and the error code in +.Ar archive +or +.Ar error +is set to indicate the error. +.Sh ERRORS +.Fn zip_source_filep +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +.Ar file , +.Ar start , +or +.Ar len +are invalid. +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_add 3 , +.Xr zip_file_replace 3 , +.Xr zip_source 3 +.Sh HISTORY +.Fn zip_source_filep +and +.Fn zip_source_filep_create +were added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_free.html b/core/deps/libzip/man/zip_source_free.html new file mode 100644 index 000000000..abf319a84 --- /dev/null +++ b/core/deps/libzip/man/zip_source_free.html @@ -0,0 +1,104 @@ + + + + + + + ZIP_SOURCE_FREE(3) + + + + + + + + +
ZIP_SOURCE_FREE(3)Library Functions ManualZIP_SOURCE_FREE(3)
+
+
+

+zip_source_free — +
free zip data source
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

void +
+ zip_source_free(zip_source_t + *source);

+
+
+

+The function zip_source_free() decrements the reference + count of source and frees it if the reference count + drops to 0. If source is NULL, + it does nothing. +

NOTE: This function should not be called on a + source after it was used successfully in a + zip_open_from_source(3), + zip_file_add(3), or + zip_file_replace(3) call.

+
+
+

+libzip(3), + zip_source(3), + zip_source_keep(3) +
+
+

+zip_source_free() was added in libzip 0.6. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_free.man b/core/deps/libzip/man/zip_source_free.man new file mode 100644 index 000000000..5f7967188 --- /dev/null +++ b/core/deps/libzip/man/zip_source_free.man @@ -0,0 +1,81 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_free.mdoc -- free zip data source +.\" Copyright (C) 2004-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_FREE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_free\fR +\- free zip data source +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_source_free\fR(\fIzip_source_t\ *source\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_source_free\fR() +decrements the reference count of +\fIsource\fR +and frees it if the reference count drops to 0. +If +\fIsource\fR +is +\fRNULL\fR, +it does nothing. +.PP +\fINOTE\fR: +This function should not be called on a +\fIsource\fR +after it was used successfully in a +zip_open_from_source(3), +zip_file_add(3), +or +zip_file_replace(3) +call. +.SH "SEE ALSO" +libzip(3), +zip_source(3), +zip_source_keep(3) +.SH "HISTORY" +\fBzip_source_free\fR() +was added in libzip 0.6. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_free.mdoc b/core/deps/libzip/man/zip_source_free.mdoc new file mode 100644 index 000000000..816f7a1e1 --- /dev/null +++ b/core/deps/libzip/man/zip_source_free.mdoc @@ -0,0 +1,76 @@ +.\" zip_source_free.mdoc -- free zip data source +.\" Copyright (C) 2004-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_FREE 3 +.Os +.Sh NAME +.Nm zip_source_free +.Nd free zip data source +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft void +.Fn zip_source_free "zip_source_t *source" +.Sh DESCRIPTION +The function +.Fn zip_source_free +decrements the reference count of +.Ar source +and frees it if the reference count drops to 0. +If +.Ar source +is +.Dv NULL , +it does nothing. +.Pp +.Em NOTE : +This function should not be called on a +.Ar source +after it was used successfully in a +.Xr zip_open_from_source 3 , +.Xr zip_file_add 3 , +or +.Xr zip_file_replace 3 +call. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 , +.Xr zip_source_keep 3 +.Sh HISTORY +.Fn zip_source_free +was added in libzip 0.6. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_function.html b/core/deps/libzip/man/zip_source_function.html new file mode 100644 index 000000000..814085e80 --- /dev/null +++ b/core/deps/libzip/man/zip_source_function.html @@ -0,0 +1,380 @@ + + + + + + + ZIP_SOURCE_FUNCTION(3) + + + + + + + + +
ZIP_SOURCE_FUNCTION(3)Library Functions ManualZIP_SOURCE_FUNCTION(3)
+
+
+

+zip_source_function, + zip_source_function_create — +
create data source from function
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_source_t * +
+ zip_source_function(zip_t + *archive, + zip_source_callback fn, + void *userdata);

+

zip_source_t * +
+ zip_source_function_create(zip_source_callback + fn, void *userdata, + zip_error_t *error);

+
+
+

+The functions zip_source_function() and + zip_source_function_create() creates a zip source from + the user-provided function fn, which must be of the + following type: +

typedef zip_int64_t + (*zip_source_callback)(void + *userdata, void *data, + zip_uint64_t len, zip_source_cmd_t + cmd);

+

archive or error are + used for reporting errors and can be NULL.

+

When called by the library, the first argument is the + userdata argument supplied to the function. The next + two arguments are a buffer data of size + len when data is passed in or expected to be returned, + or else NULL and 0. The last argument, + cmd, specifies which action the function should + perform.

+

Depending on the uses, there are three useful sets of commands to + be supported by a zip_source_callback():

+
+
read source
+
Providing streamed data (for file data added to archives). Must support + ZIP_SOURCE_OPEN, + ZIP_SOURCE_READ, + ZIP_SOURCE_CLOSE, + ZIP_SOURCE_STAT, and + ZIP_SOURCE_ERROR.
+
seekable read source
+
Same as previous, but from a source allowing reading from arbitrary + offsets (also for read-only zip archive). Must additionally support + ZIP_SOURCE_SEEK, + ZIP_SOURCE_TELL, and + ZIP_SOURCE_SUPPORTS.
+
read/write source
+
Same as previous, but additionally allowing writing (also for writable zip + archives). Must additionally support + ZIP_SOURCE_BEGIN_WRITE, + ZIP_SOURCE_COMMIT_WRITE, + ZIP_SOURCE_ROLLBACK_WRITE, + ZIP_SOURCE_SEEK_WRITE, + ZIP_SOURCE_TELL_WRITE, and + ZIP_SOURCE_REMOVE.
+
+
+

ZIP_SOURCE_ACCEPT_EMPTY

+Return 1 if an empty source should be accepted as a valid zip archive. This is + the default if this command is not supported by a source. File system backed + sources should return 0. +
+
+

ZIP_SOURCE_BEGIN_WRITE

+Prepare the source for writing. Use this to create any temporary file(s). +
+
+

ZIP_SOURCE_BEGIN_WRITE_CLONING

+Prepare the source for writing, keeping the first len + bytes of the original file. Only implement this command if it is more + efficient than copying the data, and if it does not destructively overwrite + the original file (you still have to be able to execute + ZIP_SOURCE_ROLLBACK_WRITE). +

The next write should happen at byte + offset.

+
+
+

ZIP_SOURCE_CLOSE

+Reading is done. +
+
+

ZIP_SOURCE_COMMIT_WRITE

+Finish writing to the source. Replace the original data with the newly written + data. Clean up temporary files or internal buffers. Subsequently opening and + reading from the source should return the newly written data. +
+
+

ZIP_SOURCE_ERROR

+Get error information. data points to an array of two + ints, which should be filled with the libzip error code and the corresponding + system error code for the error that occurred. See + zip_errors(3) for details on the + error codes. If the source stores error information in a zip_error_t, use + zip_error_to_data(3) and + return its return value. Otherwise, return 2 * sizeof(int). +
+
+

ZIP_SOURCE_FREE

+Clean up and free all resources, including userdata. The + callback function will not be called again. +
+
+

ZIP_SOURCE_GET_FILE_ATTRIBUTES

+Provide information about various data. Then the data should be put in the + appropriate entry in the passed zip_file_attributes_t + argument, and the appropriate ZIP_FILE_ATTRIBUTES_* + value must be or'ed into the valid member to denote that + the corresponding data has been provided. A + zip_file_attributes_t structure can be initialized using + zip_file_attributes_init(3). +
+
ASCII mode
+
If a file is a plaintext file in ASCII. Can be used by extraction tools to + automatically convert line endings (part of the interal file attributes). + Member ascii, flag + ZIP_FILE_ATTRIBUTES_ASCII.
+
General Purpose Bit Flags (limited to Compression Flags)
+
The general purpose bit flag in the zip in the local and central directory + headers contain information about the compression method. Member + general_purpose_bit_flags and + general_purpose_bit_mask to denote which members + have been set; flag + ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS.
+
External File Attributes
+
The external file attributes (usually operating system-specific). Member + external_file_attributes, flag + ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES.
+
Version Needed
+
A minimum version needed required to unpack this entry (in the usual + "major * 10 + minor" format). Member + version_needed, flag + ZIP_FILE_ATTRIBUTES_VERSION_NEEDED.
+
Operating System
+
One of the operating systems as defined by the + ZIP_OPSYS_* variables (see + zip.h). This value affects the interpretation of + the external file attributes. Member host_system, + flag ZIP_FILE_ATTRIBUTES_HOST_SYSTEM.
+
+
+
+

ZIP_SOURCE_OPEN

+Prepare for reading. +
+
+

ZIP_SOURCE_READ

+Read data into the buffer data of size + len. Return the number of bytes placed into + data on success, and zero for end-of-file. +
+
+

ZIP_SOURCE_REMOVE

+Remove the underlying file. This is called if a zip archive is empty when + closed. +
+
+

ZIP_SOURCE_ROLLBACK_WRITE

+Abort writing to the source. Discard written data. Clean up temporary files or + internal buffers. Subsequently opening and reading from the source should + return the original data. +
+
+

ZIP_SOURCE_SEEK

+Specify position to read next byte from, like + fseek(3). Use + ZIP_SOURCE_GET_ARGS(3) to + decode the arguments into the following struct: +
+
+struct zip_source_args_seek {
+    zip_int64_t offset;
+    int whence;
+};
+
+
+

If the size of the source's data is known, use + zip_source_seek_compute_offset(3) + to validate the arguments and compute the new offset.

+
+
+

ZIP_SOURCE_SEEK_WRITE

+Specify position to write next byte to, like + fseek(3). See + ZIP_SOURCE_SEEK for details. +
+
+

ZIP_SOURCE_STAT

+Get meta information for the input data. data points to an + allocated struct zip_stat, which should be initialized + using zip_stat_init(3) and then + filled in. +

For uncompressed, unencrypted data, all information is optional. + However, fill in as much information as is readily available.

+

If the data is compressed, + ZIP_STAT_COMP_METHOD, + ZIP_STAT_SIZE, and + ZIP_STAT_CRC must be filled in.

+

If the data is encrypted, + ZIP_STAT_ENCRYPTION_METHOD, + ZIP_STAT_COMP_METHOD, + ZIP_STAT_SIZE, and + ZIP_STAT_CRC must be filled in.

+

Information only available after the source has been read (e.g., + size) can be omitted in an earlier call. NOTE: + zip_source_function() may be called with this + argument even after being called with + ZIP_SOURCE_CLOSE.

+

Return sizeof(struct zip_stat) on success.

+
+
+

ZIP_SOURCE_SUPPORTS

+Return bitmap specifying which commands are supported. Use + zip_source_make_command_bitmap(3). + If this command is not implemented, the source is assumed to be a read source + without seek support. +
+
+

ZIP_SOURCE_TELL

+Return the current read offset in the source, like + ftell(3). +
+
+

ZIP_SOURCE_TELL_WRITE

+Return the current write offset in the source, like + ftell(3). +
+
+

ZIP_SOURCE_WRITE

+Write data to the source. Return number of bytes written. +
+
+

+Commands should return -1 on error. ZIP_SOURCE_ERROR + will be called to retrieve the error code. On success, commands return 0, + unless specified otherwise in the description above. +
+
+

+The library will always issue ZIP_SOURCE_OPEN before + issuing ZIP_SOURCE_READ, + ZIP_SOURCE_SEEK, or + ZIP_SOURCE_TELL. When it no longer wishes to read from + this source, it will issue ZIP_SOURCE_CLOSE. If the + library wishes to read the data again, it will issue + ZIP_SOURCE_OPEN a second time. If the function is + unable to provide the data again, it should return -1. +

ZIP_SOURCE_BEGIN_WRITE or + ZIP_SOURCE_BEGIN_WRITE_CLONING will be called before + ZIP_SOURCE_WRITE, + ZIP_SOURCE_SEEK_WRITE, or + ZIP_SOURCE_TELL_WRITE. When writing is complete, + either ZIP_SOURCE_COMMIT_WRITE or + ZIP_SOURCE_ROLLBACK_WRITE will be called.

+

ZIP_SOURCE_ACCEPT_EMPTY, + ZIP_SOURCE_GET_FILE_ATTRIBUTES, and + ZIP_SOURCE_STAT can be issued at any time.

+

ZIP_SOURCE_ERROR will only be issued in + response to the function returning -1.

+

ZIP_SOURCE_FREE will be the last command + issued; if ZIP_SOURCE_OPEN was called and succeeded, + ZIP_SOURCE_CLOSE will be called before + ZIP_SOURCE_FREE, and similarly for + ZIP_SOURCE_BEGIN_WRITE or + ZIP_SOURCE_BEGIN_WRITE_CLONING and + ZIP_SOURCE_COMMIT_WRITE or + ZIP_SOURCE_ROLLBACK_WRITE.

+
+
+
+

+Upon successful completion, the created source is returned. Otherwise, + NULL is returned and the error code in + archive or error is set to + indicate the error (unless it is NULL). +
+
+

+zip_source_function() fails if: +
+
[]
+
Required memory could not be allocated.
+
+
+
+

+libzip(3), + zip_file_add(3), + zip_file_attributes_init(3), + zip_file_replace(3), + zip_source(3), + zip_stat_init(3) +
+
+

+zip_source_function() and + zip_source_function_create() were added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
April 17, 2020NiH
+ + diff --git a/core/deps/libzip/man/zip_source_function.man b/core/deps/libzip/man/zip_source_function.man new file mode 100644 index 000000000..4d43f997f --- /dev/null +++ b/core/deps/libzip/man/zip_source_function.man @@ -0,0 +1,413 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_function.mdoc -- create data source from function +.\" Copyright (C) 2004-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_FUNCTION" "3" "April 17, 2020" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_function\fR, +\fBzip_source_function_create\fR +\- create data source from function +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_function\fR(\fIzip_t\ *archive\fR, \fIzip_source_callback\ fn\fR, \fIvoid\ *userdata\fR); +.PD +.PP +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_function_create\fR(\fIzip_source_callback\ fn\fR, \fIvoid\ *userdata\fR, \fIzip_error_t\ *error\fR); +.PD +.SH "DESCRIPTION" +The functions +\fBzip_source_function\fR() +and +\fBzip_source_function_create\fR() +creates a zip source from the user-provided function +\fIfn\fR, +which must be of the following type: +.PP +\fItypedef zip_int64_t\fR +\fB\fR(*\fPzip_source_callback\fR)\fP\fR(\fIvoid\ *userdata\fR, \fIvoid\ *data\fR, \fIzip_uint64_t\ len\fR, \fIzip_source_cmd_t\ cmd\fR) +.PP +\fIarchive\fR +or +\fIerror\fR +are used for reporting errors and can be +\fRNULL\fR. +.PP +When called by the library, the first argument is the +\fIuserdata\fR +argument supplied to the function. +The next two arguments are a buffer +\fIdata\fR +of size +\fIlen\fR +when data is passed in or expected to be returned, or else +\fRNULL\fR +and 0. +The last argument, +\fIcmd\fR, +specifies which action the function should perform. +.PP +Depending on the uses, there are three useful sets of commands to be supported by a +\fBzip_source_callback\fR(): +.TP 24n +read source +Providing streamed data (for file data added to archives). +Must support +\fRZIP_SOURCE_OPEN\fR, +\fRZIP_SOURCE_READ\fR, +\fRZIP_SOURCE_CLOSE\fR, +\fRZIP_SOURCE_STAT\fR, +and +\fRZIP_SOURCE_ERROR\fR. +.TP 24n +seekable read source +Same as previous, but from a source allowing reading from arbitrary +offsets (also for read-only zip archive). +Must additionally support +\fRZIP_SOURCE_SEEK\fR, +\fRZIP_SOURCE_TELL\fR, +and +\fRZIP_SOURCE_SUPPORTS\fR. +.TP 24n +read/write source +Same as previous, but additionally allowing writing (also for writable +zip archives). +Must additionally support +\fRZIP_SOURCE_BEGIN_WRITE\fR, +\fRZIP_SOURCE_COMMIT_WRITE\fR, +\fRZIP_SOURCE_ROLLBACK_WRITE\fR, +\fRZIP_SOURCE_SEEK_WRITE\fR, +\fRZIP_SOURCE_TELL_WRITE\fR, +and +\fRZIP_SOURCE_REMOVE\fR. +.SS "\fRZIP_SOURCE_ACCEPT_EMPTY\fR" +Return 1 if an empty source should be accepted as a valid zip archive. +This is the default if this command is not supported by a source. +File system backed sources should return 0. +.SS "\fRZIP_SOURCE_BEGIN_WRITE\fR" +Prepare the source for writing. +Use this to create any temporary file(s). +.SS "\fRZIP_SOURCE_BEGIN_WRITE_CLONING\fR" +Prepare the source for writing, keeping the first +\fIlen\fR +bytes of the original file. +Only implement this command if it is more efficient than copying the +data, and if it does not destructively overwrite the original file +(you still have to be able to execute +\fRZIP_SOURCE_ROLLBACK_WRITE\fR). +.PP +The next write should happen at byte +\fIoffset\fR. +.SS "\fRZIP_SOURCE_CLOSE\fR" +Reading is done. +.SS "\fRZIP_SOURCE_COMMIT_WRITE\fR" +Finish writing to the source. +Replace the original data with the newly written data. +Clean up temporary files or internal buffers. +Subsequently opening and reading from the source should return the +newly written data. +.SS "\fRZIP_SOURCE_ERROR\fR" +Get error information. +\fIdata\fR +points to an array of two ints, which should be filled with the libzip +error code and the corresponding system error code for the error that +occurred. +See +zip_errors(3) +for details on the error codes. +If the source stores error information in a zip_error_t, use +zip_error_to_data(3) +and return its return value. +Otherwise, return 2 * sizeof(int). +.SS "\fRZIP_SOURCE_FREE\fR" +Clean up and free all resources, including +\fIuserdata\fR. +The callback function will not be called again. +.SS "\fRZIP_SOURCE_GET_FILE_ATTRIBUTES\fR" +Provide information about various data. +Then the data should be put in the appropriate entry in the passed +\fIzip_file_attributes_t\fR +argument, and the appropriate +\fRZIP_FILE_ATTRIBUTES_*\fR +value must be or'ed into the +\fIvalid\fR +member to denote that the corresponding data has been provided. +A +\fIzip_file_attributes_t\fR +structure can be initialized using +zip_file_attributes_init(3). +.TP 12n +ASCII mode +If a file is a plaintext file in ASCII. +Can be used by extraction tools to automatically convert line endings +(part of the interal file attributes). +Member +\fIascii\fR, +flag +\fRZIP_FILE_ATTRIBUTES_ASCII\fR. +.TP 12n +General Purpose Bit Flags (limited to Compression Flags) +The general purpose bit flag in the zip in the local and central +directory headers contain information about the compression method. +Member +\fIgeneral_purpose_bit_flags\fR +and +\fIgeneral_purpose_bit_mask\fR +to denote which members have been set; +flag +\fRZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS\fR. +.TP 12n +External File Attributes +The external file attributes (usually operating system-specific). +Member +\fIexternal_file_attributes\fR, +flag +\fRZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES\fR. +.TP 12n +Version Needed +A minimum version needed required to unpack this entry (in the usual +"major * 10 + minor" format). +Member +\fIversion_needed\fR, +flag +\fRZIP_FILE_ATTRIBUTES_VERSION_NEEDED\fR. +.TP 12n +Operating System +One of the operating systems as defined by the +\fRZIP_OPSYS_*\fR +variables (see +\fIzip.h\fR). +This value affects the interpretation of the external file attributes. +Member +\fIhost_system\fR, +flag +\fRZIP_FILE_ATTRIBUTES_HOST_SYSTEM\fR. +.SS "\fRZIP_SOURCE_OPEN\fR" +Prepare for reading. +.SS "\fRZIP_SOURCE_READ\fR" +Read data into the buffer +\fIdata\fR +of size +\fIlen\fR. +Return the number of bytes placed into +\fIdata\fR +on success, and zero for end-of-file. +.SS "\fRZIP_SOURCE_REMOVE\fR" +Remove the underlying file. +This is called if a zip archive is empty when closed. +.SS "\fRZIP_SOURCE_ROLLBACK_WRITE\fR" +Abort writing to the source. +Discard written data. +Clean up temporary files or internal buffers. +Subsequently opening and reading from the source should return the +original data. +.SS "\fRZIP_SOURCE_SEEK\fR" +Specify position to read next byte from, like +fseek(3). +Use +ZIP_SOURCE_GET_ARGS(3) +to decode the arguments into the following struct: +.nf +.sp +.RS 0n +struct zip_source_args_seek { + zip_int64_t offset; + int whence; +}; +.RE +.fi +.PP +If the size of the source's data is known, use +zip_source_seek_compute_offset(3) +to validate the arguments and compute the new offset. +.SS "\fRZIP_SOURCE_SEEK_WRITE\fR" +Specify position to write next byte to, like +fseek(3). +See +\fRZIP_SOURCE_SEEK\fR +for details. +.SS "\fRZIP_SOURCE_STAT\fR" +Get meta information for the input data. +\fIdata\fR +points to an allocated +\fIstruct zip_stat\fR, +which should be initialized using +zip_stat_init(3) +and then filled in. +.PP +For uncompressed, unencrypted data, all information is optional. +However, fill in as much information as is readily available. +.PP +If the data is compressed, +\fRZIP_STAT_COMP_METHOD\fR, +\fRZIP_STAT_SIZE\fR, +and +\fRZIP_STAT_CRC\fR +must be filled in. +.PP +If the data is encrypted, +\fRZIP_STAT_ENCRYPTION_METHOD\fR, +\fRZIP_STAT_COMP_METHOD\fR, +\fRZIP_STAT_SIZE\fR, +and +\fRZIP_STAT_CRC\fR +must be filled in. +.PP +Information only available after the source has been read (e.g., size) +can be omitted in an earlier call. +\fINOTE\fR: +\fBzip_source_function\fR() +may be called with this argument even after being called with +\fRZIP_SOURCE_CLOSE\fR. +.PP +Return sizeof(struct zip_stat) on success. +.SS "\fRZIP_SOURCE_SUPPORTS\fR" +Return bitmap specifying which commands are supported. +Use +zip_source_make_command_bitmap(3). +If this command is not implemented, the source is assumed to be a +read source without seek support. +.SS "\fRZIP_SOURCE_TELL\fR" +Return the current read offset in the source, like +ftell(3). +.SS "\fRZIP_SOURCE_TELL_WRITE\fR" +Return the current write offset in the source, like +ftell(3). +.SS "\fRZIP_SOURCE_WRITE\fR" +Write data to the source. +Return number of bytes written. +.SS "Return Values" +Commands should return \-1 on error. +\fRZIP_SOURCE_ERROR\fR +will be called to retrieve the error code. +On success, commands return 0, unless specified otherwise in the +description above. +.SS "Calling Conventions" +The library will always issue +\fRZIP_SOURCE_OPEN\fR +before issuing +\fRZIP_SOURCE_READ\fR, +\fRZIP_SOURCE_SEEK\fR, +or +\fRZIP_SOURCE_TELL\fR. +When it no longer wishes to read from this source, it will issue +\fRZIP_SOURCE_CLOSE\fR. +If the library wishes to read the data again, it will issue +\fRZIP_SOURCE_OPEN\fR +a second time. +If the function is unable to provide the data again, it should +return \-1. +.PP +\fRZIP_SOURCE_BEGIN_WRITE\fR +or +\fRZIP_SOURCE_BEGIN_WRITE_CLONING\fR +will be called before +\fRZIP_SOURCE_WRITE\fR, +\fRZIP_SOURCE_SEEK_WRITE\fR, +or +\fRZIP_SOURCE_TELL_WRITE\fR. +When writing is complete, either +\fRZIP_SOURCE_COMMIT_WRITE\fR +or +\fRZIP_SOURCE_ROLLBACK_WRITE\fR +will be called. +.PP +\fRZIP_SOURCE_ACCEPT_EMPTY\fR, +\fRZIP_SOURCE_GET_FILE_ATTRIBUTES\fR, +and +\fRZIP_SOURCE_STAT\fR +can be issued at any time. +.PP +\fRZIP_SOURCE_ERROR\fR +will only be issued in response to the function +returning \-1. +.PP +\fRZIP_SOURCE_FREE\fR +will be the last command issued; +if +\fRZIP_SOURCE_OPEN\fR +was called and succeeded, +\fRZIP_SOURCE_CLOSE\fR +will be called before +\fRZIP_SOURCE_FREE\fR, +and similarly for +\fRZIP_SOURCE_BEGIN_WRITE\fR +or +\fRZIP_SOURCE_BEGIN_WRITE_CLONING\fR +and +\fRZIP_SOURCE_COMMIT_WRITE\fR +or +\fRZIP_SOURCE_ROLLBACK_WRITE\fR. +.SH "RETURN VALUES" +Upon successful completion, the created source is returned. +Otherwise, +\fRNULL\fR +is returned and the error code in +\fIarchive\fR +or +\fIerror\fR +is set to indicate the error (unless +it is +\fRNULL\fR). +.SH "ERRORS" +\fBzip_source_function\fR() +fails if: +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.SH "SEE ALSO" +libzip(3), +zip_file_add(3), +zip_file_attributes_init(3), +zip_file_replace(3), +zip_source(3), +zip_stat_init(3) +.SH "HISTORY" +\fBzip_source_function\fR() +and +\fBzip_source_function_create\fR() +were added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_function.mdoc b/core/deps/libzip/man/zip_source_function.mdoc new file mode 100644 index 000000000..fdfd899d8 --- /dev/null +++ b/core/deps/libzip/man/zip_source_function.mdoc @@ -0,0 +1,399 @@ +.\" zip_source_function.mdoc -- create data source from function +.\" Copyright (C) 2004-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd April 17, 2020 +.Dt ZIP_SOURCE_FUNCTION 3 +.Os +.Sh NAME +.Nm zip_source_function , +.Nm zip_source_function_create +.Nd create data source from function +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_source_t * +.Fn zip_source_function "zip_t *archive" "zip_source_callback fn" "void *userdata" +.Ft zip_source_t * +.Fn zip_source_function_create "zip_source_callback fn" "void *userdata" "zip_error_t *error" +.Sh DESCRIPTION +The functions +.Fn zip_source_function +and +.Fn zip_source_function_create +creates a zip source from the user-provided function +.Ar fn , +which must be of the following type: +.Pp +.Ft typedef zip_int64_t +.Fo \fR(*\fPzip_source_callback\fR)\fP +.Fa "void *userdata" "void *data" "zip_uint64_t len" "zip_source_cmd_t cmd" +.Fc +.Pp +.Ar archive +or +.Ar error +are used for reporting errors and can be +.Dv NULL . +.Pp +When called by the library, the first argument is the +.Ar userdata +argument supplied to the function. +The next two arguments are a buffer +.Ar data +of size +.Ar len +when data is passed in or expected to be returned, or else +.Dv NULL +and 0. +The last argument, +.Ar cmd , +specifies which action the function should perform. +.Pp +Depending on the uses, there are three useful sets of commands to be supported by a +.Fn zip_source_callback : +.Bl -tag -width seekable-read-sourceXX +.It read source +Providing streamed data (for file data added to archives). +Must support +.Dv ZIP_SOURCE_OPEN , +.Dv ZIP_SOURCE_READ , +.Dv ZIP_SOURCE_CLOSE , +.Dv ZIP_SOURCE_STAT , +and +.Dv ZIP_SOURCE_ERROR . +.It seekable read source +Same as previous, but from a source allowing reading from arbitrary +offsets (also for read-only zip archive). +Must additionally support +.Dv ZIP_SOURCE_SEEK , +.Dv ZIP_SOURCE_TELL , +and +.Dv ZIP_SOURCE_SUPPORTS . +.It read/write source +Same as previous, but additionally allowing writing (also for writable +zip archives). +Must additionally support +.Dv ZIP_SOURCE_BEGIN_WRITE , +.Dv ZIP_SOURCE_COMMIT_WRITE , +.Dv ZIP_SOURCE_ROLLBACK_WRITE , +.Dv ZIP_SOURCE_SEEK_WRITE , +.Dv ZIP_SOURCE_TELL_WRITE , +and +.Dv ZIP_SOURCE_REMOVE . +.El +.Ss Dv ZIP_SOURCE_ACCEPT_EMPTY +Return 1 if an empty source should be accepted as a valid zip archive. +This is the default if this command is not supported by a source. +File system backed sources should return 0. +.Ss Dv ZIP_SOURCE_BEGIN_WRITE +Prepare the source for writing. +Use this to create any temporary file(s). +.Ss Dv ZIP_SOURCE_BEGIN_WRITE_CLONING +Prepare the source for writing, keeping the first +.Ar len +bytes of the original file. +Only implement this command if it is more efficient than copying the +data, and if it does not destructively overwrite the original file +(you still have to be able to execute +.Dv ZIP_SOURCE_ROLLBACK_WRITE ) . +.Pp +The next write should happen at byte +.Ar offset . +.Ss Dv ZIP_SOURCE_CLOSE +Reading is done. +.Ss Dv ZIP_SOURCE_COMMIT_WRITE +Finish writing to the source. +Replace the original data with the newly written data. +Clean up temporary files or internal buffers. +Subsequently opening and reading from the source should return the +newly written data. +.Ss Dv ZIP_SOURCE_ERROR +Get error information. +.Ar data +points to an array of two ints, which should be filled with the libzip +error code and the corresponding system error code for the error that +occurred. +See +.Xr zip_errors 3 +for details on the error codes. +If the source stores error information in a zip_error_t, use +.Xr zip_error_to_data 3 +and return its return value. +Otherwise, return 2 * sizeof(int). +.Ss Dv ZIP_SOURCE_FREE +Clean up and free all resources, including +.Ar userdata . +The callback function will not be called again. +.Ss Dv ZIP_SOURCE_GET_FILE_ATTRIBUTES +Provide information about various data. +Then the data should be put in the appropriate entry in the passed +.Vt zip_file_attributes_t +argument, and the appropriate +.Dv ZIP_FILE_ATTRIBUTES_* +value must be or'ed into the +.Ar valid +member to denote that the corresponding data has been provided. +A +.Vt zip_file_attributes_t +structure can be initialized using +.Xr zip_file_attributes_init 3 . +.Bl -tag -width 10n +.It ASCII mode +If a file is a plaintext file in ASCII. +Can be used by extraction tools to automatically convert line endings +(part of the interal file attributes). +Member +.Ar ascii , +flag +.Dv ZIP_FILE_ATTRIBUTES_ASCII . +.It General Purpose Bit Flags (limited to Compression Flags) +The general purpose bit flag in the zip in the local and central +directory headers contain information about the compression method. +Member +.Ar general_purpose_bit_flags +and +.Ar general_purpose_bit_mask +to denote which members have been set; +flag +.Dv ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS . +.It External File Attributes +The external file attributes (usually operating system-specific). +Member +.Ar external_file_attributes , +flag +.Dv ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES . +.It Version Needed +A minimum version needed required to unpack this entry (in the usual +"major * 10 + minor" format). +Member +.Ar version_needed , +flag +.Dv ZIP_FILE_ATTRIBUTES_VERSION_NEEDED . +.It Operating System +One of the operating systems as defined by the +.Dv ZIP_OPSYS_* +variables (see +.Pa zip.h ) . +This value affects the interpretation of the external file attributes. +Member +.Ar host_system , +flag +.Dv ZIP_FILE_ATTRIBUTES_HOST_SYSTEM . +.El +.Ss Dv ZIP_SOURCE_OPEN +Prepare for reading. +.Ss Dv ZIP_SOURCE_READ +Read data into the buffer +.Ar data +of size +.Ar len . +Return the number of bytes placed into +.Ar data +on success, and zero for end-of-file. +.Ss Dv ZIP_SOURCE_REMOVE +Remove the underlying file. +This is called if a zip archive is empty when closed. +.Ss Dv ZIP_SOURCE_ROLLBACK_WRITE +Abort writing to the source. +Discard written data. +Clean up temporary files or internal buffers. +Subsequently opening and reading from the source should return the +original data. +.Ss Dv ZIP_SOURCE_SEEK +Specify position to read next byte from, like +.Xr fseek 3 . +Use +.Xr ZIP_SOURCE_GET_ARGS 3 +to decode the arguments into the following struct: +.Bd -literal +struct zip_source_args_seek { + zip_int64_t offset; + int whence; +}; +.Ed +.Pp +If the size of the source's data is known, use +.Xr zip_source_seek_compute_offset 3 +to validate the arguments and compute the new offset. +.Ss Dv ZIP_SOURCE_SEEK_WRITE +Specify position to write next byte to, like +.Xr fseek 3 . +See +.Dv ZIP_SOURCE_SEEK +for details. +.Ss Dv ZIP_SOURCE_STAT +Get meta information for the input data. +.Ar data +points to an allocated +.Vt struct zip_stat , +which should be initialized using +.Xr zip_stat_init 3 +and then filled in. +.Pp +For uncompressed, unencrypted data, all information is optional. +However, fill in as much information as is readily available. +.Pp +If the data is compressed, +.Dv ZIP_STAT_COMP_METHOD , +.Dv ZIP_STAT_SIZE , +and +.Dv ZIP_STAT_CRC +must be filled in. +.Pp +If the data is encrypted, +.Dv ZIP_STAT_ENCRYPTION_METHOD , +.Dv ZIP_STAT_COMP_METHOD , +.Dv ZIP_STAT_SIZE , +and +.Dv ZIP_STAT_CRC +must be filled in. +.Pp +Information only available after the source has been read (e.g., size) +can be omitted in an earlier call. +.Em NOTE : +.Fn zip_source_function +may be called with this argument even after being called with +.Dv ZIP_SOURCE_CLOSE . +.Pp +Return sizeof(struct zip_stat) on success. +.Ss Dv ZIP_SOURCE_SUPPORTS +Return bitmap specifying which commands are supported. +Use +.Xr zip_source_make_command_bitmap 3 . +If this command is not implemented, the source is assumed to be a +read source without seek support. +.Ss Dv ZIP_SOURCE_TELL +Return the current read offset in the source, like +.Xr ftell 3 . +.Ss Dv ZIP_SOURCE_TELL_WRITE +Return the current write offset in the source, like +.Xr ftell 3 . +.Ss Dv ZIP_SOURCE_WRITE +Write data to the source. +Return number of bytes written. +.Ss Return Values +Commands should return \-1 on error. +.Dv ZIP_SOURCE_ERROR +will be called to retrieve the error code. +On success, commands return 0, unless specified otherwise in the +description above. +.Ss Calling Conventions +The library will always issue +.Dv ZIP_SOURCE_OPEN +before issuing +.Dv ZIP_SOURCE_READ , +.Dv ZIP_SOURCE_SEEK , +or +.Dv ZIP_SOURCE_TELL . +When it no longer wishes to read from this source, it will issue +.Dv ZIP_SOURCE_CLOSE . +If the library wishes to read the data again, it will issue +.Dv ZIP_SOURCE_OPEN +a second time. +If the function is unable to provide the data again, it should +return \-1. +.Pp +.Dv ZIP_SOURCE_BEGIN_WRITE +or +.Dv ZIP_SOURCE_BEGIN_WRITE_CLONING +will be called before +.Dv ZIP_SOURCE_WRITE , +.Dv ZIP_SOURCE_SEEK_WRITE , +or +.Dv ZIP_SOURCE_TELL_WRITE . +When writing is complete, either +.Dv ZIP_SOURCE_COMMIT_WRITE +or +.Dv ZIP_SOURCE_ROLLBACK_WRITE +will be called. +.Pp +.Dv ZIP_SOURCE_ACCEPT_EMPTY , +.Dv ZIP_SOURCE_GET_FILE_ATTRIBUTES , +and +.Dv ZIP_SOURCE_STAT +can be issued at any time. +.Pp +.Dv ZIP_SOURCE_ERROR +will only be issued in response to the function +returning \-1. +.Pp +.Dv ZIP_SOURCE_FREE +will be the last command issued; +if +.Dv ZIP_SOURCE_OPEN +was called and succeeded, +.Dv ZIP_SOURCE_CLOSE +will be called before +.Dv ZIP_SOURCE_FREE , +and similarly for +.Dv ZIP_SOURCE_BEGIN_WRITE +or +.Dv ZIP_SOURCE_BEGIN_WRITE_CLONING +and +.Dv ZIP_SOURCE_COMMIT_WRITE +or +.Dv ZIP_SOURCE_ROLLBACK_WRITE . +.Sh RETURN VALUES +Upon successful completion, the created source is returned. +Otherwise, +.Dv NULL +is returned and the error code in +.Ar archive +or +.Ar error +is set to indicate the error (unless +it is +.Dv NULL ) . +.Sh ERRORS +.Fn zip_source_function +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_add 3 , +.Xr zip_file_attributes_init 3 , +.Xr zip_file_replace 3 , +.Xr zip_source 3 , +.Xr zip_stat_init 3 +.Sh HISTORY +.Fn zip_source_function +and +.Fn zip_source_function_create +were added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_is_deleted.html b/core/deps/libzip/man/zip_source_is_deleted.html new file mode 100644 index 000000000..166c7d34f --- /dev/null +++ b/core/deps/libzip/man/zip_source_is_deleted.html @@ -0,0 +1,103 @@ + + + + + + + ZIP_SOURCE_IS_DELETED(3) + + + + + + + + +
ZIP_SOURCE_IS_DELETED(3)Library Functions ManualZIP_SOURCE_IS_DELETED(3)
+
+
+

+zip_source_is_deleted — +
check if zip_source is deleted
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_source_is_deleted(zip_source_t + *source);

+
+
+

+The function zip_source_is_deleted() returns whether the + zip_source was deleted. This can for example happen when all entries are + removed from a zip archive. +
+
+

+zip_source_is_deleted() returns 1 if the zip_source is + deleted and 0 otherwise. +
+
+

+libzip(3), + zip_source(3) +
+
+

+zip_source_is_deleted() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_is_deleted.man b/core/deps/libzip/man/zip_source_is_deleted.man new file mode 100644 index 000000000..89dab743b --- /dev/null +++ b/core/deps/libzip/man/zip_source_is_deleted.man @@ -0,0 +1,67 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_is_deleted.mdoc -- check if zip source is deleted +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_IS_DELETED" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_is_deleted\fR +\- check if zip_source is deleted +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_source_is_deleted\fR(\fIzip_source_t\ *source\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_source_is_deleted\fR() +returns whether the zip_source was deleted. +This can for example happen when all entries are removed from a zip archive. +.SH "RETURN VALUES" +\fBzip_source_is_deleted\fR() +returns 1 if the zip_source is deleted and 0 otherwise. +.SH "SEE ALSO" +libzip(3), +zip_source(3) +.SH "HISTORY" +\fBzip_source_is_deleted\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_is_deleted.mdoc b/core/deps/libzip/man/zip_source_is_deleted.mdoc new file mode 100644 index 000000000..9903058f7 --- /dev/null +++ b/core/deps/libzip/man/zip_source_is_deleted.mdoc @@ -0,0 +1,62 @@ +.\" zip_source_is_deleted.mdoc -- check if zip source is deleted +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_IS_DELETED 3 +.Os +.Sh NAME +.Nm zip_source_is_deleted +.Nd check if zip_source is deleted +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_source_is_deleted "zip_source_t *source" +.Sh DESCRIPTION +The function +.Fn zip_source_is_deleted +returns whether the zip_source was deleted. +This can for example happen when all entries are removed from a zip archive. +.Sh RETURN VALUES +.Fn zip_source_is_deleted +returns 1 if the zip_source is deleted and 0 otherwise. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 +.Sh HISTORY +.Fn zip_source_is_deleted +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_keep.html b/core/deps/libzip/man/zip_source_keep.html new file mode 100644 index 000000000..fc7d1d16f --- /dev/null +++ b/core/deps/libzip/man/zip_source_keep.html @@ -0,0 +1,97 @@ + + + + + + + ZIP_SOURCE_KEEP(3) + + + + + + + + +
ZIP_SOURCE_KEEP(3)Library Functions ManualZIP_SOURCE_KEEP(3)
+
+
+

+zip_source_keep — +
increment reference count of zip data source
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

void +
+ zip_source_keep(zip_source_t + *source);

+
+
+

+The function zip_source_keep() increments the reference + count of source. +
+
+

+libzip(3), + zip_source(3), + zip_source_free(3) +
+
+

+zip_source_keep() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_keep.man b/core/deps/libzip/man/zip_source_keep.man new file mode 100644 index 000000000..488673cbe --- /dev/null +++ b/core/deps/libzip/man/zip_source_keep.man @@ -0,0 +1,65 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_keep.mdoc -- increment reference count of zip data source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_KEEP" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_keep\fR +\- increment reference count of zip data source +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_source_keep\fR(\fIzip_source_t\ *source\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_source_keep\fR() +increments the reference count of +\fIsource\fR. +.SH "SEE ALSO" +libzip(3), +zip_source(3), +zip_source_free(3) +.SH "HISTORY" +\fBzip_source_keep\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_keep.mdoc b/core/deps/libzip/man/zip_source_keep.mdoc new file mode 100644 index 000000000..122c4f84a --- /dev/null +++ b/core/deps/libzip/man/zip_source_keep.mdoc @@ -0,0 +1,60 @@ +.\" zip_source_keep.mdoc -- increment reference count of zip data source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_KEEP 3 +.Os +.Sh NAME +.Nm zip_source_keep +.Nd increment reference count of zip data source +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft void +.Fn zip_source_keep "zip_source_t *source" +.Sh DESCRIPTION +The function +.Fn zip_source_keep +increments the reference count of +.Ar source . +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 , +.Xr zip_source_free 3 +.Sh HISTORY +.Fn zip_source_keep +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_make_command_bitmap.html b/core/deps/libzip/man/zip_source_make_command_bitmap.html new file mode 100644 index 000000000..d6ce945eb --- /dev/null +++ b/core/deps/libzip/man/zip_source_make_command_bitmap.html @@ -0,0 +1,99 @@ + + + + + + + ZIP_SOURCE_MAKE_COMMAND_BITMAP(3) + + + + + + + + +
ZIP_SOURCE_MAKE_COMMAND_BITMAP(3)Library Functions ManualZIP_SOURCE_MAKE_COMMAND_BITMAP(3)
+
+
+

+zip_source_make_command_bitmap — +
create bitmap of supported source operations
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int64_t +
+ zip_source_make_command_bitmap(zip_source_cmd_t + command, ...);

+
+
+

+The zip_source_make_command_bitmap() function returns a + bitmap of source commands suitable as return value for + ZIP_SOURCE_SUPPORTS. It includes all the commands from + the argument list, which must be terminated by -1. +
+
+

+libzip(3), + zip_source_function(3) +
+
+

+zip_source_make_command_bitmap() was added in libzip + 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_make_command_bitmap.man b/core/deps/libzip/man/zip_source_make_command_bitmap.man new file mode 100644 index 000000000..3dc3ed5d0 --- /dev/null +++ b/core/deps/libzip/man/zip_source_make_command_bitmap.man @@ -0,0 +1,67 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_make_command_bitmap -- create bitmap of supported source operations +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_MAKE_COMMAND_BITMAP" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_make_command_bitmap\fR +\- create bitmap of supported source operations +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int64_t\fR +.br +.PD 0 +.HP 4n +\fBzip_source_make_command_bitmap\fR(\fIzip_source_cmd_t\ command\fR, \fI...\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_source_make_command_bitmap\fR() +function returns a bitmap of source commands suitable as return value +for +\fRZIP_SOURCE_SUPPORTS\fR. +It includes all the commands from the argument list, which must be +terminated by \-1. +.SH "SEE ALSO" +libzip(3), +zip_source_function(3) +.SH "HISTORY" +\fBzip_source_make_command_bitmap\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_make_command_bitmap.mdoc b/core/deps/libzip/man/zip_source_make_command_bitmap.mdoc new file mode 100644 index 000000000..28d296f2f --- /dev/null +++ b/core/deps/libzip/man/zip_source_make_command_bitmap.mdoc @@ -0,0 +1,62 @@ +.\" zip_source_make_command_bitmap -- create bitmap of supported source operations +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_MAKE_COMMAND_BITMAP 3 +.Os +.Sh NAME +.Nm zip_source_make_command_bitmap +.Nd create bitmap of supported source operations +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int64_t +.Fn zip_source_make_command_bitmap "zip_source_cmd_t command" "..." +.Sh DESCRIPTION +The +.Fn zip_source_make_command_bitmap +function returns a bitmap of source commands suitable as return value +for +.Dv ZIP_SOURCE_SUPPORTS . +It includes all the commands from the argument list, which must be +terminated by \-1. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source_function 3 +.Sh HISTORY +.Fn zip_source_make_command_bitmap +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_open.html b/core/deps/libzip/man/zip_source_open.html new file mode 100644 index 000000000..9dc5a579a --- /dev/null +++ b/core/deps/libzip/man/zip_source_open.html @@ -0,0 +1,108 @@ + + + + + + + ZIP_SOURCE_OPEN(3) + + + + + + + + +
ZIP_SOURCE_OPEN(3)Library Functions ManualZIP_SOURCE_OPEN(3)
+
+
+

+zip_source_open — +
open zip_source for reading
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_source_open(zip_source_t + *source);

+
+
+

+The function zip_source_open() opens + source for reading. +
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in source is set to indicate the + error. +
+
+

+libzip(3), + zip_source(3), + zip_source_begin_write(3), + zip_source_close(3), + zip_source_read(3), + zip_source_seek(3), + zip_source_tell(3) +
+
+

+zip_source_open() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_open.man b/core/deps/libzip/man/zip_source_open.man new file mode 100644 index 000000000..dc337baf6 --- /dev/null +++ b/core/deps/libzip/man/zip_source_open.man @@ -0,0 +1,75 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_open.mdoc -- open zip source for reading +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_OPEN" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_open\fR +\- open zip_source for reading +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_source_open\fR(\fIzip_source_t\ *source\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_source_open\fR() +opens +\fIsource\fR +for reading. +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +\fIsource\fR +is set to indicate the error. +.SH "SEE ALSO" +libzip(3), +zip_source(3), +zip_source_begin_write(3), +zip_source_close(3), +zip_source_read(3), +zip_source_seek(3), +zip_source_tell(3) +.SH "HISTORY" +\fBzip_source_open\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_open.mdoc b/core/deps/libzip/man/zip_source_open.mdoc new file mode 100644 index 000000000..00371f64f --- /dev/null +++ b/core/deps/libzip/man/zip_source_open.mdoc @@ -0,0 +1,70 @@ +.\" zip_source_open.mdoc -- open zip source for reading +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_OPEN 3 +.Os +.Sh NAME +.Nm zip_source_open +.Nd open zip_source for reading +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_source_open "zip_source_t *source" +.Sh DESCRIPTION +The function +.Fn zip_source_open +opens +.Fa source +for reading. +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +.Ar source +is set to indicate the error. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 , +.Xr zip_source_begin_write 3 , +.Xr zip_source_close 3 , +.Xr zip_source_read 3 , +.Xr zip_source_seek 3 , +.Xr zip_source_tell 3 +.Sh HISTORY +.Fn zip_source_open +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_read.html b/core/deps/libzip/man/zip_source_read.html new file mode 100644 index 000000000..1269a42e6 --- /dev/null +++ b/core/deps/libzip/man/zip_source_read.html @@ -0,0 +1,112 @@ + + + + + + + ZIP_SOURCE_READ(3) + + + + + + + + +
ZIP_SOURCE_READ(3)Library Functions ManualZIP_SOURCE_READ(3)
+
+
+

+zip_source_read — +
read data from zip source
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int64_t +
+ zip_source_read(zip_source_t + *source, void + *data, zip_uint64_t + len);

+
+
+

+The function zip_source_read() reads up to + len bytes of data from source at + the current read offset into the buffer data. +

The zip source source has to be opened for + reading by calling + zip_source_open(3) first.

+
+
+

+Upon successful completion the number of bytes read is returned. Upon reading + end-of-file, zero is returned. Otherwise, -1 is returned and the error + information in source is set to indicate the error. +
+
+

+libzip(3), + zip_source(3), + zip_source_seek(3), + zip_source_tell(3), + zip_source_write(3) +
+
+

+zip_source_read() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_read.man b/core/deps/libzip/man/zip_source_read.man new file mode 100644 index 000000000..78ea1bf33 --- /dev/null +++ b/core/deps/libzip/man/zip_source_read.man @@ -0,0 +1,83 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_read.mdoc -- read data from zip source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_READ" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_read\fR +\- read data from zip source +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int64_t\fR +.br +.PD 0 +.HP 4n +\fBzip_source_read\fR(\fIzip_source_t\ *source\fR, \fIvoid\ *data\fR, \fIzip_uint64_t\ len\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_source_read\fR() +reads up to +\fIlen\fR +bytes of data from +\fIsource\fR +at the current read offset into the buffer +\fIdata\fR. +.PP +The zip source +\fIsource\fR +has to be opened for reading by calling +zip_source_open(3) +first. +.SH "RETURN VALUES" +Upon successful completion the number of bytes read is returned. +Upon reading end-of-file, zero is returned. +Otherwise, \-1 is returned and the error information in +\fIsource\fR +is set to indicate the error. +.SH "SEE ALSO" +libzip(3), +zip_source(3), +zip_source_seek(3), +zip_source_tell(3), +zip_source_write(3) +.SH "HISTORY" +\fBzip_source_read\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_read.mdoc b/core/deps/libzip/man/zip_source_read.mdoc new file mode 100644 index 000000000..1e7bc02d0 --- /dev/null +++ b/core/deps/libzip/man/zip_source_read.mdoc @@ -0,0 +1,78 @@ +.\" zip_source_read.mdoc -- read data from zip source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_READ 3 +.Os +.Sh NAME +.Nm zip_source_read +.Nd read data from zip source +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int64_t +.Fn zip_source_read "zip_source_t *source" "void *data" "zip_uint64_t len" +.Sh DESCRIPTION +The function +.Fn zip_source_read +reads up to +.Ar len +bytes of data from +.Ar source +at the current read offset into the buffer +.Ar data . +.Pp +The zip source +.Ar source +has to be opened for reading by calling +.Xr zip_source_open 3 +first. +.Sh RETURN VALUES +Upon successful completion the number of bytes read is returned. +Upon reading end-of-file, zero is returned. +Otherwise, \-1 is returned and the error information in +.Ar source +is set to indicate the error. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 , +.Xr zip_source_seek 3 , +.Xr zip_source_tell 3 , +.Xr zip_source_write 3 +.Sh HISTORY +.Fn zip_source_read +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_rollback_write.html b/core/deps/libzip/man/zip_source_rollback_write.html new file mode 100644 index 000000000..9ba26954c --- /dev/null +++ b/core/deps/libzip/man/zip_source_rollback_write.html @@ -0,0 +1,110 @@ + + + + + + + ZIP_SOURCE_ROLLBACK_WRITE(3) + + + + + + + + +
ZIP_SOURCE_ROLLBACK_WRITE(3)Library Functions ManualZIP_SOURCE_ROLLBACK_WRITE(3)
+
+
+

+zip_source_rollback_write — +
undo changes to zip source
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

void +
+ zip_source_rollback_write(zip_source_t + *source);

+
+
+

+The function zip_source_rollback_write() reverts changes + written to source, restoring the data before + zip_source_begin_write(3) + was called. Usually this removes temporary files or frees buffers. +
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in source is set to indicate the + error. +
+
+

+libzip(3), + zip_source(3), + zip_source_begin_write(3), + zip_source_commit_write(3), + zip_source_seek_write(3), + zip_source_tell_write(3), + zip_source_write(3) +
+
+

+zip_source_rollback_write() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_rollback_write.man b/core/deps/libzip/man/zip_source_rollback_write.man new file mode 100644 index 000000000..1665dbe96 --- /dev/null +++ b/core/deps/libzip/man/zip_source_rollback_write.man @@ -0,0 +1,78 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_rollback_write.mdoc -- undo changes to zip source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_ROLLBACK_WRITE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_rollback_write\fR +\- undo changes to zip source +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_source_rollback_write\fR(\fIzip_source_t\ *source\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_source_rollback_write\fR() +reverts changes written to +\fIsource\fR, +restoring the data before +zip_source_begin_write(3) +was called. +Usually this removes temporary files or frees buffers. +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +\fIsource\fR +is set to indicate the error. +.SH "SEE ALSO" +libzip(3), +zip_source(3), +zip_source_begin_write(3), +zip_source_commit_write(3), +zip_source_seek_write(3), +zip_source_tell_write(3), +zip_source_write(3) +.SH "HISTORY" +\fBzip_source_rollback_write\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_rollback_write.mdoc b/core/deps/libzip/man/zip_source_rollback_write.mdoc new file mode 100644 index 000000000..50a2a603b --- /dev/null +++ b/core/deps/libzip/man/zip_source_rollback_write.mdoc @@ -0,0 +1,73 @@ +.\" zip_source_rollback_write.mdoc -- undo changes to zip source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_ROLLBACK_WRITE 3 +.Os +.Sh NAME +.Nm zip_source_rollback_write +.Nd undo changes to zip source +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft void +.Fn zip_source_rollback_write "zip_source_t *source" +.Sh DESCRIPTION +The function +.Fn zip_source_rollback_write +reverts changes written to +.Fa source , +restoring the data before +.Xr zip_source_begin_write 3 +was called. +Usually this removes temporary files or frees buffers. +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +.Ar source +is set to indicate the error. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 , +.Xr zip_source_begin_write 3 , +.Xr zip_source_commit_write 3 , +.Xr zip_source_seek_write 3 , +.Xr zip_source_tell_write 3 , +.Xr zip_source_write 3 +.Sh HISTORY +.Fn zip_source_rollback_write +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_seek.html b/core/deps/libzip/man/zip_source_seek.html new file mode 100644 index 000000000..6fad80300 --- /dev/null +++ b/core/deps/libzip/man/zip_source_seek.html @@ -0,0 +1,120 @@ + + + + + + + ZIP_SOURCE_SEEK(3) + + + + + + + + +
ZIP_SOURCE_SEEK(3)Library Functions ManualZIP_SOURCE_SEEK(3)
+
+
+

+zip_source_seek — +
set read offset in zip source
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_source_seek(zip_source_t + *source, zip_int64_t + offset, int + whence);

+
+
+

+The function zip_source_seek() sets the current read + offset for source. Just like in + fseek(3), depending on the + whence argument, the offset is + counted relative from: +
+
+
+
start of file
+
+
current read offset in file
+
+
end of file
+
+
+
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in source is set to indicate the + error. +
+
+

+libzip(3), + zip_source(3), + zip_source_read(3), + zip_source_tell(3) +
+
+

+zip_source_seek() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_seek.man b/core/deps/libzip/man/zip_source_seek.man new file mode 100644 index 000000000..399597ed9 --- /dev/null +++ b/core/deps/libzip/man/zip_source_seek.man @@ -0,0 +1,89 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_seek.mdoc -- set read offset in source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_SEEK" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_seek\fR +\- set read offset in zip source +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_source_seek\fR(\fIzip_source_t\ *source\fR, \fIzip_int64_t\ offset\fR, \fIint\ whence\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_source_seek\fR() +sets the current read offset for +\fIsource\fR. +Just like in +fseek(3), +depending on the +\fIwhence\fR +argument, the +\fIoffset\fR +is counted relative from: +.RS 6n +.TP 12n +\fRSEEK_SET\fR +start of file +.TP 12n +\fRSEEK_CUR\fR +current read offset in file +.TP 12n +\fRSEEK_END\fR +end of file +.RE +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +\fIsource\fR +is set to indicate the error. +.SH "SEE ALSO" +libzip(3), +zip_source(3), +zip_source_read(3), +zip_source_tell(3) +.SH "HISTORY" +\fBzip_source_seek\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_seek.mdoc b/core/deps/libzip/man/zip_source_seek.mdoc new file mode 100644 index 000000000..6518ba700 --- /dev/null +++ b/core/deps/libzip/man/zip_source_seek.mdoc @@ -0,0 +1,81 @@ +.\" zip_source_seek.mdoc -- set read offset in source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_SEEK 3 +.Os +.Sh NAME +.Nm zip_source_seek +.Nd set read offset in zip source +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_source_seek "zip_source_t *source" "zip_int64_t offset" "int whence" +.Sh DESCRIPTION +The function +.Fn zip_source_seek +sets the current read offset for +.Fa source . +Just like in +.Xr fseek 3 , +depending on the +.Ar whence +argument, the +.Ar offset +is counted relative from: +.Bl -tag -width SEEK_CURXX -offset indent +.It Dv SEEK_SET +start of file +.It Dv SEEK_CUR +current read offset in file +.It Dv SEEK_END +end of file +.El +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +.Ar source +is set to indicate the error. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 , +.Xr zip_source_read 3 , +.Xr zip_source_tell 3 +.Sh HISTORY +.Fn zip_source_seek +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_seek_compute_offset.html b/core/deps/libzip/man/zip_source_seek_compute_offset.html new file mode 100644 index 000000000..15fee4545 --- /dev/null +++ b/core/deps/libzip/man/zip_source_seek_compute_offset.html @@ -0,0 +1,119 @@ + + + + + + + ZIP_SOURCE_SEEK_COMPUTE_OFFSET(3) + + + + + + + + +
ZIP_SOURCE_SEEK_COMPUTE_OFFSET(3)Library Functions ManualZIP_SOURCE_SEEK_COMPUTE_OFFSET(3)
+
+
+

+zip_source_seek_compute_offset — +
validate arguments and compute offset
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int64_t +
+ zip_source_seek_compute_offset(zip_uint64_t + offset, zip_uint64_t + length, void *data, + zip_uint64_t data_length, + zip_error_t *error);

+
+
+

+Use this function to compute the offset for a + ZIP_SOURCE_SEEK or + ZIP_SOURCE_SEEK_WRITE command. + data and data_length are the + arguments to the source callback, offset is the current + offset and length is the length of the source data or, + for ZIP_SOURCE_SEEK_WRITE, the amount of data written. +
+
+

+On success, it returns the new offset, on error it returns -1 and sets + error. +
+
+

+zip_source_seek_compute_offset() fails if: +
+
[]
+
One of the arguments is invalid or the seek would place the offset outside + the data.
+
+
+
+

+zip_source_function(3) +
+
+

+zip_source_seek_compute_offset() was added in libzip + 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_seek_compute_offset.man b/core/deps/libzip/man/zip_source_seek_compute_offset.man new file mode 100644 index 000000000..a1b1cc13d --- /dev/null +++ b/core/deps/libzip/man/zip_source_seek_compute_offset.man @@ -0,0 +1,85 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_seek_compute_offset.mdoc - validate arguments and compute offset +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_SEEK_COMPUTE_OFFSET" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_seek_compute_offset\fR +\- validate arguments and compute offset +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int64_t\fR +.br +.PD 0 +.HP 4n +\fBzip_source_seek_compute_offset\fR(\fIzip_uint64_t\ offset\fR, \fIzip_uint64_t\ length\fR, \fIvoid\ *data\fR, \fIzip_uint64_t\ data_length\fR, \fIzip_error_t\ *error\fR); +.PD +.SH "DESCRIPTION" +Use this function to compute the offset for a +\fRZIP_SOURCE_SEEK\fR +or +\fRZIP_SOURCE_SEEK_WRITE\fR +command. +\fIdata\fR +and +\fIdata_length\fR +are the arguments to the source callback, +\fIoffset\fR +is the current offset and +\fIlength\fR +is the length of the source data or, for +\fRZIP_SOURCE_SEEK_WRITE\fR, +the amount of data written. +.SH "RETURN VALUES" +On success, it returns the new offset, on error it returns \-1 and +sets +\fIerror\fR. +.SH "ERRORS" +\fBzip_source_seek_compute_offset\fR() +fails if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +One of the arguments is invalid or the seek would place the offset +outside the data. +.SH "SEE ALSO" +zip_source_function(3) +.SH "HISTORY" +\fBzip_source_seek_compute_offset\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_seek_compute_offset.mdoc b/core/deps/libzip/man/zip_source_seek_compute_offset.mdoc new file mode 100644 index 000000000..bcf159a83 --- /dev/null +++ b/core/deps/libzip/man/zip_source_seek_compute_offset.mdoc @@ -0,0 +1,81 @@ +.\" zip_source_seek_compute_offset.mdoc - validate arguments and compute offset +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_SEEK_COMPUTE_OFFSET 3 +.Os +.Sh NAME +.Nm zip_source_seek_compute_offset +.Nd validate arguments and compute offset +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int64_t +.Fn zip_source_seek_compute_offset "zip_uint64_t offset" "zip_uint64_t length" "void *data" "zip_uint64_t data_length" "zip_error_t *error" +.Sh DESCRIPTION +Use this function to compute the offset for a +.Dv ZIP_SOURCE_SEEK +or +.Dv ZIP_SOURCE_SEEK_WRITE +command. +.Ar data +and +.Ar data_length +are the arguments to the source callback, +.Ar offset +is the current offset and +.Ar length +is the length of the source data or, for +.Dv ZIP_SOURCE_SEEK_WRITE , +the amount of data written. +.Sh RETURN VALUES +On success, it returns the new offset, on error it returns \-1 and +sets +.Ar error . +.Sh ERRORS +.Fn zip_source_seek_compute_offset +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +One of the arguments is invalid or the seek would place the offset +outside the data. +.El +.Sh SEE ALSO +.Xr zip_source_function 3 +.Sh HISTORY +.Fn zip_source_seek_compute_offset +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_seek_write.html b/core/deps/libzip/man/zip_source_seek_write.html new file mode 100644 index 000000000..76eb2669e --- /dev/null +++ b/core/deps/libzip/man/zip_source_seek_write.html @@ -0,0 +1,123 @@ + + + + + + + ZIP_SOURCE_SEEK_WRITE(3) + + + + + + + + +
ZIP_SOURCE_SEEK_WRITE(3)Library Functions ManualZIP_SOURCE_SEEK_WRITE(3)
+
+
+

+zip_source_seek_write — +
set write offset in zip source
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_source_seek_write(zip_source_t + *source, zip_int64_t + offset, int + whence);

+
+
+

+The function zip_source_seek_write() sets the current + write offset for source. Just like in + fseek(3), depending on the + whence argument, the offset is + counted relative from: +
+
+
+
start of file
+
+
current write offset in file
+
+
end of file
+
+
+
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in source is set to indicate the + error. +
+
+

+libzip(3), + zip_source(3), + zip_source_begin_write(3), + zip_source_commit_write(3), + zip_source_rollback_write(3), + zip_source_tell_write(3), + zip_source_write(3) +
+
+

+zip_source_seek_write() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_seek_write.man b/core/deps/libzip/man/zip_source_seek_write.man new file mode 100644 index 000000000..567588d42 --- /dev/null +++ b/core/deps/libzip/man/zip_source_seek_write.man @@ -0,0 +1,92 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_seek_write.mdoc -- set write offset in source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_SEEK_WRITE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_seek_write\fR +\- set write offset in zip source +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_source_seek_write\fR(\fIzip_source_t\ *source\fR, \fIzip_int64_t\ offset\fR, \fIint\ whence\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_source_seek_write\fR() +sets the current write offset for +\fIsource\fR. +Just like in +fseek(3), +depending on the +\fIwhence\fR +argument, the +\fIoffset\fR +is counted relative from: +.RS 6n +.TP 12n +\fRSEEK_SET\fR +start of file +.TP 12n +\fRSEEK_CUR\fR +current write offset in file +.TP 12n +\fRSEEK_END\fR +end of file +.RE +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +\fIsource\fR +is set to indicate the error. +.SH "SEE ALSO" +libzip(3), +zip_source(3), +zip_source_begin_write(3), +zip_source_commit_write(3), +zip_source_rollback_write(3), +zip_source_tell_write(3), +zip_source_write(3) +.SH "HISTORY" +\fBzip_source_seek_write\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_seek_write.mdoc b/core/deps/libzip/man/zip_source_seek_write.mdoc new file mode 100644 index 000000000..fac015939 --- /dev/null +++ b/core/deps/libzip/man/zip_source_seek_write.mdoc @@ -0,0 +1,84 @@ +.\" zip_source_seek_write.mdoc -- set write offset in source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_SEEK_WRITE 3 +.Os +.Sh NAME +.Nm zip_source_seek_write +.Nd set write offset in zip source +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_source_seek_write "zip_source_t *source" "zip_int64_t offset" "int whence" +.Sh DESCRIPTION +The function +.Fn zip_source_seek_write +sets the current write offset for +.Fa source . +Just like in +.Xr fseek 3 , +depending on the +.Ar whence +argument, the +.Ar offset +is counted relative from: +.Bl -tag -width SEEK_CURXX -offset indent +.It Dv SEEK_SET +start of file +.It Dv SEEK_CUR +current write offset in file +.It Dv SEEK_END +end of file +.El +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +.Ar source +is set to indicate the error. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 , +.Xr zip_source_begin_write 3 , +.Xr zip_source_commit_write 3 , +.Xr zip_source_rollback_write 3 , +.Xr zip_source_tell_write 3 , +.Xr zip_source_write 3 +.Sh HISTORY +.Fn zip_source_seek_write +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_stat.html b/core/deps/libzip/man/zip_source_stat.html new file mode 100644 index 000000000..91ae69c67 --- /dev/null +++ b/core/deps/libzip/man/zip_source_stat.html @@ -0,0 +1,154 @@ + + + + + + + ZIP_SOURCE_STAT(3) + + + + + + + + +
ZIP_SOURCE_STAT(3)Library Functions ManualZIP_SOURCE_STAT(3)
+
+
+

+zip_source_stat — +
get information about zip_source
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_source_stat(zip_source_t + *source, zip_stat_t + *sb);

+
+
+

+The zip_source_stat() function obtains information about + the zip source source +

The sb argument is a pointer to a + struct zip_source_stat (shown below), into which + information about the zip source is placed.

+
+
+struct zip_source_stat {
+    zip_uint64_t valid;                 /* which fields have valid values */
+    const char *name;                   /* name of the file */
+    zip_uint64_t index;                 /* index within archive */
+    zip_uint64_t size;                  /* size of file (uncompressed) */
+    zip_uint64_t comp_size;             /* size of file (compressed) */
+    time_t mtime;                       /* modification time */
+    zip_uint32_t crc;                   /* crc of file data */
+    zip_uint16_t comp_method;           /* compression method used */
+    zip_uint16_t encryption_method;     /* encryption method used */
+    zip_uint32_t flags;                 /* reserved for future use */
+};
+
+
+The structure pointed to by sb must be initialized with + zip_stat_init(3) before calling + zip_source_stat(). +

The valid field of the structure specifies + which other fields are valid. Check if the flag defined by the following + defines are in valid before accessing the fields:

+
+
+
+
name
+
+
index
+
+
size
+
+
comp_size
+
+
mtime
+
+
crc
+
+
comp_method
+
+
encryption_method
+
+
flags
+
+
+

NOTE: Some fields may only be filled out after + all data has been read from the source, for example the + crc or size fields.

+
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in source is set to indicate the + error. +
+
+

+libzip(3), + zip_source(3) +
+
+

+zip_source_stat() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_stat.man b/core/deps/libzip/man/zip_source_stat.man new file mode 100644 index 000000000..cb8443b49 --- /dev/null +++ b/core/deps/libzip/man/zip_source_stat.man @@ -0,0 +1,144 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_stat.mdoc -- get information about zip source +.\" Copyright (C) 2014-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_STAT" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_stat\fR +\- get information about zip_source +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_source_stat\fR(\fIzip_source_t\ *source\fR, \fIzip_stat_t\ *sb\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_source_stat\fR() +function obtains information about the zip source +\fIsource\fR +.PP +The +\fIsb\fR +argument is a pointer to a +\fIstruct zip_source_stat\fR +(shown below), into which information about the zip source is placed. +.nf +.sp +.RS 0n +struct zip_source_stat { + zip_uint64_t valid; /* which fields have valid values */ + const char *name; /* name of the file */ + zip_uint64_t index; /* index within archive */ + zip_uint64_t size; /* size of file (uncompressed) */ + zip_uint64_t comp_size; /* size of file (compressed) */ + time_t mtime; /* modification time */ + zip_uint32_t crc; /* crc of file data */ + zip_uint16_t comp_method; /* compression method used */ + zip_uint16_t encryption_method; /* encryption method used */ + zip_uint32_t flags; /* reserved for future use */ +}; +.RE +.fi +The structure pointed to by +\fIsb\fR +must be initialized with +\fBzip_stat_init\fR(\fI3\fR) +before calling +\fBzip_source_stat\fR(). +.PP +The +\fIvalid\fR +field of the structure specifies which other fields are valid. +Check if the flag defined by the following defines are in +\fIvalid\fR +before accessing the fields: +.RS 6n +.PD 0 +.TP 30n +\fRZIP_STAT_NAME\fR +\fIname\fR +.TP 30n +\fRZIP_STAT_INDEX\fR +\fIindex\fR +.TP 30n +\fRZIP_STAT_SIZE\fR +\fIsize\fR +.TP 30n +\fRZIP_STAT_COMP_SIZE\fR +\fIcomp_size\fR +.TP 30n +\fRZIP_STAT_MTIME\fR +\fImtime\fR +.TP 30n +\fRZIP_STAT_CRC\fR +\fIcrc\fR +.TP 30n +\fRZIP_STAT_COMP_METHOD\fR +\fIcomp_method\fR +.TP 30n +\fRZIP_STAT_ENCRYPTION_METHOD\fR +\fIencryption_method\fR +.TP 30n +\fRZIP_STAT_FLAGS\fR +\fIflags\fR +.RE +.PD +.PP +\fINOTE\fR: +Some fields may only be filled out after all data has been read from +the source, for example the +\fIcrc\fR +or +\fIsize\fR +fields. +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +\fIsource\fR +is set to indicate the error. +.SH "SEE ALSO" +libzip(3), +zip_source(3) +.SH "HISTORY" +\fBzip_source_stat\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_stat.mdoc b/core/deps/libzip/man/zip_source_stat.mdoc new file mode 100644 index 000000000..64d13c84e --- /dev/null +++ b/core/deps/libzip/man/zip_source_stat.mdoc @@ -0,0 +1,125 @@ +.\" zip_source_stat.mdoc -- get information about zip source +.\" Copyright (C) 2014-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_STAT 3 +.Os +.Sh NAME +.Nm zip_source_stat +.Nd get information about zip_source +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_source_stat "zip_source_t *source" "zip_stat_t *sb" +.Sh DESCRIPTION +The +.Fn zip_source_stat +function obtains information about the zip source +.Ar source +.Pp +The +.Ar sb +argument is a pointer to a +.Ft struct zip_source_stat +(shown below), into which information about the zip source is placed. +.Bd -literal +struct zip_source_stat { + zip_uint64_t valid; /* which fields have valid values */ + const char *name; /* name of the file */ + zip_uint64_t index; /* index within archive */ + zip_uint64_t size; /* size of file (uncompressed) */ + zip_uint64_t comp_size; /* size of file (compressed) */ + time_t mtime; /* modification time */ + zip_uint32_t crc; /* crc of file data */ + zip_uint16_t comp_method; /* compression method used */ + zip_uint16_t encryption_method; /* encryption method used */ + zip_uint32_t flags; /* reserved for future use */ +}; +.Ed +The structure pointed to by +.Ar sb +must be initialized with +.Fn zip_stat_init 3 +before calling +.Fn zip_source_stat . +.Pp +The +.Ar valid +field of the structure specifies which other fields are valid. +Check if the flag defined by the following defines are in +.Ar valid +before accessing the fields: +.Bl -tag -width ZIP_STAT_ENCRYPTION_METHODXX -compact -offset indent +.It Dv ZIP_STAT_NAME +.Ar name +.It Dv ZIP_STAT_INDEX +.Ar index +.It Dv ZIP_STAT_SIZE +.Ar size +.It Dv ZIP_STAT_COMP_SIZE +.Ar comp_size +.It Dv ZIP_STAT_MTIME +.Ar mtime +.It Dv ZIP_STAT_CRC +.Ar crc +.It Dv ZIP_STAT_COMP_METHOD +.Ar comp_method +.It Dv ZIP_STAT_ENCRYPTION_METHOD +.Ar encryption_method +.It Dv ZIP_STAT_FLAGS +.Ar flags +.El +.Pp +.Em NOTE : +Some fields may only be filled out after all data has been read from +the source, for example the +.Ar crc +or +.Ar size +fields. +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +.Ar source +is set to indicate the error. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 +.Sh HISTORY +.Fn zip_source_stat +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_tell.html b/core/deps/libzip/man/zip_source_tell.html new file mode 100644 index 000000000..4668d5bc4 --- /dev/null +++ b/core/deps/libzip/man/zip_source_tell.html @@ -0,0 +1,108 @@ + + + + + + + ZIP_SOURCE_TELL(3) + + + + + + + + +
ZIP_SOURCE_TELL(3)Library Functions ManualZIP_SOURCE_TELL(3)
+
+
+

+zip_source_tell — +
report current read offset in zip source
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int64_t +
+ zip_source_tell(zip_source_t + *source);

+
+
+

+The function zip_source_tell() returns the current read + offset for source. The return value can be passed to + zip_source_seek(3) with + whence set to SEEK_SET to return + to the same location in the source. +
+
+

+Upon successful completion the current read offset is returned. Otherwise, -1 is + returned and the error information in source is set to + indicate the error. +
+
+

+libzip(3), + zip_source(3), + zip_source_read(3), + zip_source_tell_write(3) +
+
+

+zip_source_tell() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_tell.man b/core/deps/libzip/man/zip_source_tell.man new file mode 100644 index 000000000..088ec861d --- /dev/null +++ b/core/deps/libzip/man/zip_source_tell.man @@ -0,0 +1,79 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_tell.mdoc -- report current read offset in source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_TELL" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_tell\fR +\- report current read offset in zip source +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int64_t\fR +.br +.PD 0 +.HP 4n +\fBzip_source_tell\fR(\fIzip_source_t\ *source\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_source_tell\fR() +returns the current read offset +for +\fIsource\fR. +The return value can be passed to +zip_source_seek(3) +with +\fIwhence\fR +set to +\fRSEEK_SET\fR +to return to the same location in the source. +.SH "RETURN VALUES" +Upon successful completion the current read offset is returned. +Otherwise, \-1 is returned and the error information in +\fIsource\fR +is set to indicate the error. +.SH "SEE ALSO" +libzip(3), +zip_source(3), +zip_source_read(3), +zip_source_tell_write(3) +.SH "HISTORY" +\fBzip_source_tell\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_tell.mdoc b/core/deps/libzip/man/zip_source_tell.mdoc new file mode 100644 index 000000000..e8249184b --- /dev/null +++ b/core/deps/libzip/man/zip_source_tell.mdoc @@ -0,0 +1,74 @@ +.\" zip_source_tell.mdoc -- report current read offset in source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_TELL 3 +.Os +.Sh NAME +.Nm zip_source_tell +.Nd report current read offset in zip source +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int64_t +.Fn zip_source_tell "zip_source_t *source" +.Sh DESCRIPTION +The function +.Fn zip_source_tell +returns the current read offset +for +.Fa source . +The return value can be passed to +.Xr zip_source_seek 3 +with +.Ar whence +set to +.Dv SEEK_SET +to return to the same location in the source. +.Sh RETURN VALUES +Upon successful completion the current read offset is returned. +Otherwise, \-1 is returned and the error information in +.Ar source +is set to indicate the error. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 , +.Xr zip_source_read 3 , +.Xr zip_source_tell_write 3 +.Sh HISTORY +.Fn zip_source_tell +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_tell_write.html b/core/deps/libzip/man/zip_source_tell_write.html new file mode 100644 index 000000000..3c6f9082b --- /dev/null +++ b/core/deps/libzip/man/zip_source_tell_write.html @@ -0,0 +1,112 @@ + + + + + + + ZIP_SOURCE_TELL_WRITE(3) + + + + + + + + +
ZIP_SOURCE_TELL_WRITE(3)Library Functions ManualZIP_SOURCE_TELL_WRITE(3)
+
+
+

+zip_source_tell_write — +
report current write offset in zip source
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int64_t +
+ zip_source_tell_write(zip_source_t + *source);

+
+
+

+The function zip_source_tell_write() returns the current + write offset for source. The return value can be passed + to + zip_source_seek_write(3) + with whence set to SEEK_SET to + return to the same location in the source. +
+
+

+Upon successful completion the current write offset is returned. Otherwise, -1 + is returned and the error information in source is set + to indicate the error. +
+
+

+libzip(3), + zip_source(3), + zip_source_begin_write(3), + zip_source_commit_write(3), + zip_source_rollback_write(3), + zip_source_tell(3), + zip_source_write(3) +
+
+

+zip_source_tell_write() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_tell_write.man b/core/deps/libzip/man/zip_source_tell_write.man new file mode 100644 index 000000000..4208e5cc5 --- /dev/null +++ b/core/deps/libzip/man/zip_source_tell_write.man @@ -0,0 +1,82 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_tell_write.mdoc -- report current write offset in source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_TELL_WRITE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_tell_write\fR +\- report current write offset in zip source +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int64_t\fR +.br +.PD 0 +.HP 4n +\fBzip_source_tell_write\fR(\fIzip_source_t\ *source\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_source_tell_write\fR() +returns the current write offset +for +\fIsource\fR. +The return value can be passed to +zip_source_seek_write(3) +with +\fIwhence\fR +set to +\fRSEEK_SET\fR +to return to the same location in the source. +.SH "RETURN VALUES" +Upon successful completion the current write offset is returned. +Otherwise, \-1 is returned and the error information in +\fIsource\fR +is set to indicate the error. +.SH "SEE ALSO" +libzip(3), +zip_source(3), +zip_source_begin_write(3), +zip_source_commit_write(3), +zip_source_rollback_write(3), +zip_source_tell(3), +zip_source_write(3) +.SH "HISTORY" +\fBzip_source_tell_write\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_tell_write.mdoc b/core/deps/libzip/man/zip_source_tell_write.mdoc new file mode 100644 index 000000000..00fc3b1c7 --- /dev/null +++ b/core/deps/libzip/man/zip_source_tell_write.mdoc @@ -0,0 +1,77 @@ +.\" zip_source_tell_write.mdoc -- report current write offset in source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_TELL_WRITE 3 +.Os +.Sh NAME +.Nm zip_source_tell_write +.Nd report current write offset in zip source +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int64_t +.Fn zip_source_tell_write "zip_source_t *source" +.Sh DESCRIPTION +The function +.Fn zip_source_tell_write +returns the current write offset +for +.Fa source . +The return value can be passed to +.Xr zip_source_seek_write 3 +with +.Ar whence +set to +.Dv SEEK_SET +to return to the same location in the source. +.Sh RETURN VALUES +Upon successful completion the current write offset is returned. +Otherwise, \-1 is returned and the error information in +.Ar source +is set to indicate the error. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 , +.Xr zip_source_begin_write 3 , +.Xr zip_source_commit_write 3 , +.Xr zip_source_rollback_write 3 , +.Xr zip_source_tell 3 , +.Xr zip_source_write 3 +.Sh HISTORY +.Fn zip_source_tell_write +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_win32a.html b/core/deps/libzip/man/zip_source_win32a.html new file mode 100644 index 000000000..5461b7e42 --- /dev/null +++ b/core/deps/libzip/man/zip_source_win32a.html @@ -0,0 +1,143 @@ + + + + + + + ZIP_SOURCE_WIN32A(3) + + + + + + + + +
ZIP_SOURCE_WIN32A(3)Library Functions ManualZIP_SOURCE_WIN32A(3)
+
+
+

+zip_source_win32a, + zip_source_win32a_create — +
create data source from a Windows ANSI file name
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_source_t * +
+ zip_source_win32a(zip_t + *archive, const char + *fname, zip_uint64_t + start, zip_int64_t + len);

+

zip_source_t * +
+ zip_source_win32a_create(const + char *fname, zip_uint64_t + start, zip_int64_t + len, zip_error_t + *error);

+
+
+

+The functions zip_source_win32a() and + zip_source_win32a_create() create a zip source on + Windows using a Windows ANSI name. They open fname and + read len bytes from offset start + from it. If len is 0 or -1, the whole file (starting + from start) is used. +

If the file supports seek, the source can be used to open a zip + archive from.

+

The file is opened and read when the data from the source is used, + usually by zip_close() or + zip_open_from_source().

+
+
+

+Upon successful completion, the created source is returned. Otherwise, + NULL is returned and the error code in + archive or error is set to + indicate the error. +
+
+

+zip_source_win32a() and + zip_source_win32a_create() fail if: +
+
[]
+
fname, start, or + len are invalid.
+
[]
+
Required memory could not be allocated.
+
[]
+
Opening fname failed.
+
+
+
+

+libzip(3), + zip_file_add(3), + zip_file_replace(3), + zip_source(3), + zip_source_win32handle(3), + zip_source_win32w(3) +
+
+

+zip_source_win32a() and + zip_source_win32a_create() were added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_win32a.man b/core/deps/libzip/man/zip_source_win32a.man new file mode 100644 index 000000000..a6f279c4a --- /dev/null +++ b/core/deps/libzip/man/zip_source_win32a.man @@ -0,0 +1,127 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_win32a.mdoc -- create data source using a win32 ANSI name +.\" Copyright (C) 2015-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_WIN32A" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_win32a\fR, +\fBzip_source_win32a_create\fR +\- create data source from a Windows ANSI file name +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_win32a\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR); +.PD +.PP +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_win32a_create\fR(\fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR); +.PD +.SH "DESCRIPTION" +The functions +\fBzip_source_win32a\fR() +and +\fBzip_source_win32a_create\fR() +create a zip source on Windows using a Windows ANSI name. +They open +\fIfname\fR +and read +\fIlen\fR +bytes from offset +\fIstart\fR +from it. +If +\fIlen\fR +is 0 or \-1, the whole file (starting from +\fIstart\fR) +is used. +.PP +If the file supports seek, the source can be used to open a zip archive from. +.PP +The file is opened and read when the data from the source is used, usually by +\fBzip_close\fR() +or +\fBzip_open_from_source\fR(). +.SH "RETURN VALUES" +Upon successful completion, the created source is returned. +Otherwise, +\fRNULL\fR +is returned and the error code in +\fIarchive\fR +or +\fIerror\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_source_win32a\fR() +and +\fBzip_source_win32a_create\fR() +fail if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIfname\fR, +\fIstart\fR, +or +\fIlen\fR +are invalid. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.TP 19n +[\fRZIP_ER_OPEN\fR] +Opening +\fIfname\fR +failed. +.SH "SEE ALSO" +libzip(3), +zip_file_add(3), +zip_file_replace(3), +zip_source(3), +zip_source_win32handle(3), +zip_source_win32w(3) +.SH "HISTORY" +\fBzip_source_win32a\fR() +and +\fBzip_source_win32a_create\fR() +were added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_win32a.mdoc b/core/deps/libzip/man/zip_source_win32a.mdoc new file mode 100644 index 000000000..6049df419 --- /dev/null +++ b/core/deps/libzip/man/zip_source_win32a.mdoc @@ -0,0 +1,116 @@ +.\" zip_source_win32a.mdoc -- create data source using a win32 ANSI name +.\" Copyright (C) 2015-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_WIN32A 3 +.Os +.Sh NAME +.Nm zip_source_win32a , +.Nm zip_source_win32a_create +.Nd create data source from a Windows ANSI file name +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_source_t * +.Fn zip_source_win32a "zip_t *archive" "const char *fname" "zip_uint64_t start" "zip_int64_t len" +.Ft zip_source_t * +.Fn zip_source_win32a_create "const char *fname" "zip_uint64_t start" "zip_int64_t len" "zip_error_t *error" +.Sh DESCRIPTION +The functions +.Fn zip_source_win32a +and +.Fn zip_source_win32a_create +create a zip source on Windows using a Windows ANSI name. +They open +.Ar fname +and read +.Ar len +bytes from offset +.Ar start +from it. +If +.Ar len +is 0 or \-1, the whole file (starting from +.Ar start ) +is used. +.Pp +If the file supports seek, the source can be used to open a zip archive from. +.Pp +The file is opened and read when the data from the source is used, usually by +.Fn zip_close +or +.Fn zip_open_from_source . +.Sh RETURN VALUES +Upon successful completion, the created source is returned. +Otherwise, +.Dv NULL +is returned and the error code in +.Ar archive +or +.Ar error +is set to indicate the error. +.Sh ERRORS +.Fn zip_source_win32a +and +.Fn zip_source_win32a_create +fail if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +.Ar fname , +.Ar start , +or +.Ar len +are invalid. +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.It Bq Er ZIP_ER_OPEN +Opening +.Ar fname +failed. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_add 3 , +.Xr zip_file_replace 3 , +.Xr zip_source 3 , +.Xr zip_source_win32handle 3 , +.Xr zip_source_win32w 3 +.Sh HISTORY +.Fn zip_source_win32a +and +.Fn zip_source_win32a_create +were added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_win32handle.html b/core/deps/libzip/man/zip_source_win32handle.html new file mode 100644 index 000000000..5eeb48daf --- /dev/null +++ b/core/deps/libzip/man/zip_source_win32handle.html @@ -0,0 +1,143 @@ + + + + + + + ZIP_SOURCE_WIN32HANDLE(3) + + + + + + + + +
ZIP_SOURCE_WIN32HANDLE(3)Library Functions ManualZIP_SOURCE_WIN32HANDLE(3)
+
+
+

+zip_source_win32handle, + zip_source_win32handle_create — +
create data source from a Windows file handle
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_source_t * +
+ zip_source_win32handle(zip_t + *archive, HANDLE h, + zip_uint64_t start, + zip_int64_t len);

+

zip_source_t * +
+ zip_source_win32handle_create(HANDLE + h, zip_uint64_t + start, zip_int64_t + len, zip_error_t + *error);

+
+
+

+The functions zip_source_win32handle() and + zip_source_win32handle_create() create a zip source + from a Windows file handle. They open fname and read + len bytes from offset start from + it. If len is 0 or -1, the whole file (starting from + start) is used. +

If the file supports seek, the source can be used to open a zip + archive from.

+

The file is opened and read when the data from the source is used, + usually by zip_close() or + zip_open_from_source().

+
+
+

+Upon successful completion, the created source is returned. Otherwise, + NULL is returned and the error code in + archive or error is set to + indicate the error. +
+
+

+zip_source_w32handle() and + zip_source_w32handle_create() fail if: +
+
[]
+
fname, start, or + len are invalid.
+
[]
+
Required memory could not be allocated.
+
[]
+
Opening fname failed.
+
+
+
+

+libzip(3), + zip_file_add(3), + zip_file_replace(3), + zip_source(3), + zip_source_win32a(3), + zip_source_win32w(3) +
+
+

+zip_source_win32handle() and + zip_source_win32handle_create() were added in libzip + 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_win32handle.man b/core/deps/libzip/man/zip_source_win32handle.man new file mode 100644 index 000000000..e7462cd2b --- /dev/null +++ b/core/deps/libzip/man/zip_source_win32handle.man @@ -0,0 +1,127 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_handle.mdoc -- create data source from a Windows file handle +.\" Copyright (C) 2015-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_WIN32HANDLE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_win32handle\fR, +\fBzip_source_win32handle_create\fR +\- create data source from a Windows file handle +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_win32handle\fR(\fIzip_t\ *archive\fR, \fIHANDLE\ h\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR); +.PD +.PP +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_win32handle_create\fR(\fIHANDLE\ h\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR); +.PD +.SH "DESCRIPTION" +The functions +\fBzip_source_win32handle\fR() +and +\fBzip_source_win32handle_create\fR() +create a zip source from a Windows file handle. +They open +\fIfname\fR +and read +\fIlen\fR +bytes from offset +\fIstart\fR +from it. +If +\fIlen\fR +is 0 or \-1, the whole file (starting from +\fIstart\fR) +is used. +.PP +If the file supports seek, the source can be used to open a zip archive from. +.PP +The file is opened and read when the data from the source is used, usually by +\fBzip_close\fR() +or +\fBzip_open_from_source\fR(). +.SH "RETURN VALUES" +Upon successful completion, the created source is returned. +Otherwise, +\fRNULL\fR +is returned and the error code in +\fIarchive\fR +or +\fIerror\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_source_w32handle\fR() +and +\fBzip_source_w32handle_create\fR() +fail if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIfname\fR, +\fIstart\fR, +or +\fIlen\fR +are invalid. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.TP 19n +[\fRZIP_ER_OPEN\fR] +Opening +\fIfname\fR +failed. +.SH "SEE ALSO" +libzip(3), +zip_file_add(3), +zip_file_replace(3), +zip_source(3), +zip_source_win32a(3), +zip_source_win32w(3) +.SH "HISTORY" +\fBzip_source_win32handle\fR() +and +\fBzip_source_win32handle_create\fR() +were added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_win32handle.mdoc b/core/deps/libzip/man/zip_source_win32handle.mdoc new file mode 100644 index 000000000..af037cd21 --- /dev/null +++ b/core/deps/libzip/man/zip_source_win32handle.mdoc @@ -0,0 +1,116 @@ +.\" zip_source_handle.mdoc -- create data source from a Windows file handle +.\" Copyright (C) 2015-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_WIN32HANDLE 3 +.Os +.Sh NAME +.Nm zip_source_win32handle , +.Nm zip_source_win32handle_create +.Nd create data source from a Windows file handle +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_source_t * +.Fn zip_source_win32handle "zip_t *archive" "HANDLE h" "zip_uint64_t start" "zip_int64_t len" +.Ft zip_source_t * +.Fn zip_source_win32handle_create "HANDLE h" "zip_uint64_t start" "zip_int64_t len" "zip_error_t *error" +.Sh DESCRIPTION +The functions +.Fn zip_source_win32handle +and +.Fn zip_source_win32handle_create +create a zip source from a Windows file handle. +They open +.Ar fname +and read +.Ar len +bytes from offset +.Ar start +from it. +If +.Ar len +is 0 or \-1, the whole file (starting from +.Ar start ) +is used. +.Pp +If the file supports seek, the source can be used to open a zip archive from. +.Pp +The file is opened and read when the data from the source is used, usually by +.Fn zip_close +or +.Fn zip_open_from_source . +.Sh RETURN VALUES +Upon successful completion, the created source is returned. +Otherwise, +.Dv NULL +is returned and the error code in +.Ar archive +or +.Ar error +is set to indicate the error. +.Sh ERRORS +.Fn zip_source_w32handle +and +.Fn zip_source_w32handle_create +fail if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +.Ar fname , +.Ar start , +or +.Ar len +are invalid. +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.It Bq Er ZIP_ER_OPEN +Opening +.Ar fname +failed. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_add 3 , +.Xr zip_file_replace 3 , +.Xr zip_source 3 , +.Xr zip_source_win32a 3 , +.Xr zip_source_win32w 3 +.Sh HISTORY +.Fn zip_source_win32handle +and +.Fn zip_source_win32handle_create +were added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_win32w.html b/core/deps/libzip/man/zip_source_win32w.html new file mode 100644 index 000000000..4e616f058 --- /dev/null +++ b/core/deps/libzip/man/zip_source_win32w.html @@ -0,0 +1,142 @@ + + + + + + + ZIP_SOURCE_WIN32W(3) + + + + + + + + +
ZIP_SOURCE_WIN32W(3)Library Functions ManualZIP_SOURCE_WIN32W(3)
+
+
+

+zip_source_win32w, + zip_source_win32w_create — +
create data source from a Windows Unicode file name
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_source_t * +
+ zip_source_win32w(zip_t + *archive, const wchar_t + *fname, zip_uint64_t + start, zip_int64_t + len);

+

zip_source_t * +
+ zip_source_win32w_create(const + wchar_t *fname, + zip_uint64_t start, + zip_int64_t len, + zip_error_t *error);

+
+
+

+The functions zip_source_win32w() and + zip_source_win32w_create() create a zip source on + Windows using a Windows Unicode name. They open fname + and read len bytes from offset + start from it. If len is 0 or -1, + the whole file (starting from start) is used. +

If the file supports seek, the source can be used to open a zip + archive from.

+

The file is opened and read when the data from the source is used, + usually by zip_close() or + zip_open_from_source().

+
+
+

+Upon successful completion, the created source is returned. Otherwise, + NULL is returned and the error code in + archive or error is set to + indicate the error. +
+
+

+zip_source_win32w() and + zip_source_win32w_create() fail if: +
+
[]
+
fname, start, or + len are invalid.
+
[]
+
Required memory could not be allocated.
+
[]
+
Opening fname failed.
+
+
+
+

+libzip(3), + zip_file_add(3), + zip_file_replace(3), + zip_source(3), + zip_source_win32a(3), + zip_source_win32handle(3) +
+
+

+zip_source_win32w() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
June 22, 2018NiH
+ + diff --git a/core/deps/libzip/man/zip_source_win32w.man b/core/deps/libzip/man/zip_source_win32w.man new file mode 100644 index 000000000..557a628bf --- /dev/null +++ b/core/deps/libzip/man/zip_source_win32w.man @@ -0,0 +1,125 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_win32w.mdoc -- create data source using a win32 Unicode name +.\" Copyright (C) 2015-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_WIN32W" "3" "June 22, 2018" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_win32w\fR, +\fBzip_source_win32w_create\fR +\- create data source from a Windows Unicode file name +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_win32w\fR(\fIzip_t\ *archive\fR, \fIconst\ wchar_t\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR); +.PD +.PP +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_win32w_create\fR(\fIconst\ wchar_t\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR); +.PD +.SH "DESCRIPTION" +The functions +\fBzip_source_win32w\fR() +and +\fBzip_source_win32w_create\fR() +create a zip source on Windows using a Windows Unicode name. +They open +\fIfname\fR +and read +\fIlen\fR +bytes from offset +\fIstart\fR +from it. +If +\fIlen\fR +is 0 or \-1, the whole file (starting from +\fIstart\fR) +is used. +.PP +If the file supports seek, the source can be used to open a zip archive from. +.PP +The file is opened and read when the data from the source is used, usually by +\fBzip_close\fR() +or +\fBzip_open_from_source\fR(). +.SH "RETURN VALUES" +Upon successful completion, the created source is returned. +Otherwise, +\fRNULL\fR +is returned and the error code in +\fIarchive\fR +or +\fIerror\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_source_win32w\fR() +and +\fBzip_source_win32w_create\fR() +fail if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIfname\fR, +\fIstart\fR, +or +\fIlen\fR +are invalid. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.TP 19n +[\fRZIP_ER_OPEN\fR] +Opening +\fIfname\fR +failed. +.SH "SEE ALSO" +libzip(3), +zip_file_add(3), +zip_file_replace(3), +zip_source(3), +zip_source_win32a(3), +zip_source_win32handle(3) +.SH "HISTORY" +\fBzip_source_win32w\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_win32w.mdoc b/core/deps/libzip/man/zip_source_win32w.mdoc new file mode 100644 index 000000000..3381e41f2 --- /dev/null +++ b/core/deps/libzip/man/zip_source_win32w.mdoc @@ -0,0 +1,114 @@ +.\" zip_source_win32w.mdoc -- create data source using a win32 Unicode name +.\" Copyright (C) 2015-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd June 22, 2018 +.Dt ZIP_SOURCE_WIN32W 3 +.Os +.Sh NAME +.Nm zip_source_win32w , +.Nm zip_source_win32w_create +.Nd create data source from a Windows Unicode file name +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_source_t * +.Fn zip_source_win32w "zip_t *archive" "const wchar_t *fname" "zip_uint64_t start" "zip_int64_t len" +.Ft zip_source_t * +.Fn zip_source_win32w_create "const wchar_t *fname" "zip_uint64_t start" "zip_int64_t len" "zip_error_t *error" +.Sh DESCRIPTION +The functions +.Fn zip_source_win32w +and +.Fn zip_source_win32w_create +create a zip source on Windows using a Windows Unicode name. +They open +.Ar fname +and read +.Ar len +bytes from offset +.Ar start +from it. +If +.Ar len +is 0 or \-1, the whole file (starting from +.Ar start ) +is used. +.Pp +If the file supports seek, the source can be used to open a zip archive from. +.Pp +The file is opened and read when the data from the source is used, usually by +.Fn zip_close +or +.Fn zip_open_from_source . +.Sh RETURN VALUES +Upon successful completion, the created source is returned. +Otherwise, +.Dv NULL +is returned and the error code in +.Ar archive +or +.Ar error +is set to indicate the error. +.Sh ERRORS +.Fn zip_source_win32w +and +.Fn zip_source_win32w_create +fail if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +.Ar fname , +.Ar start , +or +.Ar len +are invalid. +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.It Bq Er ZIP_ER_OPEN +Opening +.Ar fname +failed. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_add 3 , +.Xr zip_file_replace 3 , +.Xr zip_source 3 , +.Xr zip_source_win32a 3 , +.Xr zip_source_win32handle 3 +.Sh HISTORY +.Fn zip_source_win32w +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_write.html b/core/deps/libzip/man/zip_source_write.html new file mode 100644 index 000000000..88749bce8 --- /dev/null +++ b/core/deps/libzip/man/zip_source_write.html @@ -0,0 +1,115 @@ + + + + + + + ZIP_SOURCE_WRITE(3) + + + + + + + + +
ZIP_SOURCE_WRITE(3)Library Functions ManualZIP_SOURCE_WRITE(3)
+
+
+

+zip_source_write — +
write data to zip source
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_int64_t +
+ zip_source_write(zip_source_t + *source, const void + *data, zip_uint64_t + len);

+
+
+

+The function zip_source_write() writes + len bytes from the buffer data to + the zip source source at the current write offset. +

The zip source source has to be prepared for + writing by calling + zip_source_begin_write(3) + first.

+
+
+

+Upon successful completion the number of bytes written is returned. Otherwise, + -1 is returned and the error information in source is + set to indicate the error. +
+
+

+libzip(3), + zip_source(3), + zip_source_begin_write(3), + zip_source_commit_write(3), + zip_source_rollback_write(3), + zip_source_seek_write(3), + zip_source_tell_write(3) +
+
+

+zip_source_write() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_write.man b/core/deps/libzip/man/zip_source_write.man new file mode 100644 index 000000000..58d808ee2 --- /dev/null +++ b/core/deps/libzip/man/zip_source_write.man @@ -0,0 +1,85 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_write.mdoc -- write data to zip source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_WRITE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_write\fR +\- write data to zip source +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_int64_t\fR +.br +.PD 0 +.HP 4n +\fBzip_source_write\fR(\fIzip_source_t\ *source\fR, \fIconst\ void\ *data\fR, \fIzip_uint64_t\ len\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_source_write\fR() +writes +\fIlen\fR +bytes from the buffer +\fIdata\fR +to the zip source +\fIsource\fR +at the current write offset. +.PP +The zip source +\fIsource\fR +has to be prepared for writing by calling +zip_source_begin_write(3) +first. +.SH "RETURN VALUES" +Upon successful completion the number of bytes written is returned. +Otherwise, \-1 is returned and the error information in +\fIsource\fR +is set to indicate the error. +.SH "SEE ALSO" +libzip(3), +zip_source(3), +zip_source_begin_write(3), +zip_source_commit_write(3), +zip_source_rollback_write(3), +zip_source_seek_write(3), +zip_source_tell_write(3) +.SH "HISTORY" +\fBzip_source_write\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_write.mdoc b/core/deps/libzip/man/zip_source_write.mdoc new file mode 100644 index 000000000..00836b034 --- /dev/null +++ b/core/deps/libzip/man/zip_source_write.mdoc @@ -0,0 +1,80 @@ +.\" zip_source_write.mdoc -- write data to zip source +.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_WRITE 3 +.Os +.Sh NAME +.Nm zip_source_write +.Nd write data to zip source +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_int64_t +.Fn zip_source_write "zip_source_t *source" "const void *data" "zip_uint64_t len" +.Sh DESCRIPTION +The function +.Fn zip_source_write +writes +.Ar len +bytes from the buffer +.Ar data +to the zip source +.Ar source +at the current write offset. +.Pp +The zip source +.Ar source +has to be prepared for writing by calling +.Xr zip_source_begin_write 3 +first. +.Sh RETURN VALUES +Upon successful completion the number of bytes written is returned. +Otherwise, \-1 is returned and the error information in +.Ar source +is set to indicate the error. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 , +.Xr zip_source_begin_write 3 , +.Xr zip_source_commit_write 3 , +.Xr zip_source_rollback_write 3 , +.Xr zip_source_seek_write 3 , +.Xr zip_source_tell_write 3 +.Sh HISTORY +.Fn zip_source_write +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_source_zip.html b/core/deps/libzip/man/zip_source_zip.html new file mode 100644 index 000000000..ec8dd752e --- /dev/null +++ b/core/deps/libzip/man/zip_source_zip.html @@ -0,0 +1,143 @@ + + + + + + + ZIP_SOURCE_ZIP(3) + + + + + + + + +
ZIP_SOURCE_ZIP(3)Library Functions ManualZIP_SOURCE_ZIP(3)
+
+
+

+zip_source_zip — +
create data source from zip file
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

zip_source_t * +
+ zip_source_zip(zip_t + *archive, zip_t + *srcarchive, zip_uint64_t + srcidx, zip_flags_t + flags, zip_uint64_t + start, zip_int64_t + len);

+
+
+

+The function zip_source_zip() creates a zip source from + a file in a zip archive. The srcarchive argument is the + (open) zip archive containing the source zip file at index + srcidx. len bytes from offset + start will be used in the zip_source. If + len is 0 or -1, the rest of the file, starting from + start, is used. If start is zero + and len is -1, the whole file will be copied without + decompressing it. +

Supported flags are:

+
+
+
Try to get the original data without any changes that may have been made + to srcarchive after opening it.
+
+
When adding the data from srcarchive, re-compress it + using the current settings instead of copying the compressed data.
+
+
+
+

+Upon successful completion, the created source is returned. Otherwise, + NULL is returned and the error code in + archive is set to indicate the error. +
+
+

+zip_source_zip() fails if: +
+
[]
+
Unchanged data was requested, but it is not available.
+
[]
+
srcarchive, srcidx, + start, or len are + invalid.
+
[]
+
Required memory could not be allocated.
+
+Additionally, it can return all error codes from + zip_stat_index() and + zip_fopen_index(). +
+
+

+libzip(3), + zip_file_add(3), + zip_file_replace(3), + zip_source(3) +
+
+

+zip_source_zip() was added in libzip 1.0. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_source_zip.man b/core/deps/libzip/man/zip_source_zip.man new file mode 100644 index 000000000..971911549 --- /dev/null +++ b/core/deps/libzip/man/zip_source_zip.man @@ -0,0 +1,129 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_zip.mdoc -- create data source from zip file +.\" Copyright (C) 2004-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_SOURCE_ZIP" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_zip\fR +\- create data source from zip file +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_zip\fR(\fIzip_t\ *archive\fR, \fIzip_t\ *srcarchive\fR, \fIzip_uint64_t\ srcidx\fR, \fIzip_flags_t\ flags\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR); +.PD +.SH "DESCRIPTION" +The function +\fBzip_source_zip\fR() +creates a zip source from a file in a zip archive. +The +\fIsrcarchive\fR +argument is the (open) zip archive containing the source zip file +at index +\fIsrcidx\fR. +\fIlen\fR +bytes from offset +\fIstart\fR +will be used in the zip_source. +If +\fIlen\fR +is 0 or \-1, the rest of the file, starting from +\fIstart\fR, +is used. +If +\fIstart\fR +is zero and +\fIlen\fR +is \-1, the whole file will be copied without decompressing it. +.PP +Supported flags are: +.TP 23n +\fRZIP_FL_UNCHANGED\fR +Try to get the original data without any changes that may have been +made to +\fIsrcarchive\fR +after opening it. +.TP 23n +\fRZIP_FL_RECOMPRESS\fR +When adding the data from +\fIsrcarchive\fR, +re-compress it using the current settings instead of copying the +compressed data. +.SH "RETURN VALUES" +Upon successful completion, the created source is returned. +Otherwise, +\fRNULL\fR +is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_source_zip\fR() +fails if: +.TP 19n +[\fRZIP_ER_CHANGED\fR] +Unchanged data was requested, but it is not available. +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIsrcarchive\fR, +\fIsrcidx\fR, +\fIstart\fR, +or +\fIlen\fR +are invalid. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.PD 0 +.PP +Additionally, it can return all error codes from +\fBzip_stat_index\fR() +and +\fBzip_fopen_index\fR(). +.PD +.SH "SEE ALSO" +libzip(3), +zip_file_add(3), +zip_file_replace(3), +zip_source(3) +.SH "HISTORY" +\fBzip_source_zip\fR() +was added in libzip 1.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_source_zip.mdoc b/core/deps/libzip/man/zip_source_zip.mdoc new file mode 100644 index 000000000..974842ec8 --- /dev/null +++ b/core/deps/libzip/man/zip_source_zip.mdoc @@ -0,0 +1,120 @@ +.\" zip_source_zip.mdoc -- create data source from zip file +.\" Copyright (C) 2004-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_SOURCE_ZIP 3 +.Os +.Sh NAME +.Nm zip_source_zip +.Nd create data source from zip file +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_source_t * +.Fn zip_source_zip "zip_t *archive" "zip_t *srcarchive" "zip_uint64_t srcidx" "zip_flags_t flags" "zip_uint64_t start" "zip_int64_t len" +.Sh DESCRIPTION +The function +.Fn zip_source_zip +creates a zip source from a file in a zip archive. +The +.Ar srcarchive +argument is the (open) zip archive containing the source zip file +at index +.Ar srcidx . +.Ar len +bytes from offset +.Ar start +will be used in the zip_source. +If +.Ar len +is 0 or \-1, the rest of the file, starting from +.Ar start , +is used. +If +.Ar start +is zero and +.Ar len +is \-1, the whole file will be copied without decompressing it. +.Pp +Supported flags are: +.Bl -tag -width XZIPXFLXRECOMPRESSXXX +.It Dv ZIP_FL_UNCHANGED +Try to get the original data without any changes that may have been +made to +.Ar srcarchive +after opening it. +.It Dv ZIP_FL_RECOMPRESS +When adding the data from +.Ar srcarchive , +re-compress it using the current settings instead of copying the +compressed data. +.El +.Sh RETURN VALUES +Upon successful completion, the created source is returned. +Otherwise, +.Dv NULL +is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_source_zip +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_CHANGED +Unchanged data was requested, but it is not available. +.It Bq Er ZIP_ER_INVAL +.Ar srcarchive , +.Ar srcidx , +.Ar start , +or +.Ar len +are invalid. +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.El +Additionally, it can return all error codes from +.Fn zip_stat_index +and +.Fn zip_fopen_index . +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_file_add 3 , +.Xr zip_file_replace 3 , +.Xr zip_source 3 +.Sh HISTORY +.Fn zip_source_zip +was added in libzip 1.0. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_stat.html b/core/deps/libzip/man/zip_stat.html new file mode 100644 index 000000000..699c78f64 --- /dev/null +++ b/core/deps/libzip/man/zip_stat.html @@ -0,0 +1,190 @@ + + + + + + + ZIP_STAT(3) + + + + + + + + +
ZIP_STAT(3)Library Functions ManualZIP_STAT(3)
+
+
+

+zip_stat, zip_stat_index + — +
get information about file
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_stat(zip_t + *archive, const char + *fname, zip_flags_t + flags, zip_stat_t + *sb);

+

int +
+ zip_stat_index(zip_t + *archive, zip_uint64_t + index, zip_flags_t + flags, zip_stat_t + *sb);

+
+
+

+The zip_stat() function obtains information about the + file named fname in archive. The + flags argument specifies how the name lookup should be + done. Its values are described in + zip_name_locate(3). Also, + ZIP_FL_UNCHANGED may be + or'ed to it to request information + about the original file in the archive, ignoring any changes made. +

The zip_stat_index() function obtains + information about the file at position index.

+

The sb argument is a pointer to a + struct zip_stat (shown below), into which information + about the file is placed.

+
+
+struct zip_stat {
+    zip_uint64_t valid;                 /* which fields have valid values */
+    const char *name;                   /* name of the file */
+    zip_uint64_t index;                 /* index within archive */
+    zip_uint64_t size;                  /* size of file (uncompressed) */
+    zip_uint64_t comp_size;             /* size of file (compressed) */
+    time_t mtime;                       /* modification time */
+    zip_uint32_t crc;                   /* crc of file data */
+    zip_uint16_t comp_method;           /* compression method used */
+    zip_uint16_t encryption_method;     /* encryption method used */
+    zip_uint32_t flags;                 /* reserved for future use */
+};
+
+
+The structure pointed to by sb must be allocated before + calling zip_stat() or + zip_stat_index(). +

The valid field of the structure specifies + which other fields are valid. Check if the flag defined by the following + defines are in valid before accessing the fields:

+
+
+
+
name
+
+
index
+
+
size
+
+
comp_size
+
+
mtime
+
+
crc
+
+
comp_method
+
+
encryption_method
+
+
flags
+
+
+
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in archive is set to indicate the + error. +
+
+

+The function zip_stat() can fail for any of the errors + specified for the routine + zip_name_locate(3). +

The function zip_stat_index() fails and + sets the error information to ZIP_ER_INVAL if + index is invalid. If + ZIP_FL_UNCHANGED is not set and no information can + be obtained from the source callback, the error information is set to + ZIP_ER_CHANGED.

+
+
+

+libzip(3), + zip_get_num_entries(3), + zip_name_locate(3), + zip_stat_init(3) +
+
+

+zip_stat() was added in libzip 0.6. In libzip 0.11 the + type of flags was changed from int + to zip_flags_t. +

zip_stat_index() was added in libzip 0.6. + In libzip 0.10 the type of index was changed from + int to zip_uint64_t. In libzip + 0.11 the type of flags was changed from + int to zip_flags_t.

+
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_stat.man b/core/deps/libzip/man/zip_stat.man new file mode 100644 index 000000000..93b6fdd5c --- /dev/null +++ b/core/deps/libzip/man/zip_stat.man @@ -0,0 +1,203 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_stat.mdoc -- get information about file +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_STAT" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_stat\fR, +\fBzip_stat_index\fR +\- get information about file +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_stat\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_flags_t\ flags\fR, \fIzip_stat_t\ *sb\fR); +.PD +.PP +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_stat_index\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR, \fIzip_stat_t\ *sb\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_stat\fR() +function obtains information about the file named +\fIfname\fR +in +\fIarchive\fR. +The +\fIflags\fR +argument specifies how the name lookup should be done. +Its values are described in +zip_name_locate(3). +Also, +\fRZIP_FL_UNCHANGED\fR +may be +\fIor\fR'ed +to it to request information about the original file in the archive, +ignoring any changes made. +.PP +The +\fBzip_stat_index\fR() +function obtains information about the file at position +\fIindex\fR. +.PP +The +\fIsb\fR +argument is a pointer to a +\fIstruct zip_stat\fR +(shown below), into which information about the file is placed. +.nf +.sp +.RS 0n +struct zip_stat { + zip_uint64_t valid; /* which fields have valid values */ + const char *name; /* name of the file */ + zip_uint64_t index; /* index within archive */ + zip_uint64_t size; /* size of file (uncompressed) */ + zip_uint64_t comp_size; /* size of file (compressed) */ + time_t mtime; /* modification time */ + zip_uint32_t crc; /* crc of file data */ + zip_uint16_t comp_method; /* compression method used */ + zip_uint16_t encryption_method; /* encryption method used */ + zip_uint32_t flags; /* reserved for future use */ +}; +.RE +.fi +The structure pointed to by +\fIsb\fR +must be allocated before calling +\fBzip_stat\fR() +or +\fBzip_stat_index\fR(). +.PP +The +\fIvalid\fR +field of the structure specifies which other fields are valid. +Check if the flag defined by the following defines are in +\fIvalid\fR +before accessing the fields: +.RS 6n +.PD 0 +.TP 30n +\fRZIP_STAT_NAME\fR +\fIname\fR +.TP 30n +\fRZIP_STAT_INDEX\fR +\fIindex\fR +.TP 30n +\fRZIP_STAT_SIZE\fR +\fIsize\fR +.TP 30n +\fRZIP_STAT_COMP_SIZE\fR +\fIcomp_size\fR +.TP 30n +\fRZIP_STAT_MTIME\fR +\fImtime\fR +.TP 30n +\fRZIP_STAT_CRC\fR +\fIcrc\fR +.TP 30n +\fRZIP_STAT_COMP_METHOD\fR +\fIcomp_method\fR +.TP 30n +\fRZIP_STAT_ENCRYPTION_METHOD\fR +\fIencryption_method\fR +.TP 30n +\fRZIP_STAT_FLAGS\fR +\fIflags\fR +.RE +.PD +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +The function +\fBzip_stat\fR() +can fail for any of the errors specified for the routine +zip_name_locate(3). +.PP +The function +\fBzip_stat_index\fR() +fails and sets the error information to +\fRZIP_ER_INVAL\fR +if +\fIindex\fR +is invalid. +If +\fRZIP_FL_UNCHANGED\fR +is not set and no information can be obtained from the source +callback, the error information is set to +\fRZIP_ER_CHANGED\fR. +.SH "SEE ALSO" +libzip(3), +zip_get_num_entries(3), +zip_name_locate(3), +zip_stat_init(3) +.SH "HISTORY" +\fBzip_stat\fR() +was added in libzip 0.6. +In libzip 0.11 the type of +\fIflags\fR +was changed from +\fIint\fR +to +\fIzip_flags_t\fR. +.PP +\fBzip_stat_index\fR() +was added in libzip 0.6. +In libzip 0.10 the type of +\fIindex\fR +was changed from +\fIint\fR +to +\fIzip_uint64_t\fR. +In libzip 0.11 the type of +\fIflags\fR +was changed from +\fIint\fR +to +\fIzip_flags_t\fR. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_stat.mdoc b/core/deps/libzip/man/zip_stat.mdoc new file mode 100644 index 000000000..4d5661ef4 --- /dev/null +++ b/core/deps/libzip/man/zip_stat.mdoc @@ -0,0 +1,179 @@ +.\" zip_stat.mdoc -- get information about file +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_STAT 3 +.Os +.Sh NAME +.Nm zip_stat , +.Nm zip_stat_index +.Nd get information about file +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_stat "zip_t *archive" "const char *fname" "zip_flags_t flags" "zip_stat_t *sb" +.Ft int +.Fn zip_stat_index "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags" "zip_stat_t *sb" +.Sh DESCRIPTION +The +.Fn zip_stat +function obtains information about the file named +.Ar fname +in +.Ar archive . +The +.Ar flags +argument specifies how the name lookup should be done. +Its values are described in +.Xr zip_name_locate 3 . +Also, +.Dv ZIP_FL_UNCHANGED +may be +.Em or Ns No 'ed +to it to request information about the original file in the archive, +ignoring any changes made. +.Pp +The +.Fn zip_stat_index +function obtains information about the file at position +.Ar index . +.Pp +The +.Ar sb +argument is a pointer to a +.Ft struct zip_stat +(shown below), into which information about the file is placed. +.Bd -literal +struct zip_stat { + zip_uint64_t valid; /* which fields have valid values */ + const char *name; /* name of the file */ + zip_uint64_t index; /* index within archive */ + zip_uint64_t size; /* size of file (uncompressed) */ + zip_uint64_t comp_size; /* size of file (compressed) */ + time_t mtime; /* modification time */ + zip_uint32_t crc; /* crc of file data */ + zip_uint16_t comp_method; /* compression method used */ + zip_uint16_t encryption_method; /* encryption method used */ + zip_uint32_t flags; /* reserved for future use */ +}; +.Ed +The structure pointed to by +.Ar sb +must be allocated before calling +.Fn zip_stat +or +.Fn zip_stat_index . +.Pp +The +.Ar valid +field of the structure specifies which other fields are valid. +Check if the flag defined by the following defines are in +.Ar valid +before accessing the fields: +.Bl -tag -width ZIP_STAT_ENCRYPTION_METHODXX -compact -offset indent +.It Dv ZIP_STAT_NAME +.Ar name +.It Dv ZIP_STAT_INDEX +.Ar index +.It Dv ZIP_STAT_SIZE +.Ar size +.It Dv ZIP_STAT_COMP_SIZE +.Ar comp_size +.It Dv ZIP_STAT_MTIME +.Ar mtime +.It Dv ZIP_STAT_CRC +.Ar crc +.It Dv ZIP_STAT_COMP_METHOD +.Ar comp_method +.It Dv ZIP_STAT_ENCRYPTION_METHOD +.Ar encryption_method +.It Dv ZIP_STAT_FLAGS +.Ar flags +.El +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error information in +.Ar archive +is set to indicate the error. +.Sh ERRORS +The function +.Fn zip_stat +can fail for any of the errors specified for the routine +.Xr zip_name_locate 3 . +.Pp +The function +.Fn zip_stat_index +fails and sets the error information to +.Er ZIP_ER_INVAL +if +.Ar index +is invalid. +If +.Dv ZIP_FL_UNCHANGED +is not set and no information can be obtained from the source +callback, the error information is set to +.Er ZIP_ER_CHANGED . +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_get_num_entries 3 , +.Xr zip_name_locate 3 , +.Xr zip_stat_init 3 +.Sh HISTORY +.Fn zip_stat +was added in libzip 0.6. +In libzip 0.11 the type of +.Ar flags +was changed from +.Vt int +to +.Vt zip_flags_t . +.Pp +.Fn zip_stat_index +was added in libzip 0.6. +In libzip 0.10 the type of +.Ar index +was changed from +.Vt int +to +.Vt zip_uint64_t . +In libzip 0.11 the type of +.Ar flags +was changed from +.Vt int +to +.Vt zip_flags_t . +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_stat_init.html b/core/deps/libzip/man/zip_stat_init.html new file mode 100644 index 000000000..99b36dee2 --- /dev/null +++ b/core/deps/libzip/man/zip_stat_init.html @@ -0,0 +1,109 @@ + + + + + + + ZIP_STAT_INIT(3) + + + + + + + + +
ZIP_STAT_INIT(3)Library Functions ManualZIP_STAT_INIT(3)
+
+
+

+zip_stat_init — +
initialize zip_stat structure
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

void +
+ zip_stat_init(zip_stat_t + *sb);

+
+
+

+The zip_stat_init() function initializes the members of + a struct zip_stat. The current members are described in + zip_stat(3), but this function should + be used to initialize it to make sure none are missed. The structure pointed + to by sb must be allocated before calling + zip_stat_init(). +

This function should be used by functions provided to + zip_source_function(3) + when returning ZIP_SOURCE_STAT information to make + sure all fields are initialized.

+
+
+

+If sb is valid, the function is always successful. +
+
+

+libzip(3), + zip_stat(3) +
+
+

+zip_stat_init() was added in libzip 0.8. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_stat_init.man b/core/deps/libzip/man/zip_stat_init.man new file mode 100644 index 000000000..75f3ea9b4 --- /dev/null +++ b/core/deps/libzip/man/zip_stat_init.man @@ -0,0 +1,81 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_stat_init.mdoc -- init zip_stat structure +.\" Copyright (C) 2006-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_STAT_INIT" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_stat_init\fR +\- initialize zip_stat structure +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_stat_init\fR(\fIzip_stat_t\ *sb\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_stat_init\fR() +function initializes the members of a struct zip_stat. +The current members are described in +zip_stat(3), +but this function should be used to initialize it to +make sure none are missed. +The structure pointed to by +\fIsb\fR +must be allocated before calling +\fBzip_stat_init\fR(). +.PP +This function should be used by functions provided to +zip_source_function(3) +when returning +\fRZIP_SOURCE_STAT\fR +information to make sure all fields are initialized. +.SH "RETURN VALUES" +If +\fIsb\fR +is valid, the function is always successful. +.SH "SEE ALSO" +libzip(3), +zip_stat(3) +.SH "HISTORY" +\fBzip_stat_init\fR() +was added in libzip 0.8. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_stat_init.mdoc b/core/deps/libzip/man/zip_stat_init.mdoc new file mode 100644 index 000000000..0d464a614 --- /dev/null +++ b/core/deps/libzip/man/zip_stat_init.mdoc @@ -0,0 +1,76 @@ +.\" zip_stat_init.mdoc -- init zip_stat structure +.\" Copyright (C) 2006-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_STAT_INIT 3 +.Os +.Sh NAME +.Nm zip_stat_init +.Nd initialize zip_stat structure +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft void +.Fn zip_stat_init "zip_stat_t *sb" +.Sh DESCRIPTION +The +.Fn zip_stat_init +function initializes the members of a struct zip_stat. +The current members are described in +.Xr zip_stat 3 , +but this function should be used to initialize it to +make sure none are missed. +The structure pointed to by +.Ar sb +must be allocated before calling +.Fn zip_stat_init . +.Pp +This function should be used by functions provided to +.Xr zip_source_function 3 +when returning +.Dv ZIP_SOURCE_STAT +information to make sure all fields are initialized. +.Sh RETURN VALUES +If +.Ar sb +is valid, the function is always successful. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_stat 3 +.Sh HISTORY +.Fn zip_stat_init +was added in libzip 0.8. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_unchange.html b/core/deps/libzip/man/zip_unchange.html new file mode 100644 index 000000000..671abede5 --- /dev/null +++ b/core/deps/libzip/man/zip_unchange.html @@ -0,0 +1,116 @@ + + + + + + + ZIP_UNCHANGE(3) + + + + + + + + +
ZIP_UNCHANGE(3)Library Functions ManualZIP_UNCHANGE(3)
+
+
+

+zip_unchange — +
undo changes to file in zip archive
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_unchange(zip_t + *archive, zip_uint64_t + index);

+
+
+

+Changes to the file at position index are reverted. +
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error code in archive is set to indicate the error. +
+
+

+zip_unchange() fails if: +
+
[]
+
Unchanging the name would result in a duplicate name in the archive.
+
[]
+
index is not a valid file index in + zip.
+
+
+
+

+libzip(3), + zip_unchange_all(3), + zip_unchange_archive(3) +
+
+

+zip_unchange() was added in libzip 0.6. In libzip 0.10 + the type of index was changed from + int to zip_uint64_t. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_unchange.man b/core/deps/libzip/man/zip_unchange.man new file mode 100644 index 000000000..c7ec25f55 --- /dev/null +++ b/core/deps/libzip/man/zip_unchange.man @@ -0,0 +1,86 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_unchange.mdoc -- undo changes to file in zip archive +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_UNCHANGE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_unchange\fR +\- undo changes to file in zip archive +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_unchange\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR); +.PD +.SH "DESCRIPTION" +Changes to the file at position +\fIindex\fR +are reverted. +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_unchange\fR() +fails if: +.TP 19n +[\fRZIP_ER_EXISTS\fR] +Unchanging the name would result in a duplicate name in the archive. +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIindex\fR +is not a valid file index in +\fIzip\fR. +.SH "SEE ALSO" +libzip(3), +zip_unchange_all(3), +zip_unchange_archive(3) +.SH "HISTORY" +\fBzip_unchange\fR() +was added in libzip 0.6. +In libzip 0.10 the type of +\fIindex\fR +was changed from +\fIint\fR +to +\fIzip_uint64_t\fR. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_unchange.mdoc b/core/deps/libzip/man/zip_unchange.mdoc new file mode 100644 index 000000000..6bde36bb5 --- /dev/null +++ b/core/deps/libzip/man/zip_unchange.mdoc @@ -0,0 +1,81 @@ +.\" zip_unchange.mdoc -- undo changes to file in zip archive +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_UNCHANGE 3 +.Os +.Sh NAME +.Nm zip_unchange +.Nd undo changes to file in zip archive +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_unchange "zip_t *archive" "zip_uint64_t index" +.Sh DESCRIPTION +Changes to the file at position +.Ar index +are reverted. +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh ERRORS +.Fn zip_unchange +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_EXISTS +Unchanging the name would result in a duplicate name in the archive. +.It Bq Er ZIP_ER_INVAL +.Ar index +is not a valid file index in +.Ar zip . +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_unchange_all 3 , +.Xr zip_unchange_archive 3 +.Sh HISTORY +.Fn zip_unchange +was added in libzip 0.6. +In libzip 0.10 the type of +.Ar index +was changed from +.Vt int +to +.Vt zip_uint64_t . +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_unchange_all.html b/core/deps/libzip/man/zip_unchange_all.html new file mode 100644 index 000000000..ab94a0038 --- /dev/null +++ b/core/deps/libzip/man/zip_unchange_all.html @@ -0,0 +1,103 @@ + + + + + + + ZIP_UNCHANGE_ALL(3) + + + + + + + + +
ZIP_UNCHANGE_ALL(3)Library Functions ManualZIP_UNCHANGE_ALL(3)
+
+
+

+zip_unchange_all — +
undo all changes in a zip archive
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_unchange_all(zip_t + *archive);

+
+
+

+All changes to files and global information in archive are + reverted. +
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error code in archive is set to indicate the error. +
+
+

+libzip(3), + zip_unchange(3), + zip_unchange_archive(3) +
+
+

+zip_unchange_all() was added in libzip 0.6. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_unchange_all.man b/core/deps/libzip/man/zip_unchange_all.man new file mode 100644 index 000000000..4fcbee320 --- /dev/null +++ b/core/deps/libzip/man/zip_unchange_all.man @@ -0,0 +1,69 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_unchange_all.mdoc -- undo changes to all files in zip archive +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_UNCHANGE_ALL" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_unchange_all\fR +\- undo all changes in a zip archive +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_unchange_all\fR(\fIzip_t\ *archive\fR); +.PD +.SH "DESCRIPTION" +All changes to files and global information in +\fIarchive\fR +are reverted. +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "SEE ALSO" +libzip(3), +zip_unchange(3), +zip_unchange_archive(3) +.SH "HISTORY" +\fBzip_unchange_all\fR() +was added in libzip 0.6. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_unchange_all.mdoc b/core/deps/libzip/man/zip_unchange_all.mdoc new file mode 100644 index 000000000..b676eb557 --- /dev/null +++ b/core/deps/libzip/man/zip_unchange_all.mdoc @@ -0,0 +1,64 @@ +.\" zip_unchange_all.mdoc -- undo changes to all files in zip archive +.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_UNCHANGE_ALL 3 +.Os +.Sh NAME +.Nm zip_unchange_all +.Nd undo all changes in a zip archive +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_unchange_all "zip_t *archive" +.Sh DESCRIPTION +All changes to files and global information in +.Ar archive +are reverted. +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_unchange 3 , +.Xr zip_unchange_archive 3 +.Sh HISTORY +.Fn zip_unchange_all +was added in libzip 0.6. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zip_unchange_archive.html b/core/deps/libzip/man/zip_unchange_archive.html new file mode 100644 index 000000000..f40ea4edc --- /dev/null +++ b/core/deps/libzip/man/zip_unchange_archive.html @@ -0,0 +1,103 @@ + + + + + + + ZIP_UNCHANGE_ARCHIVE(3) + + + + + + + + +
ZIP_UNCHANGE_ARCHIVE(3)Library Functions ManualZIP_UNCHANGE_ARCHIVE(3)
+
+
+

+zip_unchange_archive — +
undo global changes to zip archive
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

int +
+ zip_unchange_archive(zip_t + *archive);

+
+
+

+Revert all global changes to the archive archive. This + reverts changes to the archive comment and global flags. +
+
+

+Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error code in archive is set to indicate the error. +
+
+

+libzip(3), + zip_unchange(3), + zip_unchange_all(3) +
+
+

+zip_unchange_archive() was added in libzip 0.7. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zip_unchange_archive.man b/core/deps/libzip/man/zip_unchange_archive.man new file mode 100644 index 000000000..430eafc00 --- /dev/null +++ b/core/deps/libzip/man/zip_unchange_archive.man @@ -0,0 +1,69 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_unchange_archive.mdoc -- undo changes to all files in zip archive +.\" Copyright (C) 2006-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_UNCHANGE_ARCHIVE" "3" "December 18, 2017" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_unchange_archive\fR +\- undo global changes to zip archive +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIint\fR +.br +.PD 0 +.HP 4n +\fBzip_unchange_archive\fR(\fIzip_t\ *archive\fR); +.PD +.SH "DESCRIPTION" +Revert all global changes to the archive +\fIarchive\fR. +This reverts changes to the archive comment and global flags. +.SH "RETURN VALUES" +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error code in +\fIarchive\fR +is set to indicate the error. +.SH "SEE ALSO" +libzip(3), +zip_unchange(3), +zip_unchange_all(3) +.SH "HISTORY" +\fBzip_unchange_archive\fR() +was added in libzip 0.7. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zip_unchange_archive.mdoc b/core/deps/libzip/man/zip_unchange_archive.mdoc new file mode 100644 index 000000000..b3b3d3f1a --- /dev/null +++ b/core/deps/libzip/man/zip_unchange_archive.mdoc @@ -0,0 +1,64 @@ +.\" zip_unchange_archive.mdoc -- undo changes to all files in zip archive +.\" Copyright (C) 2006-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIP_UNCHANGE_ARCHIVE 3 +.Os +.Sh NAME +.Nm zip_unchange_archive +.Nd undo global changes to zip archive +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft int +.Fn zip_unchange_archive "zip_t *archive" +.Sh DESCRIPTION +Revert all global changes to the archive +.Ar archive . +This reverts changes to the archive comment and global flags. +.Sh RETURN VALUES +Upon successful completion 0 is returned. +Otherwise, \-1 is returned and the error code in +.Ar archive +is set to indicate the error. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_unchange 3 , +.Xr zip_unchange_all 3 +.Sh HISTORY +.Fn zip_unchange_archive +was added in libzip 0.7. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zipcmp.html b/core/deps/libzip/man/zipcmp.html new file mode 100644 index 000000000..ddb397e3d --- /dev/null +++ b/core/deps/libzip/man/zipcmp.html @@ -0,0 +1,122 @@ + + + + + + + ZIPCMP(1) + + + + + + + + +
ZIPCMP(1)General Commands ManualZIPCMP(1)
+
+
+

+zipcmp — +
compare contents of zip archives
+
+
+

+ + + + + +
zipcmp[-hipqtVv] archive1 + archive2
+
+
+

+zipcmp compares the zip archives or directories + archive1 and archive2 and checks + if they contain the same files, comparing their names, uncompressed sizes, and + CRCs. File order and compressed size differences are ignored. +

Supported options:

+
+
+
Display a short help message and exit.
+
+
Compare names ignoring case distinctions.
+
+
Enable paranoid checks. Compares extra fields and other meta data. + (Automatically disabled if one of the archives is a directory.)
+
+
Quiet mode. Compare -v.
+
+
Test zip files by comparing the contents to their checksums.
+
+
Display version information and exit.
+
+
Verbose mode. Print details about differences to stdout. (This is the + default.)
+
+
+
+

+zipcmp exits 0 if the two archives contain the same + files, 1 if they differ, and >1 if an error occurred. +
+
+

+zipmerge(1), + ziptool(1), + libzip(3) +
+
+

+zipcmp was added in libzip 0.6. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zipcmp.man b/core/deps/libzip/man/zipcmp.man new file mode 100644 index 000000000..fe84821c6 --- /dev/null +++ b/core/deps/libzip/man/zipcmp.man @@ -0,0 +1,96 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zipcmp.mdoc -- compare zip archives +.\" Copyright (C) 2003-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIPCMP" "1" "December 18, 2017" "NiH" "General Commands Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzipcmp\fR +\- compare contents of zip archives +.SH "SYNOPSIS" +.HP 7n +\fBzipcmp\fR +[\fB\-hipqtVv\fR] +\fIarchive1\ archive2\fR +.SH "DESCRIPTION" +\fBzipcmp\fR +compares the zip archives or directories +\fIarchive1\fR +and +\fIarchive2\fR +and checks if they contain the same files, comparing their names, +uncompressed sizes, and CRCs. +File order and compressed size differences are ignored. +.PP +Supported options: +.TP 5n +\fB\-h\fR +Display a short help message and exit. +.TP 5n +\fB\-i\fR +Compare names ignoring case distinctions. +.TP 5n +\fB\-p\fR +Enable paranoid checks. +Compares extra fields and other meta data. +(Automatically disabled if one of the archives is a directory.) +.TP 5n +\fB\-q\fR +Quiet mode. +Compare +\fB\-v\fR. +.TP 5n +\fB\-t\fR +Test zip files by comparing the contents to their checksums. +.TP 5n +\fB\-V\fR +Display version information and exit. +.TP 5n +\fB\-v\fR +Verbose mode. +Print details about differences to stdout. +(This is the default.) +.SH "EXIT STATUS" +\fBzipcmp\fR +exits 0 if the two archives contain the same files, 1 if they differ, +and >1 if an error occurred. +.SH "SEE ALSO" +zipmerge(1), +ziptool(1), +libzip(3) +.SH "HISTORY" +\fBzipcmp\fR +was added in libzip 0.6. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zipcmp.mdoc b/core/deps/libzip/man/zipcmp.mdoc new file mode 100644 index 000000000..84866ded7 --- /dev/null +++ b/core/deps/libzip/man/zipcmp.mdoc @@ -0,0 +1,90 @@ +.\" zipcmp.mdoc -- compare zip archives +.\" Copyright (C) 2003-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIPCMP 1 +.Os +.Sh NAME +.Nm zipcmp +.Nd compare contents of zip archives +.Sh SYNOPSIS +.Nm +.Op Fl hipqtVv +.Ar archive1 archive2 +.Sh DESCRIPTION +.Nm +compares the zip archives or directories +.Ar archive1 +and +.Ar archive2 +and checks if they contain the same files, comparing their names, +uncompressed sizes, and CRCs. +File order and compressed size differences are ignored. +.Pp +Supported options: +.Bl -tag -width MMM +.It Fl h +Display a short help message and exit. +.It Fl i +Compare names ignoring case distinctions. +.It Fl p +Enable paranoid checks. +Compares extra fields and other meta data. +(Automatically disabled if one of the archives is a directory.) +.It Fl q +Quiet mode. +Compare +.Fl v . +.It Fl t +Test zip files by comparing the contents to their checksums. +.It Fl V +Display version information and exit. +.It Fl v +Verbose mode. +Print details about differences to stdout. +(This is the default.) +.El +.Sh EXIT STATUS +.Nm +exits 0 if the two archives contain the same files, 1 if they differ, +and >1 if an error occurred. +.Sh SEE ALSO +.Xr zipmerge 1 , +.Xr ziptool 1 , +.Xr libzip 3 +.Sh HISTORY +.Nm +was added in libzip 0.6. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/zipmerge.html b/core/deps/libzip/man/zipmerge.html new file mode 100644 index 000000000..e81d8c3dc --- /dev/null +++ b/core/deps/libzip/man/zipmerge.html @@ -0,0 +1,125 @@ + + + + + + + ZIPMERGE(1) + + + + + + + + +
ZIPMERGE(1)General Commands ManualZIPMERGE(1)
+
+
+

+zipmerge — +
merge zip archives
+
+
+

+ + + + + +
zipmerge[-DhIiSsV] target-zip + source-zip [source-zip + ...]
+
+
+

+zipmerge merges the source zip archives + source-zip into the target zip archive + target-zip. By default, files in the source zip archives + overwrite existing files of the same name in the target zip archive. +

Supported options:

+
+
+
Ignore directory components in file name comparisons. This option is slow + for archives with many files.
+
+
Display a short help message and exit.
+
+
Ignore case in file name comparisons This option is slow for archives with + many files.
+
+
Ask before overwriting files. See also -s.
+
+
Do not overwrite files that have the same size and CRC32 in both the + source and target archives.
+
+
When -i is given, do not before overwriting files + that have the same size and CRC32.
+
+
Display version information and exit.
+
+
+
+

+zipmerge exits 0 on success and >1 if an error + occurred. +
+
+

+zipcmp(1), + ziptool(1), + libzip(3) +
+
+

+zipmerge was added in libzip 0.6. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/zipmerge.man b/core/deps/libzip/man/zipmerge.man new file mode 100644 index 000000000..088b346af --- /dev/null +++ b/core/deps/libzip/man/zipmerge.man @@ -0,0 +1,97 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zipmerge.mdoc -- merge zip archives +.\" Copyright (C) 2004-2019 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIPMERGE" "1" "December 18, 2017" "NiH" "General Commands Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzipmerge\fR +\- merge zip archives +.SH "SYNOPSIS" +.HP 9n +\fBzipmerge\fR +[\fB\-DhIiSsV\fR] +\fItarget-zip\fR +\fIsource-zip\fR\ [\fIsource-zip\ ...\fR] +.SH "DESCRIPTION" +\fBzipmerge\fR +merges the source zip archives +\fIsource-zip\fR +into the target zip archive +\fItarget-zip\fR. +By default, files in the source zip archives overwrite +existing files of the same name in the target zip archive. +.PP +Supported options: +.TP 5n +\fB\-D\fR +Ignore directory components in file name comparisons. +This option is slow for archives with many files. +.TP 5n +\fB\-h\fR +Display a short help message and exit. +.TP 5n +\fB\-I\fR +Ignore case in file name comparisons +This option is slow for archives with many files. +.TP 5n +\fB\-i\fR +Ask before overwriting files. +See also +\fB\-s\fR. +.TP 5n +\fB\-S\fR +Do not overwrite files that have the same size and +CRC32 in both the source and target archives. +.TP 5n +\fB\-s\fR +When +\fB\-i\fR +is given, do not before overwriting files that have the same size +and CRC32. +.TP 5n +\fB\-V\fR +Display version information and exit. +.SH "EXIT STATUS" +\fBzipmerge\fR +exits 0 on success and >1 if an error occurred. +.SH "SEE ALSO" +zipcmp(1), +ziptool(1), +libzip(3) +.SH "HISTORY" +\fBzipmerge\fR +was added in libzip 0.6. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/zipmerge.mdoc b/core/deps/libzip/man/zipmerge.mdoc new file mode 100644 index 000000000..3ead20b4d --- /dev/null +++ b/core/deps/libzip/man/zipmerge.mdoc @@ -0,0 +1,91 @@ +.\" zipmerge.mdoc -- merge zip archives +.\" Copyright (C) 2004-2020 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIPMERGE 1 +.Os +.Sh NAME +.Nm zipmerge +.Nd merge zip archives +.Sh SYNOPSIS +.Nm +.Op Fl DhIiSsV +.Ar target-zip +.Ar source-zip Op Ar source-zip ... +.Sh DESCRIPTION +.Nm +merges the source zip archives +.Ar source-zip +into the target zip archive +.Ar target-zip . +By default, files in the source zip archives overwrite +existing files of the same name in the target zip archive. +.Pp +Supported options: +.Bl -tag -width MMM +.It Fl D +Ignore directory components in file name comparisons. +This option is slow for archives with many files. +.It Fl h +Display a short help message and exit. +.It Fl I +Ignore case in file name comparisons +This option is slow for archives with many files. +.It Fl i +Ask before overwriting files. +See also +.Fl s . +.It Fl S +Do not overwrite files that have the same size and +CRC32 in both the source and target archives. +.It Fl s +When +.Fl i +is given, do not before overwriting files that have the same size +and CRC32. +.It Fl V +Display version information and exit. +.El +.Sh EXIT STATUS +.Nm +exits 0 on success and >1 if an error occurred. +.Sh SEE ALSO +.Xr zipcmp 1 , +.Xr ziptool 1 , +.Xr libzip 3 +.Sh HISTORY +.Nm +was added in libzip 0.6. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/man/ziptool.html b/core/deps/libzip/man/ziptool.html new file mode 100644 index 000000000..b5fd2b12e --- /dev/null +++ b/core/deps/libzip/man/ziptool.html @@ -0,0 +1,315 @@ + + + + + + + ZIPTOOL(1) + + + + + + + + +
ZIPTOOL(1)General Commands ManualZIPTOOL(1)
+
+
+

+ziptool — +
modify zip archives
+
+
+

+ + + + + +
ziptool[-ceghnrst] [-l + length] [-o + offset] zip-archive + command [command-args ...] + [command [command-args ...] + ...]
+
+
+

+ziptool modifies the zip archive + zip-archive according to the + commands given. +

Supported options:

+
+
+
Check zip archive consistency when opening it.
+
+
Error if archive already exists (only useful with + -n).
+
+
Guess file name encoding (for stat command).
+
+
Display help.
+
+ length
+
Only read length bytes of archive. See also + -o.
+
+
Create archive if it doesn't exist. See also + -e.
+
+ offset
+
Start reading input archive from offset. See also + -l.
+
+
Print raw file name encoding without translation (for + stat command).
+
+
Follow file name convention strictly (for stat + command).
+
+
Disregard current file contents, if any. Note: use this + with care, it deletes all existing file contents when you modify the + archive.
+
+
+

+For all commands below, the index is zero-based. In other words, the first entry + in the zip archive has index 0. +

Supported commands and arguments are:

+
+
+ name content
+
Add file called name using the string + content from the command line as data.
+
+ name
+
Add directory name.
+
+ name file_to_add offset len
+
Add file name to archive, using + len bytes from the file + file_to_add as input data, starting at + offset.
+
+ name archivename index offset len
+
Add file called name to archive using data from + another zip archive archivename using the entry with + index index and reading len + bytes from offset.
+
+ index
+
Output file contents for entry index to stdout.
+
+ index flags
+
Print the number of extra fields for archive entry + index using flags.
+
+ index extra_id flags
+
Print number of extra fields of type extra_id for + archive entry index using + flags.
+
+ index
+
Remove entry at index from zip archive.
+
+ index extra_idx flags
+
Remove extra field number extra_idx from archive + entry index using flags.
+
+ index extra_id extra_index flags
+
Remove extra field number extra_index of type + extra_id from archive entry + index using flags.
+
+
Print archive comment.
+
+ index extra_index flags
+
Print extra field extra_index for archive entry + index using flags.
+
+ index extra_id extra_index flags
+
Print extra field extra_index of type + extra_id for archive entry + index using flags.
+
+ index
+
Get file comment for archive entry index.
+
+ flags
+
Print number of entries in archive using flags.
+
+ name flags
+
Find entry in archive with the filename name using + flags and print its index.
+
+ index name
+
Rename archive entry index to + name.
+
+ index data
+
Replace file contents for archive entry index with + the string data.
+
+ comment
+
Set archive comment to comment.
+
+ index extra_id extra_index flags value
+
Set extra field number extra_index of type + extra_id for archive entry + index using flags to + value.
+
+ index comment
+
Set file comment for archive entry index to string + comment.
+
+ index method compression_flags
+
Set file compression method for archive entry index + to method using + compression_flags. Note: + Currently, compression_flags are ignored.
+
+ index method password
+
Set file encryption method for archive entry index + to method with password + password.
+
+ index timestamp
+
Set file modification time for archive entry index + to UNIX mtime timestamp.
+
+ timestamp
+
Set file modification time for all archive entries to UNIX mtime + timestamp.
+
+ password
+
Set default password for encryption/decryption to + password.
+
+ index
+
Print information about archive entry index.
+
+
+
+

+Some commands take flag arguments. Supported flags are: + +
+
+

+Some commands take compression method arguments. Supported methods are: + +
+
+

+Some commands take encryption method arguments. Supported methods are: + +
+
+
+

+The ziptool utility exits 0 on success, + and >0 if an error occurs. +
+
+

+Add a file called teststring.txt to the zip archive + testbuffer.zip with data “This is a + test.\n” where “\n” is replaced with a newline character: +
+
+ziptool testbuffer.zip add teststring.txt \"This is a test.\n\"
+
+
+

Delete the first file from the zip archive + testfile.zip:

+
+
+ziptool testfile.zip delete 0
+
+
+
+
+

+zipcmp(1), + zipmerge(1), + libzip(3) +
+
+

+ziptool was added in libzip 1.1. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <tk@giga.or.at> +
+
+ + + + + +
December 18, 2017NiH
+ + diff --git a/core/deps/libzip/man/ziptool.man b/core/deps/libzip/man/ziptool.man new file mode 100644 index 000000000..da9829aa7 --- /dev/null +++ b/core/deps/libzip/man/ziptool.man @@ -0,0 +1,389 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" ziptool.mdoc -- modify zip archives in multiple ways +.\" Copyright (C) 2016-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIPTOOL" "1" "December 18, 2017" "NiH" "General Commands Manual" +.nh +.if n .ad l +.SH "NAME" +\fBziptool\fR +\- modify zip archives +.SH "SYNOPSIS" +.HP 8n +\fBziptool\fR +[\fB\-ceghnrst\fR] +[\fB\-l\fR\ \fIlength\fR] +[\fB\-o\fR\ \fIoffset\fR] +\fIzip-archive\fR +\fBcommand\fR\ [\fIcommand-args\ ...\fR] +[\fBcommand\fR\ [\fIcommand-args\ ...\fR]\ ...] +.SH "DESCRIPTION" +\fBziptool\fR +modifies the zip archive +\fIzip-archive\fR +according to the +\fIcommands\fR +given. +.PP +Supported options: +.TP 13n +\fB\-c\fR +Check zip archive consistency when opening it. +.TP 13n +\fB\-e\fR +Error if archive already exists (only useful with +\fB\-n\fR). +.TP 13n +\fB\-g\fR +Guess file name encoding (for +\fBstat\fR +command). +.TP 13n +\fB\-h\fR +Display help. +.TP 13n +\fB\-l\fR \fIlength\fR +Only read +\fIlength\fR +bytes of archive. +See also +\fB\-o\fR. +.TP 13n +\fB\-n\fR +Create archive if it doesn't exist. +See also +\fB\-e\fR. +.TP 13n +\fB\-o\fR \fIoffset\fR +Start reading input archive from +\fIoffset\fR. +See also +\fB\-l\fR. +.TP 13n +\fB\-r\fR +Print raw file name encoding without translation (for +\fBstat\fR +command). +.TP 13n +\fB\-s\fR +Follow file name convention strictly (for +\fBstat\fR +command). +.TP 13n +\fB\-t\fR +Disregard current file contents, if any. +\fINote\fR: +use this with care, it deletes all existing file contents when +you modify the archive. +.SS "Commands" +For all commands below, the index is zero-based. +In other words, the first entry in the zip archive has index 0. +.PP +Supported commands and arguments are: +.TP 12n +\fBadd\fR \fIname content\fR +Add file called +\fIname\fR +using the string +\fIcontent\fR +from the command line as data. +.TP 12n +\fBadd_dir\fR \fIname\fR +Add directory +\fIname\fR. +.TP 12n +\fBadd_file\fR \fIname file_to_add offset len\fR +Add file +\fIname\fR +to archive, using +\fIlen\fR +bytes from the file +\fIfile_to_add\fR +as input data, starting at +\fIoffset\fR. +.TP 12n +\fBadd_from_zip\fR \fIname archivename index offset len\fR +Add file called +\fIname\fR +to archive using data from another zip archive +\fIarchivename\fR +using the entry with index +\fIindex\fR +and reading +\fIlen\fR +bytes from +\fIoffset\fR. +.TP 12n +\fBcat\fR \fIindex\fR +Output file contents for entry +\fIindex\fR +to stdout. +.TP 12n +\fBcount_extra\fR \fIindex flags\fR +Print the number of extra fields for archive entry +\fIindex\fR +using +\fIflags\fR. +.TP 12n +\fBcount_extra_by_id\fR \fIindex extra_id flags\fR +Print number of extra fields of type +\fIextra_id\fR +for archive entry +\fIindex\fR +using +\fIflags\fR. +.TP 12n +\fBdelete\fR \fIindex\fR +Remove entry at +\fIindex\fR +from zip archive. +.TP 12n +\fBdelete_extra\fR \fIindex extra_idx flags\fR +Remove extra field number +\fIextra_idx\fR +from archive entry +\fIindex\fR +using +\fIflags\fR. +.TP 12n +\fBdelete_extra_by_id\fR \fIindex extra_id extra_index flags\fR +Remove extra field number +\fIextra_index\fR +of type +\fIextra_id\fR +from archive entry +\fIindex\fR +using +\fIflags\fR. +.TP 12n +\fBget_archive_comment\fR +Print archive comment. +.TP 12n +\fBget_extra\fR \fIindex extra_index flags\fR +Print extra field +\fIextra_index\fR +for archive entry +\fIindex\fR +using +\fIflags\fR. +.TP 12n +\fBget_extra_by_id\fR \fIindex extra_id extra_index flags\fR +Print extra field +\fIextra_index\fR +of type +\fIextra_id\fR +for archive entry +\fIindex\fR +using +\fIflags\fR. +.TP 12n +\fBget_file_comment\fR \fIindex\fR +Get file comment for archive entry +\fIindex\fR. +.TP 12n +\fBget_num_entries\fR \fIflags\fR +Print number of entries in archive using +\fIflags\fR. +.TP 12n +\fBname_locate\fR \fIname flags\fR +Find entry in archive with the filename +\fIname\fR +using +\fIflags\fR +and print its index. +.TP 12n +\fBrename\fR \fIindex name\fR +Rename archive entry +\fIindex\fR +to +\fIname\fR. +.TP 12n +\fBreplace_file_contents\fR \fIindex data\fR +Replace file contents for archive entry +\fIindex\fR +with the string +\fIdata\fR. +.TP 12n +\fBset_archive_comment\fR \fIcomment\fR +Set archive comment to +\fIcomment\fR. +.TP 12n +\fBset_extra\fR \fIindex extra_id extra_index flags value\fR +Set extra field number +\fIextra_index\fR +of type +\fIextra_id\fR +for archive entry +\fIindex\fR +using +\fIflags\fR +to +\fIvalue\fR. +.TP 12n +\fBset_file_comment\fR \fIindex comment\fR +Set file comment for archive entry +\fIindex\fR +to string +\fIcomment\fR. +.TP 12n +\fBset_file_compression\fR \fIindex method compression_flags\fR +Set file compression method for archive entry +\fIindex\fR +to +\fImethod\fR +using +\fIcompression_flags\fR. +\fINote\fR: +Currently, +\fIcompression_flags\fR +are ignored. +.TP 12n +\fBset_file_encryption\fR \fIindex method password\fR +Set file encryption method for archive entry +\fIindex\fR +to +\fImethod\fR +with password +\fIpassword\fR. +.TP 12n +\fBset_file_mtime\fR \fIindex timestamp\fR +Set file modification time for archive entry +\fIindex\fR +to UNIX mtime +\fItimestamp\fR. +.TP 12n +\fBset_file_mtime_all\fR \fItimestamp\fR +Set file modification time for all archive entries to UNIX mtime +\fItimestamp\fR. +.TP 12n +\fBset_password\fR \fIpassword\fR +Set default password for encryption/decryption to +\fIpassword\fR. +.TP 12n +\fBstat\fR \fIindex\fR +Print information about archive entry +\fIindex\fR. +.SS "Flags" +Some commands take flag arguments. +Supported flags are: +.RS 6n +.PD 0 +.TP 5n +\fIC\fR +\fRZIP_FL_NOCASE\fR +.TP 5n +\fIc\fR +\fRZIP_FL_CENTRAL\fR +.TP 5n +\fId\fR +\fRZIP_FL_NODIR\fR +.TP 5n +\fIl\fR +\fRZIP_FL_LOCAL\fR +.TP 5n +\fIu\fR +\fRZIP_FL_UNCHANGED\fR +.RE +.PD +.SS "Compression Methods" +Some commands take compression method arguments. +Supported methods are: +.RS 6n +.PD 0 +.TP 4n +\fB\(bu\fR +\fRdefault\fR +.TP 4n +\fB\(bu\fR +\fRdeflate\fR +.TP 4n +\fB\(bu\fR +\fRstore\fR +.RE +.PD +.SS "Encryption Methods" +Some commands take encryption method arguments. +Supported methods are: +.RS 6n +.PD 0 +.TP 4n +\fB\(bu\fR +\fRnone\fR +.TP 4n +\fB\(bu\fR +\fRAES-128\fR +.TP 4n +\fB\(bu\fR +\fRAES-192\fR +.TP 4n +\fB\(bu\fR +\fRAES-256\fR +.RE +.PD +.SH "EXIT STATUS" +.br +The \fBziptool\fR utility exits\~0 on success, and\~>0 if an error occurs. +.SH "EXAMPLES" +Add a file called +\fIteststring.txt\fR +to the zip archive +\fItestbuffer.zip\fR +with data +\(lqThis is a test.\en\(rq +where +\(lq\en\(rq +is replaced with a newline character: +.nf +.sp +.RS 6n +ziptool testbuffer.zip add teststring.txt \\"This is a test.\en\\" +.RE +.fi +.PP +Delete the first file from the zip archive +\fItestfile.zip\fR: +.nf +.sp +.RS 6n +ziptool testfile.zip delete 0 +.RE +.fi +.SH "SEE ALSO" +zipcmp(1), +zipmerge(1), +libzip(3) +.SH "HISTORY" +\fBziptool\fR +was added in libzip 1.1. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/core/deps/libzip/man/ziptool.mdoc b/core/deps/libzip/man/ziptool.mdoc new file mode 100644 index 000000000..751eeb0c4 --- /dev/null +++ b/core/deps/libzip/man/ziptool.mdoc @@ -0,0 +1,330 @@ +.\" ziptool.mdoc -- modify zip archives in multiple ways +.\" Copyright (C) 2016-2017 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd December 18, 2017 +.Dt ZIPTOOL 1 +.Os +.Sh NAME +.Nm ziptool +.Nd modify zip archives +.Sh SYNOPSIS +.Nm +.Op Fl ceghnrst +.Op Fl l Ar length +.Op Fl o Ar offset +.Ar zip-archive +.Cm command Op Ar command-args ... +.Op Cm command Oo Ar command-args ... Oc ... +.Sh DESCRIPTION +.Nm +modifies the zip archive +.Ar zip-archive +according to the +.Ar commands +given. +.Pp +Supported options: +.Bl -tag -width MoMoffsetMM +.It Fl c +Check zip archive consistency when opening it. +.It Fl e +Error if archive already exists (only useful with +.Fl n ) . +.It Fl g +Guess file name encoding (for +.Cm stat +command). +.It Fl h +Display help. +.It Fl l Ar length +Only read +.Ar length +bytes of archive. +See also +.Fl o . +.It Fl n +Create archive if it doesn't exist. +See also +.Fl e . +.It Fl o Ar offset +Start reading input archive from +.Ar offset . +See also +.Fl l . +.It Fl r +Print raw file name encoding without translation (for +.Cm stat +command). +.It Fl s +Follow file name convention strictly (for +.Cm stat +command). +.It Fl t +Disregard current file contents, if any. +.Em Note : +use this with care, it deletes all existing file contents when +you modify the archive. +.El +.Ss Commands +For all commands below, the index is zero-based. +In other words, the first entry in the zip archive has index 0. +.Pp +Supported commands and arguments are: +.Bl -tag -width 10n +.It Cm add Ar name content +Add file called +.Ar name +using the string +.Ar content +from the command line as data. +.It Cm add_dir Ar name +Add directory +.Ar name . +.It Cm add_file Ar name file_to_add offset len +Add file +.Ar name +to archive, using +.Ar len +bytes from the file +.Ar file_to_add +as input data, starting at +.Ar offset . +.It Cm add_from_zip Ar name archivename index offset len +Add file called +.Ar name +to archive using data from another zip archive +.Ar archivename +using the entry with index +.Ar index +and reading +.Ar len +bytes from +.Ar offset . +.It Cm cat Ar index +Output file contents for entry +.Ar index +to stdout. +.It Cm count_extra Ar index flags +Print the number of extra fields for archive entry +.Ar index +using +.Ar flags . +.It Cm count_extra_by_id Ar index extra_id flags +Print number of extra fields of type +.Ar extra_id +for archive entry +.Ar index +using +.Ar flags . +.It Cm delete Ar index +Remove entry at +.Ar index +from zip archive. +.It Cm delete_extra Ar index extra_idx flags +Remove extra field number +.Ar extra_idx +from archive entry +.Ar index +using +.Ar flags . +.It Cm delete_extra_by_id Ar index extra_id extra_index flags +Remove extra field number +.Ar extra_index +of type +.Ar extra_id +from archive entry +.Ar index +using +.Ar flags . +.It Cm get_archive_comment +Print archive comment. +.It Cm get_extra Ar index extra_index flags +Print extra field +.Ar extra_index +for archive entry +.Ar index +using +.Ar flags . +.It Cm get_extra_by_id Ar index extra_id extra_index flags +Print extra field +.Ar extra_index +of type +.Ar extra_id +for archive entry +.Ar index +using +.Ar flags . +.It Cm get_file_comment Ar index +Get file comment for archive entry +.Ar index . +.It Cm get_num_entries Ar flags +Print number of entries in archive using +.Ar flags . +.It Cm name_locate Ar name flags +Find entry in archive with the filename +.Ar name +using +.Ar flags +and print its index. +.It Cm rename Ar index name +Rename archive entry +.Ar index +to +.Ar name . +.It Cm replace_file_contents Ar index data +Replace file contents for archive entry +.Ar index +with the string +.Ar data . +.It Cm set_archive_comment Ar comment +Set archive comment to +.Ar comment . +.It Cm set_extra Ar index extra_id extra_index flags value +Set extra field number +.Ar extra_index +of type +.Ar extra_id +for archive entry +.Ar index +using +.Ar flags +to +.Ar value . +.It Cm set_file_comment Ar index comment +Set file comment for archive entry +.Ar index +to string +.Ar comment . +.It Cm set_file_compression Ar index method compression_flags +Set file compression method for archive entry +.Ar index +to +.Ar method +using +.Ar compression_flags . +.Em Note : +Currently, +.Ar compression_flags +are ignored. +.It Cm set_file_encryption Ar index method password +Set file encryption method for archive entry +.Ar index +to +.Ar method +with password +.Ar password . +.It Cm set_file_mtime Ar index timestamp +Set file modification time for archive entry +.Ar index +to UNIX mtime +.Ar timestamp . +.It Cm set_file_mtime_all Ar timestamp +Set file modification time for all archive entries to UNIX mtime +.Ar timestamp . +.It Cm set_password Ar password +Set default password for encryption/decryption to +.Ar password . +.It Cm stat Ar index +Print information about archive entry +.Ar index . +.El +.Ss Flags +Some commands take flag arguments. +Supported flags are: +.Bl -tag -width MMM -compact -offset indent +.It Ar C +.Dv ZIP_FL_NOCASE +.It Ar c +.Dv ZIP_FL_CENTRAL +.It Ar d +.Dv ZIP_FL_NODIR +.It Ar l +.Dv ZIP_FL_LOCAL +.It Ar u +.Dv ZIP_FL_UNCHANGED +.El +.Ss Compression Methods +Some commands take compression method arguments. +Supported methods are: +.Bl -bullet -compact -offset indent +.It +.Dv default +.It +.Dv deflate +.It +.Dv store +.El +.Ss Encryption Methods +Some commands take encryption method arguments. +Supported methods are: +.Bl -bullet -compact -offset indent +.It +.Dv none +.It +.Dv AES-128 +.It +.Dv AES-192 +.It +.Dv AES-256 +.El +.Sh EXIT STATUS +.Ex -std +.Sh EXAMPLES +Add a file called +.Pa teststring.txt +to the zip archive +.Pa testbuffer.zip +with data +.Dq This is a test.\en +where +.Dq \en +is replaced with a newline character: +.Bd -literal -offset indent +ziptool testbuffer.zip add teststring.txt \\"This is a test.\en\\" +.Ed +.Pp +Delete the first file from the zip archive +.Pa testfile.zip : +.Bd -literal -offset indent +ziptool testfile.zip delete 0 +.Ed +.Sh SEE ALSO +.Xr zipcmp 1 , +.Xr zipmerge 1 , +.Xr libzip 3 +.Sh HISTORY +.Nm +was added in libzip 1.1. +.Sh AUTHORS +.An -nosplit +.An Dieter Baron Aq Mt dillo@nih.at +and +.An Thomas Klausner Aq Mt tk@giga.or.at diff --git a/core/deps/libzip/mkstemp.c b/core/deps/libzip/mkstemp.c deleted file mode 100644 index a505d9e02..000000000 --- a/core/deps/libzip/mkstemp.c +++ /dev/null @@ -1,143 +0,0 @@ -/* $NiH: mkstemp.c,v 1.3 2006/04/23 14:51:45 wiz Exp $ */ - -/* Adapted from NetBSB libc by Dieter Baron */ - -/* NetBSD: gettemp.c,v 1.13 2003/12/05 00:57:36 uebayasi Exp */ - -/* - * Copyright (c) 1987, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include - -#include -#include -#include -#include -#include -#include - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -#if defined(__APPLE__) -#include -#endif - - -int -_zip_mkstemp(char *path) -{ - int fd; - char *start, *trv; - struct stat sbuf; - pid_t pid; - - /* To guarantee multiple calls generate unique names even if - the file is not created. 676 different possibilities with 7 - or more X's, 26 with 6 or less. */ - static char xtra[2] = "aa"; - int xcnt = 0; - - pid = getpid(); - - /* Move to end of path and count trailing X's. */ - for (trv = path; *trv; ++trv) - if (*trv == 'X') - xcnt++; - else - xcnt = 0; - - /* Use at least one from xtra. Use 2 if more than 6 X's. */ - if (*(trv - 1) == 'X') - *--trv = xtra[0]; - if (xcnt > 6 && *(trv - 1) == 'X') - *--trv = xtra[1]; - - /* Set remaining X's to pid digits with 0's to the left. */ - while (*--trv == 'X') { - *trv = (pid % 10) + '0'; - pid /= 10; - } - - /* update xtra for next call. */ - if (xtra[0] != 'z') - xtra[0]++; - else { - xtra[0] = 'a'; - if (xtra[1] != 'z') - xtra[1]++; - else - xtra[1] = 'a'; - } - - /* - * check the target directory; if you have six X's and it - * doesn't exist this runs for a *very* long time. - */ - for (start = trv + 1;; --trv) { - if (trv <= path) - break; - if (*trv == '/') { - *trv = '\0'; - if (stat(path, &sbuf)) - return (0); - if (!S_ISDIR(sbuf.st_mode)) { - errno = ENOTDIR; - return (0); - } - *trv = '/'; - break; - } - } - - for (;;) { - if ((fd=open(path, O_CREAT|O_EXCL|O_RDWR|O_BINARY, 0600)) >= 0) - return (fd); - if (errno != EEXIST) - return (0); - - /* tricky little algorithm for backward compatibility */ - for (trv = start;;) { - if (!*trv) - return (0); - if (*trv == 'z') - *trv++ = 'a'; - else { - if (isdigit((unsigned char)*trv)) - *trv = 'a'; - else - ++*trv; - break; - } - } - } - /*NOTREACHED*/ -} diff --git a/core/deps/libzip/regress/nihtest.conf.in b/core/deps/libzip/regress/nihtest.conf.in new file mode 100644 index 000000000..0a32f78d9 --- /dev/null +++ b/core/deps/libzip/regress/nihtest.conf.in @@ -0,0 +1,4 @@ +default-program ziptool_regress +source-directory @srcdir@ +top-build-directory @top_builddir@ +file-compare zip zip ../src/zipcmp -pv diff --git a/core/deps/libzip/regress/runtest.in b/core/deps/libzip/regress/runtest.in new file mode 100644 index 000000000..a6eb1407a --- /dev/null +++ b/core/deps/libzip/regress/runtest.in @@ -0,0 +1,60 @@ +#!/usr/bin/env perl + +# runtest -- run regression tests +# Copyright (C) 2002-2014 Dieter Baron and Thomas Klausner +# +# This file is part of ckmame, a program to check rom sets for MAME. +# The authors can be contacted at +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. The names of the authors may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +use strict; + +BEGIN { push @INC, '@abs_srcdir@'; } + +use NiHTest; + +my $test = NiHTest::new({ default_program => 'ziptool_regress', srcdir => '@srcdir@', top_builddir => '@top_builddir@', zipcmp => '../../src/zipcmp', zipcmp_flags => '-p' }); + +sub mangle_test { + my ($test, $variant) = @_; + + if (defined($test->{test}->{preload})) { + if (!defined($test->{test}->{features})) { + $test->{test}->{features} = []; + } + push @{$test->{test}->{features}}, 'SHARED'; + } + + return 1; +} + + +$test->add_comparator('zip/zip', \&NiHTest::comparator_zip); +$test->add_hook('post_parse', \&mangle_test); + +$test->run(@ARGV); diff --git a/core/deps/libzip/vstudio/readme.txt b/core/deps/libzip/vstudio/readme.txt new file mode 100644 index 000000000..72b7546a5 --- /dev/null +++ b/core/deps/libzip/vstudio/readme.txt @@ -0,0 +1,77 @@ +Building libzip with Microsoft Visual C++ +========================================= +The script vsbuild.cmd can be used to build (and optionally test) libzip using +Microsoft Visual C++. + +Prerequisites +------------- +Windows Server 2003 or Windows Vista or later (tested with Windows 7 x64) +Microsoft Visual Studio (tested with VS2013 Premium) +CMake (tested with version 3.3.1) +Source code for zlib (tested with version 1.2.8) + +To run tests, you will also need: +Perl interpreter (tested with ActiveState ActivePerl 5.20.2 64-bit) +CPAN module IPC::Cmd (comes with ActivePerl) + +You'll also need to make sure all of the above (specifically: msbuild.exe, +cmake.exe and perl.exe) are in your PATH at the time of running the script. + +Unpacking zlib +-------------- +Because libzip depends on zlib, the vsbuild.cmd script takes care of building +zlib for you as well. Download the source code from http://zlib.org/ and extract +all the files and subdirectories from the "zlib-x.y.z" directory into +vstudio/zlib. + +Building libzip with Visual Studio 2013 for the impatient +--------------------------------------------------------- +1. Make sure all the prerequisites (see above) are installed and in your PATH. +2. Don't forget to unpack zlib (see "Unpacking zlib" above). +3. Open a Visual Studio Command Prompt in the "vstudio" directory (the directory + containing this file). +4. Enter the following command for a 32-bit x86 build: + vsbuild build "Visual Studio 12" v120 + or for a 64-bit x64 build: + vsbuild build "Visual Studio 12 Win64" v120 + +If you'd like to run the tests as well, use one of the following commands: +vsbuild build+test "Visual Studio 12" v120 +vsbuild build+test "Visual Studio 12 Win64" v120 + +Building libzip +--------------- +The script vsbuild.cmd has three modes of operation, with the following syntax: +vsbuild clean +vsbuild build +vsbuild build+test + +"vsbuild clean" deletes all output and intermediate files and directories +generated by the build process. + +"vsbuild build" just builds zlib and libzip and leaves the DLL files in the +following locations: +vstudio/zlib/installed/bin/zlib.dll +vstudio/zlib/installed/bin/zlibd.dll +build/lib/Debug/zip.dll +build/lib/Release/zip.dll + +"vsbuild build+test" builds zlib and libzip as above, then runs the libzip +regression test suite. + +The "build" and "build+test" commands require the following parameters: + +: The CMake generator to use for project files. This identifies the +version of Visual Studio you're using, and also allows you to specify whether +the 32-bit or 64-bit of the libraries should be built. +I've tested "Visual Studio 12" (VS2013 x86) and "Visual Studio 12 Win64" +(VS2013 x64) but other versions should work as well. Run "cmake --help" for a +list of generators. + +: Specifies the platform toolset to use. Normally, this will match the +version of Visual Studio (e.g. "v120" for Visual Studio 2013 aka Visual Studio +12). See the Visual Studio documentation for more information about platform +toolsets. + +Andrew Molyneux +andrew@molyneuxfamily.co.uk \ No newline at end of file diff --git a/core/deps/libzip/vstudio/vsbuild.cmd b/core/deps/libzip/vstudio/vsbuild.cmd new file mode 100644 index 000000000..9b7d8bd7e --- /dev/null +++ b/core/deps/libzip/vstudio/vsbuild.cmd @@ -0,0 +1,186 @@ +@echo off +setlocal enableextensions enabledelayedexpansion + +rem --------------------------------------------------------------------------- +rem Check that required commands are in the PATH. +rem --------------------------------------------------------------------------- +set CHECK_CMD=cmake.exe +set CHECK_DESC=CMake +call :check_installed +set CHECK_CMD=msbuild.exe +set CHECK_DESC=MSBuild +call :check_installed + +rem --------------------------------------------------------------------------- +rem Parse command-line arguments. +rem %1: Command ("build" or "clean") +rem %2: Generator (e.g. "Visual Studio 12" for VS2013) +rem %3: Platform toolset (e.g. "v120_xp" for VS2013 toolset for Windows XP) +rem --------------------------------------------------------------------------- +if "%1"=="clean" ( + echo Cleaning + if exist zlib\installed rmdir /s /q zlib\installed + if errorlevel 1 goto exit_failure + if exist zlib\build rmdir /s /q zlib\build + if errorlevel 1 goto exit_failure + if exist ..\build rmdir /s /q ..\build + if errorlevel 1 goto exit_failure + if exist ..\regress\bigzero.zip del ..\regress\bigzero.zip + if errorlevel 1 goto exit_failure + if exist ..\regress\manyfiles.zip del ..\regress\manyfiles.zip + if errorlevel 1 goto exit_failure + if exist ..\regress\manyfiles-133000.zip del ..\regress\manyfiles-133000.zip + if errorlevel 1 goto exit_failure + if exist ..\regress\manyfiles-65536.zip del ..\regress\manyfiles-65536.zip + if errorlevel 1 goto exit_failure + if exist ..\regress\manyfiles-zip64-modulo.zip del ..\regress\manyfiles-zip64-modulo.zip + if errorlevel 1 goto exit_failure + if exist ..\regress\manyfiles-zip64.zip del ..\regress\manyfiles-zip64.zip + if errorlevel 1 goto exit_failure + if exist ..\regress\manyfiles-fewer.zip del ..\regress\manyfiles-fewer.zip + if errorlevel 1 goto exit_failure + if exist ..\regress\manyfiles-more.zip del ..\regress\manyfiles-more.zip + if errorlevel 1 goto exit_failure + echo Done + exit /b 0 +) else if "%1"=="build" ( + set CMAKE_GENERATOR=%2 + set CMAKE_TOOLSET=%3 + set LIBZIP_RUN_TESTS=false +) else if "%1"=="build+test" ( + set CMAKE_GENERATOR=%2 + set CMAKE_TOOLSET=%3 + set LIBZIP_RUN_TESTS=true +) else ( + echo Invalid command "%1" + exit /b 1 +) + +rem --------------------------------------------------------------------------- +rem If we're running tests, we'll also need a Perl interpreter. +rem --------------------------------------------------------------------------- +if "%LIBZIP_RUN_TESTS%"=="true" ( + set CHECK_CMD=perl.exe + set CHECK_DESC=a Perl interpreter (to run tests) + call :check_installed +) + +rem --------------------------------------------------------------------------- +rem Configure and build zlib. +rem --------------------------------------------------------------------------- +pushd zlib +for /f %%p in (".\installed") do set ZLIB_INSTALL_PATH=%%~fp +echo zlib will be "installed" to %ZLIB_INSTALL_PATH% +if not exist build ( + mkdir build + if errorlevel 1 popd & goto exit_failure +) +cd build +if errorlevel 1 popd & goto exit_failure +echo Configuring zlib +cmake .. -G %CMAKE_GENERATOR% -T %CMAKE_TOOLSET% -DCMAKE_INSTALL_PREFIX="%ZLIB_INSTALL_PATH%" +if errorlevel 1 popd & goto exit_failure +echo Building zlib +msbuild /P:Configuration=Debug INSTALL.vcxproj +if errorlevel 1 popd & goto exit_failure +msbuild /P:Configuration=Release INSTALL.vcxproj +if errorlevel 1 popd & goto exit_failure +popd + +rem --------------------------------------------------------------------------- +rem Prepare the build directory and run CMake to configure the project. +rem --------------------------------------------------------------------------- +pushd .. +if not exist build ( + echo Creating build directory + mkdir build + if errorlevel 1 popd & goto exit_failure +) +cd build +if errorlevel 1 popd & goto exit_failure +cmake .. -G %CMAKE_GENERATOR% -T %CMAKE_TOOLSET% -DCMAKE_PREFIX_PATH="%ZLIB_INSTALL_PATH%" +if errorlevel 1 popd & goto exit_failure +goto :EOF + +rem --------------------------------------------------------------------------- +rem Build libzip. +rem --------------------------------------------------------------------------- +msbuild /P:Configuration=Debug ALL_BUILD.vcxproj +if errorlevel 1 popd & goto exit_failure +msbuild /P:Configuration=Release ALL_BUILD.vcxproj +if errorlevel 1 popd & goto exit_failure +popd + +rem --------------------------------------------------------------------------- +rem Copy DLLs so zipcmp/zipmerge can run. +rem --------------------------------------------------------------------------- +echo Copying DLLs +copy zlib\installed\bin\zlibd.dll ..\build\src\Debug +if errorlevel 1 goto exit_failure +copy zlib\installed\bin\zlib.dll ..\build\src\Release +if errorlevel 1 goto exit_failure +copy ..\build\lib\Release\zip.dll ..\build\src\Release +if errorlevel 1 goto exit_failure +copy ..\build\lib\Debug\zip.dll ..\build\src\Debug +if errorlevel 1 goto exit_failure + +rem --------------------------------------------------------------------------- +rem Run the tests, if required. +rem --------------------------------------------------------------------------- +if "%LIBZIP_RUN_TESTS%"=="true" ( + echo Copying libraries for tests + pushd ..\build\regress + copy ..\..\vstudio\zlib\installed\bin\zlib.dll . + if errorlevel 1 popd & goto exit_failure + copy ..\lib\Release\zip.dll . + if errorlevel 1 popd & goto exit_failure + copy Release\*.exe . + if errorlevel 1 popd & goto exit_failure + copy ..\src\Release\*.exe . + if errorlevel 1 popd & goto exit_failure + echo Extracting test files + if not exist ..\..\regress\bigzero.zip ziptool ..\..\regress\bigzero-zip.zip cat 0 > ..\..\regress\bigzero.zip + if errorlevel 1 popd & goto exit_failure + if not exist ..\..\regress\manyfiles.zip ziptool ..\..\regress\manyfiles-zip.zip cat 0 > ..\..\regress\manyfiles.zip + if errorlevel 1 popd & goto exit_failure + if not exist ..\..\regress\manyfiles-133000.zip ziptool ..\..\regress\manyfiles-zip.zip cat 1 > ..\..\regress\manyfiles-133000.zip + if errorlevel 1 popd & goto exit_failure + if not exist ..\..\regress\manyfiles-65536.zip ziptool ..\..\regress\manyfiles-zip.zip cat 2 > ..\..\regress\manyfiles-65536.zip + if errorlevel 1 popd & goto exit_failure + if not exist ..\..\regress\manyfiles-zip64-modulo.zip ziptool ..\..\regress\manyfiles-zip.zip cat 3 > ..\..\regress\manyfiles-zip64-modulo.zip + if errorlevel 1 popd & goto exit_failure + if not exist ..\..\regress\manyfiles-zip64.zip ziptool ..\..\regress\manyfiles-zip.zip cat 4 > ..\..\regress\manyfiles-zip64.zip + if errorlevel 1 popd & goto exit_failure + if not exist ..\..\regress\manyfiles-fewer.zip ziptool ..\..\regress\manyfiles-zip.zip cat 5 > ..\..\regress\manyfiles-fewer.zip + if errorlevel 1 popd & goto exit_failure + if not exist ..\..\regress\manyfiles-more.zip ziptool ..\..\regress\manyfiles-zip.zip cat 6 > ..\..\regress\manyfiles-more.zip + if errorlevel 1 popd & goto exit_failure + echo Generating runtest script + for /f %%p in ("..\..\regress") do set ABS_SRCDIR=%%~fp + set ABS_SRCDIR=!ABS_SRCDIR:\=\\! + perl -p -e "s/@[s]rcdir@/..\\..\\regress/g;s/@[a]bs_srcdir@/!ABS_SRCDIR!/g;s|../../src/zipcmp|..\\..\\src\\Release\\zipcmp|g;" ..\..\regress\runtest.in > runtest + if errorlevel 1 popd & goto exit_failure + echo Running tests + ctest + popd + if errorlevel 1 goto exit_failure +) + +goto :EOF + +:check_installed +where %CHECK_CMD% > nul 2>&1 +if "%errorlevel%"=="9009" ( + echo This build script requires where.exe. If running on Windows XP or + echo earlier, this can be found in the Windows Resource Kit. + exit /b 1 +) +if errorlevel 1 ( + echo Please make sure that %CHECK_DESC% is installed and in your PATH. + exit /b 1 +) +goto :EOF + +:exit_failure +echo Build failed. +exit /b 1 diff --git a/core/deps/libzip/vstudio/zlib/unpack_zlib_here.txt b/core/deps/libzip/vstudio/zlib/unpack_zlib_here.txt new file mode 100644 index 000000000..f4e51a6e2 --- /dev/null +++ b/core/deps/libzip/vstudio/zlib/unpack_zlib_here.txt @@ -0,0 +1 @@ +Unpack zlib source archive into this directory. \ No newline at end of file diff --git a/core/deps/libzip/zip.h b/core/deps/libzip/zip.h deleted file mode 100644 index b6cabeb1d..000000000 --- a/core/deps/libzip/zip.h +++ /dev/null @@ -1,232 +0,0 @@ -#ifndef _HAD_ZIP_H -#define _HAD_ZIP_H - -/* - zip.h -- exported declarations. - Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner - - This file is part of libzip, a library to manipulate ZIP archives. - The authors can be contacted at - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - 3. The names of the authors may not be used to endorse or promote - products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - - -#ifndef ZIP_EXTERN -#ifdef _MSC_VER -#define ZIP_EXTERN __declspec(dllexport) -#else -#define ZIP_EXTERN -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -/* flags for zip_open */ - -#define ZIP_CREATE 1 -#define ZIP_EXCL 2 -#define ZIP_CHECKCONS 4 - - -/* flags for zip_name_locate, zip_fopen, zip_stat, ... */ - -#define ZIP_FL_NOCASE 1 /* ignore case on name lookup */ -#define ZIP_FL_NODIR 2 /* ignore directory component */ -#define ZIP_FL_COMPRESSED 4 /* read compressed data */ -#define ZIP_FL_UNCHANGED 8 /* use original data, ignoring changes */ -#define ZIP_FL_RECOMPRESS 16 /* force recompression of data */ - -/* archive global flags flags */ - -#define ZIP_AFL_TORRENT 1 /* torrent zipped */ - -/* libzip error codes */ - -#define ZIP_ER_OK 0 /* N No error */ -#define ZIP_ER_MULTIDISK 1 /* N Multi-disk zip archives not supported */ -#define ZIP_ER_RENAME 2 /* S Renaming temporary file failed */ -#define ZIP_ER_CLOSE 3 /* S Closing zip archive failed */ -#define ZIP_ER_SEEK 4 /* S Seek error */ -#define ZIP_ER_READ 5 /* S Read error */ -#define ZIP_ER_WRITE 6 /* S Write error */ -#define ZIP_ER_CRC 7 /* N CRC error */ -#define ZIP_ER_ZIPCLOSED 8 /* N Containing zip archive was closed */ -#define ZIP_ER_NOENT 9 /* N No such file */ -#define ZIP_ER_EXISTS 10 /* N File already exists */ -#define ZIP_ER_OPEN 11 /* S Can't open file */ -#define ZIP_ER_TMPOPEN 12 /* S Failure to create temporary file */ -#define ZIP_ER_ZLIB 13 /* Z Zlib error */ -#define ZIP_ER_MEMORY 14 /* N Malloc failure */ -#define ZIP_ER_CHANGED 15 /* N Entry has been changed */ -#define ZIP_ER_COMPNOTSUPP 16 /* N Compression method not supported */ -#define ZIP_ER_EOF 17 /* N Premature EOF */ -#define ZIP_ER_INVAL 18 /* N Invalid argument */ -#define ZIP_ER_NOZIP 19 /* N Not a zip archive */ -#define ZIP_ER_INTERNAL 20 /* N Internal error */ -#define ZIP_ER_INCONS 21 /* N Zip archive inconsistent */ -#define ZIP_ER_REMOVE 22 /* S Can't remove file */ -#define ZIP_ER_DELETED 23 /* N Entry has been deleted */ - - -/* type of system error value */ - -#define ZIP_ET_NONE 0 /* sys_err unused */ -#define ZIP_ET_SYS 1 /* sys_err is errno */ -#define ZIP_ET_ZLIB 2 /* sys_err is zlib error code */ - -/* compression methods */ - -#define ZIP_CM_DEFAULT -1 /* better of deflate or store */ -#define ZIP_CM_STORE 0 /* stored (uncompressed) */ -#define ZIP_CM_SHRINK 1 /* shrunk */ -#define ZIP_CM_REDUCE_1 2 /* reduced with factor 1 */ -#define ZIP_CM_REDUCE_2 3 /* reduced with factor 2 */ -#define ZIP_CM_REDUCE_3 4 /* reduced with factor 3 */ -#define ZIP_CM_REDUCE_4 5 /* reduced with factor 4 */ -#define ZIP_CM_IMPLODE 6 /* imploded */ -/* 7 - Reserved for Tokenizing compression algorithm */ -#define ZIP_CM_DEFLATE 8 /* deflated */ -#define ZIP_CM_DEFLATE64 9 /* deflate64 */ -#define ZIP_CM_PKWARE_IMPLODE 10 /* PKWARE imploding */ -/* 11 - Reserved by PKWARE */ -#define ZIP_CM_BZIP2 12 /* compressed using BZIP2 algorithm */ -/* 13 - Reserved by PKWARE */ -#define ZIP_CM_LZMA 14 /* LZMA (EFS) */ -/* 15-17 - Reserved by PKWARE */ -#define ZIP_CM_TERSE 18 /* compressed using IBM TERSE (new) */ -#define ZIP_CM_LZ77 19 /* IBM LZ77 z Architecture (PFS) */ -#define ZIP_CM_WAVPACK 97 /* WavPack compressed data */ -#define ZIP_CM_PPMD 98 /* PPMd version I, Rev 1 */ - -/* encryption methods */ - -#define ZIP_EM_NONE 0 /* not encrypted */ -#define ZIP_EM_TRAD_PKWARE 1 /* traditional PKWARE encryption */ -#if 0 /* Strong Encryption Header not parsed yet */ -#define ZIP_EM_DES 0x6601 /* strong encryption: DES */ -#define ZIP_EM_RC2_OLD 0x6602 /* strong encryption: RC2, version < 5.2 */ -#define ZIP_EM_3DES_168 0x6603 -#define ZIP_EM_3DES_112 0x6609 -#define ZIP_EM_AES_128 0x660e -#define ZIP_EM_AES_192 0x660f -#define ZIP_EM_AES_256 0x6610 -#define ZIP_EM_RC2 0x6702 /* strong encryption: RC2, version >= 5.2 */ -#define ZIP_EM_RC4 0x6801 -#endif -#define ZIP_EM_UNKNOWN 0xffff /* unknown algorithm */ - - - -enum zip_source_cmd { - ZIP_SOURCE_OPEN, /* prepare for reading */ - ZIP_SOURCE_READ, /* read data */ - ZIP_SOURCE_CLOSE, /* reading is done */ - ZIP_SOURCE_STAT, /* get meta information */ - ZIP_SOURCE_ERROR, /* get error information */ - ZIP_SOURCE_FREE /* cleanup and free resources */ -}; - -typedef ssize_t (*zip_source_callback)(void *state, void *data, - size_t len, enum zip_source_cmd cmd); - -struct zip_stat { - const char *name; /* name of the file */ - int index; /* index within archive */ - unsigned int crc; /* crc of file data */ - time_t mtime; /* modification time */ - off_t size; /* size of file (uncompressed) */ - off_t comp_size; /* size of file (compressed) */ - unsigned short comp_method; /* compression method used */ - unsigned short encryption_method; /* encryption method used */ -}; - -struct zip; -struct zip_file; -struct zip_source; - - - -ZIP_EXTERN int zip_add(struct zip *, const char *, struct zip_source *); -ZIP_EXTERN int zip_add_dir(struct zip *, const char *); -ZIP_EXTERN int zip_close(struct zip *); -ZIP_EXTERN int zip_delete(struct zip *, int); -ZIP_EXTERN void zip_error_clear(struct zip *); -ZIP_EXTERN void zip_error_get(struct zip *, int *, int *); -ZIP_EXTERN int zip_error_get_sys_type(int); -ZIP_EXTERN int zip_error_to_str(char *, size_t, int, int); -ZIP_EXTERN int zip_fclose(struct zip_file *); -ZIP_EXTERN void zip_file_error_clear(struct zip_file *); -ZIP_EXTERN void zip_file_error_get(struct zip_file *, int *, int *); -ZIP_EXTERN const char *zip_file_strerror(struct zip_file *); -ZIP_EXTERN struct zip_file *zip_fopen(struct zip *, const char *, int); -ZIP_EXTERN struct zip_file *zip_fopen_by_crc(struct zip *, int, int); -ZIP_EXTERN struct zip_file *zip_fopen_index(struct zip *, int, int); -ZIP_EXTERN ssize_t zip_fread(struct zip_file *, void *, size_t); -ZIP_EXTERN const char *zip_get_archive_comment(struct zip *, int *, int); -ZIP_EXTERN int zip_get_archive_flag(struct zip *, int, int); -ZIP_EXTERN const char *zip_get_file_comment(struct zip *, int, int *, int); -ZIP_EXTERN const char *zip_get_name(struct zip *, int, int); -ZIP_EXTERN int zip_get_num_files(struct zip *); -ZIP_EXTERN int zip_name_locate(struct zip *, const char *, int); -ZIP_EXTERN int zip_crc_locate(struct zip *, int, int); -ZIP_EXTERN struct zip *zip_open(const char *, int, int *); -ZIP_EXTERN int zip_rename(struct zip *, int, const char *); -ZIP_EXTERN int zip_replace(struct zip *, int, struct zip_source *); -ZIP_EXTERN int zip_set_archive_comment(struct zip *, const char *, int); -ZIP_EXTERN int zip_set_archive_flag(struct zip *, int, int); -ZIP_EXTERN int zip_set_file_comment(struct zip *, int, const char *, int); -ZIP_EXTERN struct zip_source *zip_source_buffer(struct zip *, const void *, - off_t, int); -ZIP_EXTERN struct zip_source *zip_source_file(struct zip *, const char *, - off_t, off_t); -ZIP_EXTERN struct zip_source *zip_source_filep(struct zip *, FILE *, - off_t, off_t); -ZIP_EXTERN void zip_source_free(struct zip_source *); -ZIP_EXTERN struct zip_source *zip_source_function(struct zip *, - zip_source_callback, void *); -ZIP_EXTERN struct zip_source *zip_source_zip(struct zip *, struct zip *, - int, int, off_t, off_t); -ZIP_EXTERN int zip_stat(struct zip *, const char *, int, struct zip_stat *); -ZIP_EXTERN int zip_stat_index(struct zip *, int, int, struct zip_stat *); -ZIP_EXTERN void zip_stat_init(struct zip_stat *); -ZIP_EXTERN const char *zip_strerror(struct zip *); -ZIP_EXTERN int zip_unchange(struct zip *, int); -ZIP_EXTERN int zip_unchange_all(struct zip *); -ZIP_EXTERN int zip_unchange_archive(struct zip *); - -#ifdef __cplusplus -} -#endif - -#endif /* _HAD_ZIP_H */ diff --git a/core/deps/libzip/zip_close.c b/core/deps/libzip/zip_close.c deleted file mode 100644 index c6885d96a..000000000 --- a/core/deps/libzip/zip_close.c +++ /dev/null @@ -1,679 +0,0 @@ -/* - zip_close.c -- close zip archive and update changes - Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner - - This file is part of libzip, a library to manipulate ZIP archives. - The authors can be contacted at - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - 3. The names of the authors may not be used to endorse or promote - products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - - -#include -#include -#include -#include -#include -#include - -#include "zipint.h" - -static int add_data(struct zip *, struct zip_source *, struct zip_dirent *, - FILE *); -static int add_data_comp(zip_source_callback, void *, struct zip_stat *, - FILE *, struct zip_error *); -static int add_data_uncomp(struct zip *, zip_source_callback, void *, - struct zip_stat *, FILE *); -static void ch_set_error(struct zip_error *, zip_source_callback, void *); -static int copy_data(FILE *, off_t, FILE *, struct zip_error *); -static int write_cdir(struct zip *, struct zip_cdir *, FILE *); -static int _zip_cdir_set_comment(struct zip_cdir *, struct zip *); -static int _zip_changed(struct zip *, int *); -static char *_zip_create_temp_output(struct zip *, FILE **); -static int _zip_torrentzip_cmp(const void *, const void *); - - - -struct filelist { - int idx; - const char *name; -}; - - - -ZIP_EXTERN int -zip_close(struct zip *za) -{ - int survivors; - int i, j, error; - char *temp; - FILE *out; - mode_t mask; - struct zip_cdir *cd; - struct zip_dirent de; - struct filelist *filelist; - int reopen_on_error; - int new_torrentzip; - - reopen_on_error = 0; - - if (za == NULL) - return -1; - - if (!_zip_changed(za, &survivors)) { - _zip_free(za); - return 0; - } - - /* don't create zip files with no entries */ - if (survivors == 0) { - if (za->zn && za->zp) { - if (remove(za->zn) != 0) { - _zip_error_set(&za->error, ZIP_ER_REMOVE, errno); - return -1; - } - } - _zip_free(za); - return 0; - } - - if ((filelist=(struct filelist *)malloc(sizeof(filelist[0])*survivors)) - == NULL) - return -1; - - if ((cd=_zip_cdir_new(survivors, &za->error)) == NULL) { - free(filelist); - return -1; - } - - for (i=0; ientry[i]); - - /* archive comment is special for torrentzip */ - if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) { - cd->comment = _zip_memdup(TORRENT_SIG "XXXXXXXX", - TORRENT_SIG_LEN + TORRENT_CRC_LEN, - &za->error); - if (cd->comment == NULL) { - _zip_cdir_free(cd); - free(filelist); - return -1; - } - cd->comment_len = TORRENT_SIG_LEN + TORRENT_CRC_LEN; - } - else if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, ZIP_FL_UNCHANGED) == 0) { - if (_zip_cdir_set_comment(cd, za) == -1) { - _zip_cdir_free(cd); - free(filelist); - return -1; - } - } - - if ((temp=_zip_create_temp_output(za, &out)) == NULL) { - _zip_cdir_free(cd); - free(filelist); - return -1; - } - - - /* create list of files with index into original archive */ - for (i=j=0; inentry; i++) { - if (za->entry[i].state == ZIP_ST_DELETED) - continue; - - filelist[j].idx = i; - filelist[j].name = zip_get_name(za, i, 0); - j++; - } - if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) - qsort(filelist, survivors, sizeof(filelist[0]), - _zip_torrentzip_cmp); - - new_torrentzip = (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0) == 1 - && zip_get_archive_flag(za, ZIP_AFL_TORRENT, - ZIP_FL_UNCHANGED) == 0); - error = 0; - for (j=0; jentry+i) || new_torrentzip) { - _zip_dirent_init(&de); - - if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) - _zip_dirent_torrent_normalize(&de); - - /* use it as central directory entry */ - memcpy(cd->entry+j, &de, sizeof(cd->entry[j])); - - /* set/update file name */ - if (za->entry[i].ch_filename == NULL) { - if (za->entry[i].state == ZIP_ST_ADDED) { - de.filename = strdup("-"); - de.filename_len = 1; - cd->entry[j].filename = "-"; - cd->entry[j].filename_len = 1; - } - else { - de.filename = strdup(za->cdir->entry[i].filename); - de.filename_len = strlen(de.filename); - cd->entry[j].filename = za->cdir->entry[i].filename; - cd->entry[j].filename_len = de.filename_len; - } - } - } - else { - /* copy existing directory entries */ - if (fseeko(za->zp, za->cdir->entry[i].offset, SEEK_SET) != 0) { - _zip_error_set(&za->error, ZIP_ER_SEEK, errno); - error = 1; - break; - } - if (_zip_dirent_read(&de, za->zp, NULL, NULL, 1, - &za->error) != 0) { - error = 1; - break; - } - memcpy(cd->entry+j, za->cdir->entry+i, sizeof(cd->entry[j])); - if (de.bitflags & ZIP_GPBF_DATA_DESCRIPTOR) { - de.crc = za->cdir->entry[i].crc; - de.comp_size = za->cdir->entry[i].comp_size; - de.uncomp_size = za->cdir->entry[i].uncomp_size; - de.bitflags &= ~ZIP_GPBF_DATA_DESCRIPTOR; - cd->entry[j].bitflags &= ~ZIP_GPBF_DATA_DESCRIPTOR; - } - } - - if (za->entry[i].ch_filename) { - free(de.filename); - if ((de.filename=strdup(za->entry[i].ch_filename)) == NULL) { - error = 1; - break; - } - de.filename_len = strlen(de.filename); - cd->entry[j].filename = za->entry[i].ch_filename; - cd->entry[j].filename_len = de.filename_len; - } - - if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0) == 0 - && za->entry[i].ch_comment_len != -1) { - /* as the rest of cd entries, its malloc/free is done by za */ - cd->entry[j].comment = za->entry[i].ch_comment; - cd->entry[j].comment_len = za->entry[i].ch_comment_len; - } - - cd->entry[j].offset = ftello(out); - - if (ZIP_ENTRY_DATA_CHANGED(za->entry+i) || new_torrentzip) { - struct zip_source *zs; - - zs = NULL; - if (!ZIP_ENTRY_DATA_CHANGED(za->entry+i)) { - if ((zs=zip_source_zip(za, za, i, ZIP_FL_RECOMPRESS, 0, -1)) - == NULL) { - error = 1; - break; - } - } - - if (add_data(za, zs ? zs : za->entry[i].source, &de, out) < 0) { - error = 1; - break; - } - cd->entry[j].last_mod = de.last_mod; - cd->entry[j].comp_method = de.comp_method; - cd->entry[j].comp_size = de.comp_size; - cd->entry[j].uncomp_size = de.uncomp_size; - cd->entry[j].crc = de.crc; - } - else { - if (_zip_dirent_write(&de, out, 1, &za->error) < 0) { - error = 1; - break; - } - /* we just read the local dirent, file is at correct position */ - if (copy_data(za->zp, cd->entry[j].comp_size, out, - &za->error) < 0) { - error = 1; - break; - } - } - - _zip_dirent_finalize(&de); - } - - free(filelist); - - if (!error) { - if (write_cdir(za, cd, out) < 0) - error = 1; - } - - /* pointers in cd entries are owned by za */ - cd->nentry = 0; - _zip_cdir_free(cd); - - if (error) { - _zip_dirent_finalize(&de); - fclose(out); - remove(temp); - free(temp); - return -1; - } - - if (fclose(out) != 0) { - _zip_error_set(&za->error, ZIP_ER_CLOSE, errno); - remove(temp); - free(temp); - return -1; - } - - if (za->zp) { - fclose(za->zp); - za->zp = NULL; - reopen_on_error = 1; - } - if (_zip_rename(temp, za->zn) != 0) { - _zip_error_set(&za->error, ZIP_ER_RENAME, errno); - remove(temp); - free(temp); - if (reopen_on_error) { - /* ignore errors, since we're already in an error case */ - za->zp = fopen(za->zn, "rb"); - } - return -1; - } - mask = umask(0); - umask(mask); - chmod(za->zn, 0666&~mask); - - _zip_free(za); - free(temp); - - return 0; -} - - - -static int -add_data(struct zip *za, struct zip_source *zs, struct zip_dirent *de, FILE *ft) -{ - off_t offstart, offend; - zip_source_callback cb; - void *ud; - struct zip_stat st; - - cb = zs->f; - ud = zs->ud; - - if (cb(ud, &st, sizeof(st), ZIP_SOURCE_STAT) < (ssize_t)sizeof(st)) { - ch_set_error(&za->error, cb, ud); - return -1; - } - - if (cb(ud, NULL, 0, ZIP_SOURCE_OPEN) < 0) { - ch_set_error(&za->error, cb, ud); - return -1; - } - - offstart = ftello(ft); - - if (_zip_dirent_write(de, ft, 1, &za->error) < 0) - return -1; - - if (st.comp_method != ZIP_CM_STORE) { - if (add_data_comp(cb, ud, &st, ft, &za->error) < 0) - return -1; - } - else { - if (add_data_uncomp(za, cb, ud, &st, ft) < 0) - return -1; - } - - if (cb(ud, NULL, 0, ZIP_SOURCE_CLOSE) < 0) { - ch_set_error(&za->error, cb, ud); - return -1; - } - - offend = ftello(ft); - - if (fseeko(ft, offstart, SEEK_SET) < 0) { - _zip_error_set(&za->error, ZIP_ER_SEEK, errno); - return -1; - } - - - de->last_mod = st.mtime; - de->comp_method = st.comp_method; - de->crc = st.crc; - de->uncomp_size = st.size; - de->comp_size = st.comp_size; - - if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) - _zip_dirent_torrent_normalize(de); - - if (_zip_dirent_write(de, ft, 1, &za->error) < 0) - return -1; - - if (fseeko(ft, offend, SEEK_SET) < 0) { - _zip_error_set(&za->error, ZIP_ER_SEEK, errno); - return -1; - } - - return 0; -} - - - -static int -add_data_comp(zip_source_callback cb, void *ud, struct zip_stat *st,FILE *ft, - struct zip_error *error) -{ - char buf[BUFSIZE]; - ssize_t n; - - st->comp_size = 0; - while ((n=cb(ud, buf, sizeof(buf), ZIP_SOURCE_READ)) > 0) { - if (fwrite(buf, 1, n, ft) != (size_t)n) { - _zip_error_set(error, ZIP_ER_WRITE, errno); - return -1; - } - - st->comp_size += n; - } - if (n < 0) { - ch_set_error(error, cb, ud); - return -1; - } - - return 0; -} - - - -static int -add_data_uncomp(struct zip *za, zip_source_callback cb, void *ud, - struct zip_stat *st, FILE *ft) -{ - char b1[BUFSIZE], b2[BUFSIZE]; - int end, flush, ret; - ssize_t n; - size_t n2; - z_stream zstr; - int mem_level; - - st->comp_method = ZIP_CM_DEFLATE; - st->comp_size = st->size = 0; - st->crc = crc32(0, NULL, 0); - - zstr.zalloc = Z_NULL; - zstr.zfree = Z_NULL; - zstr.opaque = NULL; - zstr.avail_in = 0; - zstr.avail_out = 0; - - if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) - mem_level = TORRENT_MEM_LEVEL; - else - mem_level = MAX_MEM_LEVEL; - - /* -MAX_WBITS: undocumented feature of zlib to _not_ write a zlib header */ - deflateInit2(&zstr, Z_BEST_COMPRESSION, Z_DEFLATED, -MAX_WBITS, mem_level, - Z_DEFAULT_STRATEGY); - - zstr.next_out = (Bytef *)b2; - zstr.avail_out = sizeof(b2); - zstr.next_in = NULL; - zstr.avail_in = 0; - - flush = 0; - end = 0; - while (!end) { - if (zstr.avail_in == 0 && !flush) { - if ((n=cb(ud, b1, sizeof(b1), ZIP_SOURCE_READ)) < 0) { - ch_set_error(&za->error, cb, ud); - deflateEnd(&zstr); - return -1; - } - if (n > 0) { - zstr.avail_in = n; - zstr.next_in = (Bytef *)b1; - st->size += n; - st->crc = crc32(st->crc, (Bytef *)b1, n); - } - else - flush = Z_FINISH; - } - - ret = deflate(&zstr, flush); - if (ret != Z_OK && ret != Z_STREAM_END) { - _zip_error_set(&za->error, ZIP_ER_ZLIB, ret); - return -1; - } - - if (zstr.avail_out != sizeof(b2)) { - n2 = sizeof(b2) - zstr.avail_out; - - if (fwrite(b2, 1, n2, ft) != n2) { - _zip_error_set(&za->error, ZIP_ER_WRITE, errno); - return -1; - } - - zstr.next_out = (Bytef *)b2; - zstr.avail_out = sizeof(b2); - st->comp_size += n2; - } - - if (ret == Z_STREAM_END) { - deflateEnd(&zstr); - end = 1; - } - } - - return 0; -} - - - -static void -ch_set_error(struct zip_error *error, zip_source_callback cb, void *ud) -{ - int e[2]; - - if ((cb(ud, e, sizeof(e), ZIP_SOURCE_ERROR)) < (ssize_t)sizeof(e)) { - error->zip_err = ZIP_ER_INTERNAL; - error->sys_err = 0; - } - else { - error->zip_err = e[0]; - error->sys_err = e[1]; - } -} - - - -static int -copy_data(FILE *fs, off_t len, FILE *ft, struct zip_error *error) -{ - char buf[BUFSIZE]; - int n, nn; - - if (len == 0) - return 0; - - while (len > 0) { - nn = len > sizeof(buf) ? sizeof(buf) : len; - if ((n=fread(buf, 1, nn, fs)) < 0) { - _zip_error_set(error, ZIP_ER_READ, errno); - return -1; - } - else if (n == 0) { - _zip_error_set(error, ZIP_ER_EOF, 0); - return -1; - } - - if (fwrite(buf, 1, n, ft) != (size_t)n) { - _zip_error_set(error, ZIP_ER_WRITE, errno); - return -1; - } - - len -= n; - } - - return 0; -} - - - -static int -write_cdir(struct zip *za, struct zip_cdir *cd, FILE *out) -{ - off_t offset; - uLong crc; - char buf[TORRENT_CRC_LEN+1]; - - if (_zip_cdir_write(cd, out, &za->error) < 0) - return -1; - - if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0) == 0) - return 0; - - - /* fix up torrentzip comment */ - - offset = ftello(out); - - if (_zip_filerange_crc(out, cd->offset, cd->size, &crc, &za->error) < 0) - return -1; - - snprintf(buf, sizeof(buf), "%08lX", (long)crc); - - if (fseeko(out, offset-TORRENT_CRC_LEN, SEEK_SET) < 0) { - _zip_error_set(&za->error, ZIP_ER_SEEK, errno); - return -1; - } - - if (fwrite(buf, TORRENT_CRC_LEN, 1, out) != 1) { - _zip_error_set(&za->error, ZIP_ER_WRITE, errno); - return -1; - } - - return 0; -} - - - -static int -_zip_cdir_set_comment(struct zip_cdir *dest, struct zip *src) -{ - if (src->ch_comment_len != -1) { - dest->comment = _zip_memdup(src->ch_comment, - src->ch_comment_len, &src->error); - if (dest->comment == NULL) - return -1; - dest->comment_len = src->ch_comment_len; - } else { - if (src->cdir && src->cdir->comment) { - dest->comment = _zip_memdup(src->cdir->comment, - src->cdir->comment_len, &src->error); - if (dest->comment == NULL) - return -1; - dest->comment_len = src->cdir->comment_len; - } - } - - return 0; -} - - - -static int -_zip_changed(struct zip *za, int *survivorsp) -{ - int changed, i, survivors; - - changed = survivors = 0; - - if (za->ch_comment_len != -1 - || za->ch_flags != za->flags) - changed = 1; - - for (i=0; inentry; i++) { - if ((za->entry[i].state != ZIP_ST_UNCHANGED) - || (za->entry[i].ch_comment_len != -1)) - changed = 1; - if (za->entry[i].state != ZIP_ST_DELETED) - survivors++; - } - - *survivorsp = survivors; - - return changed; -} - - - -static char * -_zip_create_temp_output(struct zip *za, FILE **outp) -{ - char *temp; - int tfd; - FILE *tfp; - - if ((temp=(char *)malloc(strlen(za->zn)+8)) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return NULL; - } - - sprintf(temp, "%s.XXXXXX", za->zn); - - if ((tfd=mkstemp(temp)) == -1) { - _zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno); - free(temp); - return NULL; - } - - if ((tfp=fdopen(tfd, "r+b")) == NULL) { - _zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno); - close(tfd); - remove(temp); - free(temp); - return NULL; - } - - *outp = tfp; - return temp; -} - - - -static int -_zip_torrentzip_cmp(const void *a, const void *b) -{ - return strcasecmp(((const struct filelist *)a)->name, - ((const struct filelist *)b)->name); -} diff --git a/core/deps/libzip/zip_dirent.c b/core/deps/libzip/zip_dirent.c deleted file mode 100644 index d15b376ba..000000000 --- a/core/deps/libzip/zip_dirent.c +++ /dev/null @@ -1,615 +0,0 @@ -/* - zip_dirent.c -- read directory entry (local or central), clean dirent - Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner - - This file is part of libzip, a library to manipulate ZIP archives. - The authors can be contacted at - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - 3. The names of the authors may not be used to endorse or promote - products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - - -#include -#include -#include -#include -#include -#include - -#include "zipint.h" - -static time_t _zip_d2u_time(int, int); -static char *_zip_readfpstr(FILE *, unsigned int, int, struct zip_error *); -static char *_zip_readstr(unsigned char **, int, int, struct zip_error *); -static void _zip_u2d_time(time_t, unsigned short *, unsigned short *); -static void _zip_write2(unsigned short, FILE *); -static void _zip_write4(unsigned int, FILE *); - - - -void -_zip_cdir_free(struct zip_cdir *cd) -{ - int i; - - if (!cd) - return; - - for (i=0; inentry; i++) - _zip_dirent_finalize(cd->entry+i); - free(cd->comment); - free(cd->entry); - free(cd); -} - - - -int -_zip_cdir_grow(struct zip_cdir *cd, int nentry, struct zip_error *error) -{ - struct zip_dirent *entry; - - if (nentry < cd->nentry) { - _zip_error_set(error, ZIP_ER_INTERNAL, 0); - return -1; - } - - if ((entry=((struct zip_dirent *) - realloc(cd->entry, sizeof(*(cd->entry))*nentry))) == NULL) { - _zip_error_set(error, ZIP_ER_MEMORY, 0); - return -1; - } - - cd->nentry = nentry; - cd->entry = entry; - - return 0; -} - - - -struct zip_cdir * -_zip_cdir_new(int nentry, struct zip_error *error) -{ - struct zip_cdir *cd; - - if ((cd=(struct zip_cdir *)malloc(sizeof(*cd))) == NULL) { - _zip_error_set(error, ZIP_ER_MEMORY, 0); - return NULL; - } - - if ((cd->entry=(struct zip_dirent *)malloc(sizeof(*(cd->entry))*nentry)) - == NULL) { - _zip_error_set(error, ZIP_ER_MEMORY, 0); - free(cd); - return NULL; - } - - /* entries must be initialized by caller */ - - cd->nentry = nentry; - cd->size = cd->offset = 0; - cd->comment = NULL; - cd->comment_len = 0; - - return cd; -} - - - -int -_zip_cdir_write(struct zip_cdir *cd, FILE *fp, struct zip_error *error) -{ - int i; - - cd->offset = ftello(fp); - - for (i=0; inentry; i++) { - if (_zip_dirent_write(cd->entry+i, fp, 0, error) != 0) - return -1; - } - - cd->size = ftello(fp) - cd->offset; - - /* clearerr(fp); */ - fwrite(EOCD_MAGIC, 1, 4, fp); - _zip_write4(0, fp); - _zip_write2((unsigned short)cd->nentry, fp); - _zip_write2((unsigned short)cd->nentry, fp); - _zip_write4(cd->size, fp); - _zip_write4(cd->offset, fp); - _zip_write2(cd->comment_len, fp); - fwrite(cd->comment, 1, cd->comment_len, fp); - - if (ferror(fp)) { - _zip_error_set(error, ZIP_ER_WRITE, errno); - return -1; - } - - return 0; -} - - - -void -_zip_dirent_finalize(struct zip_dirent *zde) -{ - free(zde->filename); - zde->filename = NULL; - free(zde->extrafield); - zde->extrafield = NULL; - free(zde->comment); - zde->comment = NULL; -} - - - -void -_zip_dirent_init(struct zip_dirent *de) -{ - de->version_madeby = 0; - de->version_needed = 20; /* 2.0 */ - de->bitflags = 0; - de->comp_method = 0; - de->last_mod = 0; - de->crc = 0; - de->comp_size = 0; - de->uncomp_size = 0; - de->filename = NULL; - de->filename_len = 0; - de->extrafield = NULL; - de->extrafield_len = 0; - de->comment = NULL; - de->comment_len = 0; - de->disk_number = 0; - de->int_attrib = 0; - de->ext_attrib = 0; - de->offset = 0; -} - - - -/* _zip_dirent_read(zde, fp, bufp, left, localp, error): - Fills the zip directory entry zde. - - If bufp is non-NULL, data is taken from there and bufp is advanced - by the amount of data used; otherwise data is read from fp as needed. - - if leftp is non-NULL, no more bytes than specified by it are used, - and *leftp is reduced by the number of bytes used. - - If local != 0, it reads a local header instead of a central - directory entry. - - Returns 0 if successful. On error, error is filled in and -1 is - returned. - - XXX: leftp and file position undefined on error. -*/ - -int -_zip_dirent_read(struct zip_dirent *zde, FILE *fp, - unsigned char **bufp, unsigned int *leftp, int local, - struct zip_error *error) -{ - unsigned char buf[CDENTRYSIZE]; - unsigned char *cur; - unsigned short dostime, dosdate; - unsigned int size; - - if (local) - size = LENTRYSIZE; - else - size = CDENTRYSIZE; - - if (leftp && (*leftp < size)) { - _zip_error_set(error, ZIP_ER_NOZIP, 0); - return -1; - } - - if (bufp) { - /* use data from buffer */ - cur = *bufp; - } - else { - /* read entry from disk */ - if ((fread(buf, 1, size, fp)version_madeby = _zip_read2(&cur); - else - zde->version_madeby = 0; - zde->version_needed = _zip_read2(&cur); - zde->bitflags = _zip_read2(&cur); - zde->comp_method = _zip_read2(&cur); - - /* convert to time_t */ - dostime = _zip_read2(&cur); - dosdate = _zip_read2(&cur); - zde->last_mod = _zip_d2u_time(dostime, dosdate); - - zde->crc = _zip_read4(&cur); - zde->comp_size = _zip_read4(&cur); - zde->uncomp_size = _zip_read4(&cur); - - zde->filename_len = _zip_read2(&cur); - zde->extrafield_len = _zip_read2(&cur); - - if (local) { - zde->comment_len = 0; - zde->disk_number = 0; - zde->int_attrib = 0; - zde->ext_attrib = 0; - zde->offset = 0; - } else { - zde->comment_len = _zip_read2(&cur); - zde->disk_number = _zip_read2(&cur); - zde->int_attrib = _zip_read2(&cur); - zde->ext_attrib = _zip_read4(&cur); - zde->offset = _zip_read4(&cur); - } - - zde->filename = NULL; - zde->extrafield = NULL; - zde->comment = NULL; - - size += zde->filename_len+zde->extrafield_len+zde->comment_len; - - if (leftp && (*leftp < size)) { - _zip_error_set(error, ZIP_ER_NOZIP, 0); - return -1; - } - - if (bufp) { - if (zde->filename_len) { - zde->filename = _zip_readstr(&cur, zde->filename_len, 1, error); - if (!zde->filename) - return -1; - } - - if (zde->extrafield_len) { - zde->extrafield = _zip_readstr(&cur, zde->extrafield_len, 0, - error); - if (!zde->extrafield) - return -1; - } - - if (zde->comment_len) { - zde->comment = _zip_readstr(&cur, zde->comment_len, 0, error); - if (!zde->comment) - return -1; - } - } - else { - if (zde->filename_len) { - zde->filename = _zip_readfpstr(fp, zde->filename_len, 1, error); - if (!zde->filename) - return -1; - } - - if (zde->extrafield_len) { - zde->extrafield = _zip_readfpstr(fp, zde->extrafield_len, 0, - error); - if (!zde->extrafield) - return -1; - } - - if (zde->comment_len) { - zde->comment = _zip_readfpstr(fp, zde->comment_len, 0, error); - if (!zde->comment) - return -1; - } - } - - if (bufp) - *bufp = cur; - if (leftp) - *leftp -= size; - - return 0; -} - - - -/* _zip_dirent_torrent_normalize(de); - Set values suitable for torrentzip. -*/ - -void -_zip_dirent_torrent_normalize(struct zip_dirent *de) -{ - static struct tm torrenttime; - static time_t last_mod = 0; - - if (last_mod == 0) { -#ifdef HAVE_STRUCT_TM_TM_ZONE - time_t now; - struct tm *l; -#endif - - torrenttime.tm_sec = 0; - torrenttime.tm_min = 32; - torrenttime.tm_hour = 23; - torrenttime.tm_mday = 24; - torrenttime.tm_mon = 11; - torrenttime.tm_year = 96; - torrenttime.tm_wday = 0; - torrenttime.tm_yday = 0; - torrenttime.tm_isdst = 0; - -#ifdef HAVE_STRUCT_TM_TM_ZONE - time(&now); - l = localtime(&now); - torrenttime.tm_gmtoff = l->tm_gmtoff; - torrenttime.tm_zone = l->tm_zone; -#endif - - last_mod = mktime(&torrenttime); - } - - de->version_madeby = 0; - de->version_needed = 20; /* 2.0 */ - de->bitflags = 2; /* maximum compression */ - de->comp_method = ZIP_CM_DEFLATE; - de->last_mod = last_mod; - - de->disk_number = 0; - de->int_attrib = 0; - de->ext_attrib = 0; - de->offset = 0; - - free(de->extrafield); - de->extrafield = NULL; - de->extrafield_len = 0; - free(de->comment); - de->comment = NULL; - de->comment_len = 0; -} - - - -/* _zip_dirent_write(zde, fp, localp, error): - Writes zip directory entry zde to file fp. - - If localp != 0, it writes a local header instead of a central - directory entry. - - Returns 0 if successful. On error, error is filled in and -1 is - returned. -*/ - -int -_zip_dirent_write(struct zip_dirent *zde, FILE *fp, int localp, - struct zip_error *error) -{ - unsigned short dostime, dosdate; - - fwrite(localp ? LOCAL_MAGIC : CENTRAL_MAGIC, 1, 4, fp); - - if (!localp) - _zip_write2(zde->version_madeby, fp); - _zip_write2(zde->version_needed, fp); - _zip_write2(zde->bitflags, fp); - _zip_write2(zde->comp_method, fp); - - _zip_u2d_time(zde->last_mod, &dostime, &dosdate); - _zip_write2(dostime, fp); - _zip_write2(dosdate, fp); - - _zip_write4(zde->crc, fp); - _zip_write4(zde->comp_size, fp); - _zip_write4(zde->uncomp_size, fp); - - _zip_write2(zde->filename_len, fp); - _zip_write2(zde->extrafield_len, fp); - - if (!localp) { - _zip_write2(zde->comment_len, fp); - _zip_write2(zde->disk_number, fp); - _zip_write2(zde->int_attrib, fp); - _zip_write4(zde->ext_attrib, fp); - _zip_write4(zde->offset, fp); - } - - if (zde->filename_len) - fwrite(zde->filename, 1, zde->filename_len, fp); - - if (zde->extrafield_len) - fwrite(zde->extrafield, 1, zde->extrafield_len, fp); - - if (!localp) { - if (zde->comment_len) - fwrite(zde->comment, 1, zde->comment_len, fp); - } - - if (ferror(fp)) { - _zip_error_set(error, ZIP_ER_WRITE, errno); - return -1; - } - - return 0; -} - - - -static time_t -_zip_d2u_time(int dtime, int ddate) -{ - struct tm tm; - - memset(&tm, 0, sizeof(tm)); - - /* let mktime decide if DST is in effect */ - tm.tm_isdst = -1; - - tm.tm_year = ((ddate>>9)&127) + 1980 - 1900; - tm.tm_mon = ((ddate>>5)&15) - 1; - tm.tm_mday = ddate&31; - - tm.tm_hour = (dtime>>11)&31; - tm.tm_min = (dtime>>5)&63; - tm.tm_sec = (dtime<<1)&62; - - return mktime(&tm); -} - - - -unsigned short -_zip_read2(unsigned char **a) -{ - unsigned short ret; - - ret = (*a)[0]+((*a)[1]<<8); - *a += 2; - - return ret; -} - - - -unsigned int -_zip_read4(unsigned char **a) -{ - unsigned int ret; - - ret = ((((((*a)[3]<<8)+(*a)[2])<<8)+(*a)[1])<<8)+(*a)[0]; - *a += 4; - - return ret; -} - - - -static char * -_zip_readfpstr(FILE *fp, unsigned int len, int nulp, struct zip_error *error) -{ - char *r, *o; - - r = (char *)malloc(nulp ? len+1 : len); - if (!r) { - _zip_error_set(error, ZIP_ER_MEMORY, 0); - return NULL; - } - - if (fread(r, 1, len, fp)>8)&0xff, fp); - - return; -} - - - -static void -_zip_write4(unsigned int i, FILE *fp) -{ - putc(i&0xff, fp); - putc((i>>8)&0xff, fp); - putc((i>>16)&0xff, fp); - putc((i>>24)&0xff, fp); - - return; -} - - - -static void -_zip_u2d_time(time_t time, unsigned short *dtime, unsigned short *ddate) -{ - struct tm *tm; - - tm = localtime(&time); - *ddate = ((tm->tm_year+1900-1980)<<9) + ((tm->tm_mon+1)<<5) - + tm->tm_mday; - *dtime = ((tm->tm_hour)<<11) + ((tm->tm_min)<<5) - + ((tm->tm_sec)>>1); - - return; -} diff --git a/core/deps/libzip/zip_fopen_index.c b/core/deps/libzip/zip_fopen_index.c deleted file mode 100644 index a330d697d..000000000 --- a/core/deps/libzip/zip_fopen_index.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - zip_fopen_index.c -- open file in zip archive for reading by index - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner - - This file is part of libzip, a library to manipulate ZIP archives. - The authors can be contacted at - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - 3. The names of the authors may not be used to endorse or promote - products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - - -#include -#include -#include - -#include "zipint.h" - -static struct zip_file *_zip_file_new(struct zip *za); - - - -ZIP_EXTERN struct zip_file * -zip_fopen_index(struct zip *za, int fileno, int flags) -{ - int len, ret; - int zfflags; - struct zip_file *zf; - - if ((fileno < 0) || (fileno >= za->nentry)) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return NULL; - } - - if ((flags & ZIP_FL_UNCHANGED) == 0 - && ZIP_ENTRY_DATA_CHANGED(za->entry+fileno)) { - _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); - return NULL; - } - - if (fileno >= za->cdir->nentry) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return NULL; - } - - zfflags = 0; - switch (za->cdir->entry[fileno].comp_method) { - case ZIP_CM_STORE: - zfflags |= ZIP_ZF_CRC; - break; - - case ZIP_CM_DEFLATE: - if ((flags & ZIP_FL_COMPRESSED) == 0) - zfflags |= ZIP_ZF_CRC | ZIP_ZF_DECOMP; - break; - default: - if ((flags & ZIP_FL_COMPRESSED) == 0) { - _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); - return NULL; - } - break; - } - - zf = _zip_file_new(za); - - zf->flags = zfflags; - /* zf->name = za->cdir->entry[fileno].filename; */ - zf->method = za->cdir->entry[fileno].comp_method; - zf->bytes_left = za->cdir->entry[fileno].uncomp_size; - zf->cbytes_left = za->cdir->entry[fileno].comp_size; - zf->crc_orig = za->cdir->entry[fileno].crc; - - if ((zf->fpos=_zip_file_get_offset(za, fileno)) == 0) { - zip_fclose(zf); - return NULL; - } - - if ((zf->flags & ZIP_ZF_DECOMP) == 0) - zf->bytes_left = zf->cbytes_left; - else { - if ((zf->buffer=(char *)malloc(BUFSIZE)) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - zip_fclose(zf); - return NULL; - } - - len = _zip_file_fillbuf(zf->buffer, BUFSIZE, zf); - if (len <= 0) { - _zip_error_copy(&za->error, &zf->error); - zip_fclose(zf); - return NULL; - } - - if ((zf->zstr = (z_stream *)malloc(sizeof(z_stream))) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - zip_fclose(zf); - return NULL; - } - zf->zstr->zalloc = Z_NULL; - zf->zstr->zfree = Z_NULL; - zf->zstr->opaque = NULL; - zf->zstr->next_in = (Bytef *)zf->buffer; - zf->zstr->avail_in = len; - - /* negative value to tell zlib that there is no header */ - if ((ret=inflateInit2(zf->zstr, -MAX_WBITS)) != Z_OK) { - _zip_error_set(&za->error, ZIP_ER_ZLIB, ret); - zip_fclose(zf); - return NULL; - } - } - - return zf; -} - - - -int -_zip_file_fillbuf(void *buf, size_t buflen, struct zip_file *zf) -{ - int i, j; - - if (zf->error.zip_err != ZIP_ER_OK) - return -1; - - if ((zf->flags & ZIP_ZF_EOF) || zf->cbytes_left <= 0 || buflen <= 0) - return 0; - - if (fseeko(zf->za->zp, zf->fpos, SEEK_SET) < 0) { - _zip_error_set(&zf->error, ZIP_ER_SEEK, errno); - return -1; - } - if (buflen < zf->cbytes_left) - i = buflen; - else - i = zf->cbytes_left; - - j = fread(buf, 1, i, zf->za->zp); - if (j == 0) { - _zip_error_set(&zf->error, ZIP_ER_EOF, 0); - j = -1; - } - else if (j < 0) - _zip_error_set(&zf->error, ZIP_ER_READ, errno); - else { - zf->fpos += j; - zf->cbytes_left -= j; - } - - return j; -} - - - -static struct zip_file * -_zip_file_new(struct zip *za) -{ - struct zip_file *zf, **file; - int n; - - if ((zf=(struct zip_file *)malloc(sizeof(struct zip_file))) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return NULL; - } - - if (za->nfile >= za->nfile_alloc-1) { - n = za->nfile_alloc + 10; - file = (struct zip_file **)realloc(za->file, - n*sizeof(struct zip_file *)); - if (file == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - free(zf); - return NULL; - } - za->nfile_alloc = n; - za->file = file; - } - - za->file[za->nfile++] = zf; - - zf->za = za; - _zip_error_init(&zf->error); - zf->flags = 0; - zf->crc = crc32(0L, Z_NULL, 0); - zf->crc_orig = 0; - zf->method = -1; - zf->bytes_left = zf->cbytes_left = 0; - zf->fpos = 0; - zf->buffer = NULL; - zf->zstr = NULL; - - return zf; -} diff --git a/core/deps/libzip/zip_fread.c b/core/deps/libzip/zip_fread.c deleted file mode 100644 index 2a7fb42c7..000000000 --- a/core/deps/libzip/zip_fread.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - zip_fread.c -- read from file - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner - - This file is part of libzip, a library to manipulate ZIP archives. - The authors can be contacted at - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - 3. The names of the authors may not be used to endorse or promote - products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - - -#include "zipint.h" - - - -ZIP_EXTERN ssize_t -zip_fread(struct zip_file *zf, void *outbuf, size_t toread) -{ - int ret; - size_t out_before, len; - int i; - - if (!zf) - return -1; - - if (zf->error.zip_err != 0) - return -1; - - if ((zf->flags & ZIP_ZF_EOF) || (toread == 0)) - return 0; - - if (zf->bytes_left == 0) { - zf->flags |= ZIP_ZF_EOF; - if (zf->flags & ZIP_ZF_CRC) { - if (zf->crc != zf->crc_orig) { - _zip_error_set(&zf->error, ZIP_ER_CRC, 0); - return -1; - } - } - return 0; - } - - if ((zf->flags & ZIP_ZF_DECOMP) == 0) { - ret = _zip_file_fillbuf(outbuf, toread, zf); - if (ret > 0) { - if (zf->flags & ZIP_ZF_CRC) - zf->crc = crc32(zf->crc, (Bytef *)outbuf, ret); - zf->bytes_left -= ret; - } - return ret; - } - - zf->zstr->next_out = (Bytef *)outbuf; - zf->zstr->avail_out = toread; - out_before = zf->zstr->total_out; - - /* endless loop until something has been accomplished */ - for (;;) { - ret = inflate(zf->zstr, Z_SYNC_FLUSH); - - switch (ret) { - case Z_STREAM_END: - if (zf->zstr->total_out == out_before) { - if (zf->crc != zf->crc_orig) { - _zip_error_set(&zf->error, ZIP_ER_CRC, 0); - return -1; - } - else - return 0; - } - - /* fallthrough */ - - case Z_OK: - len = zf->zstr->total_out - out_before; - if (len >= zf->bytes_left || len >= toread) { - if (zf->flags & ZIP_ZF_CRC) - zf->crc = crc32(zf->crc, (Bytef *)outbuf, len); - zf->bytes_left -= len; - return len; - } - break; - - case Z_BUF_ERROR: - if (zf->zstr->avail_in == 0) { - i = _zip_file_fillbuf(zf->buffer, BUFSIZE, zf); - if (i == 0) { - _zip_error_set(&zf->error, ZIP_ER_INCONS, 0); - return -1; - } - else if (i < 0) - return -1; - zf->zstr->next_in = (Bytef *)zf->buffer; - zf->zstr->avail_in = i; - continue; - } - /* fallthrough */ - case Z_NEED_DICT: - case Z_DATA_ERROR: - case Z_STREAM_ERROR: - case Z_MEM_ERROR: - _zip_error_set(&zf->error, ZIP_ER_ZLIB, ret); - return -1; - } - } -} diff --git a/core/deps/libzip/zip_open.c b/core/deps/libzip/zip_open.c deleted file mode 100644 index a65974df9..000000000 --- a/core/deps/libzip/zip_open.c +++ /dev/null @@ -1,567 +0,0 @@ -/* - zip_open.c -- open zip archive - Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner - - This file is part of libzip, a library to manipulate ZIP archives. - The authors can be contacted at - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - 3. The names of the authors may not be used to endorse or promote - products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - - -#include -#include -#include -#include -#include -#include - -#include "zipint.h" - -static void set_error(int *, struct zip_error *, int); -static struct zip *_zip_allocate_new(const char *, int *); -static int _zip_checkcons(FILE *, struct zip_cdir *, struct zip_error *); -static void _zip_check_torrentzip(struct zip *); -static struct zip_cdir *_zip_find_central_dir(FILE *, int, int *, off_t); -static int _zip_file_exists(const char *, int, int *); -static int _zip_headercomp(struct zip_dirent *, int, - struct zip_dirent *, int); -static unsigned char *_zip_memmem(const unsigned char *, int, - const unsigned char *, int); -static struct zip_cdir *_zip_readcdir(FILE *, unsigned char *, unsigned char *, - int, int, struct zip_error *); - - - -ZIP_EXTERN struct zip * -zip_open(const char *fn, int flags, int *zep) -{ - FILE *fp; - struct zip *za; - struct zip_cdir *cdir; - int i; - off_t len; - - switch (_zip_file_exists(fn, flags, zep)) { - case -1: - return NULL; - case 0: - return _zip_allocate_new(fn, zep); - default: - break; - } - - if ((fp=fopen(fn, "rb")) == NULL) { - set_error(zep, NULL, ZIP_ER_OPEN); - return NULL; - } - - fseeko(fp, 0, SEEK_END); - len = ftello(fp); - - /* treat empty files as empty archives */ - if (len == 0) { - if ((za=_zip_allocate_new(fn, zep)) == NULL) - fclose(fp); - else - za->zp = fp; - return za; - } - - cdir = _zip_find_central_dir(fp, flags, zep, len); - if (cdir == NULL) { - fclose(fp); - return NULL; - } - - if ((za=_zip_allocate_new(fn, zep)) == NULL) { - _zip_cdir_free(cdir); - fclose(fp); - return NULL; - } - - za->cdir = cdir; - za->zp = fp; - - if ((za->entry=(struct zip_entry *)malloc(sizeof(*(za->entry)) - * cdir->nentry)) == NULL) { - set_error(zep, NULL, ZIP_ER_MEMORY); - _zip_free(za); - return NULL; - } - for (i=0; inentry; i++) - _zip_entry_new(za); - - _zip_check_torrentzip(za); - za->ch_flags = za->flags; - - return za; -} - - - -static void -set_error(int *zep, struct zip_error *err, int ze) -{ - int se; - - if (err) { - _zip_error_get(err, &ze, &se); - if (zip_error_get_sys_type(ze) == ZIP_ET_SYS) - errno = se; - } - - if (zep) - *zep = ze; -} - - - -/* _zip_readcdir: - tries to find a valid end-of-central-directory at the beginning of - buf, and then the corresponding central directory entries. - Returns a struct zip_cdir which contains the central directory - entries, or NULL if unsuccessful. */ - -static struct zip_cdir * -_zip_readcdir(FILE *fp, unsigned char *buf, unsigned char *eocd, int buflen, - int flags, struct zip_error *error) -{ - struct zip_cdir *cd; - unsigned char *cdp, **bufp; - int i, comlen, nentry; - unsigned int left; - - comlen = buf + buflen - eocd - EOCDLEN; - if (comlen < 0) { - /* not enough bytes left for comment */ - _zip_error_set(error, ZIP_ER_NOZIP, 0); - return NULL; - } - - /* check for end-of-central-dir magic */ - if (memcmp(eocd, EOCD_MAGIC, 4) != 0) { - _zip_error_set(error, ZIP_ER_NOZIP, 0); - return NULL; - } - - if (memcmp(eocd+4, "\0\0\0\0", 4) != 0) { - _zip_error_set(error, ZIP_ER_MULTIDISK, 0); - return NULL; - } - - cdp = eocd + 8; - /* number of cdir-entries on this disk */ - i = _zip_read2(&cdp); - /* number of cdir-entries */ - nentry = _zip_read2(&cdp); - - if ((cd=_zip_cdir_new(nentry, error)) == NULL) - return NULL; - - cd->size = _zip_read4(&cdp); - cd->offset = _zip_read4(&cdp); - cd->comment = NULL; - cd->comment_len = _zip_read2(&cdp); - - if ((comlen < cd->comment_len) || (cd->nentry != i)) { - _zip_error_set(error, ZIP_ER_NOZIP, 0); - free(cd); - return NULL; - } - if ((flags & ZIP_CHECKCONS) && comlen != cd->comment_len) { - _zip_error_set(error, ZIP_ER_INCONS, 0); - free(cd); - return NULL; - } - - if (cd->comment_len) { - if ((cd->comment=(char *)_zip_memdup(eocd+EOCDLEN, - cd->comment_len, error)) - == NULL) { - free(cd); - return NULL; - } - } - - if (cd->size < (unsigned int)(eocd-buf)) { - /* if buffer already read in, use it */ - cdp = eocd - cd->size; - bufp = &cdp; - } - else { - /* go to start of cdir and read it entry by entry */ - bufp = NULL; - clearerr(fp); - fseeko(fp, cd->offset, SEEK_SET); - /* possible consistency check: cd->offset = - len-(cd->size+cd->comment_len+EOCDLEN) ? */ - if (ferror(fp) || ((unsigned long)ftello(fp) != cd->offset)) { - /* seek error or offset of cdir wrong */ - if (ferror(fp)) - _zip_error_set(error, ZIP_ER_SEEK, errno); - else - _zip_error_set(error, ZIP_ER_NOZIP, 0); - free(cd); - return NULL; - } - } - - left = cd->size; - i=0; - do { - if (i == cd->nentry && left > 0) { - /* Infozip extension for more than 64k entries: - nentries wraps around, size indicates correct EOCD */ - _zip_cdir_grow(cd, cd->nentry+0x10000, error); - } - - if ((_zip_dirent_read(cd->entry+i, fp, bufp, &left, 0, error)) < 0) { - cd->nentry = i; - _zip_cdir_free(cd); - return NULL; - } - i++; - - } while (inentry); - - return cd; -} - - - -/* _zip_checkcons: - Checks the consistency of the central directory by comparing central - directory entries with local headers and checking for plausible - file and header offsets. Returns -1 if not plausible, else the - difference between the lowest and the highest fileposition reached */ - -static int -_zip_checkcons(FILE *fp, struct zip_cdir *cd, struct zip_error *error) -{ - int i; - unsigned int min, max, j; - struct zip_dirent temp; - - if (cd->nentry) { - max = cd->entry[0].offset; - min = cd->entry[0].offset; - } - else - min = max = 0; - - for (i=0; inentry; i++) { - if (cd->entry[i].offset < min) - min = cd->entry[i].offset; - if (min > cd->offset) { - _zip_error_set(error, ZIP_ER_NOZIP, 0); - return -1; - } - - j = cd->entry[i].offset + cd->entry[i].comp_size - + cd->entry[i].filename_len + LENTRYSIZE; - if (j > max) - max = j; - if (max > cd->offset) { - _zip_error_set(error, ZIP_ER_NOZIP, 0); - return -1; - } - - if (fseeko(fp, cd->entry[i].offset, SEEK_SET) != 0) { - _zip_error_set(error, ZIP_ER_SEEK, 0); - return -1; - } - - if (_zip_dirent_read(&temp, fp, NULL, NULL, 1, error) == -1) - return -1; - - if (_zip_headercomp(cd->entry+i, 0, &temp, 1) != 0) { - _zip_error_set(error, ZIP_ER_INCONS, 0); - _zip_dirent_finalize(&temp); - return -1; - } - _zip_dirent_finalize(&temp); - } - - return max - min; -} - - - -/* _zip_check_torrentzip: - check wether ZA has a valid TORRENTZIP comment, i.e. is torrentzipped */ - -static void -_zip_check_torrentzip(struct zip *za) -{ - uLong crc_got, crc_should; - char buf[8+1]; - char *end; - - if (za->zp == NULL || za->cdir == NULL) - return; - - if (za->cdir->comment_len != TORRENT_SIG_LEN+8 - || strncmp(za->cdir->comment, TORRENT_SIG, TORRENT_SIG_LEN) != 0) - return; - - memcpy(buf, za->cdir->comment+TORRENT_SIG_LEN, 8); - buf[8] = '\0'; - errno = 0; - crc_should = strtoul(buf, &end, 16); - if ((crc_should == UINT_MAX && errno != 0) || (end && *end)) - return; - - if (_zip_filerange_crc(za->zp, za->cdir->offset, za->cdir->size, - &crc_got, NULL) < 0) - return; - - if (crc_got == crc_should) - za->flags |= ZIP_AFL_TORRENT; -} - - - - -/* _zip_headercomp: - compares two headers h1 and h2; if they are local headers, set - local1p or local2p respectively to 1, else 0. Return 0 if they - are identical, -1 if not. */ - -static int -_zip_headercomp(struct zip_dirent *h1, int local1p, struct zip_dirent *h2, - int local2p) -{ - if ((h1->version_needed != h2->version_needed) -#if 0 - /* some zip-files have different values in local - and global headers for the bitflags */ - || (h1->bitflags != h2->bitflags) -#endif - || (h1->comp_method != h2->comp_method) - || (h1->last_mod != h2->last_mod) - || (h1->filename_len != h2->filename_len) - || !h1->filename || !h2->filename - || strcmp(h1->filename, h2->filename)) - return -1; - - /* check that CRC and sizes are zero if data descriptor is used */ - if ((h1->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) && local1p - && (h1->crc != 0 - || h1->comp_size != 0 - || h1->uncomp_size != 0)) - return -1; - if ((h2->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) && local2p - && (h2->crc != 0 - || h2->comp_size != 0 - || h2->uncomp_size != 0)) - return -1; - - /* check that CRC and sizes are equal if no data descriptor is used */ - if (((h1->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) == 0 || local1p == 0) - && ((h2->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) == 0 || local2p == 0)) { - if ((h1->crc != h2->crc) - || (h1->comp_size != h2->comp_size) - || (h1->uncomp_size != h2->uncomp_size)) - return -1; - } - - if ((local1p == local2p) - && ((h1->extrafield_len != h2->extrafield_len) - || (h1->extrafield_len && h2->extrafield - && memcmp(h1->extrafield, h2->extrafield, - h1->extrafield_len)))) - return -1; - - /* if either is local, nothing more to check */ - if (local1p || local2p) - return 0; - - if ((h1->version_madeby != h2->version_madeby) - || (h1->disk_number != h2->disk_number) - || (h1->int_attrib != h2->int_attrib) - || (h1->ext_attrib != h2->ext_attrib) - || (h1->offset != h2->offset) - || (h1->comment_len != h2->comment_len) - || (h1->comment_len && h2->comment - && memcmp(h1->comment, h2->comment, h1->comment_len))) - return -1; - - return 0; -} - - - -static struct zip * -_zip_allocate_new(const char *fn, int *zep) -{ - struct zip *za; - struct zip_error error; - - if ((za=_zip_new(&error)) == NULL) { - set_error(zep, &error, 0); - return NULL; - } - - za->zn = strdup(fn); - if (!za->zn) { - _zip_free(za); - set_error(zep, NULL, ZIP_ER_MEMORY); - return NULL; - } - return za; -} - - - -static int -_zip_file_exists(const char *fn, int flags, int *zep) -{ - struct stat st; - - if (fn == NULL) { - set_error(zep, NULL, ZIP_ER_INVAL); - return -1; - } - - if (stat(fn, &st) != 0) { - if (flags & ZIP_CREATE) - return 0; - else { - set_error(zep, NULL, ZIP_ER_OPEN); - return -1; - } - } - else if ((flags & ZIP_EXCL)) { - set_error(zep, NULL, ZIP_ER_EXISTS); - return -1; - } - /* ZIP_CREATE gets ignored if file exists and not ZIP_EXCL, - just like open() */ - - return 1; -} - - - -static struct zip_cdir * -_zip_find_central_dir(FILE *fp, int flags, int *zep, off_t len) -{ - struct zip_cdir *cdir, *cdirnew; - unsigned char *buf, *match; - int a, best, buflen, i; - struct zip_error zerr; - - i = fseeko(fp, -(len < CDBUFSIZE ? len : CDBUFSIZE), SEEK_END); - if (i == -1 && errno != EFBIG) { - /* seek before start of file on my machine */ - set_error(zep, NULL, ZIP_ER_SEEK); - return NULL; - } - - /* 64k is too much for stack */ - if ((buf=(unsigned char *)malloc(CDBUFSIZE)) == NULL) { - set_error(zep, NULL, ZIP_ER_MEMORY); - return NULL; - } - - clearerr(fp); - buflen = fread(buf, 1, CDBUFSIZE, fp); - - if (ferror(fp)) { - set_error(zep, NULL, ZIP_ER_READ); - free(buf); - return NULL; - } - - best = -1; - cdir = NULL; - match = buf; - _zip_error_set(&zerr, ZIP_ER_NOZIP, 0); - - while ((match=_zip_memmem(match, buflen-(match-buf)-18, - (const unsigned char *)EOCD_MAGIC, 4))!=NULL) { - /* found match -- check, if good */ - /* to avoid finding the same match all over again */ - match++; - if ((cdirnew=_zip_readcdir(fp, buf, match-1, buflen, flags, - &zerr)) == NULL) - continue; - - if (cdir) { - if (best <= 0) - best = _zip_checkcons(fp, cdir, &zerr); - a = _zip_checkcons(fp, cdirnew, &zerr); - if (best < a) { - _zip_cdir_free(cdir); - cdir = cdirnew; - best = a; - } - else - _zip_cdir_free(cdirnew); - } - else { - cdir = cdirnew; - if (flags & ZIP_CHECKCONS) - best = _zip_checkcons(fp, cdir, &zerr); - else - best = 0; - } - cdirnew = NULL; - } - - free(buf); - - if (best < 0) { - set_error(zep, &zerr, 0); - _zip_cdir_free(cdir); - return NULL; - } - - return cdir; -} - - - -static unsigned char * -_zip_memmem(const unsigned char *big, int biglen, const unsigned char *little, - int littlelen) -{ - const unsigned char *p; - - if ((biglen < littlelen) || (littlelen == 0)) - return NULL; - p = big-1; - while ((p=(const unsigned char *) - memchr(p+1, little[0], (size_t)(big-(p+1)+biglen-littlelen+1))) - != NULL) { - if (memcmp(p+1, little+1, littlelen-1)==0) - return (unsigned char *)p; - } - - return NULL; -} diff --git a/core/deps/libzip/zip_source_buffer.c b/core/deps/libzip/zip_source_buffer.c deleted file mode 100644 index 1e9121c56..000000000 --- a/core/deps/libzip/zip_source_buffer.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - zip_source_buffer.c -- create zip data source from buffer - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner - - This file is part of libzip, a library to manipulate ZIP archives. - The authors can be contacted at - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - 3. The names of the authors may not be used to endorse or promote - products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - - -#include -#include - -#include "zipint.h" - -struct read_data { - const char *buf, *data, *end; - time_t mtime; - int freep; -}; - -static ssize_t read_data(void *state, void *data, size_t len, - enum zip_source_cmd cmd); - - - -ZIP_EXTERN struct zip_source * -zip_source_buffer(struct zip *za, const void *data, off_t len, int freep) -{ - struct read_data *f; - struct zip_source *zs; - - if (za == NULL) - return NULL; - - if (len < 0 || (data == NULL && len > 0)) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return NULL; - } - - if ((f=(struct read_data *)malloc(sizeof(*f))) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return NULL; - } - - f->data = (const char *)data; - f->end = ((const char *)data)+len; - f->freep = freep; - f->mtime = time(NULL); - - if ((zs=zip_source_function(za, read_data, f)) == NULL) { - free(f); - return NULL; - } - - return zs; -} - - - -static ssize_t -read_data(void *state, void *data, size_t len, enum zip_source_cmd cmd) -{ - struct read_data *z; - char *buf; - size_t n; - - z = (struct read_data *)state; - buf = (char *)data; - - switch (cmd) { - case ZIP_SOURCE_OPEN: - z->buf = z->data; - return 0; - - case ZIP_SOURCE_READ: - n = z->end - z->buf; - if (n > len) - n = len; - - if (n) { - memcpy(buf, z->buf, n); - z->buf += n; - } - - return n; - - case ZIP_SOURCE_CLOSE: - return 0; - - case ZIP_SOURCE_STAT: - { - struct zip_stat *st; - - if (len < sizeof(*st)) - return -1; - - st = (struct zip_stat *)data; - - zip_stat_init(st); - st->mtime = z->mtime; - st->size = z->end - z->data; - - return sizeof(*st); - } - - case ZIP_SOURCE_ERROR: - { - int *e; - - if (len < sizeof(int)*2) - return -1; - - e = (int *)data; - e[0] = e[1] = 0; - } - return sizeof(int)*2; - - case ZIP_SOURCE_FREE: - if (z->freep) { - free((void *)z->data); - z->data = NULL; - } - free(z); - return 0; - - default: - ; - } - - return -1; -} diff --git a/core/deps/libzip/zip_source_filep.c b/core/deps/libzip/zip_source_filep.c deleted file mode 100644 index 537393410..000000000 --- a/core/deps/libzip/zip_source_filep.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - zip_source_filep.c -- create data source from FILE * - Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner - - This file is part of libzip, a library to manipulate ZIP archives. - The authors can be contacted at - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - 3. The names of the authors may not be used to endorse or promote - products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - - -#include -#include -#include -#include -#include - -#include "zipint.h" - -struct read_file { - char *fname; /* name of file to copy from */ - FILE *f; /* file to copy from */ - off_t off; /* start offset of */ - off_t len; /* lengt of data to copy */ - off_t remain; /* bytes remaining to be copied */ - int e[2]; /* error codes */ -}; - -static ssize_t read_file(void *state, void *data, size_t len, - enum zip_source_cmd cmd); - - - -ZIP_EXTERN struct zip_source * -zip_source_filep(struct zip *za, FILE *file, off_t start, off_t len) -{ - if (za == NULL) - return NULL; - - if (file == NULL || start < 0 || len < -1) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return NULL; - } - - return _zip_source_file_or_p(za, NULL, file, start, len); -} - - - -struct zip_source * -_zip_source_file_or_p(struct zip *za, const char *fname, FILE *file, - off_t start, off_t len) -{ - struct read_file *f; - struct zip_source *zs; - - if (file == NULL && fname == NULL) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return NULL; - } - - if ((f=(struct read_file *)malloc(sizeof(struct read_file))) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return NULL; - } - - f->fname = NULL; - if (fname) { - if ((f->fname=strdup(fname)) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - free(f); - return NULL; - } - } - f->f = file; - f->off = start; - f->len = (len ? len : -1); - - if ((zs=zip_source_function(za, read_file, f)) == NULL) { - free(f); - return NULL; - } - - return zs; -} - - - -static ssize_t -read_file(void *state, void *data, size_t len, enum zip_source_cmd cmd) -{ - struct read_file *z; - char *buf; - int i, n; - - z = (struct read_file *)state; - buf = (char *)data; - - switch (cmd) { - case ZIP_SOURCE_OPEN: - if (z->fname) { - if ((z->f=fopen(z->fname, "rb")) == NULL) { - z->e[0] = ZIP_ER_OPEN; - z->e[1] = errno; - return -1; - } - } - - if (fseeko(z->f, z->off, SEEK_SET) < 0) { - z->e[0] = ZIP_ER_SEEK; - z->e[1] = errno; - return -1; - } - z->remain = z->len; - return 0; - - case ZIP_SOURCE_READ: - if (z->remain != -1) - n = len > z->remain ? z->remain : len; - else - n = len; - - if ((i=fread(buf, 1, n, z->f)) < 0) { - z->e[0] = ZIP_ER_READ; - z->e[1] = errno; - return -1; - } - - if (z->remain != -1) - z->remain -= i; - - return i; - - case ZIP_SOURCE_CLOSE: - if (z->fname) { - fclose(z->f); - z->f = NULL; - } - return 0; - - case ZIP_SOURCE_STAT: - { - struct zip_stat *st; - struct stat fst; - int err; - - if (len < sizeof(*st)) - return -1; - - if (z->f) - err = fstat(fileno(z->f), &fst); - else - err = stat(z->fname, &fst); - - if (err != 0) { - z->e[0] = ZIP_ER_READ; /* best match */ - z->e[1] = errno; - return -1; - } - - st = (struct zip_stat *)data; - - zip_stat_init(st); - st->mtime = fst.st_mtime; - if (z->len != -1) - st->size = z->len; - else if ((fst.st_mode&S_IFMT) == S_IFREG) - st->size = fst.st_size; - - return sizeof(*st); - } - - case ZIP_SOURCE_ERROR: - if (len < sizeof(int)*2) - return -1; - - memcpy(data, z->e, sizeof(int)*2); - return sizeof(int)*2; - - case ZIP_SOURCE_FREE: - free(z->fname); - if (z->f) - fclose(z->f); - free(z); - return 0; - - default: - ; - } - - return -1; -} diff --git a/core/deps/libzip/zip_source_zip.c b/core/deps/libzip/zip_source_zip.c deleted file mode 100644 index 3eef552a2..000000000 --- a/core/deps/libzip/zip_source_zip.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - zip_source_zip.c -- create data source from zip file - Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner - - This file is part of libzip, a library to manipulate ZIP archives. - The authors can be contacted at - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - 3. The names of the authors may not be used to endorse or promote - products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - - -#include -#include - -#include "zipint.h" - -struct read_zip { - struct zip_file *zf; - struct zip_stat st; - off_t off, len; -}; - -static ssize_t read_zip(void *st, void *data, size_t len, - enum zip_source_cmd cmd); - - - -ZIP_EXTERN struct zip_source * -zip_source_zip(struct zip *za, struct zip *srcza, int srcidx, int flags, - off_t start, off_t len) -{ - struct zip_error error; - struct zip_source *zs; - struct read_zip *p; - - /* XXX: ZIP_FL_RECOMPRESS */ - - if (za == NULL) - return NULL; - - if (srcza == NULL || start < 0 || len < -1 || srcidx < 0 || srcidx >= srcza->nentry) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return NULL; - } - - if ((flags & ZIP_FL_UNCHANGED) == 0 - && ZIP_ENTRY_DATA_CHANGED(srcza->entry+srcidx)) { - _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); - return NULL; - } - - if (len == 0) - len = -1; - - if (start == 0 && len == -1 && (flags & ZIP_FL_RECOMPRESS) == 0) - flags |= ZIP_FL_COMPRESSED; - else - flags &= ~ZIP_FL_COMPRESSED; - - if ((p=(struct read_zip *)malloc(sizeof(*p))) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return NULL; - } - - _zip_error_copy(&error, &srcza->error); - - if (zip_stat_index(srcza, srcidx, flags, &p->st) < 0 - || (p->zf=zip_fopen_index(srcza, srcidx, flags)) == NULL) { - free(p); - _zip_error_copy(&za->error, &srcza->error); - _zip_error_copy(&srcza->error, &error); - - return NULL; - } - p->off = start; - p->len = len; - - if ((flags & ZIP_FL_COMPRESSED) == 0) { - p->st.size = p->st.comp_size = len; - p->st.comp_method = ZIP_CM_STORE; - p->st.crc = 0; - } - - if ((zs=zip_source_function(za, read_zip, p)) == NULL) { - free(p); - return NULL; - } - - return zs; -} - - - -static ssize_t -read_zip(void *state, void *data, size_t len, enum zip_source_cmd cmd) -{ - struct read_zip *z; - char b[8192], *buf; - int i, n; - - z = (struct read_zip *)state; - buf = (char *)data; - - switch (cmd) { - case ZIP_SOURCE_OPEN: - for (n=0; noff; n+= i) { - i = (z->off-n > sizeof(b) ? sizeof(b) : z->off-n); - if ((i=zip_fread(z->zf, b, i)) < 0) { - zip_fclose(z->zf); - z->zf = NULL; - return -1; - } - } - return 0; - - case ZIP_SOURCE_READ: - if (z->len != -1) - n = len > z->len ? z->len : len; - else - n = len; - - - if ((i=zip_fread(z->zf, buf, n)) < 0) - return -1; - - if (z->len != -1) - z->len -= i; - - return i; - - case ZIP_SOURCE_CLOSE: - return 0; - - case ZIP_SOURCE_STAT: - if (len < sizeof(z->st)) - return -1; - len = sizeof(z->st); - - memcpy(data, &z->st, len); - return len; - - case ZIP_SOURCE_ERROR: - { - int *e; - - if (len < sizeof(int)*2) - return -1; - - e = (int *)data; - zip_file_error_get(z->zf, e, e+1); - } - return sizeof(int)*2; - - case ZIP_SOURCE_FREE: - zip_fclose(z->zf); - free(z); - return 0; - - default: - ; - } - - return -1; -} diff --git a/core/deps/libzip/zipint.h b/core/deps/libzip/zipint.h deleted file mode 100644 index f5a81b193..000000000 --- a/core/deps/libzip/zipint.h +++ /dev/null @@ -1,264 +0,0 @@ -#ifndef _HAD_ZIPINT_H -#define _HAD_ZIPINT_H - -/* - zipint.h -- internal declarations. - Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner - - This file is part of libzip, a library to manipulate ZIP archives. - The authors can be contacted at - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - 3. The names of the authors may not be used to endorse or promote - products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include - -#ifdef _MSC_VER -#define ZIP_EXTERN __declspec(dllimport) -#endif - -#include "zip.h" -#include "config.h" - -#ifndef HAVE_MKSTEMP -int _zip_mkstemp(char *); -#define mkstemp _zip_mkstemp -#endif - -#ifdef HAVE_MOVEFILEEXA -#include -#define _zip_rename(s, t) \ - (!MoveFileExA((s), (t), \ - MOVEFILE_COPY_ALLOWED|MOVEFILE_REPLACE_EXISTING)) -#else -#define _zip_rename rename -#endif - -#ifndef HAVE_FSEEKO -#define fseeko(s, o, w) (fseek((s), (long int)(o), (w))) -#endif -#ifndef HAVE_FTELLO -#define ftello(s) ((long)ftell((s))) -#endif - - - -#define CENTRAL_MAGIC "PK\1\2" -#define LOCAL_MAGIC "PK\3\4" -#define EOCD_MAGIC "PK\5\6" -#define DATADES_MAGIC "PK\7\8" -#define TORRENT_SIG "TORRENTZIPPED-" -#define TORRENT_SIG_LEN 14 -#define TORRENT_CRC_LEN 8 -#define TORRENT_MEM_LEVEL 8 -#define CDENTRYSIZE 46u -#define LENTRYSIZE 30 -#define MAXCOMLEN 65536 -#define EOCDLEN 22 -#define CDBUFSIZE (MAXCOMLEN+EOCDLEN) -#define BUFSIZE 8192 - - - -/* state of change of a file in zip archive */ - -enum zip_state { ZIP_ST_UNCHANGED, ZIP_ST_DELETED, ZIP_ST_REPLACED, - ZIP_ST_ADDED, ZIP_ST_RENAMED }; - -/* constants for struct zip_file's member flags */ - -#define ZIP_ZF_EOF 1 /* EOF reached */ -#define ZIP_ZF_DECOMP 2 /* decompress data */ -#define ZIP_ZF_CRC 4 /* compute and compare CRC */ - -/* directory entry: general purpose bit flags */ - -#define ZIP_GPBF_ENCRYPTED 0x0001 /* is encrypted */ -#define ZIP_GPBF_DATA_DESCRIPTOR 0x0008 /* crc/size after file data */ -#define ZIP_GPBF_STRONG_ENCRYPTION 0x0040 /* uses strong encryption */ - -/* error information */ - -struct zip_error { - int zip_err; /* libzip error code (ZIP_ER_*) */ - int sys_err; /* copy of errno (E*) or zlib error code */ - char *str; /* string representation or NULL */ -}; - -/* zip archive, part of API */ - -struct zip { - char *zn; /* file name */ - FILE *zp; /* file */ - struct zip_error error; /* error information */ - - unsigned int flags; /* archive global flags */ - unsigned int ch_flags; /* changed archive global flags */ - - struct zip_cdir *cdir; /* central directory */ - char *ch_comment; /* changed archive comment */ - int ch_comment_len; /* length of changed zip archive - * comment, -1 if unchanged */ - int nentry; /* number of entries */ - int nentry_alloc; /* number of entries allocated */ - struct zip_entry *entry; /* entries */ - int nfile; /* number of opened files within archive */ - int nfile_alloc; /* number of files allocated */ - struct zip_file **file; /* opened files within archive */ -}; - -/* file in zip archive, part of API */ - -struct zip_file { - struct zip *za; /* zip archive containing this file */ - struct zip_error error; /* error information */ - int flags; /* -1: eof, >0: error */ - - int method; /* compression method */ - off_t fpos; /* position within zip file (fread/fwrite) */ - unsigned long bytes_left; /* number of bytes left to read */ - unsigned long cbytes_left; /* number of bytes of compressed data left */ - - unsigned long crc; /* CRC so far */ - unsigned long crc_orig; /* CRC recorded in archive */ - - char *buffer; - z_stream *zstr; -}; - -/* zip archive directory entry (central or local) */ - -struct zip_dirent { - unsigned short version_madeby; /* (c) version of creator */ - unsigned short version_needed; /* (cl) version needed to extract */ - unsigned short bitflags; /* (cl) general purpose bit flag */ - unsigned short comp_method; /* (cl) compression method used */ - time_t last_mod; /* (cl) time of last modification */ - unsigned int crc; /* (cl) CRC-32 of uncompressed data */ - unsigned int comp_size; /* (cl) size of commpressed data */ - unsigned int uncomp_size; /* (cl) size of uncommpressed data */ - char *filename; /* (cl) file name (NUL-terminated) */ - unsigned short filename_len; /* (cl) length of filename (w/o NUL) */ - char *extrafield; /* (cl) extra field */ - unsigned short extrafield_len; /* (cl) length of extra field */ - char *comment; /* (c) file comment */ - unsigned short comment_len; /* (c) length of file comment */ - unsigned short disk_number; /* (c) disk number start */ - unsigned short int_attrib; /* (c) internal file attributes */ - unsigned int ext_attrib; /* (c) external file attributes */ - unsigned int offset; /* (c) offset of local header */ -}; - -/* zip archive central directory */ - -struct zip_cdir { - struct zip_dirent *entry; /* directory entries */ - int nentry; /* number of entries */ - - unsigned int size; /* size of central direcotry */ - unsigned int offset; /* offset of central directory in file */ - char *comment; /* zip archive comment */ - unsigned short comment_len; /* length of zip archive comment */ -}; - - - -struct zip_source { - zip_source_callback f; - void *ud; -}; - -/* entry in zip archive directory */ - -struct zip_entry { - enum zip_state state; - struct zip_source *source; - char *ch_filename; - char *ch_comment; - int ch_comment_len; -}; - - - -extern const char * const _zip_err_str[]; -extern const int _zip_nerr_str; -extern const int _zip_err_type[]; - - - -#define ZIP_ENTRY_DATA_CHANGED(x) \ - ((x)->state == ZIP_ST_REPLACED \ - || (x)->state == ZIP_ST_ADDED) - - - -int _zip_cdir_compute_crc(struct zip *, uLong *); -void _zip_cdir_free(struct zip_cdir *); -int _zip_cdir_grow(struct zip_cdir *, int, struct zip_error *); -struct zip_cdir *_zip_cdir_new(int, struct zip_error *); -int _zip_cdir_write(struct zip_cdir *, FILE *, struct zip_error *); - -void _zip_dirent_finalize(struct zip_dirent *); -void _zip_dirent_init(struct zip_dirent *); -int _zip_dirent_read(struct zip_dirent *, FILE *, unsigned char **, - unsigned int *, int, struct zip_error *); -void _zip_dirent_torrent_normalize(struct zip_dirent *); -int _zip_dirent_write(struct zip_dirent *, FILE *, int, struct zip_error *); - -void _zip_entry_free(struct zip_entry *); -void _zip_entry_init(struct zip *, int); -struct zip_entry *_zip_entry_new(struct zip *); - -void _zip_error_clear(struct zip_error *); -void _zip_error_copy(struct zip_error *, struct zip_error *); -void _zip_error_fini(struct zip_error *); -void _zip_error_get(struct zip_error *, int *, int *); -void _zip_error_init(struct zip_error *); -void _zip_error_set(struct zip_error *, int, int); -const char *_zip_error_strerror(struct zip_error *); - -int _zip_file_fillbuf(void *, size_t, struct zip_file *); -unsigned int _zip_file_get_offset(struct zip *, int); - -int _zip_filerange_crc(FILE *, off_t, off_t, uLong *, struct zip_error *); - -struct zip_source *_zip_source_file_or_p(struct zip *, const char *, FILE *, - off_t, off_t); - -void _zip_free(struct zip *); -const char *_zip_get_name(struct zip *, int, int, struct zip_error *); -int _zip_local_header_read(struct zip *, int); -void *_zip_memdup(const void *, size_t, struct zip_error *); -int _zip_name_locate(struct zip *, const char *, int, struct zip_error *); -struct zip *_zip_new(struct zip_error *); -unsigned short _zip_read2(unsigned char **); -unsigned int _zip_read4(unsigned char **); -int _zip_replace(struct zip *, int, const char *, struct zip_source *); -int _zip_set_name(struct zip *, int, const char *); -int _zip_unchange(struct zip *, int, int); -void _zip_unchange_data(struct zip_entry *); - -#endif /* zipint.h */ diff --git a/core/deps/nowide/CMakeLists.txt b/core/deps/nowide/CMakeLists.txt new file mode 100644 index 000000000..6915aafea --- /dev/null +++ b/core/deps/nowide/CMakeLists.txt @@ -0,0 +1,359 @@ +cmake_minimum_required(VERSION 2.8.5) +if(NOT CMAKE_VERSION VERSION_LESS "3.0") + cmake_policy(SET CMP0048 OLD) +endif() +if(NOT CMAKE_VERSION VERSION_LESS "3.1") + cmake_policy(SET CMP0054 OLD) +endif() +if(NOT CMAKE_VERSION VERSION_LESS "3.3") + cmake_policy(SET CMP0063 NEW) + set(HONOR_VISIBILITY TRUE) +else() + set(HONOR_VISIBILITY FALSE) +endif() + +# +# Project Definition +# + +project(nowide CXX) +set(NOWIDE_TARGET_NAME nowide) +set(TARGET_VER 0.0.0_neph) +set(TARGET_ABI_VER 0) +set(TARGET_OUTPUT_NAME "${NOWIDE_TARGET_NAME}") + +# +# CMake Modules +# + +list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/contrib/CMake/modules") +include(CheckCXXCompilerFlag) +include(CMakeDependentOption) +include(GNUInstallDirs) +find_package(Doxygen) +find_package(HHC) +find_package(LATEX) +find_package(Perl) + +# +# Include Files +# + +include_directories("${PROJECT_SOURCE_DIR}/include") + +# +# Project Options +# + +option(NOWIDE_BUILD_SHARED "Build Shared Library" ON) +option(NOWIDE_BUILD_STATIC "Build Static Library" ON) +cmake_dependent_option(NOWIDE_BUILD_TESTS "Build NoWide Tests" ON "NOT CMAKE_TOOLCHAIN_FILE" OFF) +cmake_dependent_option(NOWIDE_BUILD_DOC_HTML "Build NoWide Documentation - HTML" ON "DOXYGEN_FOUND" OFF) +cmake_dependent_option(NOWIDE_BUILD_DOC_CHM "Build NoWide Documentation - CHM" ON "HHC_FOUND AND NOWIDE_BUILD_DOC_HTML" OFF) +cmake_dependent_option(NOWIDE_BUILD_DOC_TEX "Build NoWide Documentation - LaTeX" ON "DOXYGEN_FOUND AND LATEX_FOUND" OFF) + +set(NOWIDE_HEADERS + "${PROJECT_SOURCE_DIR}/include/nowide/config.hpp" + "${PROJECT_SOURCE_DIR}/include/nowide/convert.hpp" + "${PROJECT_SOURCE_DIR}/include/nowide/encoding_errors.hpp" + "${PROJECT_SOURCE_DIR}/include/nowide/encoding_utf.hpp" + "${PROJECT_SOURCE_DIR}/include/nowide/iostream.hpp" + "${PROJECT_SOURCE_DIR}/include/nowide/scoped_ptr.hpp" + "${PROJECT_SOURCE_DIR}/include/nowide/utf.hpp") + +set(NOWIDE_SOURCE + "${PROJECT_SOURCE_DIR}/src/iostream.cpp") + +# +# Require C++11 Standard +# + +if(NOT MSVC) + if(NOT CMAKE_VERSION VERSION_LESS "3.1") + set(CMAKE_CXX_STANDARD_REQUIRED TRUE) + set(CMAKE_CXX_STANDARD "11") + else() + check_cxx_compiler_flag("-std=gnu++11" _COMPILER_HAS_STD_GNUPP11) + if(_COMPILER_HAS_STD_GNUPP11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") + else() + check_cxx_compiler_flag("-std=c++11" _COMPILER_HAS_STD_GNUPP0X) + if(_COMPILER_HAS_STD_GNUPP0X) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x") + else() + check_cxx_compiler_flag("-std=c++11" _COMPILER_HAS_STD_CPP11) + if(_COMPILER_HAS_STD_CPP11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif() + endif() + endif() + endif() +endif() + +# +# MSVC Runtime DLL +# + +cmake_dependent_option(NOWIDE_USE_MSVC_RUNTIME "Use MSVC Runtime Library DLL" ON MSVC OFF) +if(MSVC AND NOT NOWIDE_USE_MSVC_RUNTIME) + foreach(flag CMAKE_C_FLAGS + CMAKE_C_FLAGS_DEBUG + CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_MINSIZEREL + CMAKE_C_FLAGS_RELWITHDEBINFO) + string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}") + string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}") + endforeach() +endif() + +# +# Compiler Flags +# + +if(MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3") +else() + check_cxx_compiler_flag("-fno-strict-aliasing" _COMPILER_HAS_NO_STRICT_ALIASING) + check_cxx_compiler_flag("-fvisibility=hidden" _COMPILER_HAS_VISIBILITY_HIDDEN) + check_cxx_compiler_flag("-Wall" _COMPILER_HAS_WARN_ALL) + check_cxx_compiler_flag("-Wextra" _COMPILER_HAS_WARN_EXTRA) + check_cxx_compiler_flag("-Wno-unused-parameter" _COMPILER_HAS_NO_WARN_UNUSED_PARAMETER) + if(_COMPILER_HAS_NO_STRICT_ALIASING) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") + endif() + if(_COMPILER_HAS_WARN_ALL) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + endif() + if(_COMPILER_HAS_WARN_EXTRA) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") + endif() + if(_COMPILER_HAS_NO_WARN_UNUSED_PARAMETER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter") + endif() +endif() + +# +# Linker Flags +# + +if(NOT MSVC) + set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) + + set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined") + check_cxx_compiler_flag("" _LINKER_HAS_NO_UNDEFINED) + if (_LINKER_HAS_NO_UNDEFINED) + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}") + endif() + + if (MINGW) + set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat") + check_cxx_compiler_flag("" _LINKER_HAS_DEP) + if (_LINKER_HAS_DEP) + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--nxcompat ${CMAKE_SHARED_LINKER_FLAGS}") + endif() + set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase") + check_cxx_compiler_flag("" _LINKER_HAS_ASLR) + if (_LINKER_HAS_ASLR) + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--dynamicbase ${CMAKE_SHARED_LINKER_FLAGS}") + endif() + set(CMAKE_REQUIRED_FLAGS "-Wl,--high-entropy-va") + check_cxx_compiler_flag("" _LINKER_HAS_64ASLR) + if (_LINKER_HAS_64ASLR) + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--high-entropy-va ${CMAKE_SHARED_LINKER_FLAGS}") + endif() + endif() + + set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) +endif() + +# +# Build Targets +# + +set(NOWIDE_TARGET_BUILT "") +set(NOWIDE_TARGET_TYPES "") + +if(NOWIDE_BUILD_SHARED) + list(APPEND NOWIDE_TARGET_TYPES "shared") + add_library("${NOWIDE_TARGET_NAME}_shared" SHARED ${NOWIDE_SOURCE} ${NOWIDE_HEADERS}) + if(WIN32 OR ANDROID OR MSYS) + set_target_properties("${NOWIDE_TARGET_NAME}_shared" PROPERTIES + OUTPUT_NAME "${TARGET_OUTPUT_NAME}${TARGET_ABI_VER}") + else() + set_target_properties("${NOWIDE_TARGET_NAME}_shared" PROPERTIES + OUTPUT_NAME "${TARGET_OUTPUT_NAME}") + endif() + if(NOT ANDROID) + set_target_properties("${NOWIDE_TARGET_NAME}_shared" PROPERTIES + VERSION "${TARGET_VER}" + SOVERSION "${TARGET_ABI_VER}") + endif() + set_target_properties("${NOWIDE_TARGET_NAME}_shared" PROPERTIES + COMPILE_DEFINITIONS "NOWIDE_DLL") +endif() + +if(NOWIDE_BUILD_STATIC) + list(APPEND NOWIDE_TARGET_TYPES "static") + add_library("${NOWIDE_TARGET_NAME}_static" STATIC ${NOWIDE_SOURCE} ${NOWIDE_HEADERS}) + if(MSVC) + set_target_properties("${NOWIDE_TARGET_NAME}_static" PROPERTIES + OUTPUT_NAME "${TARGET_OUTPUT_NAME}${TARGET_ABI_VER}_static") + else() + set_target_properties("${NOWIDE_TARGET_NAME}_static" PROPERTIES + OUTPUT_NAME "${TARGET_OUTPUT_NAME}${TARGET_ABI_VER}") + endif() +endif() + +foreach(NOWIDE_TARGET_TYPE ${NOWIDE_TARGET_TYPES}) + list(APPEND NOWIDE_TARGET_BUILT "${NOWIDE_TARGET_NAME}_${NOWIDE_TARGET_TYPE}") + if(NOT MSYS) + target_link_libraries("${NOWIDE_TARGET_NAME}_${NOWIDE_TARGET_TYPE}" ${CMAKE_DL_LIBS}) + endif() + if(HONOR_VISILIBITY) + set_target_properties("${NOWIDE_TARGET_NAME}_${NOWIDE_TARGET_TYPE}" PROPERTIES + C_VISIBILITY_PRESET hidden) + elseif(_COMPILER_HAS_VISIBILITY_HIDDEN) + set_target_properties("${NOWIDE_TARGET_NAME}_${NOWIDE_TARGET_TYPE}" PROPERTIES + COMPILE_FLAGS "-fvisibility=hidden") + endif() + set_target_properties("${NOWIDE_TARGET_NAME}_${NOWIDE_TARGET_TYPE}" PROPERTIES + POSITION_INDEPENDENT_CODE ON) +endforeach() + +# +# Documentation +# + +if(NOWIDE_BUILD_DOC_HTML) + set(NOWIDE_DOXYGEN_HTML YES) +else() + set(NOWIDE_DOXYGEN_HTML NO) +endif() + +if(NOWIDE_BUILD_DOC_CHM) + set(NOWIDE_DOXYGEN_HTMLHELP YES) +else() + set(NOWIDE_DOXYGEN_HTMLHELP NO) +endif() + +if(NOWIDE_BUILD_DOC_TEX) + set(NOWIDE_DOXYGEN_LATEX YES) +else() + set(NOWIDE_DOXYGEN_LATEX NO) +endif() + +if(NOWIDE_BUILD_DOC_HTML AND NOT LATEX_FOUND) + set(NOWIDE_DOXYGEN_MATHJAX YES) +else() + set(NOWIDE_DOXYGEN_MATHJAX NO) +endif() + +if(DOXYGEN_DOT_FOUND) + set(NOWIDE_DOXYGEN_DOT YES) +else() + set(NOWIDE_DOXYGEN_DOT NO) +endif() + +if(NOWIDE_BUILD_DOC_HTML OR NOWIDE_BUILD_DOC_TEX) + configure_file("Doxyfile.in" "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" @ONLY) + add_custom_target(doc "${DOXYGEN_EXECUTABLE}" Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating API Documentation" VERBATIM) +endif() + +# +# Tests +# + +if(NOWIDE_BUILD_TESTS) + enable_testing() + foreach(NOWIDE_TARGET_TYPE ${NOWIDE_TARGET_TYPES}) + add_executable(test_${NOWIDE_TARGET_TYPE}_convert test/test_convert.cpp) + target_link_libraries(test_${NOWIDE_TARGET_TYPE}_convert ${NOWIDE_TARGET_NAME}_${NOWIDE_TARGET_TYPE}) + add_test(test_${NOWIDE_TARGET_TYPE}_convert test_${NOWIDE_TARGET_TYPE}_convert) + if("${NOWIDE_TARGET_TYPE}" STREQUAL "shared") + set_target_properties(test_${NOWIDE_TARGET_TYPE}_convert PROPERTIES COMPILE_DEFINITIONS "NOWIDE_DLL") + endif() + + add_executable(test_${NOWIDE_TARGET_TYPE}_stdio test/test_stdio.cpp) + target_link_libraries(test_${NOWIDE_TARGET_TYPE}_stdio ${NOWIDE_TARGET_NAME}_${NOWIDE_TARGET_TYPE}) + add_test(test_${NOWIDE_TARGET_TYPE}_stdio test_${NOWIDE_TARGET_TYPE}_stdio) + if("${NOWIDE_TARGET_TYPE}" STREQUAL "shared") + set_target_properties(test_${NOWIDE_TARGET_TYPE}_stdio PROPERTIES COMPILE_DEFINITIONS "NOWIDE_DLL") + endif() + + if(NOT APPLE) + # OSX fstream is bugged? + add_executable(test_${NOWIDE_TARGET_TYPE}_fstream test/test_fstream.cpp) + target_link_libraries(test_${NOWIDE_TARGET_TYPE}_fstream ${NOWIDE_TARGET_NAME}_${NOWIDE_TARGET_TYPE}) + add_test(test_${NOWIDE_TARGET_TYPE}_fstream test_${NOWIDE_TARGET_TYPE}_fstream) + if("${NOWIDE_TARGET_TYPE}" STREQUAL "shared") + set_target_properties(test_${NOWIDE_TARGET_TYPE}_fstream PROPERTIES COMPILE_DEFINITIONS "NOWIDE_DLL") + endif() + endif() + + add_executable(test_${NOWIDE_TARGET_TYPE}_iostream test/test_iostream.cpp) + target_link_libraries(test_${NOWIDE_TARGET_TYPE}_iostream ${NOWIDE_TARGET_NAME}_${NOWIDE_TARGET_TYPE}) + add_test(test_${NOWIDE_TARGET_TYPE}_iostream test_${NOWIDE_TARGET_TYPE}_iostream) + if("${NOWIDE_TARGET_TYPE}" STREQUAL "shared") + set_target_properties(test_${NOWIDE_TARGET_TYPE}_iostream PROPERTIES COMPILE_DEFINITIONS "NOWIDE_DLL") + endif() + + add_executable(test_${NOWIDE_TARGET_TYPE}_env_proto test/test_env.cpp) + target_link_libraries(test_${NOWIDE_TARGET_TYPE}_env_proto ${NOWIDE_TARGET_NAME}_${NOWIDE_TARGET_TYPE}) + add_test(test_${NOWIDE_TARGET_TYPE}_env_proto test_${NOWIDE_TARGET_TYPE}_env_proto) + if("${NOWIDE_TARGET_TYPE}" STREQUAL "shared") + set_target_properties(test_${NOWIDE_TARGET_TYPE}_env_proto PROPERTIES COMPILE_DEFINITIONS "NOWIDE_DLL") + endif() + + if(WIN32 OR MSYS) + add_executable(test_${NOWIDE_TARGET_TYPE}_env_win test/test_env.cpp) + target_link_libraries(test_${NOWIDE_TARGET_TYPE}_env_win ${NOWIDE_TARGET_NAME}_${NOWIDE_TARGET_TYPE}) + add_test(test_${NOWIDE_TARGET_TYPE}_env_win test_${NOWIDE_TARGET_TYPE}_env_win) + if("${NOWIDE_TARGET_TYPE}" STREQUAL "shared") + set_target_properties(test_${NOWIDE_TARGET_TYPE}_env_win PROPERTIES + COMPILE_DEFINITIONS "NOWIDE_DLL;NOWIDE_USE_WINDOWS_H") + else() + set_target_properties(test_${NOWIDE_TARGET_TYPE}_env_win PROPERTIES + COMPILE_DEFINITIONS "NOWIDE_USE_WINDOWS_H") + endif() + endif() + + if(NOT MSYS) + # This test fails on MSYS2 MinTTY + add_executable(test_${NOWIDE_TARGET_TYPE}_system test/test_system.cpp) + target_link_libraries(test_${NOWIDE_TARGET_TYPE}_system ${NOWIDE_TARGET_NAME}_${NOWIDE_TARGET_TYPE}) + add_test(test_${NOWIDE_TARGET_TYPE}_system_n test_${NOWIDE_TARGET_TYPE}_system "-n") + add_test(test_${NOWIDE_TARGET_TYPE}_system_w test_${NOWIDE_TARGET_TYPE}_system "-w") + if("${NOWIDE_TARGET_TYPE}" STREQUAL "shared") + set_target_properties(test_${NOWIDE_TARGET_TYPE}_system PROPERTIES COMPILE_DEFINITIONS "NOWIDE_DLL") + endif() + endif() + endforeach() +endif() + +# +# Install +# + +install(TARGETS ${NOWIDE_TARGET_BUILT} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/nowide" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +if(MSVC) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Debug/${TARGET_OUTPUT_NAME}${TARGET_ABI_VER}.pdb" DESTINATION ${CMAKE_INSTALL_BINDIR} CONFIGURATIONS Debug) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/${TARGET_OUTPUT_NAME}${TARGET_ABI_VER}.pdb" DESTINATION ${CMAKE_INSTALL_BINDIR} CONFIGURATIONS RelWithDebInfo) +endif() +install(FILES "${PROJECT_SOURCE_DIR}/COPYING" DESTINATION ${CMAKE_INSTALL_DOCDIR}) +install(FILES "${PROJECT_SOURCE_DIR}/README.md" DESTINATION ${CMAKE_INSTALL_DOCDIR}) +if(NOWIDE_BUILD_DOC_HTML) + install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" DESTINATION ${CMAKE_INSTALL_DOCDIR}) +endif() +if(NOWIDE_BUILD_DOC_TEX) + install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/latex" DESTINATION ${CMAKE_INSTALL_DOCDIR}) +endif() +if(NOWIDE_BUILD_DOC_CHM) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${NOWIDE_TARGET_NAME}.chm" DESTINATION ${CMAKE_INSTALL_DOCDIR}) +endif() diff --git a/core/deps/nowide/COPYING b/core/deps/nowide/COPYING new file mode 100644 index 000000000..36b7cd93c --- /dev/null +++ b/core/deps/nowide/COPYING @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/core/deps/nowide/Doxyfile.in b/core/deps/nowide/Doxyfile.in new file mode 100644 index 000000000..e07555c4e --- /dev/null +++ b/core/deps/nowide/Doxyfile.in @@ -0,0 +1,2387 @@ +# Doxyfile 1.8.10 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = NoWide + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = @TARGET_VER@ + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = . + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = @CMAKE_CURRENT_SOURCE_DIR@ + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = @CMAKE_CURRENT_SOURCE_DIR@/include + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = YES + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = @CMAKE_CURRENT_SOURCE_DIR@/include/nowide/ \ + @CMAKE_CURRENT_SOURCE_DIR@/src/ \ + @CMAKE_CURRENT_SOURCE_DIR@/ + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, +# *.vhdl, *.ucf, *.qsf, *.as and *.js. + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = README.md + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = NO + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = @NOWIDE_DOXYGEN_HTML@ + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = YES + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = @NOWIDE_DOXYGEN_HTMLHELP@ + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = ../@NOWIDE_TARGET_NAME@.chm + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = @HHC_EXECUTABLE@ + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = @NOWIDE_DOXYGEN_MATHJAX@ + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /