diff --git a/3rdparty/libzip/.clang-format b/3rdparty/libzip/.clang-format new file mode 100644 index 0000000000000000000000000000000000000000..8bb62b8c2ce02be27c9931b221093bb810f97bf0 --- /dev/null +++ b/3rdparty/libzip/.clang-format @@ -0,0 +1,12 @@ +BasedOnStyle: LLVM +IndentWidth: 4 +ColumnLimit: 2000 +AlwaysBreakAfterReturnType: TopLevelDefinitions +KeepEmptyLinesAtTheStartOfBlocks: false +MaxEmptyLinesToKeep: 2 +BreakBeforeBraces: Custom +BraceWrapping: + BeforeElse: true +AlignEscapedNewlines: Left +UseTab: Never +#PPDirectiveIndentStyle: AfterHash diff --git a/3rdparty/libzip/.github/ISSUE_TEMPLATE/bug-report.md b/3rdparty/libzip/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 0000000000000000000000000000000000000000..86c107807e6a75bae15b73823c2e75350d196492 --- /dev/null +++ b/3rdparty/libzip/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,32 @@ +--- +name: Bug Report +about: Report where libzip didn't behave like you expected. +title: '' +labels: bug +assignees: '' + +--- + +**Describe the Bug** +A clear and concise description of what the bug is. + +**Expected Behavior** +A clear and concise description of what you expected to happen. + +**Observed Behavior** +A clear and concise description of what actually happened. + +**To Reproduce** +Short program or code snippet that reproduces the problem. + +**libzip Version** +Version of libzip or revision repository used. + +**Operating System** +Operating system and version, used compiler. + +**Test Files** +If applicable, attach and describe zip archives that trigger the problem. + +**Additional context** +Add any other context about the problem here. diff --git a/3rdparty/libzip/.github/ISSUE_TEMPLATE/compile-error.md b/3rdparty/libzip/.github/ISSUE_TEMPLATE/compile-error.md new file mode 100644 index 0000000000000000000000000000000000000000..45c8a7a72d26c52b5fa140c99f4db0a228615d6f --- /dev/null +++ b/3rdparty/libzip/.github/ISSUE_TEMPLATE/compile-error.md @@ -0,0 +1,25 @@ +--- +name: Compile Error +about: Report when libzip does not compile. +title: '' +labels: compile +assignees: '' + +--- + +**Compiler Error** +Output from the compiler, including exact and complete error message, file name and line number. + +**libzip Version** +Version of libzip or revision repository used. + +**Operating System and Compiler** +The operating system and compiler used, including version number. + +Also, any flags passed to `cmake`. + +**Autodetected Configuration** +Attach `CmakeCache.txt` from your build directory. This list everything `cmake` detected on your system. + +**Additional context** +Add any other context about the problem here. diff --git a/3rdparty/libzip/.github/ISSUE_TEMPLATE/feature-request.md b/3rdparty/libzip/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 0000000000000000000000000000000000000000..c23381e02290d06007f147c45e3a5b26ec94324d --- /dev/null +++ b/3rdparty/libzip/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,22 @@ +--- +name: Feature Request +about: Suggest an idea for this project. +title: '' +labels: enhancement +assignees: '' + +--- + +**Description** +A clear and concise description of what you want to achieve, why the current features are insufficient, and why you think it is generally useful. + +Also, have you checked whether the feature is already mentioned in TODO.md? If so, only submit a new issue if you expand on it. + +**Solution** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context about the feature request here. diff --git a/3rdparty/libzip/.github/workflows/build.yml b/3rdparty/libzip/.github/workflows/build.yml new file mode 100644 index 0000000000000000000000000000000000000000..d01b75d0cd5b82e7f935cc7b900aeff407e464a7 --- /dev/null +++ b/3rdparty/libzip/.github/workflows/build.yml @@ -0,0 +1,46 @@ +name: build +on: [push] + +jobs: + all: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] +# os: [macos-latest, ubuntu-latest] + steps: + - name: checkout + uses: actions/checkout@v2 + - name: install dependencies (Linux) + if: ${{ runner.os == 'Linux' }} + run: | + sudo apt-get install libzstd-dev + - name: install dependencies (Windows) + if: ${{ runner.os == 'Windows' }} + uses: lukka/run-vcpkg@v6 + id: runvcpkg + with: + vcpkgGitCommitId: 0bf3923f9fab4001c00f0f429682a0853b5749e0 + vcpkgTriplet: x64-windows + vcpkgArguments: zlib bzip2 liblzma zstd + - name: prepare build directory + run: | + cmake -E make_directory ${{runner.workspace}}/build + - name: configure (Unix) + if: ${{ runner.os != 'Windows' }} + working-directory: ${{runner.workspace}}/build + run: | + cmake ${{github.workspace}} + - name: configure (Windows) + if: ${{ runner.os == 'Windows' }} + working-directory: ${{runner.workspace}}/build + run: | + cmake -DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake ${{github.workspace}} + - name: build + working-directory: ${{runner.workspace}}/build + run: | + cmake --build . --config Release + - name: test + working-directory: ${{runner.workspace}}/build + run: | + ctest -v -C Release diff --git a/3rdparty/libzip/.github/workflows/codeql-analysis.yml b/3rdparty/libzip/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000000000000000000000000000000000000..696b1fa48c538aca9910ef66f41339bba6eecce1 --- /dev/null +++ b/3rdparty/libzip/.github/workflows/codeql-analysis.yml @@ -0,0 +1,66 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +name: "CodeQL" + +on: + push: + branches: [master] + pull_request: + # The branches below must be a subset of the branches above + branches: [master] + schedule: + - cron: '0 10 * * 4' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + # Override automatic language detection by changing the below list + # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] + language: ['cpp'] + # Learn more... + # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + # We must fetch at least the immediate parents so that if this is + # a pull request then we can checkout the head. + fetch-depth: 2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # â„¹ï¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # âœï¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/3rdparty/libzip/.github/workflows/main.yml b/3rdparty/libzip/.github/workflows/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..c68160a9d09ee09b78fe7ec3bfda1dd6d150fe7a --- /dev/null +++ b/3rdparty/libzip/.github/workflows/main.yml @@ -0,0 +1,23 @@ +name: CIFuzz +on: [pull_request] +jobs: + Fuzzing: + runs-on: ubuntu-latest + steps: + - name: Build Fuzzers + uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master + with: + oss-fuzz-project-name: 'libzip' + dry-run: false + - name: Run Fuzzers + uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master + with: + oss-fuzz-project-name: 'libzip' + fuzz-seconds: 600 + dry-run: false + - name: Upload Crash + uses: actions/upload-artifact@v1 + if: failure() + with: + name: artifacts + path: ./out/artifacts diff --git a/3rdparty/libzip/API-CHANGES.md b/3rdparty/libzip/API-CHANGES.md new file mode 100644 index 0000000000000000000000000000000000000000..24e3d8e1ab9ce8c69e30715911b928908e28f6cc --- /dev/null +++ b/3rdparty/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 `<zip.h>` 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/3rdparty/libzip/AUTHORS b/3rdparty/libzip/AUTHORS new file mode 100644 index 0000000000000000000000000000000000000000..a33707b01d6dff446e828694fad15ebb6eae71f3 --- /dev/null +++ b/3rdparty/libzip/AUTHORS @@ -0,0 +1,2 @@ +Dieter Baron <dillo@nih.at> +Thomas Klausner <tk@giga.or.at> diff --git a/3rdparty/libzip/CMakeLists.txt b/3rdparty/libzip/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..93b46a61e7099f96afd31ad77dd29de0a9a7b30a --- /dev/null +++ b/3rdparty/libzip/CMakeLists.txt @@ -0,0 +1,446 @@ +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.8.0 + 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_symbol_exists(_snprintf stdio.h HAVE__SNPRINTF) +check_function_exists(_strdup HAVE__STRDUP) +check_symbol_exists(_stricmp string.h 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_symbol_exists(snprintf stdio.h HAVE_SNPRINTF) +check_symbol_exists(strcasecmp strings.h 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 <sys/ioctl.h> +#include <linux/fs.h> +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 <inttypes.h>") +elseif(HAVE_STDINT_H_LIBZIP) + set(LIBZIP_TYPES_INCLUDE "#include <stdint.h>") +elseif(HAVE_SYS_TYPES_H_LIBZIP) + set(LIBZIP_TYPES_INCLUDE "#include <sys/types.h>") +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/3rdparty/libzip/INSTALL.md b/3rdparty/libzip/INSTALL.md new file mode 100644 index 0000000000000000000000000000000000000000..5112182ecee5332f7c452f55cd9b2adfa75235ad --- /dev/null +++ b/3rdparty/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_<LIBRARY>=OFF` to cmake, where `<LIBRARY>` 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://gitlab.kitware.com/cmake/community/-/wikis/FAQ). diff --git a/3rdparty/libzip/LICENSE b/3rdparty/libzip/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..573d5d94d7d950e2f8e1b8bcf9b7b19d54996321 --- /dev/null +++ b/3rdparty/libzip/LICENSE @@ -0,0 +1,31 @@ +Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + +The authors can be contacted at <libzip@nih.at> + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/NEWS.md b/3rdparty/libzip/NEWS.md new file mode 100644 index 0000000000000000000000000000000000000000..c6a41818af033c01129649104e054f5463825ffe --- /dev/null +++ b/3rdparty/libzip/NEWS.md @@ -0,0 +1,289 @@ +1.8.0 [2021-06-18] +================== + +* Add support for zstd (Zstandard) compression. +* Add support for lzma (ID 14) compression. +* Add `zip_source_window_create()`. +* Add `zip_source_zip_create()` variant to `zip_source_zip()`. +* Allow method specific `comp_flags` in `zip_set_file_compression()`. +* Allow `zip_source_tell()` on sources that don't support seeking and `zip_ftell()` on compressed data. +* Provide more details for consistency check errors. +* Improve output of `zipcmp`. +* In `zipcmp`, don’t ignore empty directories when comparing directory listing. +* Treat empty string as no password given in `zip_file_set_encryption()`, `zip_fopen_encrypted()`, and `zip_set_default_password()`. + +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/3rdparty/libzip/README.md b/3rdparty/libzip/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c8cffd5a0b93a98d1018d7d912e859c8b2b5475b --- /dev/null +++ b/3rdparty/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 <libzip@nih.at>. + +[](https://github.com/nih-at/libzip/actions?query=workflow%3Abuild) +[](https://ci.appveyor.com/project/nih-at/libzip) +[](https://scan.coverity.com/projects/libzip) diff --git a/3rdparty/libzip/THANKS b/3rdparty/libzip/THANKS new file mode 100644 index 0000000000000000000000000000000000000000..843349ea718fc10999d2f75d6d266b9f24803915 --- /dev/null +++ b/3rdparty/libzip/THANKS @@ -0,0 +1,120 @@ +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 <al@galanin.nnov.ru> +Alexandr Shadchin <alexandr.shadchin@gmail.com> +Alexey Bykov <gnfalex@rambler.ru> +Andreas Deininger <andreas@deininger.net> +Andreas Falkenhahn <andreas@falkenhahn.com> +Andrew Brampton <brampton@gmail.com> +Andrew Molyneux <andrew@molyneuxfamily.co.uk> +Ankur Kothari <ankz.kothari@gmail.com> +Antonin Décimo <antonin.decimo@gmail.com> +Arseniy Terekhin <senyai@gmail.com> +BALATON Zoltan <balaton@eik.bme.hu> +Benjamin Gilbert <bgilbert@backtick.net> +Beuc <beuc@beuc.net> +Boaz Stolk <bstolk@aweta.nl> +Bogdan <bogiebog@gmail.com> +Brian 'geeknik' Carpenter <geeknik@protonmail.ch> +Carl Mastrangelo <notcarl@google.com> +Cédric Tabin +celan69 +Charlie Li <git@vishwin.info> +Chris Nehren <cnehren+libzip@pobox.com> +Christoph Cullmann <cullmann@kde.org> +Christoph M. Becker <cmbecker69@gmx.de> +Coverity <info@coverity.com> +Dane Springmeyer <dane.springmeyer@gmail.com> +Ларионов Даниил <scumcoder@yandex.ru> +David Demelier <demelier.david@gmail.com> +Dean Ellis <dellis1972@googlemail.com> +Declan Moran +Del Merritt <del@alum.mit.edu> +Devin Davila <daviladsoftware@gmail.com> +Dmytro Rybachenko <atmoliton@gmail.com> +Elvis Angelaccio +Erwin Haid <erwin.haid@gmx.de> +Eun-cheol Joo +Fabrice Fontaine +Florian Delizy <florian.delizy@gmail.com> +Force Charlie <charlieio@outlook.com> +François Simon <AT.GFI.Francois.SIMON@sesam-vitale.fr> +Frederik Ramm <frederik@remote.org> +gk7huki <gk7huki@gmail.com> +Gerard ODonnell +Hanno Böck <hanno@hboeck.de> +HeeMyung +Heiko Becker +Heiko Hund <heiko@ist.eigentlich.net> +Ilya Voronin +Info-ZIP group +Jan Weiß <jan@geheimwerk.de> +Jay Freeman (saurik) <saurik@saurik.com> +jloqfjgk@github +Joachim Reichel <joachim.reichel@gmx.de> +João Custódio <joao_custodio@symantec.com> +Joel Ebrahimi <joel.ebrahimi@gmail.com> +Jono Spiro <jono.spiro@gmail.com> +Julien Schueller <schueller@phimeca.com> +kensington <kensington@gentoo.org> +Keith Jones <keith@keithjjones.com> +Khaled Mardam-Bey +Kohei Yoshida <kohei.yoshida@gmail.com> +Leith Bade <leith@mapbox.com> +Lubomir I. Ivanov <neolit123@gmail.com> +Maël Nison +Martin Buchholz <martinrb@google.com> +Martin Herkt <lachs0r@srsfckn.biz> +Martin Szulecki <m.szulecki@libimobiledevice.org> +Michael Balzer +Michael Beck <mm.beck@gmx.net> +MichaÅ‚ Janiszewski <janisozaur+libzip@gmail.com> +Michal Vyskocil <mvyskocil@suse.cz> +Mikhail Gusarov <dottedmag@dottedmag.net>. +Miklos Vajna +Morris Hafner +Oliver Kaiser <under.northern.sky@googlemail.com> +Oliver Kuckertz <oliver.kuckertz@mologie.de> +OSS-Fuzz Team +Ørjan Malde <red@foxi.me> +Pascal Terjan <pterjan@gmail.com> +Patrick Spendrin <ps_ml@gmx.de> +Paul Harris <harris.pc@gmail.com> +Paul Sheppard <shepsoft@googlemail.com> +Pavel Raiskup <praiskup@redhat.com> +Pierre Joye <pierre.php@gmail.com> +Pierre-Louis Cabelguen <plcabelguen@googlemail.com> +Randy <randy408@protonmail.com> +Remi Collet <remi@fedoraproject.org> +Richard Schütz +Rick Carback <carback1@umbc.edu> +Rikard Falkeborn <rikard.falkeborn@gmail.com> +Robert Norris <rw_norris@hotmail.com> +Roberto Tirabassi <rtirabassi@3di.it> +Roland Ortloff <Ortloff.R@gmx.de> +Rosen Penev <rosenp@gmail.com> +Ryan Burns <rtburns@protonmail.com> +Sebastian Kemper <sebastian_ml@gmx.net> +Sebastian Schmitt <sebastian.schmitt@auvesy.de> +Sergei Ozerov <ru.programmist@gmail.com> +Simon Talbot <simont@nse.co.uk> +Stephen Bryant <steve@bawue.de> +Tabata Shintaro <tabata.shintaro@gmail.com> +Tarmo Pikaro <tapika@yahoo.com> +Taylor C. Richberger +TC +Tim Lunn <Tim@feathertop.org> +Timo Warns <warns@pre-sense.de> +Tom Callaway <tcallawa@redhat.com> +Tomas Hoger <thoger@redhat.com> +Tomáš Malý <malytomas@ucpu.cz> +Torsten Paul <Torsten.Paul@gmx.de> +Transporter <ogre.transporter@gmail.com> +Vassili Courzakis <vcoxvco@googlemail.com> +William Lee +Wojciech Michalski <wmichalski@quay.pl> +Wolfgang Glunz <Wolfgang.Glunz@gmx.de> diff --git a/3rdparty/libzip/TODO.md b/3rdparty/libzip/TODO.md new file mode 100644 index 0000000000000000000000000000000000000000..a7305aa461890a15db088b74fe1dd26b144dd407 --- /dev/null +++ b/3rdparty/libzip/TODO.md @@ -0,0 +1,179 @@ +## Before next release + +reconsider zip_source_zip (uncompressed data for whole file not easy to get) + +## 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 flag `ZIP_FL_SUPPORT_MULTIPLE_OPENS` and allow zip_fopen (perhaps other functions) on added/replaced files with such sources +* 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 (`<dl>`) +* 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 + +* add test cases for all ZIP_INCONS detail errors +* `incons-local-filename-short.zzip` doesn't test short filename, since extra fields fail to parse. +* 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_create()` +* 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/3rdparty/libzip/android/do.sh b/3rdparty/libzip/android/do.sh new file mode 100755 index 0000000000000000000000000000000000000000..c4641c9f23655a15f9dbe8e74bdd35d15d06e07f --- /dev/null +++ b/3rdparty/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/3rdparty/libzip/android/docker/Dockerfile b/3rdparty/libzip/android/docker/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..5532bde28bf2ce37d06a1d46006a61b88be502a7 --- /dev/null +++ b/3rdparty/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 <userid>:<groupid> ./build +# > sudo chown -R <userid>:<groupid> ./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/3rdparty/libzip/android/readme.txt b/3rdparty/libzip/android/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa69fbd455c9fea572a6f370c7d85a1213b899f4 --- /dev/null +++ b/3rdparty/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/3rdparty/libzip/appveyor.yml b/3rdparty/libzip/appveyor.yml new file mode 100644 index 0000000000000000000000000000000000000000..21d645619da96d99ae76900c8721fcbde0e37c05 --- /dev/null +++ b/3rdparty/libzip/appveyor.yml @@ -0,0 +1,81 @@ +os: +- Visual Studio 2017 + +environment: + matrix: + - GENERATOR: "Visual Studio 15 2017 Win64" + TRIPLET: x64-windows + CMAKE_OPTS: "-DBUILD_SHARED_LIBS=off" + CMAKE_CONFIG: Release + RUN_TESTS: yes +# - GENERATOR: "Visual Studio 15 2017 Win64" +# TRIPLET: x64-windows +# CMAKE_OPTS: "-DBUILD_SHARED_LIBS=off" +# CMAKE_CONFIG: Debug +# RUN_TESTS: yes + - GENERATOR: "Visual Studio 15 2017 Win64" + TRIPLET: x64-uwp + CMAKE_OPTS: "-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0" + CMAKE_CONFIG: Release + RUN_TESTS: no + - GENERATOR: "Visual Studio 15 2017" + TRIPLET: x86-windows + CMAKE_OPTS: "-DBUILD_SHARED_LIBS=off" + CMAKE_CONFIG: Release + RUN_TESTS: yes +# - GENERATOR: "Visual Studio 15 2017" +# TRIPLET: x86-windows +# CMAKE_OPTS: "-DBUILD_SHARED_LIBS=off" +# CMAKE_CONFIG: Debug +# RUN_TESTS: yes + - GENERATOR: "Visual Studio 15 2017" + TRIPLET: x86-uwp + CMAKE_OPTS: "-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0" + CMAKE_CONFIG: Release + RUN_TESTS: no + - GENERATOR: "Visual Studio 15 2017 ARM" + TRIPLET: arm-windows + CMAKE_OPTS: "-DENABLE_OPENSSL=off" + CMAKE_CONFIG: Release + RUN_TESTS: no + - GENERATOR: "Visual Studio 15 2017 ARM" + TRIPLET: arm-uwp + CMAKE_OPTS: "-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DENABLE_OPENSSL=off" + CMAKE_CONFIG: Release + RUN_TESTS: no + - GENERATOR: "Visual Studio 15 2017" + TRIPLET: arm64-windows + CMAKE_OPTS: "-AARM64 -DENABLE_OPENSSL=off" + CMAKE_CONFIG: Release + RUN_TESTS: no + - GENERATOR: "Visual Studio 15 2017" + TRIPLET: arm64-uwp + CMAKE_OPTS: "-AARM64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DENABLE_OPENSSL=off" + CMAKE_CONFIG: Release + RUN_TESTS: no + +before_build: + cmd: >- + vcpkg install zlib:%TRIPLET% bzip2:%TRIPLET% liblzma:%TRIPLET% zstd:%TRIPLET% + + mkdir build + + cd build + + cmake -DCMAKE_TOOLCHAIN_FILE=C:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake .. -G "%GENERATOR%" %CMAKE_OPTS% + + appveyor PushArtifact config.h + + appveyor PushArtifact CMakeCache.txt + +build_script: + cmd: >- + cmake --build . --config %CMAKE_CONFIG% --target INSTALL + + cmake --build . --config %CMAKE_CONFIG% + +test_script: + cmd: >- + set VERBOSE=yes + + IF %RUN_TESTS%==yes ( ctest -C %CMAKE_CONFIG% --output-on-failure ) diff --git a/3rdparty/libzip/cmake-compat/CMakePushCheckState.cmake b/3rdparty/libzip/cmake-compat/CMakePushCheckState.cmake new file mode 100644 index 0000000000000000000000000000000000000000..3e519ee512f54279c93e66c3175fac1d80050259 --- /dev/null +++ b/3rdparty/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/3rdparty/libzip/cmake-compat/CheckLibraryExists.cmake b/3rdparty/libzip/cmake-compat/CheckLibraryExists.cmake new file mode 100644 index 0000000000000000000000000000000000000000..76901ab618a8f3dcc7689fc45e480ca9df20ddc0 --- /dev/null +++ b/3rdparty/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/3rdparty/libzip/cmake-compat/CheckSymbolExists.cmake b/3rdparty/libzip/cmake-compat/CheckSymbolExists.cmake new file mode 100644 index 0000000000000000000000000000000000000000..79d3d7d7854897c226a29e72357b178e68d1a51e --- /dev/null +++ b/3rdparty/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(<symbol> <files> <variable>) + + Check that the ``<symbol>`` is available after including given header + ``<files>`` and store the result in a ``<variable>``. Specify the list + of files in one argument as a semicolon-separated list. + ``<variable>`` 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 <CMake Language Lists>` of macros to define (-DFOO=bar). +``CMAKE_REQUIRED_INCLUDES`` + a :ref:`;-list <CMake Language Lists>` of header search paths to pass to + the compiler. +``CMAKE_REQUIRED_LINK_OPTIONS`` + a :ref:`;-list <CMake Language Lists>` of options to add to the link command. +``CMAKE_REQUIRED_LIBRARIES`` + a :ref:`;-list <CMake Language Lists>` 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/3rdparty/libzip/cmake-compat/FindBZip2.cmake b/3rdparty/libzip/cmake-compat/FindBZip2.cmake new file mode 100644 index 0000000000000000000000000000000000000000..98ab72cd85ce5177b27a56ece642c42cb68fc937 --- /dev/null +++ b/3rdparty/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/3rdparty/libzip/cmake-compat/FindGnuTLS.cmake b/3rdparty/libzip/cmake-compat/FindGnuTLS.cmake new file mode 100644 index 0000000000000000000000000000000000000000..819f0001215bb1cbe85a982e7c1f23be85b7f07a --- /dev/null +++ b/3rdparty/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/3rdparty/libzip/cmake-compat/FindLibLZMA.cmake b/3rdparty/libzip/cmake-compat/FindLibLZMA.cmake new file mode 100644 index 0000000000000000000000000000000000000000..200d6bf8d694139076133600adc258e71abf3ff3 --- /dev/null +++ b/3rdparty/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/3rdparty/libzip/cmake-compat/FindPackageHandleStandardArgs.cmake b/3rdparty/libzip/cmake-compat/FindPackageHandleStandardArgs.cmake new file mode 100644 index 0000000000000000000000000000000000000000..a078049e2bb6b4f4a3a7d7c066ba8fb97dcacc9b --- /dev/null +++ b/3rdparty/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(<PackageName>)` calls. It handles the +``REQUIRED``, ``QUIET`` and version-related arguments of ``find_package``. +It also sets the ``<PackageName>_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(<PackageName> + (DEFAULT_MSG|<custom-failure-message>) + <required-var>... + ) + + find_package_handle_standard_args(<PackageName> + [FOUND_VAR <result-var>] + [REQUIRED_VARS <required-var>...] + [VERSION_VAR <version-var>] + [HANDLE_COMPONENTS] + [CONFIG_MODE] + [NAME_MISMATCHED] + [REASON_FAILURE_MESSAGE <reason-failure-message>] + [FAIL_MESSAGE <custom-failure-message>] + ) + + The ``<PackageName>_FOUND`` variable will be set to ``TRUE`` if all + the variables ``<required-var>...`` 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|<custom-failure-message>)`` + 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 <result-var>`` + Obsolete. Specifies either ``<PackageName>_FOUND`` or + ``<PACKAGENAME>_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 <required-var>...`` + 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 <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 ``<PackageName>_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(<PackageName> NO_MODULE)``. This implies + a ``VERSION_VAR`` value of ``<PackageName>_VERSION``. The command + will automatically check whether the package configuration file + was found. + + ``REASON_FAILURE_MESSAGE <reason-failure-message>`` + Specify a custom message of the reason for the failure which will be + appended to the default generated message. + + ``FAIL_MESSAGE <custom-failure-message>`` + Specify a custom failure message instead of using the default + generated message. Not recommended. + + ``NAME_MISMATCHED`` + Indicate that the ``<PackageName>`` 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 ``<required-var>``. On repeated CMake runs, +the same message will not be printed again. + +.. note:: + + If ``<PackageName>`` 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) + # <PackageName>_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 <PackageName>_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/3rdparty/libzip/cmake-compat/FindPackageMessage.cmake b/3rdparty/libzip/cmake-compat/FindPackageMessage.cmake new file mode 100644 index 0000000000000000000000000000000000000000..0628b9816911e88cff6e990195e40b836c8e3696 --- /dev/null +++ b/3rdparty/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(<name> "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/3rdparty/libzip/cmake-compat/SelectLibraryConfigurations.cmake b/3rdparty/libzip/cmake-compat/SelectLibraryConfigurations.cmake new file mode 100644 index 0000000000000000000000000000000000000000..4c0e9a8c0a2f296f09c1608fd3aa543dcb49dee4 --- /dev/null +++ b/3rdparty/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 <wdicharry@stellarscience.com>. + +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/3rdparty/libzip/cmake-config.h.in b/3rdparty/libzip/cmake-config.h.in new file mode 100644 index 0000000000000000000000000000000000000000..544adbde9c5c23e6a113c90b6c6e5f418ffe2c4c --- /dev/null +++ b/3rdparty/libzip/cmake-config.h.in @@ -0,0 +1,63 @@ +#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_SNPRINTF +#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/3rdparty/libzip/cmake-zipconf.h.in b/3rdparty/libzip/cmake-zipconf.h.in new file mode 100644 index 0000000000000000000000000000000000000000..b88ed267fa12520e2229345054eecf8a43481fb8 --- /dev/null +++ b/3rdparty/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/3rdparty/libzip/cmake/Dist.cmake b/3rdparty/libzip/cmake/Dist.cmake new file mode 100644 index 0000000000000000000000000000000000000000..829112f443edcd1b77a435474a9e000c48a9c279 --- /dev/null +++ b/3rdparty/libzip/cmake/Dist.cmake @@ -0,0 +1,83 @@ +# Copyright (C) 2020 Dieter Baron and Thomas Klausner +# +# The authors can be contacted at <libzip@nih.at> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# 3. The names of the authors may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/cmake/FindMbedTLS.cmake b/3rdparty/libzip/cmake/FindMbedTLS.cmake new file mode 100644 index 0000000000000000000000000000000000000000..244b0c57c21ebc4b985b07288bd470bfdb1e6aad --- /dev/null +++ b/3rdparty/libzip/cmake/FindMbedTLS.cmake @@ -0,0 +1,132 @@ +# Copyright (C) 2020 Dieter Baron and Thomas Klausner +# +# The authors can be contacted at <libzip@nih.at> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# 3. The names of the authors may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/cmake/FindNettle.cmake b/3rdparty/libzip/cmake/FindNettle.cmake new file mode 100644 index 0000000000000000000000000000000000000000..982ac81ee18accd14de127efc0084689c16ae405 --- /dev/null +++ b/3rdparty/libzip/cmake/FindNettle.cmake @@ -0,0 +1,141 @@ +# Copyright (C) 2020 Dieter Baron and Thomas Klausner +# +# The authors can be contacted at <libzip@nih.at> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# 3. The names of the authors may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/cmake/FindZstd.cmake b/3rdparty/libzip/cmake/FindZstd.cmake new file mode 100644 index 0000000000000000000000000000000000000000..a0da50381443115c37137c07b65757777bf1f292 --- /dev/null +++ b/3rdparty/libzip/cmake/FindZstd.cmake @@ -0,0 +1,135 @@ +# Copyright (C) 2020 Dieter Baron and Thomas Klausner +# +# The authors can be contacted at <libzip@nih.at> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# 3. The names of the authors may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/examples/CMakeLists.txt b/3rdparty/libzip/examples/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..9019e0ab6a35159da38a803121673878b3d08b6b --- /dev/null +++ b/3rdparty/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/3rdparty/libzip/examples/in-memory.c b/3rdparty/libzip/examples/in-memory.c new file mode 100644 index 0000000000000000000000000000000000000000..19f60ee1153bf7fe8b2f946a696938cb8b8a1929 --- /dev/null +++ b/3rdparty/libzip/examples/in-memory.c @@ -0,0 +1,217 @@ +/* + in-memory.c -- modify zip file in memory + 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/stat.h> + +#include <zip.h> + +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/3rdparty/libzip/examples/windows-open.c b/3rdparty/libzip/examples/windows-open.c new file mode 100644 index 0000000000000000000000000000000000000000..d01ea067417bb1ed6316468ce2a9784767ed55ec --- /dev/null +++ b/3rdparty/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-2020 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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.h> + +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/3rdparty/libzip/lib/CMakeLists.txt b/3rdparty/libzip/lib/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..1069cec14c7f155ac9832daff750cd1b515ec4be --- /dev/null +++ b/3rdparty/libzip/lib/CMakeLists.txt @@ -0,0 +1,242 @@ +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.4 SOVERSION 5) +endif() + +target_link_libraries(zip PRIVATE ZLIB::ZLIB) +target_include_directories(zip + PUBLIC + $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/lib> + $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}> + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> + ) + +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-Z0-9_]+) ([0-9]+)[ \t]+/([-*0-9a-zA-Z, ']*)/" zip_h_err ${zip_h}) +file(READ ${PROJECT_SOURCE_DIR}/lib/zipint.h zipint_h) +string(REGEX MATCHALL "#define ZIP_ER_DETAIL_([A-Z0-9_]+) ([0-9]+)[ \t]+/([-*0-9a-zA-Z, ']*)/" zipint_h_err ${zipint_h}) +set(zip_err_str [=[ +/* + This file was generated automatically by CMake + from zip.h and zipint.h\; make changes there. +*/ + +#include "zipint.h" + +#define L ZIP_ET_LIBZIP +#define N ZIP_ET_NONE +#define S ZIP_ET_SYS +#define Z ZIP_ET_ZLIB + +#define E ZIP_DETAIL_ET_ENTRY +#define G ZIP_DETAIL_ET_GLOBAL + +const struct _zip_err_info _zip_err_str[] = { +]=]) +set(zip_err_type) +foreach(errln ${zip_h_err}) + string(REGEX MATCH "#define ZIP_ER_([A-Z0-9_]+) ([0-9]+)[ \t]+/([-*0-9a-zA-Z, ']*)/" err_t_tt ${errln}) + string(REGEX MATCH "([L|N|S|Z]+) ([-0-9a-zA-Z,, ']*)" err_t_tt "${CMAKE_MATCH_3}") + string(STRIP "${CMAKE_MATCH_2}" err_t_tt) + string(APPEND zip_err_str " { ${CMAKE_MATCH_1}, \"${err_t_tt}\" },\n") +endforeach() +string(APPEND zip_err_str [=[}\; + +const int _zip_err_str_count = sizeof(_zip_err_str)/sizeof(_zip_err_str[0])\; + +const struct _zip_err_info _zip_err_details[] = { +]=]) +foreach(errln ${zipint_h_err}) + string(REGEX MATCH "#define ZIP_ER_DETAIL_([A-Z0-9_]+) ([0-9]+)[ \t]+/([-*0-9a-zA-Z, ']*)/" err_t_tt ${errln}) + string(REGEX MATCH "([E|G]+) ([-0-9a-zA-Z, ']*)" err_t_tt "${CMAKE_MATCH_3}") + string(STRIP "${CMAKE_MATCH_2}" err_t_tt) + string(APPEND zip_err_str " { ${CMAKE_MATCH_1}, \"${err_t_tt}\" },\n") +endforeach() +string(APPEND zip_err_str [=[}\; + +const int _zip_err_details_count = sizeof(_zip_err_details)/sizeof(_zip_err_details[0])\; +]=]) +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zip_err_str.c ${zip_err_str}) diff --git a/3rdparty/libzip/lib/compat.h b/3rdparty/libzip/lib/compat.h new file mode 100644 index 0000000000000000000000000000000000000000..47c28fde91ba69d1688e54af245ec0bca4517f2b --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <io.h> +#endif + +#ifdef HAVE_STDBOOL_H +#include <stdbool.h> +#else +typedef char bool; +#define true 1 +#define false 0 +#endif + +#include <errno.h> + +/* 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) && 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 <limits.h> +#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/3rdparty/libzip/lib/zip.h b/3rdparty/libzip/lib/zip.h new file mode 100644 index 0000000000000000000000000000000000000000..4b9b9e958648b9cb16568467e8b034d4f977a3ff --- /dev/null +++ b/3rdparty/libzip/lib/zip.h @@ -0,0 +1,484 @@ +#ifndef _HAD_ZIP_H +#define _HAD_ZIP_H + +/* + zip.h -- exported declarations. + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zipconf.h> + +#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 <stdio.h> +#include <sys/types.h> +#include <time.h> + +/* 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 /* L 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 */ +#define ZIP_ET_LIBZIP 3 /* sys_err is libzip 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_source_t *_Nullable zip_source_window_create(zip_source_t *_Nonnull, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable); +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 zip_source_t *_Nullable zip_source_zip_create(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable); +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/3rdparty/libzip/lib/zip_add.c b/3rdparty/libzip/lib/zip_add.c new file mode 100644 index 0000000000000000000000000000000000000000..dd6dcbc8c6cdcaa57cb7f414c8b678fcf52b2c48 --- /dev/null +++ b/3rdparty/libzip/lib/zip_add.c @@ -0,0 +1,49 @@ +/* + zip_add.c -- add file via callback function + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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" + + +/* + 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/3rdparty/libzip/lib/zip_add_dir.c b/3rdparty/libzip/lib/zip_add_dir.c new file mode 100644 index 0000000000000000000000000000000000000000..41de94bc8642bc94b429b20e179ce16305278dbb --- /dev/null +++ b/3rdparty/libzip/lib/zip_add_dir.c @@ -0,0 +1,44 @@ +/* + zip_add_dir.c -- add directory + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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" + + +/* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ + +ZIP_EXTERN zip_int64_t +zip_add_dir(zip_t *za, const char *name) { + return zip_dir_add(za, name, 0); +} diff --git a/3rdparty/libzip/lib/zip_add_entry.c b/3rdparty/libzip/lib/zip_add_entry.c new file mode 100644 index 0000000000000000000000000000000000000000..6f3c1626ada8f8b1fa271cfddea98c87cbe6e1e5 --- /dev/null +++ b/3rdparty/libzip/lib/zip_add_entry.c @@ -0,0 +1,80 @@ +/* + zip_add_entry.c -- create and init struct zip_entry + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#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/3rdparty/libzip/lib/zip_algorithm_bzip2.c b/3rdparty/libzip/lib/zip_algorithm_bzip2.c new file mode 100644 index 0000000000000000000000000000000000000000..ebc68d958361c8a5047fbde3ab5f5cde9f55916b --- /dev/null +++ b/3rdparty/libzip/lib/zip_algorithm_bzip2.c @@ -0,0 +1,285 @@ +/* + zip_algorithm_bzip2.c -- bzip2 (de)compression routines + Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <bzlib.h> +#include <limits.h> +#include <stdlib.h> + +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/3rdparty/libzip/lib/zip_algorithm_deflate.c b/3rdparty/libzip/lib/zip_algorithm_deflate.c new file mode 100644 index 0000000000000000000000000000000000000000..8707eecf4f94974f363e5a60be0a1964a83ed4c6 --- /dev/null +++ b/3rdparty/libzip/lib/zip_algorithm_deflate.c @@ -0,0 +1,265 @@ +/* + zip_algorithm_deflate.c -- deflate (de)compression routines + Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <limits.h> +#include <stdlib.h> +#include <zlib.h> + +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/3rdparty/libzip/lib/zip_algorithm_xz.c b/3rdparty/libzip/lib/zip_algorithm_xz.c new file mode 100644 index 0000000000000000000000000000000000000000..f0c2fd37ab1bd52eade8d08c69638d8957fef0df --- /dev/null +++ b/3rdparty/libzip/lib/zip_algorithm_xz.c @@ -0,0 +1,406 @@ +/* + zip_algorithm_xz.c -- LZMA/XZ (de)compression routines + Bazed on zip_algorithm_deflate.c -- deflate (de)compression routines + Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <limits.h> +#include <lzma.h> +#include <stdlib.h> +#include <zlib.h> + +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 ((ctx = (struct ctx *)malloc(sizeof(*ctx))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + ctx->error = error; + ctx->compress = compress; + if (compression_flags < 0 || compression_flags > 9) { + ctx->compression_flags = 6; /* default value */ + } else { + 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_uint8_t)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_uint8_t)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/3rdparty/libzip/lib/zip_algorithm_zstd.c b/3rdparty/libzip/lib/zip_algorithm_zstd.c new file mode 100644 index 0000000000000000000000000000000000000000..a7e2d672a821a670f405360f6bc815c1b50fe742 --- /dev/null +++ b/3rdparty/libzip/lib/zip_algorithm_zstd.c @@ -0,0 +1,294 @@ +/* + zip_algorithm_zstd.c -- zstd (de)compression routines + Copyright (C) 2020-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <limits.h> +#include <stdlib.h> +#include <zstd.h> +#include <zstd_errors.h> + +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 < ZSTD_minCLevel() || compression_flags > ZSTD_maxCLevel()) { + 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/3rdparty/libzip/lib/zip_buffer.c b/3rdparty/libzip/lib/zip_buffer.c new file mode 100644 index 0000000000000000000000000000000000000000..4e5783e8955591a38b88f93d9570f8c99b0903f6 --- /dev/null +++ b/3rdparty/libzip/lib/zip_buffer.c @@ -0,0 +1,324 @@ +/* + zip_buffer.c -- bounds checked access to memory buffer + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + +#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/3rdparty/libzip/lib/zip_close.c b/3rdparty/libzip/lib/zip_close.c new file mode 100644 index 0000000000000000000000000000000000000000..a990c2f502ea3d7c502b0810cce5983815acc175 --- /dev/null +++ b/3rdparty/libzip/lib/zip_close.c @@ -0,0 +1,698 @@ +/* + zip_close.c -- close zip archive and update changes + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdio.h> +#include <stdlib.h> +#ifdef _WIN32 +#include <fcntl.h> +#include <io.h> +#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, i, ZIP_FL_UNCHANGED, 0, 0, NULL, &za->error)) == 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_create(src_final, 0, &za->error)) == 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) { + if (zip_source_tell_write(za->src) < 0) { + return -1; + } + + if (_zip_cdir_write(za, filelist, survivors) < 0) { + return -1; + } + + if (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/3rdparty/libzip/lib/zip_crypto.h b/3rdparty/libzip/lib/zip_crypto.h new file mode 100644 index 0000000000000000000000000000000000000000..ac6e109266db3182b8959eed5f887c5205dedd52 --- /dev/null +++ b/3rdparty/libzip/lib/zip_crypto.h @@ -0,0 +1,54 @@ +/* + zip_crypto.h -- crypto definitions + Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_crypto_commoncrypto.c b/3rdparty/libzip/lib/zip_crypto_commoncrypto.c new file mode 100644 index 0000000000000000000000000000000000000000..58b797df6d659940073baf476d7aef632b41d101 --- /dev/null +++ b/3rdparty/libzip/lib/zip_crypto_commoncrypto.c @@ -0,0 +1,110 @@ +/* + zip_crypto_commoncrypto.c -- CommonCrypto 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#include "zipint.h" + +#include "zip_crypto.h" + +#include <fcntl.h> +#include <unistd.h> + +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/3rdparty/libzip/lib/zip_crypto_commoncrypto.h b/3rdparty/libzip/lib/zip_crypto_commoncrypto.h new file mode 100644 index 0000000000000000000000000000000000000000..1eae1b707b16e3b4949397555c55800b02b94d0b --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <CommonCrypto/CommonCrypto.h> + +#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/3rdparty/libzip/lib/zip_crypto_gnutls.c b/3rdparty/libzip/lib/zip_crypto_gnutls.c new file mode 100644 index 0000000000000000000000000000000000000000..406fceb0e130047f7e0697112035538ae9a02581 --- /dev/null +++ b/3rdparty/libzip/lib/zip_crypto_gnutls.c @@ -0,0 +1,134 @@ +/* + zip_crypto_gnutls.c -- GnuTLS 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#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; + + if ((hmac = (_zip_crypto_hmac_t *)malloc(sizeof(*hmac))) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if (gnutls_hmac_init(hmac, GNUTLS_MAC_SHA1, secret, 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) { + 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/3rdparty/libzip/lib/zip_crypto_gnutls.h b/3rdparty/libzip/lib/zip_crypto_gnutls.h new file mode 100644 index 0000000000000000000000000000000000000000..6743186890d55cc57d3b25ceac48283a2ad8c1c0 --- /dev/null +++ b/3rdparty/libzip/lib/zip_crypto_gnutls.h @@ -0,0 +1,68 @@ +/* + zip_crypto_gnutls.h -- definitions for GnuTLS 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <nettle/aes.h> +#include <nettle/pbkdf2.h> + +#include <gnutls/gnutls.h> + +#include <gnutls/crypto.h> + +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/3rdparty/libzip/lib/zip_crypto_mbedtls.c b/3rdparty/libzip/lib/zip_crypto_mbedtls.c new file mode 100644 index 0000000000000000000000000000000000000000..09cdf096f013a1755102e886e563646d19a9c537 --- /dev/null +++ b/3rdparty/libzip/lib/zip_crypto_mbedtls.c @@ -0,0 +1,162 @@ +/* + zip_crypto_mbedtls.c -- mbed TLS 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#include "zipint.h" + +#include "zip_crypto.h" + +#include <mbedtls/ctr_drbg.h> +#include <mbedtls/entropy.h> +#include <mbedtls/pkcs5.h> + +#include <limits.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; + } + + 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/3rdparty/libzip/lib/zip_crypto_mbedtls.h b/3rdparty/libzip/lib/zip_crypto_mbedtls.h new file mode 100644 index 0000000000000000000000000000000000000000..a82b2fd2a00a16229195c81556cb24cd5b3fca1d --- /dev/null +++ b/3rdparty/libzip/lib/zip_crypto_mbedtls.h @@ -0,0 +1,56 @@ +/* + zip_crypto_mbedtls.h -- definitions for mbedtls 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <mbedtls/aes.h> +#include <mbedtls/md.h> + +#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/3rdparty/libzip/lib/zip_crypto_openssl.c b/3rdparty/libzip/lib/zip_crypto_openssl.c new file mode 100644 index 0000000000000000000000000000000000000000..5cbc5ce2c001dea1b1b180215d2e99466b293f96 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#include "zipint.h" + +#include "zip_crypto.h" + +#include <limits.h> +#include <openssl/rand.h> + +#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/3rdparty/libzip/lib/zip_crypto_openssl.h b/3rdparty/libzip/lib/zip_crypto_openssl.h new file mode 100644 index 0000000000000000000000000000000000000000..d959b8dea009d1f75a81557976b4fe2feadd953b --- /dev/null +++ b/3rdparty/libzip/lib/zip_crypto_openssl.h @@ -0,0 +1,56 @@ +/* + zip_crypto_openssl.h -- definitions for 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <openssl/aes.h> +#include <openssl/hmac.h> + +#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/3rdparty/libzip/lib/zip_crypto_win.c b/3rdparty/libzip/lib/zip_crypto_win.c new file mode 100644 index 0000000000000000000000000000000000000000..8202bfe18943c347c637f280c4993932b3e9af25 --- /dev/null +++ b/3rdparty/libzip/lib/zip_crypto_win.c @@ -0,0 +1,495 @@ +/* + zip_crypto_win.c -- Windows Crypto API 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <limits.h> + +#include "zipint.h" + +#include "zip_crypto.h" + +#define WIN32_LEAN_AND_MEAN +#define NOCRYPT + +#include <windows.h> + +#include <bcrypt.h> + +#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 <math.h> + +#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/3rdparty/libzip/lib/zip_crypto_win.h b/3rdparty/libzip/lib/zip_crypto_win.h new file mode 100644 index 0000000000000000000000000000000000000000..be9fdc6a69881b2e47187b0ed355ffcd586690e8 --- /dev/null +++ b/3rdparty/libzip/lib/zip_crypto_win.h @@ -0,0 +1,53 @@ +/* + zip_crypto_win.h -- Windows Crypto API 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_delete.c b/3rdparty/libzip/lib/zip_delete.c new file mode 100644 index 0000000000000000000000000000000000000000..7d82d9afdee34ce5b7cd38552b178274da5fda7a --- /dev/null +++ b/3rdparty/libzip/lib/zip_delete.c @@ -0,0 +1,68 @@ +/* + zip_delete.c -- delete file from zip archive + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_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; + + za->entry[idx].deleted = 1; + + return 0; +} diff --git a/3rdparty/libzip/lib/zip_dir_add.c b/3rdparty/libzip/lib/zip_dir_add.c new file mode 100644 index 0000000000000000000000000000000000000000..89eb43292c48653a043a7f4823a5868bd5b178f4 --- /dev/null +++ b/3rdparty/libzip/lib/zip_dir_add.c @@ -0,0 +1,92 @@ +/* + zip_dir_add.c -- add directory + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + +#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/3rdparty/libzip/lib/zip_dirent.c b/3rdparty/libzip/lib/zip_dirent.c new file mode 100644 index 0000000000000000000000000000000000000000..a7c336bcc431b56d60f70530c1bb05e343aa7874 --- /dev/null +++ b/3rdparty/libzip/lib/zip_dirent.c @@ -0,0 +1,1163 @@ +/* + zip_dirent.c -- read directory entry (local or central), clean dirent + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <time.h> + +#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, ZIP_ER_DETAIL_VARIABLE_SIZE_OVERFLOW); + 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, ZIP_ER_DETAIL_VARIABLE_SIZE_OVERFLOW); + } + 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, ZIP_ER_DETAIL_INVALID_UTF8_IN_FILENAME); + 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, ZIP_ER_DETAIL_INVALID_UTF8_IN_COMMENT); + 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, ZIP_ER_DETAIL_INVALID_ZIP64_EF); + _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, ZIP_ER_DETAIL_INVALID_WINZIPAES_EF); + 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, ZIP_ER_DETAIL_INVALID_WINZIPAES_EF); + _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/3rdparty/libzip/lib/zip_discard.c b/3rdparty/libzip/lib/zip_discard.c new file mode 100644 index 0000000000000000000000000000000000000000..42f4eb85ee0c002edd3e70efe3011b8f241efc44 --- /dev/null +++ b/3rdparty/libzip/lib/zip_discard.c @@ -0,0 +1,80 @@ +/* + zip_discard.c -- discard and free struct zip + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#include "zipint.h" + + +/* zip_discard: + frees the space allocated to a zipfile struct, and closes the + corresponding file. */ + +void +zip_discard(zip_t *za) { + zip_uint64_t i; + + if (za == NULL) + return; + + if (za->src) { + zip_source_close(za->src); + zip_source_free(za->src); + } + + free(za->default_password); + _zip_string_free(za->comment_orig); + _zip_string_free(za->comment_changes); + + _zip_hash_free(za->names); + + if (za->entry) { + for (i = 0; i < za->nentry; i++) + _zip_entry_finalize(za->entry + i); + free(za->entry); + } + + 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); + + return; +} diff --git a/3rdparty/libzip/lib/zip_entry.c b/3rdparty/libzip/lib/zip_entry.c new file mode 100644 index 0000000000000000000000000000000000000000..dfc6419170dcd738d617c9f9a7a2161b747a56c1 --- /dev/null +++ b/3rdparty/libzip/lib/zip_entry.c @@ -0,0 +1,51 @@ +/* + zip_entry.c -- struct zip_entry helper functions + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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" + +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/3rdparty/libzip/lib/zip_error.c b/3rdparty/libzip/lib/zip_error.c new file mode 100644 index 0000000000000000000000000000000000000000..6c7e49f53bfceaf726d605363f2c161c06c3b91f --- /dev/null +++ b/3rdparty/libzip/lib/zip_error.c @@ -0,0 +1,151 @@ +/* + zip_error.c -- zip_error_t helper functions + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#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: + case ZIP_ET_LIBZIP: + 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_err_str_count) + return ZIP_ET_NONE; + + return _zip_err_str[error->zip_err].type; +} + + +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/3rdparty/libzip/lib/zip_error_clear.c b/3rdparty/libzip/lib/zip_error_clear.c new file mode 100644 index 0000000000000000000000000000000000000000..f6555396d24d573708f909e20c574f0b95593b28 --- /dev/null +++ b/3rdparty/libzip/lib/zip_error_clear.c @@ -0,0 +1,44 @@ +/* + zip_error_clear.c -- clear zip error + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_error_clear(zip_t *za) { + if (za == NULL) + return; + + _zip_error_clear(&za->error); +} diff --git a/3rdparty/libzip/lib/zip_error_get.c b/3rdparty/libzip/lib/zip_error_get.c new file mode 100644 index 0000000000000000000000000000000000000000..f310ed33e727b69df68b59864820ad9c99fc6455 --- /dev/null +++ b/3rdparty/libzip/lib/zip_error_get.c @@ -0,0 +1,54 @@ +/* + zip_error_get.c -- get zip error + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 void +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/3rdparty/libzip/lib/zip_error_get_sys_type.c b/3rdparty/libzip/lib/zip_error_get_sys_type.c new file mode 100644 index 0000000000000000000000000000000000000000..d9eb47a1a83780d477d1ed95358b1782809d150b --- /dev/null +++ b/3rdparty/libzip/lib/zip_error_get_sys_type.c @@ -0,0 +1,45 @@ +/* + zip_error_get_sys_type.c -- return type of system error code + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_error_get_sys_type(int ze) { + if (ze < 0 || ze >= _zip_err_str_count) { + return 0; + } + + return _zip_err_str[ze].type; +} diff --git a/3rdparty/libzip/lib/zip_error_strerror.c b/3rdparty/libzip/lib/zip_error_strerror.c new file mode 100644 index 0000000000000000000000000000000000000000..c283d8870a6f88fb8974bca71ebaed5dc7d09500 --- /dev/null +++ b/3rdparty/libzip/lib/zip_error_strerror.c @@ -0,0 +1,108 @@ +/* + zip_error_sterror.c -- get string representation of struct zip_error + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <zlib.h> + +#include "zipint.h" + +ZIP_EXTERN const char * +zip_error_strerror(zip_error_t *err) { + const char *zip_error_string, *system_error_string; + char buf[128], *s; + + zip_error_fini(err); + + if (err->zip_err < 0 || err->zip_err >= _zip_err_str_count) { + snprintf(buf, sizeof(buf), "Unknown error %d", err->zip_err); + buf[sizeof(buf) - 1] = '\0'; /* make sure string is NUL-terminated */ + zip_error_string = NULL; + system_error_string = buf; + } + else { + zip_error_string = _zip_err_str[err->zip_err].description; + + switch (_zip_err_str[err->zip_err].type) { + case ZIP_ET_SYS: + system_error_string = strerror(err->sys_err); + break; + + case ZIP_ET_ZLIB: + system_error_string = zError(err->sys_err); + break; + + case ZIP_ET_LIBZIP: { + zip_uint8_t error = GET_ERROR_FROM_DETAIL(err->sys_err); + int index = GET_INDEX_FROM_DETAIL(err->sys_err); + + if (error == 0) { + system_error_string = NULL; + } + else if (error >= _zip_err_details_count) { + snprintf(buf, sizeof(buf), "invalid detail error %u", error); + buf[sizeof(buf) - 1] = '\0'; /* make sure string is NUL-terminated */ + system_error_string = buf; + } + else if (_zip_err_details[error].type == ZIP_DETAIL_ET_ENTRY && index < MAX_DETAIL_INDEX) { + snprintf(buf, sizeof(buf), "entry %d: %s", index, _zip_err_details[error].description); + buf[sizeof(buf) - 1] = '\0'; /* make sure string is NUL-terminated */ + system_error_string = buf; + } + else { + system_error_string = _zip_err_details[error].description; + } + break; + } + + default: + system_error_string = NULL; + } + } + + if (system_error_string == NULL) { + return zip_error_string; + } + else { + if ((s = (char *)malloc(strlen(system_error_string) + (zip_error_string ? strlen(zip_error_string) + 2 : 0) + 1)) == NULL) { + return _zip_err_str[ZIP_ER_MEMORY].description; + } + + sprintf(s, "%s%s%s", (zip_error_string ? zip_error_string : ""), (zip_error_string ? ": " : ""), system_error_string); + err->str = s; + + return s; + } +} diff --git a/3rdparty/libzip/lib/zip_error_to_str.c b/3rdparty/libzip/lib/zip_error_to_str.c new file mode 100644 index 0000000000000000000000000000000000000000..f13ac19cac483a15ecb815309bfbcbd77bfe6013 --- /dev/null +++ b/3rdparty/libzip/lib/zip_error_to_str.c @@ -0,0 +1,67 @@ +/* + zip_error_to_str.c -- get string representation of zip error code + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdio.h> +#include <string.h> +#include <zlib.h> + +#define _ZIP_COMPILING_DEPRECATED +#include "zipint.h" + + +ZIP_EXTERN int +zip_error_to_str(char *buf, zip_uint64_t len, int ze, int se) { + const char *zs, *ss; + + if (ze < 0 || ze >= _zip_err_str_count) { + return snprintf(buf, len, "Unknown error %d", ze); + } + + zs = _zip_err_str[ze].description; + + switch (_zip_err_str[ze].type) { + case ZIP_ET_SYS: + ss = strerror(se); + break; + + case ZIP_ET_ZLIB: + ss = zError(se); + break; + + default: + ss = NULL; + } + + return snprintf(buf, len, "%s%s%s", zs, (ss ? ": " : ""), (ss ? ss : "")); +} diff --git a/3rdparty/libzip/lib/zip_extra_field.c b/3rdparty/libzip/lib/zip_extra_field.c new file mode 100644 index 0000000000000000000000000000000000000000..8983f758cbb50bf88a09d991c183daf33b468f56 --- /dev/null +++ b/3rdparty/libzip/lib/zip_extra_field.c @@ -0,0 +1,426 @@ +/* + zip_extra_field.c -- manipulate extra fields + Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + +#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, ZIP_ER_DETAIL_INVALID_EF_LENGTH); + _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, ZIP_ER_DETAIL_EF_TRAILING_GARBAGE); + _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/3rdparty/libzip/lib/zip_extra_field_api.c b/3rdparty/libzip/lib/zip_extra_field_api.c new file mode 100644 index 0000000000000000000000000000000000000000..9a828e4a590f5fe36240d10d082fe69bc12ee4b8 --- /dev/null +++ b/3rdparty/libzip/lib/zip_extra_field_api.c @@ -0,0 +1,355 @@ +/* + zip_extra_field_api.c -- public extra fields API functions + Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_fclose.c b/3rdparty/libzip/lib/zip_fclose.c new file mode 100644 index 0000000000000000000000000000000000000000..3984b98b16968c22481bddb80eef982afd59c045 --- /dev/null +++ b/3rdparty/libzip/lib/zip_fclose.c @@ -0,0 +1,54 @@ +/* + zip_fclose.c -- close file in zip archive + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#include "zipint.h" + + +ZIP_EXTERN int +zip_fclose(zip_file_t *zf) { + int ret; + + if (zf->src) + zip_source_free(zf->src); + + ret = 0; + if (zf->error.zip_err) + ret = zf->error.zip_err; + + zip_error_fini(&zf->error); + free(zf); + return ret; +} diff --git a/3rdparty/libzip/lib/zip_fdopen.c b/3rdparty/libzip/lib/zip_fdopen.c new file mode 100644 index 0000000000000000000000000000000000000000..c2708c6621140a671320c2000d13250c6f8274b2 --- /dev/null +++ b/3rdparty/libzip/lib/zip_fdopen.c @@ -0,0 +1,86 @@ +/* + zip_fdopen.c -- open read-only archive from file descriptor + Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_UNISTD_H +#include <unistd.h> +#endif + + +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; + } + + /* We dup() here to avoid messing with the passed in fd. + We could not restore it to the original state in case of error. */ + + if ((fd = dup(fd_orig)) < 0) { + _zip_set_open_error(zep, NULL, ZIP_ER_OPEN); + return NULL; + } + + if ((fp = fdopen(fd, "rb")) == NULL) { + close(fd); + _zip_set_open_error(zep, NULL, ZIP_ER_OPEN); + return NULL; + } + + 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/3rdparty/libzip/lib/zip_file_add.c b/3rdparty/libzip/lib/zip_file_add.c new file mode 100644 index 0000000000000000000000000000000000000000..02b65998125693cbd7818197c6d9524ea9344053 --- /dev/null +++ b/3rdparty/libzip/lib/zip_file_add.c @@ -0,0 +1,52 @@ +/* + zip_file_add.c -- add file via callback function + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_file_error_clear.c b/3rdparty/libzip/lib/zip_file_error_clear.c new file mode 100644 index 0000000000000000000000000000000000000000..b47e3d243257b67d446fa8ae4899cbc2b83f1903 --- /dev/null +++ b/3rdparty/libzip/lib/zip_file_error_clear.c @@ -0,0 +1,44 @@ +/* + zip_file_error_clear.c -- clear zip file error + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_error_clear(zip_file_t *zf) { + if (zf == NULL) + return; + + _zip_error_clear(&zf->error); +} diff --git a/3rdparty/libzip/lib/zip_file_error_get.c b/3rdparty/libzip/lib/zip_file_error_get.c new file mode 100644 index 0000000000000000000000000000000000000000..cce1ac2bbc64d5ce98125b1bf6351e6a1ee80b36 --- /dev/null +++ b/3rdparty/libzip/lib/zip_file_error_get.c @@ -0,0 +1,41 @@ +/* + zip_file_error_get.c -- get zip file error + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 void +zip_file_error_get(zip_file_t *zf, int *zep, int *sep) { + _zip_error_get(&zf->error, zep, sep); +} diff --git a/3rdparty/libzip/lib/zip_file_get_comment.c b/3rdparty/libzip/lib/zip_file_get_comment.c new file mode 100644 index 0000000000000000000000000000000000000000..59b768a2850ef74b42676b0008df52abb745fc1b --- /dev/null +++ b/3rdparty/libzip/lib/zip_file_get_comment.c @@ -0,0 +1,55 @@ +/* + zip_file_get_comment.c -- get file comment + Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_file_get_external_attributes.c b/3rdparty/libzip/lib/zip_file_get_external_attributes.c new file mode 100644 index 0000000000000000000000000000000000000000..f642918db76aa8e7fa178ef651b6d82c1b938373 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_file_get_offset.c b/3rdparty/libzip/lib/zip_file_get_offset.c new file mode 100644 index 0000000000000000000000000000000000000000..c9c8fd8de95d7c056a15ddce892fbc5083563441 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdio.h> +#include <string.h> + +#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/3rdparty/libzip/lib/zip_file_rename.c b/3rdparty/libzip/lib/zip_file_rename.c new file mode 100644 index 0000000000000000000000000000000000000000..d65f64aa395715b1eafed23b78e2ffe5841a1a33 --- /dev/null +++ b/3rdparty/libzip/lib/zip_file_rename.c @@ -0,0 +1,67 @@ +/* + zip_file_rename.c -- rename file in zip archive + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <string.h> + +#include "zipint.h" + + +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 (ZIP_IS_RDONLY(za)) { + zip_error_set(&za->error, ZIP_ER_RDONLY, 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; + } + + return _zip_set_name(za, idx, name, flags); +} diff --git a/3rdparty/libzip/lib/zip_file_replace.c b/3rdparty/libzip/lib/zip_file_replace.c new file mode 100644 index 0000000000000000000000000000000000000000..a8cf86c673e7bd1a5a6d2756d606e0ea333b2841 --- /dev/null +++ b/3rdparty/libzip/lib/zip_file_replace.c @@ -0,0 +1,105 @@ +/* + zip_file_replace.c -- replace file via callback function + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_file_set_comment.c b/3rdparty/libzip/lib/zip_file_set_comment.c new file mode 100644 index 0000000000000000000000000000000000000000..0276a4752c0ede4a6e1b083c721c38419f548cd6 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#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/3rdparty/libzip/lib/zip_file_set_encryption.c b/3rdparty/libzip/lib/zip_file_set_encryption.c new file mode 100644 index 0000000000000000000000000000000000000000..aa0d707d2b5283756a1218941d5befd567ddcbee --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + +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/3rdparty/libzip/lib/zip_file_set_external_attributes.c b/3rdparty/libzip/lib/zip_file_set_external_attributes.c new file mode 100644 index 0000000000000000000000000000000000000000..6ca01f29ad4b8cae22ed3c804a2b6fb4e67db244 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_file_set_mtime.c b/3rdparty/libzip/lib/zip_file_set_mtime.c new file mode 100644 index 0000000000000000000000000000000000000000..2753d595e58c93a792dece03c23953c25980b0d0 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_file_strerror.c b/3rdparty/libzip/lib/zip_file_strerror.c new file mode 100644 index 0000000000000000000000000000000000000000..e21c1dcda56a1ab9e8fa314a5c59120d89bbb4ac --- /dev/null +++ b/3rdparty/libzip/lib/zip_file_strerror.c @@ -0,0 +1,41 @@ +/* + zip_file_sterror.c -- get string representation of zip file error + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_file_strerror(zip_file_t *zf) { + return zip_error_strerror(&zf->error); +} diff --git a/3rdparty/libzip/lib/zip_fopen.c b/3rdparty/libzip/lib/zip_fopen.c new file mode 100644 index 0000000000000000000000000000000000000000..513f78b625eb8b631fb84645fcba3713588878fb --- /dev/null +++ b/3rdparty/libzip/lib/zip_fopen.c @@ -0,0 +1,46 @@ +/* + zip_fopen.c -- open file in zip archive for reading + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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(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; + + return zip_fopen_index_encrypted(za, (zip_uint64_t)idx, flags, za->default_password); +} diff --git a/3rdparty/libzip/lib/zip_fopen_encrypted.c b/3rdparty/libzip/lib/zip_fopen_encrypted.c new file mode 100644 index 0000000000000000000000000000000000000000..5a48437e3af441e283d3bed5f3c993df33894d33 --- /dev/null +++ b/3rdparty/libzip/lib/zip_fopen_encrypted.c @@ -0,0 +1,46 @@ +/* + zip_fopen_encrypted.c -- open file for reading with password + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_fopen_index.c b/3rdparty/libzip/lib/zip_fopen_index.c new file mode 100644 index 0000000000000000000000000000000000000000..1f7ce8cb5eadfe9770e21a425d339785a5544533 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_fopen_index_encrypted.c b/3rdparty/libzip/lib/zip_fopen_index_encrypted.c new file mode 100644 index 0000000000000000000000000000000000000000..dfdeffa977db130780cd10f43af4360c7b9449cf --- /dev/null +++ b/3rdparty/libzip/lib/zip_fopen_index_encrypted.c @@ -0,0 +1,87 @@ +/* + zip_fopen_index_encrypted.c -- open file for reading by index w/ password + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdio.h> +#include <stdlib.h> + +#include "zipint.h" + +static zip_file_t *_zip_file_new(zip_t *za); + + +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; + + if (password != NULL && password[0] == '\0') { + password = NULL; + } + + if ((src = _zip_source_zip_new(za, index, flags, 0, 0, password, &za->error)) == NULL) + return NULL; + + if (zip_source_open(src) < 0) { + _zip_error_set_from_source(&za->error, src); + zip_source_free(src); + return NULL; + } + + if ((zf = _zip_file_new(za)) == NULL) { + zip_source_free(src); + return NULL; + } + + zf->src = src; + + 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/3rdparty/libzip/lib/zip_fread.c b/3rdparty/libzip/lib/zip_fread.c new file mode 100644 index 0000000000000000000000000000000000000000..edad9d2a995b60a52750e3eee06eaaf6518cef1b --- /dev/null +++ b/3rdparty/libzip/lib/zip_fread.c @@ -0,0 +1,62 @@ +/* + zip_fread.c -- read from file + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_fseek.c b/3rdparty/libzip/lib/zip_fseek.c new file mode 100644 index 0000000000000000000000000000000000000000..542ca0759b03ccc5edf53d5627e2a529deacf5ce --- /dev/null +++ b/3rdparty/libzip/lib/zip_fseek.c @@ -0,0 +1,51 @@ +/* + zip_fseek.c -- seek in file + Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_ftell.c b/3rdparty/libzip/lib/zip_ftell.c new file mode 100644 index 0000000000000000000000000000000000000000..42067a1dd4c26c37a825082f1e4788e5a842bc99 --- /dev/null +++ b/3rdparty/libzip/lib/zip_ftell.c @@ -0,0 +1,54 @@ +/* + zip_ftell.c -- tell position in file + Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_get_archive_comment.c b/3rdparty/libzip/lib/zip_get_archive_comment.c new file mode 100644 index 0000000000000000000000000000000000000000..6752380514ccba24d596aa2261ab557a6e31a650 --- /dev/null +++ b/3rdparty/libzip/lib/zip_get_archive_comment.c @@ -0,0 +1,58 @@ +/* + zip_get_archive_comment.c -- get archive comment + Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <string.h> + +#include "zipint.h" + + +ZIP_EXTERN const char * +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/3rdparty/libzip/lib/zip_get_archive_flag.c b/3rdparty/libzip/lib/zip_get_archive_flag.c new file mode 100644 index 0000000000000000000000000000000000000000..e4d412cf5cd510be97263ff3dc530807242f5e51 --- /dev/null +++ b/3rdparty/libzip/lib/zip_get_archive_flag.c @@ -0,0 +1,45 @@ +/* + zip_get_archive_flag.c -- get archive global flag + Copyright (C) 2008-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_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; + + return (fl & flag) ? 1 : 0; +} diff --git a/3rdparty/libzip/lib/zip_get_encryption_implementation.c b/3rdparty/libzip/lib/zip_get_encryption_implementation.c new file mode 100644 index 0000000000000000000000000000000000000000..191e805b229bf9e81146a5c0d4b188fd132ec372 --- /dev/null +++ b/3rdparty/libzip/lib/zip_get_encryption_implementation.c @@ -0,0 +1,62 @@ +/* + zip_get_encryption_implementation.c -- get encryption implementation + Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_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_encryption_method_supported(zip_uint16_t method, int encode) { + if (method == ZIP_EM_NONE) { + return 1; + } + return _zip_get_encryption_implementation(method, encode ? ZIP_CODEC_ENCODE : ZIP_CODEC_DECODE) != NULL; +} diff --git a/3rdparty/libzip/lib/zip_get_file_comment.c b/3rdparty/libzip/lib/zip_get_file_comment.c new file mode 100644 index 0000000000000000000000000000000000000000..dd118160d8087329f85bf754b010f713c06a11bc --- /dev/null +++ b/3rdparty/libzip/lib/zip_get_file_comment.c @@ -0,0 +1,50 @@ +/* + zip_get_file_comment.c -- get file comment + Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 const char * +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; + } + + return s; +} diff --git a/3rdparty/libzip/lib/zip_get_name.c b/3rdparty/libzip/lib/zip_get_name.c new file mode 100644 index 0000000000000000000000000000000000000000..8777868649a6e4396d2bbfbe96e48c5ec20fb567 --- /dev/null +++ b/3rdparty/libzip/lib/zip_get_name.c @@ -0,0 +1,58 @@ +/* + zip_get_name.c -- get filename for a file in zip file + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <string.h> + +#include "zipint.h" + + +ZIP_EXTERN const char * +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(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 ((de = _zip_get_dirent(za, idx, flags, error)) == NULL) + return NULL; + + if ((str = _zip_string_get(de->filename, NULL, flags, error)) == NULL) + return NULL; + + return (const char *)str; +} diff --git a/3rdparty/libzip/lib/zip_get_num_entries.c b/3rdparty/libzip/lib/zip_get_num_entries.c new file mode 100644 index 0000000000000000000000000000000000000000..16d901c6dbf9d8a6f135ecb47e4169d5d0f469e8 --- /dev/null +++ b/3rdparty/libzip/lib/zip_get_num_entries.c @@ -0,0 +1,52 @@ +/* + zip_get_num_entries.c -- get number of entries in archive + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_get_num_entries(zip_t *za, zip_flags_t flags) { + zip_uint64_t n; + + if (za == NULL) + return -1; + + 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_int64_t)za->nentry; +} diff --git a/3rdparty/libzip/lib/zip_get_num_files.c b/3rdparty/libzip/lib/zip_get_num_files.c new file mode 100644 index 0000000000000000000000000000000000000000..1c6d6bb8c417a59894a40eae21f06f97820226bd --- /dev/null +++ b/3rdparty/libzip/lib/zip_get_num_files.c @@ -0,0 +1,51 @@ +/* + zip_get_num_files.c -- get number of files in archive + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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" +#include <limits.h> + + +ZIP_EXTERN int +zip_get_num_files(zip_t *za) { + if (za == NULL) + return -1; + + if (za->nentry > INT_MAX) { + zip_error_set(&za->error, ZIP_ER_OPNOTSUPP, 0); + return -1; + } + + return (int)za->nentry; +} diff --git a/3rdparty/libzip/lib/zip_hash.c b/3rdparty/libzip/lib/zip_hash.c new file mode 100644 index 0000000000000000000000000000000000000000..e01d9356c14ea9484e147dce1f6a779f95a8a242 --- /dev/null +++ b/3rdparty/libzip/lib/zip_hash.c @@ -0,0 +1,410 @@ +/* + zip_hash.c -- hash table string -> uint64 + Copyright (C) 2015-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + +/* 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 <seander@cs.stanford.edu> + (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/3rdparty/libzip/lib/zip_io_util.c b/3rdparty/libzip/lib/zip_io_util.c new file mode 100644 index 0000000000000000000000000000000000000000..3ee36709f11469de3abaf12b926f479acb087d1b --- /dev/null +++ b/3rdparty/libzip/lib/zip_io_util.c @@ -0,0 +1,134 @@ +/* + zip_io_util.c -- I/O helper functions + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + +#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/3rdparty/libzip/lib/zip_libzip_version.c b/3rdparty/libzip/lib/zip_libzip_version.c new file mode 100644 index 0000000000000000000000000000000000000000..6e20724a5a19c502d8a9bc5835f1b54475a9b9be --- /dev/null +++ b/3rdparty/libzip/lib/zip_libzip_version.c @@ -0,0 +1,41 @@ +/* + zip_libzip_version.c -- return run-time version of library + Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_memdup.c b/3rdparty/libzip/lib/zip_memdup.c new file mode 100644 index 0000000000000000000000000000000000000000..8f6175bd6219bebcb7903782d4970cc24f3482c8 --- /dev/null +++ b/3rdparty/libzip/lib/zip_memdup.c @@ -0,0 +1,56 @@ +/* + zip_memdup.c -- internal zip function, "strdup" with len + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + +#include "zipint.h" + + +void * +_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; + } + + memcpy(ret, mem, len); + + return ret; +} diff --git a/3rdparty/libzip/lib/zip_mkstempm.c b/3rdparty/libzip/lib/zip_mkstempm.c new file mode 100644 index 0000000000000000000000000000000000000000..ccdd62a2497f930a3031a698a5d5f31fa77c924b --- /dev/null +++ b/3rdparty/libzip/lib/zip_mkstempm.c @@ -0,0 +1,93 @@ +/* + zip_mkstempm.c -- mkstemp replacement that accepts a mode argument + Copyright (C) 2019-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <errno.h> +#include <fcntl.h> +#include <string.h> +#include <sys/stat.h> + +#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/3rdparty/libzip/lib/zip_name_locate.c b/3rdparty/libzip/lib/zip_name_locate.c new file mode 100644 index 0000000000000000000000000000000000000000..8a88404771286075872a60ddf02e9826631381a2 --- /dev/null +++ b/3rdparty/libzip/lib/zip_name_locate.c @@ -0,0 +1,92 @@ +/* + zip_name_locate.c -- get index by name + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <string.h> +#ifdef HAVE_STRINGS_H +#include <strings.h> +#endif + +#include "zipint.h" + + +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); +} + + +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; + zip_uint64_t i; + + if (za == NULL) + return -1; + + if (fname == NULL) { + zip_error_set(error, ZIP_ER_INVAL, 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/3rdparty/libzip/lib/zip_new.c b/3rdparty/libzip/lib/zip_new.c new file mode 100644 index 0000000000000000000000000000000000000000..3768d5b5aa06d4300a078dc86bdc1e217bcb80d8 --- /dev/null +++ b/3rdparty/libzip/lib/zip_new.c @@ -0,0 +1,73 @@ +/* + zip_new.c -- create and init struct zip + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#include "zipint.h" + + +/* _zip_new: + creates a new zipfile struct, and sets the contents to zero; returns + the new struct. */ + +zip_t * +_zip_new(zip_error_t *error) { + zip_t *za; + + za = (zip_t *)malloc(sizeof(struct zip)); + if (!za) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + 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->nopen_source = za->nopen_source_alloc = 0; + za->open_source = NULL; + za->progress = NULL; + + return za; +} diff --git a/3rdparty/libzip/lib/zip_open.c b/3rdparty/libzip/lib/zip_open.c new file mode 100644 index 0000000000000000000000000000000000000000..1d2f69a711baaed070389c70b4d34fa3d89d1b7b --- /dev/null +++ b/3rdparty/libzip/lib/zip_open.c @@ -0,0 +1,861 @@ +/* + zip_open.c -- open zip archive by name + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdio.h> +#include <stdlib.h> +#include <string.h> + +#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); + switch (zip_error_system_type(err)) { + case ZIP_ET_SYS: + case ZIP_ET_LIBZIP: + errno = zip_error_code_system(err); + break; + + default: + break; + } + } + + 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, ZIP_ER_DETAIL_CDIR_OVERLAPS_EOCD); + _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, ZIP_ER_DETAIL_COMMENT_LENGTH_INVALID); + _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, ZIP_ER_DETAIL_CDIR_LENGTH_INVALID); + _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 (zip_error_code_zip(error) == ZIP_ER_INCONS) { + zip_error_set(error, ZIP_ER_INCONS, ADD_INDEX_TO_DETAIL(zip_error_code_system(error), i)); + } + else if (grown && zip_error_code_zip(error) == ZIP_ER_NOZIP) { + zip_error_set(error, ZIP_ER_INCONS, MAKE_DETAIL_WITH_INDEX(ZIP_ER_DETAIL_CDIR_ENTRY_INVALID, i)); + } + _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, ZIP_ER_DETAIL_CDIR_WRONG_ENTRIES_COUNT); + _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, ZIP_ER_DETAIL_CDIR_LENGTH_INVALID); + _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) { + if (zip_error_code_zip(error) == ZIP_ER_INCONS) { + zip_error_set(error, ZIP_ER_INCONS, ADD_INDEX_TO_DETAIL(zip_error_code_system(error), i)); + } + _zip_dirent_finalize(&temp); + return -1; + } + + if (_zip_headercomp(cd->entry[i].orig, &temp) != 0) { + zip_error_set(error, ZIP_ER_INCONS, MAKE_DETAIL_WITH_INDEX(ZIP_ER_DETAIL_ENTRY_HEADER_MISMATCH, i)); + _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, ZIP_ER_DETAIL_EOCD_LENGTH_INVALID); + 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, ZIP_ER_DETAIL_CDIR_OVERLAPS_EOCD); + return NULL; + } + + if ((flags & ZIP_CHECKCONS) && offset + size != buf_offset + eocd_offset) { + zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_LENGTH_INVALID); + 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, ZIP_ER_DETAIL_EOCD64_OVERLAPS_EOCD); + 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, ZIP_ER_DETAIL_EOCD64_WRONG_MAGIC); + 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, ZIP_ER_DETAIL_EOCD64_OVERLAPS_EOCD); + 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, ZIP_ER_DETAIL_EOCD64_MISMATCH); + 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, ZIP_ER_DETAIL_CDIR_OVERLAPS_EOCD); + return NULL; + } + if ((flags & ZIP_CHECKCONS) && offset + size != buf_offset + eocd_offset) { + zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_OVERLAPS_EOCD); + return NULL; + } + + if (nentry > size / CDENTRYSIZE) { + zip_error_set(error, ZIP_ER_INCONS, ZIP_ER_DETAIL_CDIR_INVALID); + 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/3rdparty/libzip/lib/zip_pkware.c b/3rdparty/libzip/lib/zip_pkware.c new file mode 100644 index 0000000000000000000000000000000000000000..1b1b461a0bc7e76f42782bf53e3abf4dec2e66ee --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <zlib.h> + +#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/3rdparty/libzip/lib/zip_progress.c b/3rdparty/libzip/lib/zip_progress.c new file mode 100644 index 0000000000000000000000000000000000000000..a881df4766e5e51ebb8a97012103b0c5739d2d75 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + + +#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/3rdparty/libzip/lib/zip_random_unix.c b/3rdparty/libzip/lib/zip_random_unix.c new file mode 100644 index 0000000000000000000000000000000000000000..da44d3cf219dde43b271a3f13041f0ea08002cff --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#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 <fcntl.h> +#include <unistd.h> + +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 <stdlib.h> + +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/3rdparty/libzip/lib/zip_random_uwp.c b/3rdparty/libzip/lib/zip_random_uwp.c new file mode 100644 index 0000000000000000000000000000000000000000..04b03b402fdbd5d926f3364df3027a144a92b699 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <bcrypt.h> +#include <ntstatus.h> +#include <windows.h> + +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 <stdlib.h> + +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/3rdparty/libzip/lib/zip_random_win32.c b/3rdparty/libzip/lib/zip_random_win32.c new file mode 100644 index 0000000000000000000000000000000000000000..436306b1b1b78ee8b1fe2f2681bfbebb5ebee857 --- /dev/null +++ b/3rdparty/libzip/lib/zip_random_win32.c @@ -0,0 +1,81 @@ +/* + zip_random_win32.c -- fill the user's buffer with random stuff (Windows version) + Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 + +#include <windows.h> + +#ifndef HAVE_SECURE_RANDOM + +#include <wincrypt.h> + +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; + } + if (!CryptGenRandom(hprov, length, buffer)) { + return false; + } + if (!CryptReleaseContext(hprov, 0)) { + return false; + } + return true; +} +#endif + +#ifndef HAVE_RANDOM_UINT32 +#include <stdlib.h> + +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/3rdparty/libzip/lib/zip_rename.c b/3rdparty/libzip/lib/zip_rename.c new file mode 100644 index 0000000000000000000000000000000000000000..3e67b7c2add58c89f39fb01c78c278de818b068f --- /dev/null +++ b/3rdparty/libzip/lib/zip_rename.c @@ -0,0 +1,42 @@ +/* + zip_rename.c -- rename file in zip archive + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_rename(zip_t *za, zip_uint64_t idx, const char *name) { + return zip_file_rename(za, idx, name, 0); +} diff --git a/3rdparty/libzip/lib/zip_replace.c b/3rdparty/libzip/lib/zip_replace.c new file mode 100644 index 0000000000000000000000000000000000000000..e9a2973173ac24ce38e2939615c46eed6cc79294 --- /dev/null +++ b/3rdparty/libzip/lib/zip_replace.c @@ -0,0 +1,42 @@ +/* + zip_replace.c -- replace file via callback function + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_replace(zip_t *za, zip_uint64_t idx, zip_source_t *source) { + return zip_file_replace(za, idx, source, 0); +} diff --git a/3rdparty/libzip/lib/zip_set_archive_comment.c b/3rdparty/libzip/lib/zip_set_archive_comment.c new file mode 100644 index 0000000000000000000000000000000000000000..ee6f2ba11c52b93af102f7b8ab56e3f72b11f5b5 --- /dev/null +++ b/3rdparty/libzip/lib/zip_set_archive_comment.c @@ -0,0 +1,80 @@ +/* + zip_set_archive_comment.c -- set archive comment + Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#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/3rdparty/libzip/lib/zip_set_archive_flag.c b/3rdparty/libzip/lib/zip_set_archive_flag.c new file mode 100644 index 0000000000000000000000000000000000000000..a5afc818aef6e0444a62150db1409b54643bcf0c --- /dev/null +++ b/3rdparty/libzip/lib/zip_set_archive_flag.c @@ -0,0 +1,65 @@ +/* + zip_get_archive_flag.c -- set archive global flag + Copyright (C) 2008-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_archive_flag(zip_t *za, zip_flags_t flag, int value) { + unsigned int new_flags; + + if (value) + new_flags = za->ch_flags | flag; + else + 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; + + return 0; +} diff --git a/3rdparty/libzip/lib/zip_set_default_password.c b/3rdparty/libzip/lib/zip_set_default_password.c new file mode 100644 index 0000000000000000000000000000000000000000..625ac3fad86a36f35b8c796006461f5d852b4717 --- /dev/null +++ b/3rdparty/libzip/lib/zip_set_default_password.c @@ -0,0 +1,58 @@ +/* + zip_set_default_password.c -- set default password for decryption + Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + +#include "zipint.h" + + +ZIP_EXTERN int +zip_set_default_password(zip_t *za, const char *passwd) { + if (za == NULL) + return -1; + + free(za->default_password); + + if (passwd && passwd[0] != '\0') { + if ((za->default_password = strdup(passwd)) == NULL) { + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + } + else + za->default_password = NULL; + + return 0; +} diff --git a/3rdparty/libzip/lib/zip_set_file_comment.c b/3rdparty/libzip/lib/zip_set_file_comment.c new file mode 100644 index 0000000000000000000000000000000000000000..2e7dcb792c4e4144c1875273a27a925c076d16b2 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_set_file_compression.c b/3rdparty/libzip/lib/zip_set_file_compression.c new file mode 100644 index 0000000000000000000000000000000000000000..d2027c992163e313152664b87409c06ed871a042 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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) { + 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/3rdparty/libzip/lib/zip_set_name.c b/3rdparty/libzip/lib/zip_set_name.c new file mode 100644 index 0000000000000000000000000000000000000000..af4ec93493f68d3a3bd06f2a4ba99b2da3170310 --- /dev/null +++ b/3rdparty/libzip/lib/zip_set_name.c @@ -0,0 +1,157 @@ +/* + zip_set_name.c -- rename helper function + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + +#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/3rdparty/libzip/lib/zip_source_accept_empty.c b/3rdparty/libzip/lib/zip_source_accept_empty.c new file mode 100644 index 0000000000000000000000000000000000000000..10f40124d6296e07b3c634841c487f2343073b15 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_begin_write.c b/3rdparty/libzip/lib/zip_source_begin_write.c new file mode 100644 index 0000000000000000000000000000000000000000..cefb809241a4d4012289e656fd89f167bc9531c3 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_begin_write_cloning.c b/3rdparty/libzip/lib/zip_source_begin_write_cloning.c new file mode 100644 index 0000000000000000000000000000000000000000..71911e794f8aab0f80e1174a40ba65912391fa48 --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_begin_write_cloning.c @@ -0,0 +1,52 @@ +/* + zip_source_begin_write_cloning.c -- clone part of file for writing + Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_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; + } + + 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/3rdparty/libzip/lib/zip_source_buffer.c b/3rdparty/libzip/lib/zip_source_buffer.c new file mode 100644 index 0000000000000000000000000000000000000000..e0ab72be67c07b5b80a044ba0587b454cdba1b47 --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_buffer.c @@ -0,0 +1,620 @@ +/* + zip_source_buffer.c -- create zip data source from buffer + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + +#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/3rdparty/libzip/lib/zip_source_call.c b/3rdparty/libzip/lib/zip_source_call.c new file mode 100644 index 0000000000000000000000000000000000000000..41b5c0ffa06e0bbbccc6f91ae05f58f4fcc47e83 --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_call.c @@ -0,0 +1,68 @@ +/* + zip_source_call.c -- invoke callback command on zip_source + Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_close.c b/3rdparty/libzip/lib/zip_source_close.c new file mode 100644 index 0000000000000000000000000000000000000000..48efe8af8682e7a6688afefa41196e2921f0454e --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_close.c @@ -0,0 +1,57 @@ +/* + zip_source_close.c -- close zip_source (stop reading) + Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_commit_write.c b/3rdparty/libzip/lib/zip_source_commit_write.c new file mode 100644 index 0000000000000000000000000000000000000000..30243d55683999dff3a35d9a1260d19838cb4b56 --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_commit_write.c @@ -0,0 +1,63 @@ +/* + zip_source_commit_write.c -- commit changes to file + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_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 (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; + } + } + + 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/3rdparty/libzip/lib/zip_source_compress.c b/3rdparty/libzip/lib/zip_source_compress.c new file mode 100644 index 0000000000000000000000000000000000000000..9776065f97cbde8bf714d57fffa12f3aed68d67b --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_compress.c @@ -0,0 +1,398 @@ +/* + zip_source_compress.c -- (de)compression routines + Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + +#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/3rdparty/libzip/lib/zip_source_crc.c b/3rdparty/libzip/lib/zip_source_crc.c new file mode 100644 index 0000000000000000000000000000000000000000..ebbeaa7c5ef6b7b381859268234caea5af7aad63 --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_crc.c @@ -0,0 +1,198 @@ +/* + zip_source_crc.c -- pass-through source that calculates CRC32 and size + Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <limits.h> +#include <stdlib.h> +#include <zlib.h> + +#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_create(zip_source_t *src, int validate, zip_error_t *error) { + struct crc_context *ctx; + + if (src == NULL) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((ctx = (struct crc_context *)malloc(sizeof(*ctx))) == NULL) { + zip_error_set(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_create(src, crc_read, ctx, error); +} + + +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) { + /* We don't have the index here, but the caller should know which file they are reading from. */ + zip_error_set(&ctx->error, ZIP_ER_INCONS, MAKE_DETAIL_WITH_INDEX(ZIP_ER_DETAIL_INVALID_FILE_LENGTH, MAX_DETAIL_INDEX)); + 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/3rdparty/libzip/lib/zip_source_error.c b/3rdparty/libzip/lib/zip_source_error.c new file mode 100644 index 0000000000000000000000000000000000000000..042901fbdfd946dc3597d8365bb2aaa473adb40d --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_error.c @@ -0,0 +1,46 @@ +/* + zip_source_error.c -- get last error from zip_source + Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_file.h b/3rdparty/libzip/lib/zip_source_file.h new file mode 100644 index 0000000000000000000000000000000000000000..43a464533c1290c38748a640f8a4145f7789e2a0 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_file_common.c b/3rdparty/libzip/lib/zip_source_file_common.c new file mode 100644 index 0000000000000000000000000000000000000000..001239571811a408003c19a32a34b658c5991474 --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_file_common.c @@ -0,0 +1,378 @@ +/* + zip_source_file_common.c -- create data source from file + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdio.h> +#include <stdlib.h> +#include <string.h> + +#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/3rdparty/libzip/lib/zip_source_file_stdio.c b/3rdparty/libzip/lib/zip_source_file_stdio.c new file mode 100644 index 0000000000000000000000000000000000000000..15817716c0fabf49f3cd21f61bc4bd0b170a36ad --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/stat.h> + +#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/3rdparty/libzip/lib/zip_source_file_stdio.h b/3rdparty/libzip/lib/zip_source_file_stdio.h new file mode 100644 index 0000000000000000000000000000000000000000..1bf698ce281efd98c79477df9898f3525d386ad7 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdio.h> + +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/3rdparty/libzip/lib/zip_source_file_stdio_named.c b/3rdparty/libzip/lib/zip_source_file_stdio_named.c new file mode 100644 index 0000000000000000000000000000000000000000..5387c7663f1e6dfe0d27a2008a7def598a57300d --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <sys/stat.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#ifdef HAVE_CLONEFILE +#include <sys/attr.h> +#include <sys/clonefile.h> +#define CAN_CLONE +#endif +#ifdef HAVE_FICLONERANGE +#include <linux/fs.h> +#include <sys/ioctl.h> +#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/3rdparty/libzip/lib/zip_source_file_win32.c b/3rdparty/libzip/lib/zip_source_file_win32.c new file mode 100644 index 0000000000000000000000000000000000000000..6547fc20e7d398eaa835402a8923b5c3902e2be4 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_file_win32.h b/3rdparty/libzip/lib/zip_source_file_win32.h new file mode 100644 index 0000000000000000000000000000000000000000..88e45b1f92d0af24ac57c42769491a640bf541c6 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <windows.h> + +#include <aclapi.h> + +#include <stdlib.h> + +#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/3rdparty/libzip/lib/zip_source_file_win32_ansi.c b/3rdparty/libzip/lib/zip_source_file_win32_ansi.c new file mode 100644 index 0000000000000000000000000000000000000000..f299692b8eabfc6154540036fe2639e214841372 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_file_win32_named.c b/3rdparty/libzip/lib/zip_source_file_win32_named.c new file mode 100644 index 0000000000000000000000000000000000000000..1fe55918078110af1868e38e2fe9793f5717777a --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_file_win32_utf16.c b/3rdparty/libzip/lib/zip_source_file_win32_utf16.c new file mode 100644 index 0000000000000000000000000000000000000000..6aef2bb49b88d0ba4218d7d9523cd4d03c7241a4 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_file_win32_utf8.c b/3rdparty/libzip/lib/zip_source_file_win32_utf8.c new file mode 100644 index 0000000000000000000000000000000000000000..d6728e34fd003a8e9db64c376b220c10a7c13415 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_free.c b/3rdparty/libzip/lib/zip_source_free.c new file mode 100644 index 0000000000000000000000000000000000000000..2e6944e5a6b0a97aff209f0db4122a2839e2e64c --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_free.c @@ -0,0 +1,71 @@ +/* + zip_source_free.c -- free zip data source + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#include "zipint.h" + + +ZIP_EXTERN void +zip_source_free(zip_source_t *src) { + if (src == NULL) + return; + + if (src->refcount > 0) { + src->refcount--; + } + if (src->refcount > 0) { + return; + } + + 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 (src->source_archive && !src->source_closed) { + _zip_deregister_source(src->source_archive, src); + } + + (void)_zip_source_call(src, NULL, 0, ZIP_SOURCE_FREE); + + if (src->src) { + zip_source_free(src->src); + } + + free(src); +} diff --git a/3rdparty/libzip/lib/zip_source_function.c b/3rdparty/libzip/lib/zip_source_function.c new file mode 100644 index 0000000000000000000000000000000000000000..44db94752c7e18bd76df8910734513c552e4758e --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_function.c @@ -0,0 +1,98 @@ +/* + zip_source_function.c -- create zip data source from callback function + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#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/3rdparty/libzip/lib/zip_source_get_file_attributes.c b/3rdparty/libzip/lib/zip_source_get_file_attributes.c new file mode 100644 index 0000000000000000000000000000000000000000..734767a0e5affa1d3a961a17db7134f72f46e311 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_is_deleted.c b/3rdparty/libzip/lib/zip_source_is_deleted.c new file mode 100644 index 0000000000000000000000000000000000000000..c2c7eb5df0371f5dba923bd28392f4c168d2153f --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_is_deleted.c @@ -0,0 +1,41 @@ +/* + zip_source_is_deleted.c -- was archive was removed? + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_layered.c b/3rdparty/libzip/lib/zip_source_layered.c new file mode 100644 index 0000000000000000000000000000000000000000..f6db2a71c12c66aa7f11187c4accb4ffcdcb2edb --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_layered.c @@ -0,0 +1,67 @@ +/* + zip_source_layered.c -- create layered source + Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#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/3rdparty/libzip/lib/zip_source_open.c b/3rdparty/libzip/lib/zip_source_open.c new file mode 100644 index 0000000000000000000000000000000000000000..b12a4c28fd1e0b6ca850fb350f364e087fff0e41 --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_open.c @@ -0,0 +1,76 @@ +/* + zip_source_open.c -- open zip_source (prepare for reading) + Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_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 (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; + } + } + + if (_zip_source_call(src, NULL, 0, ZIP_SOURCE_OPEN) < 0) { + if (ZIP_SOURCE_IS_LAYERED(src)) { + zip_source_close(src->src); + } + return -1; + } + } + + 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/3rdparty/libzip/lib/zip_source_pkware_decode.c b/3rdparty/libzip/lib/zip_source_pkware_decode.c new file mode 100644 index 0000000000000000000000000000000000000000..a1c9e3a9b31524c4dcc8228d28115e509f2513c0 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + +#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/3rdparty/libzip/lib/zip_source_pkware_encode.c b/3rdparty/libzip/lib/zip_source_pkware_encode.c new file mode 100644 index 0000000000000000000000000000000000000000..7c77e1e8672b6edeab71802e085bd7029bca55b6 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + +#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/3rdparty/libzip/lib/zip_source_read.c b/3rdparty/libzip/lib/zip_source_read.c new file mode 100644 index 0000000000000000000000000000000000000000..ee7686a18b14b81ece6badc0a029d6c4d18eccae --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_read.c @@ -0,0 +1,96 @@ +/* + zip_source_read.c -- read data from zip_source + Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_remove.c b/3rdparty/libzip/lib/zip_source_remove.c new file mode 100644 index 0000000000000000000000000000000000000000..46230cdf739704f45a25daa0f1a8fc849064f3e0 --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_remove.c @@ -0,0 +1,60 @@ +/* + zip_source_remove.c -- remove empty archive + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_rollback_write.c b/3rdparty/libzip/lib/zip_source_rollback_write.c new file mode 100644 index 0000000000000000000000000000000000000000..6f98c39433526cfa550d18c7fcc0d32918b0b9f3 --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_rollback_write.c @@ -0,0 +1,46 @@ +/* + zip_source_rollback_write.c -- discard changes + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_seek.c b/3rdparty/libzip/lib/zip_source_seek.c new file mode 100644 index 0000000000000000000000000000000000000000..1acd6d888e2e89f0f45f8f8a90c93cb51b62231a --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_seek.c @@ -0,0 +1,95 @@ +/* + zip_source_seek.c -- seek to offset + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_seek_write.c b/3rdparty/libzip/lib/zip_source_seek_write.c new file mode 100644 index 0000000000000000000000000000000000000000..5599bcb127ac8430e55d75067e4720983f4a6599 --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_seek_write.c @@ -0,0 +1,51 @@ +/* + zip_source_seek_write.c -- seek to offset for writing + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_stat.c b/3rdparty/libzip/lib/zip_source_stat.c new file mode 100644 index 0000000000000000000000000000000000000000..a9745e067ecbf01d6e917887641f6cfb524041e9 --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_stat.c @@ -0,0 +1,62 @@ +/* + zip_source_stat.c -- get meta information from zip_source + Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_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; + } + + zip_stat_init(st); + + 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/3rdparty/libzip/lib/zip_source_supports.c b/3rdparty/libzip/lib/zip_source_supports.c new file mode 100644 index 0000000000000000000000000000000000000000..66a5303c780c6633a79f6b5031792915b5c5612e --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_supports.c @@ -0,0 +1,65 @@ +/* + zip_source_supports.c -- check for supported functions + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdarg.h> + +#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/3rdparty/libzip/lib/zip_source_tell.c b/3rdparty/libzip/lib/zip_source_tell.c new file mode 100644 index 0000000000000000000000000000000000000000..8518739c5316c6e311c3730f15a9d1b081ffd45a --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_tell.c @@ -0,0 +1,57 @@ +/* + zip_source_tell.c -- report current offset + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_tell_write.c b/3rdparty/libzip/lib/zip_source_tell_write.c new file mode 100644 index 0000000000000000000000000000000000000000..8edee67b93b49c6afe18af48bb15b0fa9c330699 --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_tell_write.c @@ -0,0 +1,46 @@ +/* + zip_source_tell_write.c -- report current offset for writing + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_window.c b/3rdparty/libzip/lib/zip_source_window.c new file mode 100644 index 0000000000000000000000000000000000000000..6f457b619946c6486c3afda4cd62a47d15124aef --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_window.c @@ -0,0 +1,338 @@ +/* + zip_source_window.c -- return part of lower source + Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + +#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 */ + bool end_valid; /* whether end is set, otherwise read until EOF */ + + /* 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_EXTERN zip_source_t * +zip_source_window_create(zip_source_t *src, zip_uint64_t start, zip_int64_t len, zip_error_t *error) { + return _zip_source_window_new(src, start, len, NULL, 0, NULL, 0, error); +} + + +zip_source_t * +_zip_source_window_new(zip_source_t *src, zip_uint64_t start, zip_int64_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 || length < -1 || (source_archive == NULL && source_index != 0)) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + if (length >= 0) { + if (start + (zip_uint64_t)length < start) { + 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; + if (length == -1) { + ctx->end_valid = false; + } + else { + ctx->end = start + (zip_uint64_t)length; + ctx->end_valid = true; + } + 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, MAKE_DETAIL_WITH_INDEX(ZIP_ER_DETAIL_CDIR_ENTRY_INVALID, ctx->source_index)); + 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 (ctx->end_valid && 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->end_valid && 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; + + if (!ctx->end_valid) { + 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 (args->whence == SEEK_END) { + if (zip_source_seek(src, args->offset, args->whence) < 0) { + _zip_error_set_from_source(&ctx->error, src); + return -1; + } + new_offset = zip_source_tell(src); + if (new_offset < 0) { + _zip_error_set_from_source(&ctx->error, src); + return -1; + } + if ((zip_uint64_t)new_offset < ctx->start) { + zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); + (void)zip_source_seek(src, (zip_int64_t)ctx->offset, SEEK_SET); + return -1; + } + ctx->offset = (zip_uint64_t)new_offset; + return 0; + } + } + + 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/3rdparty/libzip/lib/zip_source_winzip_aes_decode.c b/3rdparty/libzip/lib/zip_source_winzip_aes_decode.c new file mode 100644 index 0000000000000000000000000000000000000000..2999654152e458479ba8b30f4a75cb1c7cc934e8 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + +#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/3rdparty/libzip/lib/zip_source_winzip_aes_encode.c b/3rdparty/libzip/lib/zip_source_winzip_aes_encode.c new file mode 100644 index 0000000000000000000000000000000000000000..44c4e4bd66f816d797d125a22a75d44283135176 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + +#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/3rdparty/libzip/lib/zip_source_write.c b/3rdparty/libzip/lib/zip_source_write.c new file mode 100644 index 0000000000000000000000000000000000000000..bb72b1454b27d2ee05f74e55e2c11645121bdefe --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_write.c @@ -0,0 +1,46 @@ +/* + zip_source_write.c -- start a new file for writing + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/lib/zip_source_zip.c b/3rdparty/libzip/lib/zip_source_zip.c new file mode 100644 index 0000000000000000000000000000000000000000..e6cedafe29d2766c76d4df3fd391c4b643869f34 --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_zip.c @@ -0,0 +1,59 @@ +/* + zip_source_zip.c -- create data source from zip file + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#include "zipint.h" + +ZIP_EXTERN zip_source_t *zip_source_zip_create(zip_t *srcza, zip_uint64_t srcidx, zip_flags_t flags, zip_uint64_t start, zip_int64_t len, zip_error_t *error) { + if (len < -1) { + zip_error_set(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(srcza, srcidx, flags, start, (zip_uint64_t)len, NULL, error); +} + + +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) { + return zip_source_zip_create(srcza, srcidx, flags, start, len, &za->error); +} diff --git a/3rdparty/libzip/lib/zip_source_zip_new.c b/3rdparty/libzip/lib/zip_source_zip_new.c new file mode 100644 index 0000000000000000000000000000000000000000..cf3d2677fc21b57d497f1e48e8669cb8924d2185 --- /dev/null +++ b/3rdparty/libzip/lib/zip_source_zip_new.c @@ -0,0 +1,190 @@ +/* + zip_source_zip_new.c -- prepare data structures for zip_fopen/zip_source_zip + Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#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 *srcza, zip_uint64_t srcidx, zip_flags_t flags, zip_uint64_t start, zip_uint64_t len, const char *password, zip_error_t *error) { + 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 (srcza == NULL || srcidx >= srcza->nentry || len > ZIP_INT64_MAX) { + zip_error_set(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(error, ZIP_ER_CHANGED, 0); + return NULL; + } + + if (zip_stat_index(srcza, srcidx, flags | ZIP_FL_UNCHANGED, &st) < 0) { + zip_error_set(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(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(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 = srcza->default_password; + } + if (password == NULL) { + zip_error_set(error, ZIP_ER_NOPASSWD, 0); + return NULL; + } + } + + if ((de = _zip_get_dirent(srcza, srcidx, flags, error)) == NULL) { + return NULL; + } + _zip_file_attributes_from_dirent(&attributes, de); + + if (st.comp_size == 0) { + return zip_source_buffer_with_attributes_create(NULL, 0, 0, &attributes, error); + } + + 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, (zip_int64_t)len, &st2, &attributes, srcza, srcidx, error)) == NULL) { + return NULL; + } + } + else { + if (st.comp_size > ZIP_INT64_MAX) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + if ((src = _zip_source_window_new(srcza->src, 0, (zip_int64_t)st.comp_size, &st, &attributes, srcza, srcidx, 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(error, ZIP_ER_ENCRNOTSUPP, 0); + return NULL; + } + + s2 = enc_impl(srcza, src, st.encryption_method, 0, password); + zip_source_free(src); + if (s2 == NULL) { + return NULL; + } + src = s2; + } + if (needs_decompress) { + s2 = zip_source_decompress(srcza, src, st.comp_method); + zip_source_free(src); + if (s2 == NULL) { + return NULL; + } + src = s2; + } + if (needs_crc) { + s2 = zip_source_crc_create(src, 1, error); + zip_source_free(src); + if (s2 == NULL) { + return NULL; + } + src = s2; + } + + if (partial_data && (needs_decrypt || needs_decompress)) { + s2 = zip_source_window_create(src, start, (zip_int64_t)len, error); + 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/3rdparty/libzip/lib/zip_stat.c b/3rdparty/libzip/lib/zip_stat.c new file mode 100644 index 0000000000000000000000000000000000000000..4b7c495021b098d9efa17d6c5c18fd93cd93a08e --- /dev/null +++ b/3rdparty/libzip/lib/zip_stat.c @@ -0,0 +1,46 @@ +/* + zip_stat.c -- get information about file by name + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_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; + + return zip_stat_index(za, (zip_uint64_t)idx, flags, st); +} diff --git a/3rdparty/libzip/lib/zip_stat_index.c b/3rdparty/libzip/lib/zip_stat_index.c new file mode 100644 index 0000000000000000000000000000000000000000..62dc0455e09e1026bd2c337ae03c7ac5ad6efff4 --- /dev/null +++ b/3rdparty/libzip/lib/zip_stat_index.c @@ -0,0 +1,80 @@ +/* + zip_stat_index.c -- get information about file 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_stat_index(zip_t *za, zip_uint64_t index, zip_flags_t flags, zip_stat_t *st) { + const char *name; + zip_dirent_t *de; + + if ((de = _zip_get_dirent(za, index, flags, NULL)) == NULL) + 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 { + 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/3rdparty/libzip/lib/zip_stat_init.c b/3rdparty/libzip/lib/zip_stat_init.c new file mode 100644 index 0000000000000000000000000000000000000000..f513bdef6a2e46f39cbdca795aa14d487fb7ab08 --- /dev/null +++ b/3rdparty/libzip/lib/zip_stat_init.c @@ -0,0 +1,83 @@ +/* + zip_stat_init.c -- initialize struct zip_stat. + Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <string.h> + +#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/3rdparty/libzip/lib/zip_strerror.c b/3rdparty/libzip/lib/zip_strerror.c new file mode 100644 index 0000000000000000000000000000000000000000..e22db65ebf46ca65b99985bb3c7e2510f722bcf9 --- /dev/null +++ b/3rdparty/libzip/lib/zip_strerror.c @@ -0,0 +1,41 @@ +/* + zip_sterror.c -- get string representation of zip error + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_strerror(zip_t *za) { + return zip_error_strerror(&za->error); +} diff --git a/3rdparty/libzip/lib/zip_string.c b/3rdparty/libzip/lib/zip_string.c new file mode 100644 index 0000000000000000000000000000000000000000..70133155a5af5720ff6d79d260114efe3f948512 --- /dev/null +++ b/3rdparty/libzip/lib/zip_string.c @@ -0,0 +1,178 @@ +/* + zip_string.c -- string handling (with encoding) + Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> +#include <zlib.h> + +#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/3rdparty/libzip/lib/zip_unchange.c b/3rdparty/libzip/lib/zip_unchange.c new file mode 100644 index 0000000000000000000000000000000000000000..d80a6adb23653c591c35b040bf0198327f1e9f57 --- /dev/null +++ b/3rdparty/libzip/lib/zip_unchange.c @@ -0,0 +1,93 @@ +/* + zip_unchange.c -- undo changes to file in zip archive + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#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/3rdparty/libzip/lib/zip_unchange_all.c b/3rdparty/libzip/lib/zip_unchange_all.c new file mode 100644 index 0000000000000000000000000000000000000000..7b0a4c066d9190726e611a2b521795ff884d090a --- /dev/null +++ b/3rdparty/libzip/lib/zip_unchange_all.c @@ -0,0 +1,54 @@ +/* + zip_unchange.c -- undo changes to all files in zip archive + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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_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; i < za->nentry; i++) + ret |= _zip_unchange(za, i, 1); + + ret |= zip_unchange_archive(za); + + return ret; +} diff --git a/3rdparty/libzip/lib/zip_unchange_archive.c b/3rdparty/libzip/lib/zip_unchange_archive.c new file mode 100644 index 0000000000000000000000000000000000000000..a0616cce6b57aeab0b355b14f36bb6748a5bb692 --- /dev/null +++ b/3rdparty/libzip/lib/zip_unchange_archive.c @@ -0,0 +1,51 @@ +/* + zip_unchange_archive.c -- undo global changes to ZIP archive + Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#include "zipint.h" + + +ZIP_EXTERN int +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; + + return 0; +} diff --git a/3rdparty/libzip/lib/zip_unchange_data.c b/3rdparty/libzip/lib/zip_unchange_data.c new file mode 100644 index 0000000000000000000000000000000000000000..153c839377cf5caec6c0f36019af297125c0cca9 --- /dev/null +++ b/3rdparty/libzip/lib/zip_unchange_data.c @@ -0,0 +1,53 @@ +/* + zip_unchange_data.c -- undo helper function + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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" + +void +_zip_unchange_data(zip_entry_t *ze) { + if (ze->source) { + zip_source_free(ze->source); + ze->source = NULL; + } + + 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/3rdparty/libzip/lib/zip_utf-8.c b/3rdparty/libzip/lib/zip_utf-8.c new file mode 100644 index 0000000000000000000000000000000000000000..ebf67fae64e5275dc0108c04fe51516f719c5cdc --- /dev/null +++ b/3rdparty/libzip/lib/zip_utf-8.c @@ -0,0 +1,226 @@ +/* + zip_utf-8.c -- UTF-8 support functions for libzip + Copyright (C) 2011-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + + +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/3rdparty/libzip/lib/zip_winzip_aes.c b/3rdparty/libzip/lib/zip_winzip_aes.c new file mode 100644 index 0000000000000000000000000000000000000000..b36e46c64f317fe3c21a05d30f48b44100ff7105 --- /dev/null +++ b/3rdparty/libzip/lib/zip_winzip_aes.c @@ -0,0 +1,162 @@ +/* + zip_winzip_aes.c -- Winzip AES de/encryption backend routines + Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#include <string.h> + + +#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/3rdparty/libzip/lib/zipint.h b/3rdparty/libzip/lib/zipint.h new file mode 100644 index 0000000000000000000000000000000000000000..eab1e3a6c6e252d02da4fe2ed13ffeaa4b70471b --- /dev/null +++ b/3rdparty/libzip/lib/zipint.h @@ -0,0 +1,647 @@ +#ifndef _HAD_ZIPINT_H +#define _HAD_ZIPINT_H + +/* + zipint.h -- internal declarations. + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> +#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_create(zip_source_t *, int, zip_error_t *error); +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_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); +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); + +/* error source for layered sources */ + +enum zip_les { ZIP_LES_NONE, ZIP_LES_UPPER, ZIP_LES_LOWER, ZIP_LES_INVAL }; + +#define ZIP_DETAIL_ET_GLOBAL 0 +#define ZIP_DETAIL_ET_ENTRY 1 + +struct _zip_err_info { + int type; + const char *description; +}; + +extern const struct _zip_err_info _zip_err_str[]; +extern const int _zip_err_str_count; +extern const struct _zip_err_info _zip_err_details[]; +extern const int _zip_err_details_count; + +/* macros for libzip-internal errors */ +#define MAX_DETAIL_INDEX 0x7fffff +#define MAKE_DETAIL_WITH_INDEX(error, index) ((((index) > MAX_DETAIL_INDEX) ? MAX_DETAIL_INDEX : (int)(index)) << 8 | (error)) +#define GET_INDEX_FROM_DETAIL(error) (((error) >> 8) & MAX_DETAIL_INDEX) +#define GET_ERROR_FROM_DETAIL(error) ((error) & 0xff) +#define ADD_INDEX_TO_DETAIL(error, index) MAKE_DETAIL_WITH_INDEX(GET_ERROR_FROM_DETAIL(error), (index)) + +/* error code for libzip-internal errors */ +#define ZIP_ER_DETAIL_NO_DETAIL 0 /* G no detail */ +#define ZIP_ER_DETAIL_CDIR_OVERLAPS_EOCD 1 /* G central directory overlaps EOCD, or there is space between them */ +#define ZIP_ER_DETAIL_COMMENT_LENGTH_INVALID 2 /* G archive comment length incorrect */ +#define ZIP_ER_DETAIL_CDIR_LENGTH_INVALID 3 /* G central directory length invalid */ +#define ZIP_ER_DETAIL_CDIR_ENTRY_INVALID 4 /* E central header invalid */ +#define ZIP_ER_DETAIL_CDIR_WRONG_ENTRIES_COUNT 5 /* G central directory count of entries is incorrect */ +#define ZIP_ER_DETAIL_ENTRY_HEADER_MISMATCH 6 /* E local and central headers do not match */ +#define ZIP_ER_DETAIL_EOCD_LENGTH_INVALID 7 /* G wrong EOCD length */ +#define ZIP_ER_DETAIL_EOCD64_OVERLAPS_EOCD 8 /* G EOCD64 overlaps EOCD, or there is space between them */ +#define ZIP_ER_DETAIL_EOCD64_WRONG_MAGIC 9 /* G EOCD64 magic incorrect */ +#define ZIP_ER_DETAIL_EOCD64_MISMATCH 10 /* G EOCD64 and EOCD do not match */ +#define ZIP_ER_DETAIL_CDIR_INVALID 11 /* G invalid value in central directory */ +#define ZIP_ER_DETAIL_VARIABLE_SIZE_OVERFLOW 12 /* E variable size fields overflow header */ +#define ZIP_ER_DETAIL_INVALID_UTF8_IN_FILENAME 13 /* E invalid UTF-8 in filename */ +#define ZIP_ER_DETAIL_INVALID_UTF8_IN_COMMENT 13 /* E invalid UTF-8 in comment */ +#define ZIP_ER_DETAIL_INVALID_ZIP64_EF 14 /* E invalid Zip64 extra field */ +#define ZIP_ER_DETAIL_INVALID_WINZIPAES_EF 14 /* E invalid WinZip AES extra field */ +#define ZIP_ER_DETAIL_EF_TRAILING_GARBAGE 15 /* E garbage at end of extra fields */ +#define ZIP_ER_DETAIL_INVALID_EF_LENGTH 16 /* E extra field length is invalid */ +#define ZIP_ER_DETAIL_INVALID_FILE_LENGTH 17 /* E file length in header doesn't match actual file length */ + +/* 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; + +#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 <string.h> +#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_int64_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_uint64_t, zip_flags_t, zip_uint64_t, zip_uint64_t, const char *, zip_error_t *error); + +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/3rdparty/libzip/libzip-config.cmake.in b/3rdparty/libzip/libzip-config.cmake.in new file mode 100644 index 0000000000000000000000000000000000000000..5b9aa5580652ca4eda4fe2743820d590bd60a11d --- /dev/null +++ b/3rdparty/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/3rdparty/libzip/libzip.pc.in b/3rdparty/libzip/libzip.pc.in new file mode 100644 index 0000000000000000000000000000000000000000..58b3dca7c1e03847cc6bbb6a4eb42a51e99d1dfa --- /dev/null +++ b/3rdparty/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/3rdparty/libzip/man/CMakeLists.txt b/3rdparty/libzip/man/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f4b0ec563fe9931161a79571fcb7877e3a6f776 --- /dev/null +++ b/3rdparty/libzip/man/CMakeLists.txt @@ -0,0 +1,165 @@ +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_cancel_callback_with_state.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_window.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 ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${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 ${CMAKE_CURRENT_BINARY_DIR}/${HTML_FILE} + DEPENDS ${MDOC_FILE} + COMMAND ${CMAKE_COMMAND} -DIN=${CMAKE_CURRENT_SOURCE_DIR}/${MDOC_FILE} -DOUT=${CMAKE_CURRENT_BINARY_DIR}/${HTML_FILE} -P ${CMAKE_CURRENT_SOURCE_DIR}/update-html.cmake + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${HTML_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_FILE} + ) + list(APPEND UPDATEHTML ${CMAKE_CURRENT_BINARY_DIR}/${HTML_FILE}) + + # man re-generation + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MAN_FILE} + DEPENDS ${MDOC_FILE} + COMMAND ${CMAKE_COMMAND} -DIN=${CMAKE_CURRENT_SOURCE_DIR}/${MDOC_FILE} -DOUT=${CMAKE_CURRENT_BINARY_DIR}/${MAN_FILE} -P ${CMAKE_CURRENT_SOURCE_DIR}/update-man.cmake + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${MAN_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${MAN_FILE} + ) + list(APPEND UPDATEMAN ${CMAKE_CURRENT_BINARY_DIR}/${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/3rdparty/libzip/man/ZIP_SOURCE_GET_ARGS.html b/3rdparty/libzip/man/ZIP_SOURCE_GET_ARGS.html new file mode 100644 index 0000000000000000000000000000000000000000..bea0f3c6f8a0411a7c2bd9522ab4fc30e5127c25 --- /dev/null +++ b/3rdparty/libzip/man/ZIP_SOURCE_GET_ARGS.html @@ -0,0 +1,114 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_GET_ARGS(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_GET_ARGS(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_GET_ARGS(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">ZIP_SOURCE_GET_ARGS</code> — +<div class="Nd">validate and cast arguments to source callback</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">type *</var> + <br/> + <code class="Fn">ZIP_SOURCE_GET_ARGS</code>(<var class="Fa" style="white-space: nowrap;">type</var>, + <var class="Fa" style="white-space: nowrap;">void *data</var>, + <var class="Fa" style="white-space: nowrap;">zip_uint64_t len</var>, + <var class="Fa" style="white-space: nowrap;">zip_error_t *error</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">ZIP_SOURCE_GET_ARGS</code>() macro casts + <var class="Ar">data</var> to a pointer to <var class="Ar">type</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +On success, <code class="Fn">ZIP_SOURCE_GET_ARGS</code>() returns + <var class="Ar">data</var>. In case of error, it returns + <code class="Dv">NULL</code> and sets <var class="Ar">error</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">ZIP_SOURCE_GET_ARGS</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">len</var> is less than the size of + <var class="Ar">type</var></dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source_function.html">zip_source_function(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">ZIP_SOURCE_GET_ARGS</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/ZIP_SOURCE_GET_ARGS.man b/3rdparty/libzip/man/ZIP_SOURCE_GET_ARGS.man new file mode 100644 index 0000000000000000000000000000000000000000..0e23ebd2af80bf893b3e99f15de57b8267f9aa77 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/ZIP_SOURCE_GET_ARGS.mdoc b/3rdparty/libzip/man/ZIP_SOURCE_GET_ARGS.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..2735964e167db8fafa459eee058a8751d6b4145d --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/handle_links b/3rdparty/libzip/man/handle_links new file mode 100755 index 0000000000000000000000000000000000000000..7c2ed37d35f861c7dbe15d090b03eba185611f78 --- /dev/null +++ b/3rdparty/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/3rdparty/libzip/man/libzip.html b/3rdparty/libzip/man/libzip.html new file mode 100644 index 0000000000000000000000000000000000000000..fabeff0e6c5125d965794af9e53a5d300deedb93 --- /dev/null +++ b/3rdparty/libzip/man/libzip.html @@ -0,0 +1,266 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + libzip.mdoc -- general overview of available functions + Copyright (C) 2005-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>LIBZIP(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">LIBZIP(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">LIBZIP(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">libzip</code> — +<div class="Nd">library for manipulating zip archives</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<code class="Nm">libzip</code> is a library for reading, creating, and modifying + zip archives. +<p class="Pp">The main design criteria for <code class="Nm">libzip</code> + were:</p> +<ul class="Bl-bullet Bl-compact"> + <li>Do not create corrupt files, even in case of errors.</li> + <li>Do not delete data.</li> + <li>Be efficient.</li> +</ul> +<p class="Pp">For this reason, when modifying zip archives, + <code class="Nm">libzip</code> writes to a temporary file and replaces the + original zip archive atomically.</p> +<p class="Pp">Below there are two sections listing functions: one for how to + read from zip archives and one for how to create/modify them.</p> +<section class="Ss"> +<h2 class="Ss" id="THREAD_SAFETY"><a class="permalink" href="#THREAD_SAFETY">THREAD + SAFETY</a></h2> +In general, different zip archives opened by <code class="Nm">libzip</code> 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 + <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a> or + <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a>, access to + the target archive must be synchronized with access to the source archive as + well. +</section> +</section> +<section class="Sh"> +<h1 class="Sh" id="READING_ZIP_ARCHIVES"><a class="permalink" href="#READING_ZIP_ARCHIVES">READING + ZIP ARCHIVES</a></h1> +<section class="Ss"> +<h2 class="Ss" id="open_archive"><a class="permalink" href="#open_archive">open + archive</a></h2> +<ul class="Bl-bullet Bl-compact"> + <li><a class="Xr" href="zip_open.html">zip_open(3)</a></li> + <li><a class="Xr" href="zip_fdopen.html">zip_fdopen(3)</a></li> +</ul> +</section> +<section class="Ss"> +<h2 class="Ss" id="find_files"><a class="permalink" href="#find_files">find + files</a></h2> +<ul class="Bl-bullet Bl-compact"> + <li><a class="Xr" href="zip_name_locate.html">zip_name_locate(3)</a></li> +</ul> +</section> +<section class="Ss"> +<h2 class="Ss" id="read_files"><a class="permalink" href="#read_files">read + files</a></h2> +<ul class="Bl-bullet Bl-compact"> + <li><a class="Xr" href="zip_fopen.html">zip_fopen(3)</a></li> + <li><a class="Xr" href="zip_fopen_encrypted.html">zip_fopen_encrypted(3)</a></li> + <li><a class="Xr" href="zip_fopen_index.html">zip_fopen_index(3)</a></li> + <li><a class="Xr" href="zip_fopen_index_encrypted.html">zip_fopen_index_encrypted(3)</a></li> + <li><a class="Xr" href="zip_fread.html">zip_fread(3)</a></li> + <li><a class="Xr" href="zip_fseek.html">zip_fseek(3)</a> (uncompressed files + only)</li> + <li><a class="Xr" href="zip_ftell.html">zip_ftell(3)</a> (uncompressed files + only)</li> + <li><a class="Xr" href="zip_fclose.html">zip_fclose(3)</a></li> +</ul> +</section> +<section class="Ss"> +<h2 class="Ss" id="close_archive"><a class="permalink" href="#close_archive">close + archive</a></h2> +<ul class="Bl-bullet Bl-compact"> + <li><a class="Xr" href="zip_close.html">zip_close(3)</a></li> +</ul> +</section> +<section class="Ss"> +<h2 class="Ss" id="miscellaneous"><a class="permalink" href="#miscellaneous">miscellaneous</a></h2> +<ul class="Bl-bullet Bl-compact"> + <li><a class="Xr" href="zip_stat.html">zip_stat(3)</a></li> + <li><a class="Xr" href="zip_compression_method_supported.html">zip_compression_method_supported(3)</a></li> + <li><a class="Xr" href="zip_encryption_method_supported.html">zip_encryption_method_supported(3)</a></li> + <li><a class="Xr" href="zip_file_get_comment.html">zip_file_get_comment(3)</a></li> + <li><a class="Xr" href="zip_file_get_external_attributes.html">zip_file_get_external_attributes(3)</a></li> + <li><a class="Xr" href="zip_get_archive_comment.html">zip_get_archive_comment(3)</a></li> + <li><a class="Xr" href="zip_get_archive_flag.html">zip_get_archive_flag(3)</a></li> + <li><a class="Xr" href="zip_get_name.html">zip_get_name(3)</a></li> + <li><a class="Xr" href="zip_get_num_entries.html">zip_get_num_entries(3)</a></li> + <li><a class="Xr" href="zip_set_default_password.html">zip_set_default_password(3)</a></li> +</ul> +</section> +</section> +<section class="Sh"> +<h1 class="Sh" id="CREATING/MODIFYING_ZIP_ARCHIVES"><a class="permalink" href="#CREATING/MODIFYING_ZIP_ARCHIVES">CREATING/MODIFYING + ZIP ARCHIVES</a></h1> +<section class="Ss"> +<h2 class="Ss" id="create/open_archive"><a class="permalink" href="#create/open_archive">create/open + archive</a></h2> +<ul class="Bl-bullet Bl-compact"> + <li><a class="Xr" href="zip_open.html">zip_open(3)</a></li> +</ul> +</section> +<section class="Ss"> +<h2 class="Ss" id="add/change_files_and_directories"><a class="permalink" href="#add/change_files_and_directories">add/change + files and directories</a></h2> +<ul class="Bl-bullet Bl-compact"> + <li><a class="Xr" href="zip_dir_add.html">zip_dir_add(3)</a></li> + <li><a class="Xr" href="zip_file_add.html">zip_file_add(3)</a></li> + <li><a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a></li> + <li><a class="Xr" href="zip_file_set_comment.html">zip_file_set_comment(3)</a></li> + <li><a class="Xr" href="zip_file_set_dostime.html">zip_file_set_dostime(3)</a></li> + <li><a class="Xr" href="zip_file_set_external_attributes.html">zip_file_set_external_attributes(3)</a></li> + <li><a class="Xr" href="zip_file_set_encryption.html">zip_file_set_encryption(3)</a></li> + <li><a class="Xr" href="zip_file_set_mtime.html">zip_file_set_mtime(3)</a></li> + <li><a class="Xr" href="zip_set_file_compression.html">zip_set_file_compression(3)</a></li> + <li><a class="Xr" href="zip_source_buffer.html">zip_source_buffer(3)</a></li> + <li><a class="Xr" href="zip_source_file.html">zip_source_file(3)</a></li> + <li><a class="Xr" href="zip_source_filep.html">zip_source_filep(3)</a></li> + <li><a class="Xr" href="zip_source_free.html">zip_source_free(3)</a></li> + <li><a class="Xr" href="zip_source_function.html">zip_source_function(3)</a></li> + <li><a class="Xr" href="zip_source_zip.html">zip_source_zip(3)</a></li> +</ul> +</section> +<section class="Ss"> +<h2 class="Ss" id="rename_files"><a class="permalink" href="#rename_files">rename + files</a></h2> +<ul class="Bl-bullet Bl-compact"> + <li><a class="Xr" href="zip_rename.html">zip_rename(3)</a></li> +</ul> +</section> +<section class="Ss"> +<h2 class="Ss" id="delete_files"><a class="permalink" href="#delete_files">delete + files</a></h2> +<ul class="Bl-bullet Bl-compact"> + <li><a class="Xr" href="zip_delete.html">zip_delete(3)</a></li> +</ul> +</section> +<section class="Ss"> +<h2 class="Ss" id="revert_changes"><a class="permalink" href="#revert_changes">revert + changes</a></h2> +<ul class="Bl-bullet Bl-compact"> + <li><a class="Xr" href="zip_unchange.html">zip_unchange(3)</a></li> + <li><a class="Xr" href="zip_unchange_all.html">zip_unchange_all(3)</a></li> + <li><a class="Xr" href="zip_unchange_archive.html">zip_unchange_archive(3)</a></li> +</ul> +</section> +<section class="Ss"> +<h2 class="Ss" id="read/modify_extra_fields"><a class="permalink" href="#read/modify_extra_fields">read/modify + extra fields</a></h2> +<ul class="Bl-bullet Bl-compact"> + <li><a class="Xr" href="zip_file_extra_field_by_id.html">zip_file_extra_field_by_id(3)</a></li> + <li><a class="Xr" href="zip_file_extra_field_delete.html">zip_file_extra_field_delete(3)</a></li> + <li><a class="Xr" href="zip_file_extra_field_delete_by_id.html">zip_file_extra_field_delete_by_id(3)</a></li> + <li><a class="Xr" href="zip_file_extra_field_get.html">zip_file_extra_field_get(3)</a></li> + <li><a class="Xr" href="zip_file_extra_field_set.html">zip_file_extra_field_set(3)</a></li> + <li><a class="Xr" href="zip_file_extra_fields_count.html">zip_file_extra_fields_count(3)</a></li> + <li><a class="Xr" href="zip_file_extra_fields_count_by_id.html">zip_file_extra_fields_count_by_id(3)</a></li> +</ul> +</section> +<section class="Ss"> +<h2 class="Ss" id="close_archive_(writing)"><a class="permalink" href="#close_archive_(writing)">close + archive (writing)</a></h2> +<ul class="Bl-bullet Bl-compact"> + <li><a class="Xr" href="zip_close.html">zip_close(3)</a></li> + <li><a class="Xr" href="zip_discard.html">zip_discard(3)</a></li> +</ul> +</section> +<section class="Ss"> +<h2 class="Ss" id="miscellaneous_(writing)"><a class="permalink" href="#miscellaneous_(writing)">miscellaneous + (writing)</a></h2> +<ul class="Bl-bullet Bl-compact"> + <li><a class="Xr" href="zip_file_attributes_init.html">zip_file_attributes_init(3)</a></li> + <li><a class="Xr" href="zip_libzip_version.html">zip_libzip_version(3)</a></li> + <li><a class="Xr" href="zip_register_cancel_callback_with_state.html">zip_register_cancel_callback_with_state(3)</a></li> + <li><a class="Xr" href="zip_register_progress_callback_with_state.html">zip_register_progress_callback_with_state(3)</a></li> + <li><a class="Xr" href="zip_set_archive_comment.html">zip_set_archive_comment(3)</a></li> + <li><a class="Xr" href="zip_set_archive_flag.html">zip_set_archive_flag(3)</a></li> + <li><a class="Xr" href="zip_source.html">zip_source(3)</a></li> +</ul> +</section> +</section> +<section class="Sh"> +<h1 class="Sh" id="ERROR_HANDLING"><a class="permalink" href="#ERROR_HANDLING">ERROR + HANDLING</a></h1> +<ul class="Bl-bullet Bl-compact"> + <li><a class="Xr" href="zip_error_strerror.html">zip_error_strerror(3)</a></li> + <li><a class="Xr" href="zip_strerror.html">zip_strerror(3)</a></li> + <li><a class="Xr" href="zip_file_strerror.html">zip_file_strerror(3)</a></li> + <li><a class="Xr" href="zip_file_get_error.html">zip_file_get_error(3)</a></li> + <li><a class="Xr" href="zip_get_error.html">zip_get_error(3)</a></li> + <li><a class="Xr" href="zip_error_init_with_code.html">zip_error_init_with_code(3)</a></li> + <li><a class="Xr" href="zip_error_system_type.html">zip_error_system_type(3)</a></li> + <li><a class="Xr" href="zip_errors.html">zip_errors(3)</a></li> +</ul> +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">April 6, 2021</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/libzip.man b/3rdparty/libzip/man/libzip.man new file mode 100644 index 0000000000000000000000000000000000000000..62c6bbfb3372155d6a08bcfdbbfb42ec85348f64 --- /dev/null +++ b/3rdparty/libzip/man/libzip.man @@ -0,0 +1,322 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" libzip.mdoc -- general overview of available functions +.\" Copyright (C) 2005-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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" "April 6, 2021" "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 <zip.h>\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_cancel_callback_with_state(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/3rdparty/libzip/man/libzip.mdoc b/3rdparty/libzip/man/libzip.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..8799d30d54a2ec401061477414990df261057570 --- /dev/null +++ b/3rdparty/libzip/man/libzip.mdoc @@ -0,0 +1,262 @@ +.\" libzip.mdoc -- general overview of available functions +.\" Copyright (C) 2005-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 6, 2021 +.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_cancel_callback_with_state 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/3rdparty/libzip/man/links b/3rdparty/libzip/man/links new file mode 100644 index 0000000000000000000000000000000000000000..807dd49beeb2e0b37da0df57e4adbe65b490a982 --- /dev/null +++ b/3rdparty/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/3rdparty/libzip/man/update-html.cmake b/3rdparty/libzip/man/update-html.cmake new file mode 100644 index 0000000000000000000000000000000000000000..4bc469b4b7aea9e8f7079a1660e5d5f00a0e6306 --- /dev/null +++ b/3rdparty/libzip/man/update-html.cmake @@ -0,0 +1,12 @@ +# expect variables IN and OUT +EXECUTE_PROCESS(COMMAND mandoc -T html -Oman=%N.html,style=../nih-man.css ${IN} + OUTPUT_VARIABLE HTML) +SET(LINKBASE "http://pubs.opengroup.org/onlinepubs/9699919799/functions/") +STRING(REGEX REPLACE "(<a class=\"Xr\" href=\")([^\"]*)(\">)" "\\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 ${OUT}.new "${HTML}") +CONFIGURE_FILE(${OUT}.new ${OUT} COPYONLY) +FILE(REMOVE ${OUT}.new) + + diff --git a/3rdparty/libzip/man/update-man.cmake b/3rdparty/libzip/man/update-man.cmake new file mode 100644 index 0000000000000000000000000000000000000000..3f915d6bcf750c1267474ad11e7608ac17846bd4 --- /dev/null +++ b/3rdparty/libzip/man/update-man.cmake @@ -0,0 +1,7 @@ +# expect variables IN and OUT +EXECUTE_PROCESS(COMMAND mandoc -T man ${IN} OUTPUT_VARIABLE MAN) +STRING(REGEX REPLACE "NetBSD [0-9.]*" "NiH" MAN "${MAN}") +FILE(WRITE ${OUT}.new "${MAN}") +CONFIGURE_FILE(${OUT}.new ${OUT} COPYONLY) +FILE(REMOVE ${OUT}.new) + diff --git a/3rdparty/libzip/man/zip_add.html b/3rdparty/libzip/man/zip_add.html new file mode 100644 index 0000000000000000000000000000000000000000..511d0d303f70e037481f78cb7b4dbc6211d4f6ed --- /dev/null +++ b/3rdparty/libzip/man/zip_add.html @@ -0,0 +1,121 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_ADD(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_ADD(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_ADD(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_add</code>, <code class="Nm">zip_replace</code> — +<div class="Nd">add file to zip archive or replace file in zip archive (obsolete + interface)</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int64_t</var> + <br/> + <code class="Fn">zip_add</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">const char + *name</var>, <var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_replace</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_add</code>() is the obsolete version of + <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a>. It is the same as + calling <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a> with an + empty <var class="Ar">flags</var> argument. Similarly, the + <code class="Fn">zip_replace</code>() function is the obsolete version of + <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a>. It is the + same as calling + <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a> with an + empty <var class="Ar">flags</var> argument. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a>, + <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_add</code>() was added in libzip 0.6. In libzip 0.10 the + return type was changed from <var class="Vt">int</var> to + <var class="Vt">zip_int64_t</var>. It was deprecated in libzip 0.11, use + <code class="Fn">zip_file_add</code>() instead. +<p class="Pp"><code class="Fn">zip_replace</code>() was added in libzip 0.6. In + libzip 0.10 the type of <var class="Ar">index</var> was changed from + <var class="Vt">int</var> to <var class="Vt">zip_uint64_t</var>. It was + deprecated in libzip 0.11, use <code class="Fn">zip_file_replace</code>() + instead.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_add.man b/3rdparty/libzip/man/zip_add.man new file mode 100644 index 0000000000000000000000000000000000000000..451645f416a6aa859eacb132b982fc554a420b64 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_add.mdoc b/3rdparty/libzip/man/zip_add.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..27c5319019fd5dee11cf9f6bf0946d79f6344361 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_add_dir.html b/3rdparty/libzip/man/zip_add_dir.html new file mode 100644 index 0000000000000000000000000000000000000000..2025c289daac99b738c85c642918bfe4157f0109 --- /dev/null +++ b/3rdparty/libzip/man/zip_add_dir.html @@ -0,0 +1,102 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_ADD_DIR(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_ADD_DIR(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_ADD_DIR(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_add_dir</code> — +<div class="Nd">add directory to zip archive (obsolete interface)</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int64_t</var> + <br/> + <code class="Fn">zip_add_dir</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">const char + *name</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_add_dir</code>() is the obsolete version of + <a class="Xr" href="zip_dir_add.html">zip_dir_add(3)</a>. It is the same as + calling <a class="Xr" href="zip_dir_add.html">zip_dir_add(3)</a> with an empty + flags argument. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_dir_add.html">zip_dir_add(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_add_dir</code>() was added in libzip 0.8. In libzip 0.10 + the return type was changed from <var class="Vt">int</var> to + <var class="Vt">zip_int64_t</var>. It was deprecated in libzip 0.11, use + <code class="Fn">zip_dir_add</code>() instead. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_add_dir.man b/3rdparty/libzip/man/zip_add_dir.man new file mode 100644 index 0000000000000000000000000000000000000000..90f313d3f49c4a0d92dba16500b333a1daf3117b --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_add_dir.mdoc b/3rdparty/libzip/man/zip_add_dir.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..f28d1d5b36fb8c5a2282fd1a48cd561d9e19e75a --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_close.html b/3rdparty/libzip/man/zip_close.html new file mode 100644 index 0000000000000000000000000000000000000000..585ccbe5dc4a109e4e8ad356a9721624f773f2da --- /dev/null +++ b/3rdparty/libzip/man/zip_close.html @@ -0,0 +1,151 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_close.mdoc -- close zip archive + Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_CLOSE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_CLOSE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_CLOSE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_close</code> — +<div class="Nd">close zip archive</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_close</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_close</code>() function writes any changes made to + <var class="Ar">archive</var> to disk. If <var class="Ar">archive</var> + contains no files, the file is completely removed (no empty archive is + written). If successful, <var class="Ar">archive</var> is freed. Otherwise + <var class="Ar">archive</var> is left unchanged and must still be freed. +<p class="Pp">To close and free a zip archive without saving changes, use + <a class="Xr" href="zip_discard.html">zip_discard(3)</a>.</p> +<p class="Pp">Progress updates for GUIs can be implemented using + <a class="Xr" href="zip_register_progress_callback_with_state.html">zip_register_progress_callback_with_state(3)</a>. + Cancelling the write of an archive during <code class="Nm">zip_close</code> + can be implemented using + <a class="Xr" href="zip_register_cancel_callback_with_state.html">zip_register_cancel_callback_with_state(3)</a>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error code in <var class="Ar">archive</var> is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_close</code>() will fail if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_EOF"><code class="Er" id="ZIP_ER_EOF">ZIP_ER_EOF</code></a>]</dt> + <dd>Unexpected end-of-file found while reading from a file.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_INTERNAL"><code class="Er" id="ZIP_ER_INTERNAL">ZIP_ER_INTERNAL</code></a>]</dt> + <dd>The callback function of an added or replaced file returned an error but + failed to report which.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd>The <var class="Ar">path</var> argument is + <code class="Dv">NULL</code>.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_NOZIP"><code class="Er" id="ZIP_ER_NOZIP">ZIP_ER_NOZIP</code></a>]</dt> + <dd>File is not a zip archive.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_READ"><code class="Er" id="ZIP_ER_READ">ZIP_ER_READ</code></a>]</dt> + <dd>A file read failed.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_RENAME"><code class="Er" id="ZIP_ER_RENAME">ZIP_ER_RENAME</code></a>]</dt> + <dd>A temporary file could not be renamed to its final name.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_SEEK"><code class="Er" id="ZIP_ER_SEEK">ZIP_ER_SEEK</code></a>]</dt> + <dd>A file seek failed.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_TMPOPEN"><code class="Er" id="ZIP_ER_TMPOPEN">ZIP_ER_TMPOPEN</code></a>]</dt> + <dd>A temporary file could not be created.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_WRITE"><code class="Er" id="ZIP_ER_WRITE">ZIP_ER_WRITE</code></a>]</dt> + <dd>A file write failed.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_ZLIB"><code class="Er" id="ZIP_ER_ZLIB">ZIP_ER_ZLIB</code></a>]</dt> + <dd>An error occurred while (de)compressing a stream with + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/zlib.html">zlib(3)</a>.</dd> +</dl> +Additionally, any errors returned by the callback function for added or replaced + files will be passed back. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_discard.html">zip_discard(3)</a>, + <a class="Xr" href="zip_fdopen.html">zip_fdopen(3)</a>, + <a class="Xr" href="zip_get_error.html">zip_get_error(3)</a>, + <a class="Xr" href="zip_open.html">zip_open(3)</a>, + <a class="Xr" href="zip_register_cancel_callback_with_state.html">zip_register_cancel_callback_with_state(3)</a>, + <a class="Xr" href="zip_register_progress_callback_with_state.html">zip_register_progress_callback_with_state(3)</a>, + <a class="Xr" href="zip_strerror.html">zip_strerror(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_close</code>() was added in libzip 0.6. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">April 6, 2021</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_close.man b/3rdparty/libzip/man/zip_close.man new file mode 100644 index 0000000000000000000000000000000000000000..7bccb20fa02853263c2cf635f0dbac31cbcdd618 --- /dev/null +++ b/3rdparty/libzip/man/zip_close.man @@ -0,0 +1,142 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_close.mdoc -- close zip archive +.\" Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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" "April 6, 2021" "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 <zip.h>\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). +.PP +Progress updates for GUIs can be implemented using +zip_register_progress_callback_with_state(3). +Cancelling the write of an archive during +\fBzip_close\fR +can be implemented using +zip_register_cancel_callback_with_state(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_cancel_callback_with_state(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/3rdparty/libzip/man/zip_close.mdoc b/3rdparty/libzip/man/zip_close.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..c6239c0d8a79c1d1f7ed3f5fd2884946cd4916fb --- /dev/null +++ b/3rdparty/libzip/man/zip_close.mdoc @@ -0,0 +1,125 @@ +.\" zip_close.mdoc -- close zip archive +.\" Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 6, 2021 +.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 . +.Pp +Progress updates for GUIs can be implemented using +.Xr zip_register_progress_callback_with_state 3 . +Cancelling the write of an archive during +.Nm +can be implemented using +.Xr zip_register_cancel_callback_with_state 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_cancel_callback_with_state 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/3rdparty/libzip/man/zip_compression_method_supported.html b/3rdparty/libzip/man/zip_compression_method_supported.html new file mode 100644 index 0000000000000000000000000000000000000000..a0cfbfef31050889de512462d5a15feb928b6af9 --- /dev/null +++ b/3rdparty/libzip/man/zip_compression_method_supported.html @@ -0,0 +1,105 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_COMPRESSION_METHOD_SUPPORTED(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_COMPRESSION_METHOD_SUPPORTED(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_COMPRESSION_METHOD_SUPPORTED(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_compression_method_supported</code> — +<div class="Nd">return if a compression method is supported</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_compression_method_supported</code>(<var class="Fa" style="white-space: nowrap;">zip_int32_t + method</var>, <var class="Fa" style="white-space: nowrap;">int + compress</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_compression_method_supported</code>() returns if the + compression method <var class="Ar">method</var> is supported for compression + (if <var class="Ar">compress</var> is zero) or decompression (otherwise). +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Returns 1 if the method is supported, 0 otherwise. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_encryption_method_supported.html">zip_encryption_method_supported(3)</a>, + <a class="Xr" href="zip_set_file_compression.html">zip_set_file_compression(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_compression_method_supported</code>() was added in libzip + 1.7.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">April 2, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_compression_method_supported.man b/3rdparty/libzip/man/zip_compression_method_supported.man new file mode 100644 index 0000000000000000000000000000000000000000..44811f27481c59eb56c8b2b62b117017f7111054 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_compression_method_supported.mdoc b/3rdparty/libzip/man/zip_compression_method_supported.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..b375a30b401ea67a39f7aef2a169af63ba28c872 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_delete.html b/3rdparty/libzip/man/zip_delete.html new file mode 100644 index 0000000000000000000000000000000000000000..fc2f693212eacd12aff918b10ff2283bb7ddfdee --- /dev/null +++ b/3rdparty/libzip/man/zip_delete.html @@ -0,0 +1,114 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_DELETE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_DELETE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_DELETE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_delete</code> — +<div class="Nd">delete file from zip archive</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_delete</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The file at position <var class="Ar">index</var> in the zip archive + <var class="Ar">archive</var> is marked as deleted. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error code in <var class="Ar">archive</var> is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_delete</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">index</var> is not a valid file index in + <var class="Ar">archive</var>.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_unchange.html">zip_unchange(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_delete</code>() was added in libzip 0.6. In libzip 0.10 the + type of <var class="Ar">index</var> was changed from <var class="Vt">int</var> + to <var class="Vt">zip_uint64_t</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_delete.man b/3rdparty/libzip/man/zip_delete.man new file mode 100644 index 0000000000000000000000000000000000000000..d607c1eae677393102a517f349b871286d8f4485 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_delete.mdoc b/3rdparty/libzip/man/zip_delete.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..dc8346e41bb3c01e71f3c2aac4b997fc3c7c85b5 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_dir_add.html b/3rdparty/libzip/man/zip_dir_add.html new file mode 100644 index 0000000000000000000000000000000000000000..e297326beb0e3d5afb6483052ff3522bcef96a0e --- /dev/null +++ b/3rdparty/libzip/man/zip_dir_add.html @@ -0,0 +1,134 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_DIR_ADD(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_DIR_ADD(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_DIR_ADD(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_dir_add</code> — +<div class="Nd">add directory to zip archive</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int64_t</var> + <br/> + <code class="Fn">zip_dir_add</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">const char + *name</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_dir_add</code>() adds a directory to a zip + archive. The argument <var class="Ar">archive</var> specifies the zip archive + to which the directory should be added. <var class="Ar">name</var> is the + directory's name in the zip archive. +<p class="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 <var class="Ar">flags</var> argument can be + any of:</p> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_FL_ENC_GUESS"><code class="Dv" id="ZIP_FL_ENC_GUESS">ZIP_FL_ENC_GUESS</code></a></dt> + <dd>Guess encoding of <var class="Ar">name</var> (default). (Only CP-437 and + UTF-8 are recognized.)</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_UTF_8"><code class="Dv" id="ZIP_FL_ENC_UTF_8">ZIP_FL_ENC_UTF_8</code></a></dt> + <dd>Interpret <var class="Ar">name</var> as UTF-8.</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_CP437"><code class="Dv" id="ZIP_FL_ENC_CP437">ZIP_FL_ENC_CP437</code></a></dt> + <dd>Interpret <var class="Ar">name</var> as code page 437 (CP-437).</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, the index of the new entry in the archive is + returned. Otherwise, -1 is returned and the error code in + <var class="Ar">archive</var> is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_dir_add</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_EXISTS"><code class="Er" id="ZIP_ER_EXISTS">ZIP_ER_EXISTS</code></a>]</dt> + <dd>There is already an entry called <var class="Ar">name</var> in the + archive.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">archive</var> or <var class="Ar">name</var> are + <code class="Dv">NULL</code>, or invalid UTF-8 encoded file names.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_dir_add</code>() was added in libzip 0.11. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">September 20, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_dir_add.man b/3rdparty/libzip/man/zip_dir_add.man new file mode 100644 index 0000000000000000000000000000000000000000..4c863febe5c4ad88579e1caa5a1adbc634872f7a --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_dir_add.mdoc b/3rdparty/libzip/man/zip_dir_add.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..01e0a22bb70b4f49690e40b3b0001ecd8feda4af --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_discard.html b/3rdparty/libzip/man/zip_discard.html new file mode 100644 index 0000000000000000000000000000000000000000..05502dd7a7ed00fcf6e307955ff5cea061855abf --- /dev/null +++ b/3rdparty/libzip/man/zip_discard.html @@ -0,0 +1,97 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_DISCARD(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_DISCARD(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_DISCARD(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_discard</code> — +<div class="Nd">close zip archive and discard changes</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_discard</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_discard</code>() function closes + <var class="Ar">archive</var> and frees the memory allocated for it. Any + changes to the archive are not written to disk and discarded. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_close.html">zip_close(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_discard</code>() was added in libzip 0.11. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_discard.man b/3rdparty/libzip/man/zip_discard.man new file mode 100644 index 0000000000000000000000000000000000000000..591f7735cec86f54c51c1ff951d48110592943aa --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_discard.mdoc b/3rdparty/libzip/man/zip_discard.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..7404a48376aa98eddcd850e805cce62deb41d417 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_encryption_method_supported.html b/3rdparty/libzip/man/zip_encryption_method_supported.html new file mode 100644 index 0000000000000000000000000000000000000000..7b4603ebb9cc688adcac2e8060b6a6d91c0c5dd0 --- /dev/null +++ b/3rdparty/libzip/man/zip_encryption_method_supported.html @@ -0,0 +1,105 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_ENCRYPTION_METHOD_SUPPORTED(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_ENCRYPTION_METHOD_SUPPORTED(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_ENCRYPTION_METHOD_SUPPORTED(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_encryption_method_supported</code> — +<div class="Nd">return if an encryption method is supported</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_encryption_method_supported</code>(<var class="Fa" style="white-space: nowrap;">zip_int16_t + method</var>, <var class="Fa" style="white-space: nowrap;">int + encrypt</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_encryption_method_supported</code>() returns if the + encryption method <var class="Ar">method</var> is supported for encryption (if + <var class="Ar">encrypt</var> is zero) or decryption (otherwise). +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Returns 1 if the method is supported, 0 otherwise. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_compression_method_supported.html">zip_compression_method_supported(3)</a>, + <a class="Xr" href="zip_file_set_encryption.html">zip_file_set_encryption(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_encryption_method_supported</code>() was added in libzip + 1.7.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">April 2, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_encryption_method_supported.man b/3rdparty/libzip/man/zip_encryption_method_supported.man new file mode 100644 index 0000000000000000000000000000000000000000..4ab4e3bce0c9f61b28a4553d29078f15bfb4f638 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_encryption_method_supported.mdoc b/3rdparty/libzip/man/zip_encryption_method_supported.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..43f6ff971be99ed09bf99f7805c9d1a2cc1e085d --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_error_clear.html b/3rdparty/libzip/man/zip_error_clear.html new file mode 100644 index 0000000000000000000000000000000000000000..7f9350ce1c261c5307d2a12ad018587f97c95bfb --- /dev/null +++ b/3rdparty/libzip/man/zip_error_clear.html @@ -0,0 +1,104 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_error_clear.mdoc -- clear error state for archive or file + Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_ERROR_CLEAR(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_ERROR_CLEAR(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_ERROR_CLEAR(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_error_clear</code>, + <code class="Nm">zip_file_error_clear</code> — +<div class="Nd">clear error state for archive or file</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_error_clear</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>);</p> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_file_error_clear</code>(<var class="Fa" style="white-space: nowrap;">zip_file_t + *file</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_error_clear</code>() function clears the error state + for the zip archive <var class="Ar">archive</var>. +<p class="Pp">The <code class="Fn">zip_file_error_clear</code>() function does + the same for the zip file <var class="Ar">file</var>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_get_error.html">zip_get_error(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_error_clear</code>() and + <code class="Fn">zip_file_error_clear</code>() were added in libzip 0.8. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_error_clear.man b/3rdparty/libzip/man/zip_error_clear.man new file mode 100644 index 0000000000000000000000000000000000000000..650a36b9dad96111440b02d106d644727eb67767 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_error_clear.mdoc b/3rdparty/libzip/man/zip_error_clear.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..c322630eac61c3669713fbf01da0e8a89770e325 --- /dev/null +++ b/3rdparty/libzip/man/zip_error_clear.mdoc @@ -0,0 +1,69 @@ +.\" zip_error_clear.mdoc -- clear error state for archive or file +.\" Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_error_code_system.html b/3rdparty/libzip/man/zip_error_code_system.html new file mode 100644 index 0000000000000000000000000000000000000000..783a19adbacb23ae01a1b3d7dd23f46df1ff05c6 --- /dev/null +++ b/3rdparty/libzip/man/zip_error_code_system.html @@ -0,0 +1,99 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_ERROR_CODE_SYSTEM(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_ERROR_CODE_SYSTEM(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_ERROR_CODE_SYSTEM(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_error_code_system</code> — +<div class="Nd">get operating system error part of zip_error</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_error_code_system</code>(<var class="Fa" style="white-space: nowrap;">const + zip_error_t *ze</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_error_code_system</code>() function returns the system + specific part of the error from the zip_error error <var class="Ar">ze</var>. + For finding out what system reported the error, use + <a class="Xr" href="zip_error_system_type.html">zip_error_system_type(3)</a>. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_error_code_zip.html">zip_error_code_zip(3)</a>, + <a class="Xr" href="zip_error_system_type.html">zip_error_system_type(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_error_code_system</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_error_code_system.man b/3rdparty/libzip/man/zip_error_code_system.man new file mode 100644 index 0000000000000000000000000000000000000000..4eb0cad8deb414a7c62de178dbe6710f959eda69 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_error_code_system.mdoc b/3rdparty/libzip/man/zip_error_code_system.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..c87a2069239d1e7f6d42ffc97abe6cbf128d507f --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_error_code_zip.html b/3rdparty/libzip/man/zip_error_code_zip.html new file mode 100644 index 0000000000000000000000000000000000000000..91f874a057c76f15f9ef3ebb3e1e519bf762c31b --- /dev/null +++ b/3rdparty/libzip/man/zip_error_code_zip.html @@ -0,0 +1,96 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_ERROR_CODE_ZIP(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_ERROR_CODE_ZIP(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_ERROR_CODE_ZIP(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_error_code_zip</code> — +<div class="Nd">get libzip error part of zip_error</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_error_code_zip</code>(<var class="Fa" style="white-space: nowrap;">const + zip_error_t *ze</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_error_code_zip</code>() function returns the libzip + specific part of the error from the zip_error error <var class="Ar">ze</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_error_code_system.html">zip_error_code_system(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_error_code_zip</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_error_code_zip.man b/3rdparty/libzip/man/zip_error_code_zip.man new file mode 100644 index 0000000000000000000000000000000000000000..2a53981484c16bdf8ba7d0687731d3457ed74808 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_error_code_zip.mdoc b/3rdparty/libzip/man/zip_error_code_zip.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..c68fff431b6a9b1afff35169327ec3f6ffa8230c --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_error_fini.html b/3rdparty/libzip/man/zip_error_fini.html new file mode 100644 index 0000000000000000000000000000000000000000..7263ba34bc3a17bab74656d9714c744f41a0f9c8 --- /dev/null +++ b/3rdparty/libzip/man/zip_error_fini.html @@ -0,0 +1,97 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_ERROR_FINI(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_ERROR_FINI(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_ERROR_FINI(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_error_fini</code> — +<div class="Nd">clean up zip_error structure</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_error_fini</code>(<var class="Fa" style="white-space: nowrap;">zip_error_t + *ze</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_error_fini</code>() function cleans up and frees + internally allocated memory of the zip_error pointed to by + <var class="Ar">ze</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_error_init.html">zip_error_init(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_error_fini</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_error_fini.man b/3rdparty/libzip/man/zip_error_fini.man new file mode 100644 index 0000000000000000000000000000000000000000..2e4a1ae39bee493e070ffc388f22c679def2736c --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_error_fini.mdoc b/3rdparty/libzip/man/zip_error_fini.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..136db4ce4721857b22b44d4d00e0bac9b0229654 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_error_get.html b/3rdparty/libzip/man/zip_error_get.html new file mode 100644 index 0000000000000000000000000000000000000000..575c42c63c3347bdb67c6ac98b8b30835dfb1b08 --- /dev/null +++ b/3rdparty/libzip/man/zip_error_get.html @@ -0,0 +1,150 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_ERROR_GET(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_ERROR_GET(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_ERROR_GET(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_error_get</code>, + <code class="Nm">zip_file_error_get</code> — +<div class="Nd">get error codes for archive or file (obsolete interface)</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_error_get</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">int *zep</var>, + <var class="Fa" style="white-space: nowrap;">int *sep</var>);</p> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_file_error_get</code>(<var class="Fa" style="white-space: nowrap;">zip_file_t + *file</var>, <var class="Fa" style="white-space: nowrap;">int *zep</var>, + <var class="Fa" style="white-space: nowrap;">int *sep</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The functions <code class="Fn">zip_error_get</code>() and + <code class="Fn">zip_file_error_get</code>() are deprecated. Use + <a class="Xr" href="zip_error_code_system.html">zip_error_code_system(3)</a>, + <a class="Xr" href="zip_error_code_zip.html">zip_error_code_zip(3)</a>, + <a class="Xr" href="zip_file_get_error.html">zip_file_get_error(3)</a>, and + <a class="Xr" href="zip_get_error.html">zip_get_error(3)</a> instead. +<p class="Pp">For <code class="Fn">zip_error_get</code>(), replace</p> +<div class="Bd Pp Bd-indent"> +<pre> +int ze, se; +zip_error_get(za, &ze, &se); +</pre> +</div> +with +<div class="Bd Pp Bd-indent"> +<pre> +int ze, se; +zip_error_t *error = zip_get_error(za); +ze = zip_error_code_zip(error); +se = zip_error_code_system(error); +</pre> +</div> +For <code class="Fn">zip_file_error_get</code>(), replace +<div class="Bd Pp Bd-indent"> +<pre> +int ze, se; +zip_file_error_get(zf, &ze, &se); +</pre> +</div> +with +<div class="Bd Pp Bd-indent"> +<pre> +int ze, se; +zip_error_t *error = zip_file_get_error(zf); +ze = zip_error_code_zip(error); +se = zip_error_code_system(error); +</pre> +</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_error_code_system.html">zip_error_code_system(3)</a>, + <a class="Xr" href="zip_error_code_zip.html">zip_error_code_zip(3)</a>, + <a class="Xr" href="zip_file_get_error.html">zip_file_get_error(3)</a>, + <a class="Xr" href="zip_get_error.html">zip_get_error(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_error_get</code>() was added in libzip 0.6. It was + deprecated in libzip 1.0, use <code class="Fn">zip_get_error</code>(), + <code class="Fn">zip_error_code_zip</code>(), / + <code class="Fn">zip_error_code_system</code>() instead. +<p class="Pp"><code class="Fn">zip_file_error_get</code>() was added in libzip + 0.6. It was deprecated in libzip 1.0, use + <code class="Fn">zip_file_get_error</code>(), + <code class="Fn">zip_error_code_zip</code>(), / + <code class="Fn">zip_error_code_system</code>() instead.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_error_get.man b/3rdparty/libzip/man/zip_error_get.man new file mode 100644 index 0000000000000000000000000000000000000000..43e2c0654b4f75b1c548da72bb1a699f2e53f22a --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_error_get.mdoc b/3rdparty/libzip/man/zip_error_get.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..527139436a1008cb532bcef930c439a7e4163a79 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_error_get_sys_type.html b/3rdparty/libzip/man/zip_error_get_sys_type.html new file mode 100644 index 0000000000000000000000000000000000000000..1e67c9b99487606cc15a8da5a62ed90203d832e8 --- /dev/null +++ b/3rdparty/libzip/man/zip_error_get_sys_type.html @@ -0,0 +1,116 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_ERROR_GET_SYS_TYPE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_ERROR_GET_SYS_TYPE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_ERROR_GET_SYS_TYPE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_error_get_sys_type</code> — +<div class="Nd">get type of system error code (obsolete interface)</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_error_get_sys_type</code>(<var class="Fa" style="white-space: nowrap;">int + ze</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_error_get_sys_type</code>() is deprecated; use + <a class="Xr" href="zip_error_init_with_code.html">zip_error_init_with_code(3)</a> + and + <a class="Xr" href="zip_error_system_type.html">zip_error_system_type(3)</a> + instead. +<p class="Pp">Replace</p> +<div class="Bd Pp Bd-indent"> +<pre> +int i = zip_error_get_sys_type(ze); +</pre> +</div> +with +<div class="Bd Pp Bd-indent"> +<pre> +zip_error_t error; +zip_error_init_with_code(&error, ze); +int i = zip_error_system_type(&error); +</pre> +</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_error_init_with_code.html">zip_error_init_with_code(3)</a>, + <a class="Xr" href="zip_error_system_type.html">zip_error_system_type(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_error_get_sys_type</code>() was added in libzip 0.6. It was + deprecated in libzip 1.0, use <code class="Fn">zip_error_system_type</code>() + instead. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_error_get_sys_type.man b/3rdparty/libzip/man/zip_error_get_sys_type.man new file mode 100644 index 0000000000000000000000000000000000000000..753a94cfedae43f404eceb4b9d96ca3f94211c5b --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_error_get_sys_type.mdoc b/3rdparty/libzip/man/zip_error_get_sys_type.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..16d3af78d342082ce39192917999e1593b0ca78a --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_error_init.html b/3rdparty/libzip/man/zip_error_init.html new file mode 100644 index 0000000000000000000000000000000000000000..18e22bb9d5fa39223ed786c4b2632d97e59a0d00 --- /dev/null +++ b/3rdparty/libzip/man/zip_error_init.html @@ -0,0 +1,108 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_ERROR_INIT(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_ERROR_INIT(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_ERROR_INIT(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_error_init</code>, + <code class="Nm">zip_error_init_with_code</code> — +<div class="Nd">initialize zip_error structure</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_error_init</code>(<var class="Fa" style="white-space: nowrap;">zip_error_t + *error</var>);</p> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_error_init_with_code</code>(<var class="Fa" style="white-space: nowrap;">zip_error_t + *error</var>, <var class="Fa" style="white-space: nowrap;">int + ze</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_error_init</code>() function initializes the zip_error + pointed to by <var class="Ar">error</var>. <var class="Ar">*error</var> must + be allocated before calling <code class="Fn">zip_error_init</code>(). +<p class="Pp">The <code class="Fn">zip_error_init_with_code</code>() function + does the same, but additionally sets the zip error code to + <var class="Ar">ze</var> and sets the system error code to the current + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html">errno(3)</a> value, if appropriate.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_error_fini.html">zip_error_fini(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_error_init</code>() and + <code class="Fn">zip_error_init_with_code</code>() were added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_error_init.man b/3rdparty/libzip/man/zip_error_init.man new file mode 100644 index 0000000000000000000000000000000000000000..7623e982f1fb927d2d4ce8d52783a032d5d38e8f --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_error_init.mdoc b/3rdparty/libzip/man/zip_error_init.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..b524303ef803deb12a2a0cb7c119f4279b976c99 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_error_set.html b/3rdparty/libzip/man/zip_error_set.html new file mode 100644 index 0000000000000000000000000000000000000000..b1d87e76d06c4d475fd774899c81f41a24c28bab --- /dev/null +++ b/3rdparty/libzip/man/zip_error_set.html @@ -0,0 +1,101 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_error_set.mdoc -- set zip_error + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_ERROR_SET(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_ERROR_SET(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_ERROR_SET(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_error_set</code> — +<div class="Nd">fill in zip_error structure</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_error_set</code>(<var class="Fa" style="white-space: nowrap;">zip_error_t + *ze</var>, <var class="Fa" style="white-space: nowrap;">int le</var>, + <var class="Fa" style="white-space: nowrap;">int se</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_error_set</code>() function sets the zip_error pointed + to by <var class="Ar">ze</var> to the libzip error code + <var class="Ar">le</var> and the system error code <var class="Ar">se</var>. +<p class="Pp"><var class="Ar">ze</var> must be allocated and initialized with + <a class="Xr" href="zip_error_init.html">zip_error_init(3)</a> before + calling <code class="Fn">zip_error</code>(<var class="Fa">set</var>).</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_error_init.html">zip_error_init(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_error_set</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">April 2, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_error_set.man b/3rdparty/libzip/man/zip_error_set.man new file mode 100644 index 0000000000000000000000000000000000000000..0908d1e018ef62d15b41e98cbc4977cd54692285 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_error_set.mdoc b/3rdparty/libzip/man/zip_error_set.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..68e81f3441d7d5eb749225f3fa01b9e6bac6225f --- /dev/null +++ b/3rdparty/libzip/man/zip_error_set.mdoc @@ -0,0 +1,69 @@ +.\" zip_error_set.mdoc -- set zip_error +.\" Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_error_strerror.html b/3rdparty/libzip/man/zip_error_strerror.html new file mode 100644 index 0000000000000000000000000000000000000000..b1379f268e6ff0b641db3082a7382f04df471a98 --- /dev/null +++ b/3rdparty/libzip/man/zip_error_strerror.html @@ -0,0 +1,101 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_ERROR_STRERROR(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_ERROR_STRERROR(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_ERROR_STRERROR(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_error_strerror</code> — +<div class="Nd">create human-readable string for zip_error</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">const char *</var> + <br/> + <code class="Fn">zip_error_strerror</code>(<var class="Fa" style="white-space: nowrap;">zip_error_t + *ze</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_error_strerror</code>() function returns an error + message string corresponding to <var class="Ar">ze</var> like + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror.html">strerror(3)</a>. This string will stay + valid until the next call to <code class="Fn">zip_error_strerror</code>() or + until <a class="Xr" href="zip_error_fini.html">zip_error_fini(3)</a> is + called. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror.html">strerror(3)</a>, + <a class="Xr" href="zip_error_fini.html">zip_error_fini(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_error_strerror</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_error_strerror.man b/3rdparty/libzip/man/zip_error_strerror.man new file mode 100644 index 0000000000000000000000000000000000000000..f1396ce35e1439d13aaf2f6b799490f4e6ea4b61 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_error_strerror.mdoc b/3rdparty/libzip/man/zip_error_strerror.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..8d44c993f0fdd23703aadaa8f336b10322b6abe7 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_error_system_type.html b/3rdparty/libzip/man/zip_error_system_type.html new file mode 100644 index 0000000000000000000000000000000000000000..463b50c6c99b8eb7258d21d6caf9748b251b354c --- /dev/null +++ b/3rdparty/libzip/man/zip_error_system_type.html @@ -0,0 +1,107 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_ERROR_SYSTEM_TYPE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_ERROR_SYSTEM_TYPE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_ERROR_SYSTEM_TYPE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_error_system_type</code> — +<div class="Nd">return type of system error</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_error_system_type</code>(<var class="Fa" style="white-space: nowrap;">const + zip_error_t *ze</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_error_system_type</code>() function returns the type of + the system specific part for the zip_error <var class="Ar">ze</var>. + Currently, the following system types are defined: +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_ET_NONE"><code class="Dv" id="ZIP_ET_NONE">ZIP_ET_NONE</code></a></dt> + <dd>System specific part of <var class="Ar">ze</var> is unused.</dd> + <dt><a class="permalink" href="#ZIP_ET_SYS"><code class="Dv" id="ZIP_ET_SYS">ZIP_ET_SYS</code></a></dt> + <dd>System specific part of <var class="Ar">ze</var> is an + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html">errno(2)</a>.</dd> + <dt><a class="permalink" href="#ZIP_ET_ZLIB"><code class="Dv" id="ZIP_ET_ZLIB">ZIP_ET_ZLIB</code></a></dt> + <dd>System specific part of <var class="Ar">ze</var> is a + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/zlib.html">zlib(3)</a> error.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_error_code_system.html">zip_error_code_system(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_error_system_type</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_error_system_type.man b/3rdparty/libzip/man/zip_error_system_type.man new file mode 100644 index 0000000000000000000000000000000000000000..0d55f4a3bbbb5cfa0fd49e6d4bda39fb91bb87d8 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_error_system_type.mdoc b/3rdparty/libzip/man/zip_error_system_type.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..f9fbfce5e086cc2491854c66a16ef1fb2b676ff6 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_error_to_data.html b/3rdparty/libzip/man/zip_error_to_data.html new file mode 100644 index 0000000000000000000000000000000000000000..6ec45f5a7747e403c3882c0a210c77fd76df06b3 --- /dev/null +++ b/3rdparty/libzip/man/zip_error_to_data.html @@ -0,0 +1,108 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_ERROR_TO_DATA(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_ERROR_TO_DATA(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_ERROR_TO_DATA(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_error_to_data</code> — +<div class="Nd">convert zip_error to return value suitable for + ZIP_SOURCE_ERROR</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int64_t</var> + <br/> + <code class="Fn">zip_error_to_data</code>(<var class="Fa" style="white-space: nowrap;">const + zip_error_t *ze</var>, <var class="Fa" style="white-space: nowrap;">void + *data</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + len</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<code class="Fn">zip_error_to_data</code>() function converts the zip_error + <var class="Ar">ze</var> into data suitable as return value for + <code class="Dv">ZIP_SOURCE_ERROR</code>. The data is written into the buffer + <var class="Ar">data</var> of size <var class="Ar">len</var>. If the buffer is + not large enough to hold 2 ints, an error is returned. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +<code class="Fn">zip_error_to_data</code>() returns 2*(sizeof int) on success, + and -1 on error. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source_function.html">zip_source_function(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_error_to_data</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_error_to_data.man b/3rdparty/libzip/man/zip_error_to_data.man new file mode 100644 index 0000000000000000000000000000000000000000..f6551292f10223c6642549ed1733ed496a6520af --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_error_to_data.mdoc b/3rdparty/libzip/man/zip_error_to_data.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..e7ba170b1fb297ac66604842890f11af6ff78ab8 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_error_to_str.html b/3rdparty/libzip/man/zip_error_to_str.html new file mode 100644 index 0000000000000000000000000000000000000000..cf6ce642d2b2927a8df5baba3dd5f79872f45d7a --- /dev/null +++ b/3rdparty/libzip/man/zip_error_to_str.html @@ -0,0 +1,124 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_ERROR_TO_STR(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_ERROR_TO_STR(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_ERROR_TO_STR(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_error_to_str</code> — +<div class="Nd">get string representation of zip error (obsolete + interface)</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_error_to_str</code>(<var class="Fa" style="white-space: nowrap;">char + *buf</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + len</var>, <var class="Fa" style="white-space: nowrap;">int ze</var>, + <var class="Fa" style="white-space: nowrap;">int se</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_error_to_str</code>() is deprecated; use + <a class="Xr" href="zip_error_init_with_code.html">zip_error_init_with_code(3)</a> + and <a class="Xr" href="zip_error_strerror.html">zip_error_strerror(3)</a> + instead. +<p class="Pp">Replace</p> +<div class="Bd Pp Bd-indent"> +<pre> +char buf[BUFSIZE]; +zip_error_to_str(buf, sizeof(buf), ze, se); +printf("%s", buf); +</pre> +</div> +with +<div class="Bd Pp Bd-indent"> +<pre> +zip_error_t error; +zip_error_init_with_code(&error, ze); +printf("%s", zip_error_strerror(&error)); +zip_error_fini(&error); +</pre> +</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_error_init_with_code.html">zip_error_init_with_code(3)</a>, + <a class="Xr" href="zip_error_strerror.html">zip_error_strerror(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_error_to_str</code>() was added in libzip 0.6. In libzip + 0.10 the type of <var class="Ar">len</var> was changed from + <var class="Vt">size_t</var> to <var class="Vt">zip_uint64_t</var>. It was + deprecated in libzip 1.0, use + <code class="Fn">zip_error_init_with_code</code>() and + <code class="Fn">zip_error_strerror</code>() instead. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_error_to_str.man b/3rdparty/libzip/man/zip_error_to_str.man new file mode 100644 index 0000000000000000000000000000000000000000..0db434aa5043722847617dd639106fc86a1736d0 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_error_to_str.mdoc b/3rdparty/libzip/man/zip_error_to_str.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..7054d3e43a6404069d557bbea9033542d30c46ea --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_errors.html b/3rdparty/libzip/man/zip_errors.html new file mode 100644 index 0000000000000000000000000000000000000000..d7c25d2a16ead9970fd7582add6da6cd59dd31e8 --- /dev/null +++ b/3rdparty/libzip/man/zip_errors.html @@ -0,0 +1,150 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_errors.mdoc -- list of all libzip error codes + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_ERRORS(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_ERRORS(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_ERRORS(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_errors</code> — +<div class="Nd">list of all libzip error codes</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The following error codes are used by libzip: +<dl class="Bl-tag"> + <dt>[<code class="Er">ZIP_ER_CHANGED</code>]</dt> + <dd>Entry has been changed.</dd> + <dt>[<code class="Er">ZIP_ER_CLOSE</code>]</dt> + <dd>Closing zip archive failed.</dd> + <dt>[<code class="Er">ZIP_ER_COMPNOTSUPP</code>]</dt> + <dd>Compression method not supported.</dd> + <dt>[<code class="Er">ZIP_ER_COMPRESSED_DATA</code>]</dt> + <dd>Compressed data invalid.</dd> + <dt>[<code class="Er">ZIP_ER_CRC</code>]</dt> + <dd>CRC error.</dd> + <dt>[<code class="Er">ZIP_ER_DELETED</code>]</dt> + <dd>Entry has been deleted.</dd> + <dt>[<code class="Er">ZIP_ER_ENCRNOTSUPP</code>]</dt> + <dd>Encryption method not supported.</dd> + <dt>[<code class="Er">ZIP_ER_EOF</code>]</dt> + <dd>Premature end of file.</dd> + <dt>[<code class="Er">ZIP_ER_EXISTS</code>]</dt> + <dd>File already exists.</dd> + <dt>[<code class="Er">ZIP_ER_INCONS</code>]</dt> + <dd>Zip archive inconsistent.</dd> + <dt>[<code class="Er">ZIP_ER_INTERNAL</code>]</dt> + <dd>Internal error.</dd> + <dt>[<code class="Er">ZIP_ER_INUSE</code>]</dt> + <dd>Resource still in use.</dd> + <dt>[<code class="Er">ZIP_ER_INVAL</code>]</dt> + <dd>Invalid argument.</dd> + <dt>[<code class="Er">ZIP_ER_MEMORY</code>]</dt> + <dd>Malloc failure.</dd> + <dt>[<code class="Er">ZIP_ER_MULTIDISK</code>]</dt> + <dd>Multi-disk zip archives not supported.</dd> + <dt>[<code class="Er">ZIP_ER_NOENT</code>]</dt> + <dd>No such file.</dd> + <dt>[<code class="Er">ZIP_ER_NOPASSWD</code>]</dt> + <dd>No password provided.</dd> + <dt>[<code class="Er">ZIP_ER_NOZIP</code>]</dt> + <dd>Not a zip archive.</dd> + <dt>[<code class="Er">ZIP_ER_OK</code>]</dt> + <dd>No error.</dd> + <dt>[<code class="Er">ZIP_ER_OPEN</code>]</dt> + <dd>Can't open file.</dd> + <dt>[<code class="Er">ZIP_ER_OPNOTSUPP</code>]</dt> + <dd>Operation not supported.</dd> + <dt>[<code class="Er">ZIP_ER_RDONLY</code>]</dt> + <dd>Read-only archive.</dd> + <dt>[<code class="Er">ZIP_ER_READ</code>]</dt> + <dd>Read error.</dd> + <dt>[<code class="Er">ZIP_ER_REMOVE</code>]</dt> + <dd>Can't remove file.</dd> + <dt>[<code class="Er">ZIP_ER_RENAME</code>]</dt> + <dd>Renaming temporary file failed.</dd> + <dt>[<code class="Er">ZIP_ER_SEEK</code>]</dt> + <dd>Seek error.</dd> + <dt>[<code class="Er">ZIP_ER_TELL</code>]</dt> + <dd>Tell error.</dd> + <dt>[<code class="Er">ZIP_ER_TMPOPEN</code>]</dt> + <dd>Failure to create temporary file.</dd> + <dt>[<code class="Er">ZIP_ER_WRITE</code>]</dt> + <dd>Write error.</dd> + <dt>[<code class="Er">ZIP_ER_WRONGPASSWD</code>]</dt> + <dd>Wrong password provided.</dd> + <dt>[<code class="Er">ZIP_ER_ZIPCLOSED</code>]</dt> + <dd>Containing zip archive was closed.</dd> + <dt>[<code class="Er">ZIP_ER_ZLIB</code>]</dt> + <dd>Zlib error.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_errors.man b/3rdparty/libzip/man/zip_errors.man new file mode 100644 index 0000000000000000000000000000000000000000..353c23b86289668edf7e636918f17b3677ab8ae0 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_errors.mdoc b/3rdparty/libzip/man/zip_errors.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..5c1d8fd69f77497bacd7b662bdfbe57e3c436e2f --- /dev/null +++ b/3rdparty/libzip/man/zip_errors.mdoc @@ -0,0 +1,117 @@ +.\" zip_errors.mdoc -- list of all libzip error codes +.\" Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_fclose.html b/3rdparty/libzip/man/zip_fclose.html new file mode 100644 index 0000000000000000000000000000000000000000..4c5736405717fb9c831da887f903b83424f36f33 --- /dev/null +++ b/3rdparty/libzip/man/zip_fclose.html @@ -0,0 +1,103 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FCLOSE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FCLOSE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FCLOSE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_fclose</code> — +<div class="Nd">close file in zip archive</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_fclose</code>(<var class="Fa" style="white-space: nowrap;">zip_file_t + *file</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_fclose</code>() function closes + <var class="Ar">file</var> and frees the memory allocated for it. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, the error code is returned. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_fopen.html">zip_fopen(3)</a>, + <a class="Xr" href="zip_fread.html">zip_fread(3)</a>, + <a class="Xr" href="zip_fseek.html">zip_fseek(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_fclose</code>() was added in libzip 0.6. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_fclose.man b/3rdparty/libzip/man/zip_fclose.man new file mode 100644 index 0000000000000000000000000000000000000000..977a7b77717c7fd3e212cc3b54e5401cd0597667 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_fclose.mdoc b/3rdparty/libzip/man/zip_fclose.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..0bbeee7cd164393e9a8c9ac433d24529efb001ef --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_fdopen.html b/3rdparty/libzip/man/zip_fdopen.html new file mode 100644 index 0000000000000000000000000000000000000000..f3b84ebda3efeef99e001fab22cf1dddb876974b --- /dev/null +++ b/3rdparty/libzip/man/zip_fdopen.html @@ -0,0 +1,154 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_fdopen.mdoc -- open zip archive using existing file descriptor + Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FDOPEN(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FDOPEN(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FDOPEN(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_fdopen</code> — +<div class="Nd">open zip archive using open file descriptor</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_t *</var> + <br/> + <code class="Fn">zip_fdopen</code>(<var class="Fa" style="white-space: nowrap;">int + fd</var>, <var class="Fa" style="white-space: nowrap;">int flags</var>, + <var class="Fa" style="white-space: nowrap;">int *errorp</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The zip archive specified by the open file descriptor <var class="Ar">fd</var> + is opened and a pointer to a <var class="Ft">struct zip</var>, used to + manipulate the archive, is returned. In contrast to + <a class="Xr" href="zip_open.html">zip_open(3)</a>, using + <code class="Nm">zip_fdopen</code> the archive can only be opened in read-only + mode. The <var class="Ar">fd</var> argument may not be used any longer after + calling <code class="Nm">zip_fdopen</code>. The <var class="Fa">flags</var> + are specified by <i class="Em">or</i><span class="No">'ing</span> the + following values, or 0 for none of them. +<div class="Bd-indent"> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_CHECKCONS"><code class="Dv" id="ZIP_CHECKCONS">ZIP_CHECKCONS</code></a></dt> + <dd>Perform additional stricter consistency checks on the archive, and error + if they fail.</dd> +</dl> +</div> +<p class="Pp">If an error occurs and <var class="Ar">errorp</var> is + <span class="No">non-</span><code class="Dv">NULL</code>, it will be set to + the corresponding error code.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion <code class="Fn">zip_fdopen</code>() returns a + <var class="Ft">struct zip</var> pointer, and <var class="Ar">fd</var> should + not be used any longer, nor passed to + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html">close(2)</a>. Otherwise, + <code class="Dv">NULL</code> is returned and <var class="Ar">*errorp</var> is + set to indicate the error. In the error case, <var class="Ar">fd</var> remains + unchanged. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +The file specified by <var class="Ar">fd</var> is prepared for use by + <a class="Xr" href="libzip.html">libzip(3)</a> unless: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INCONS"><code class="Er" id="ZIP_ER_INCONS">ZIP_ER_INCONS</code></a>]</dt> + <dd>Inconsistencies were found in the file specified by + <var class="Ar">path</var>. This error is often caused by specifying + <code class="Dv">ZIP_CHECKCONS</code> but can also happen without it.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd>The <var class="Ar">flags</var> argument is invalid. Not all + <a class="Xr" href="zip_open.html">zip_open(3)</a> flags are allowed for + <code class="Nm">zip_fdopen</code>, see + <a class="Sx" href="#DESCRIPTION">DESCRIPTION</a>.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_NOZIP"><code class="Er" id="ZIP_ER_NOZIP">ZIP_ER_NOZIP</code></a>]</dt> + <dd>The file specified by <var class="Ar">fd</var> is not a zip archive.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_OPEN"><code class="Er" id="ZIP_ER_OPEN">ZIP_ER_OPEN</code></a>]</dt> + <dd>The file specified by <var class="Ar">fd</var> could not be prepared for + use by <a class="Xr" href="libzip.html">libzip(3)</a>.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_READ"><code class="Er" id="ZIP_ER_READ">ZIP_ER_READ</code></a>]</dt> + <dd>A read error occurred; see <var class="Va">errno</var> for details.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_SEEK"><code class="Er" id="ZIP_ER_SEEK">ZIP_ER_SEEK</code></a>]</dt> + <dd>The file specified by <var class="Ar">fd</var> does not allow seeks.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_close.html">zip_close(3)</a>, + <a class="Xr" href="zip_error_strerror.html">zip_error_strerror(3)</a>, + <a class="Xr" href="zip_open.html">zip_open(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_fdopen</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_fdopen.man b/3rdparty/libzip/man/zip_fdopen.man new file mode 100644 index 0000000000000000000000000000000000000000..075a649dac910b2eafbda438083ab9de39204574 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_fdopen.mdoc b/3rdparty/libzip/man/zip_fdopen.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..0db086e7e047cd3ecbc5f4075542cf39db7c82e6 --- /dev/null +++ b/3rdparty/libzip/man/zip_fdopen.mdoc @@ -0,0 +1,147 @@ +.\" zip_fdopen.mdoc -- open zip archive using existing file descriptor +.\" Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_file_add.html b/3rdparty/libzip/man/zip_file_add.html new file mode 100644 index 0000000000000000000000000000000000000000..c702ac22e65992baa6c4d1662cefce8b57f5aa3a --- /dev/null +++ b/3rdparty/libzip/man/zip_file_add.html @@ -0,0 +1,178 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_file_add.mdoc -- add files to zip archive + Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FILE_ADD(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FILE_ADD(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FILE_ADD(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_file_add</code>, <code class="Nm">zip_file_replace</code> + — +<div class="Nd">add file to zip archive or replace file in zip archive</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int64_t</var> + <br/> + <code class="Fn">zip_file_add</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">const char + *name</var>, <var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_file_replace</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_file_add</code>() adds a file to a zip + archive, while <code class="Fn">zip_file_replace</code>() replaces an existing + file in a zip archive. The argument <var class="Ar">archive</var> specifies + the zip archive to which the file should be added. <var class="Ar">name</var> + is the file's name in the zip archive (for + <code class="Fn">zip_file_add</code>()), while <var class="Ar">index</var> + specifies which file should be replaced (for + <code class="Fn">zip_file_replace</code>()). The <var class="Ar">flags</var> + argument can be any combination of <code class="Dv">ZIP_FL_OVERWRITE</code> + with one of <code class="Dv">ZIP_FL_ENC_*</code>: +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_FL_OVERWRITE"><code class="Dv" id="ZIP_FL_OVERWRITE">ZIP_FL_OVERWRITE</code></a></dt> + <dd>Overwrite any existing file of the same name. For + <code class="Nm">zip_file_add</code> only.</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_GUESS"><code class="Dv" id="ZIP_FL_ENC_GUESS">ZIP_FL_ENC_GUESS</code></a></dt> + <dd>Guess encoding of <var class="Ar">name</var> (default). (Only CP-437 and + UTF-8 are recognized.)</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_UTF_8"><code class="Dv" id="ZIP_FL_ENC_UTF_8">ZIP_FL_ENC_UTF_8</code></a></dt> + <dd>Interpret <var class="Ar">name</var> as UTF-8.</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_CP437"><code class="Dv" id="ZIP_FL_ENC_CP437">ZIP_FL_ENC_CP437</code></a></dt> + <dd>Interpret <var class="Ar">name</var> as code page 437 (CP-437).</dd> +</dl> +The data is obtained from the <var class="Ar">source</var> argument, see + <a class="Xr" href="zip_source.html">zip_source(3)</a>. +<p class="Pp"><i class="Em">NOTE</i>: + <a class="Xr" href="zip_source_free.html">zip_source_free(3)</a> should not + be called on a <var class="Ar">source</var> after it was used successfully + in a <code class="Nm">zip_file_add</code> or + <code class="Nm">zip_file_replace</code> call.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, <code class="Fn">zip_file_add</code>() returns the + index of the new file in the archive, and + <code class="Fn">zip_file_replace</code>() returns 0. Otherwise, -1 is + returned and the error code in <var class="Ar">archive</var> is set to + indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1> +<div class="Bd Bd-indent"> +<pre> +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)); +} +</pre> +</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_file_add</code>() and + <code class="Fn">zip_file_replace</code>() fail if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_EXISTS"><code class="Er" id="ZIP_ER_EXISTS">ZIP_ER_EXISTS</code></a>]</dt> + <dd>There is already a file called <var class="Ar">name</var> in the archive. + (Only applies to <code class="Fn">zip_file_add</code>(), and only if + <code class="Dv">ZIP_FL_OVERWRITE</code> is not provided).</dd> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">source</var> or <var class="Ar">name</var> are + <code class="Dv">NULL</code>, or <var class="Ar">index</var> is + invalid.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_RDONLY"><code class="Er" id="ZIP_ER_RDONLY">ZIP_ER_RDONLY</code></a>]</dt> + <dd>Archive was opened in read-only mode.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_file_add</code>() and + <code class="Fn">zip_file_replace</code>() were added in libzip 0.11. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">September 22, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_file_add.man b/3rdparty/libzip/man/zip_file_add.man new file mode 100644 index 0000000000000000000000000000000000000000..c27f3cd85dfc10e67fd4b23d2f289f80d9439bd7 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_file_add.mdoc b/3rdparty/libzip/man/zip_file_add.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..4c29e27f6f34ac4f7323bf503f3821e542e9ac06 --- /dev/null +++ b/3rdparty/libzip/man/zip_file_add.mdoc @@ -0,0 +1,164 @@ +.\" zip_file_add.mdoc -- add files to zip archive +.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_file_attributes_init.html b/3rdparty/libzip/man/zip_file_attributes_init.html new file mode 100644 index 0000000000000000000000000000000000000000..14f31db0bab4557abd92ccb2f901d899de5e227a --- /dev/null +++ b/3rdparty/libzip/man/zip_file_attributes_init.html @@ -0,0 +1,97 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FILE_ATTRIBUTES_INIT(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FILE_ATTRIBUTES_INIT(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FILE_ATTRIBUTES_INIT(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_file_attributes_init</code> — +<div class="Nd">initialize zip file attributes structure</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_file_attributes_init</code>(<var class="Fa" style="white-space: nowrap;">zip_file_attributes_t + *attributes</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_file_attributes_init</code>() initializes a + <var class="Vt">zip_file_attributes_t</var> structure with default values. It + must be called before modifying such a structure for the first time. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source_function.html">zip_source_function(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_file_attributes_init</code>() was added in libzip 1.7.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">April 17, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_file_attributes_init.man b/3rdparty/libzip/man/zip_file_attributes_init.man new file mode 100644 index 0000000000000000000000000000000000000000..ca28199cbdd562311aa2297d33fd49f78d328650 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_file_attributes_init.mdoc b/3rdparty/libzip/man/zip_file_attributes_init.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..7a5e06c60bec468b510e22d2c310d628316e6ebb --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_file_extra_field_delete.html b/3rdparty/libzip/man/zip_file_extra_field_delete.html new file mode 100644 index 0000000000000000000000000000000000000000..fb671590024fb82013843742355f68335429131b --- /dev/null +++ b/3rdparty/libzip/man/zip_file_extra_field_delete.html @@ -0,0 +1,159 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FILE_EXTRA_FIELD_DELETE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FILE_EXTRA_FIELD_DELETE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FILE_EXTRA_FIELD_DELETE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_file_extra_field_delete</code>, + <code class="Nm">zip_file_extra_field_delete_by_id</code> — +<div class="Nd">delete extra field for file in zip</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_file_extra_field_delete</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_uint16_t + extra_field_index</var>, + <var class="Fa" style="white-space: nowrap;">zip_flags_t flags</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_file_extra_field_delete_by_id</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_uint16_t + extra_field_id</var>, + <var class="Fa" style="white-space: nowrap;">zip_uint16_t + extra_field_index</var>, + <var class="Fa" style="white-space: nowrap;">zip_flags_t flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_file_extra_field_delete</code>() function deletes the + extra field with index <var class="Ar">extra_field_index</var> for the file at + position <var class="Ar">index</var> in the zip archive. +<p class="Pp">If <var class="Ar">extra_field_index</var> is + <code class="Dv">ZIP_EXTRA_FIELD_ALL</code>, then all extra fields will be + deleted.</p> +<p class="Pp">The following <var class="Ar">flags</var> are supported:</p> +<div class="Bd-indent"> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_FL_CENTRAL"><code class="Dv" id="ZIP_FL_CENTRAL">ZIP_FL_CENTRAL</code></a></dt> + <dd>Delete extra fields from the archive's central directory.</dd> + <dt><a class="permalink" href="#ZIP_FL_LOCAL"><code class="Dv" id="ZIP_FL_LOCAL">ZIP_FL_LOCAL</code></a></dt> + <dd>Delete extra fields from the local file headers.</dd> +</dl> +</div> +<p class="Pp">The <code class="Fn">zip_file_extra_field_delete_by_id</code>() + function deletes the extra field with ID (two-byte signature) + <var class="Ar">extra_field_id</var> and index + <var class="Ar">extra_field_index</var> (in other words, the + <var class="Ar">extra_field_index</var><span class="No">'th</span> extra + field with ID <var class="Ar">extra_field_id</var>) The other arguments are + the same as for <code class="Fn">zip_file_extra_field_delete</code>() + (<code class="Dv">ZIP_EXTRA_FIELD_ALL</code> will delete all extra fields of + the specified ID).</p> +<p class="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 + <code class="Dv">ZIP_FL_CENTRAL</code> and + <code class="Dv">ZIP_FL_LOCAL</code> in <var class="Ar">flags</var>, except + when deleting all extra fields (i.e., + <var class="Ar">extra_field_index</var> being + <code class="Dv">ZIP_EXTRA_FIELD_ALL</code>).</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error code in <var class="Ar">archive</var> is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_file_extra_field_delete</code>() and + <code class="Fn">zip_file_extra_field_delete_by_id</code>() fail if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_NOENT"><code class="Er" id="ZIP_ER_NOENT">ZIP_ER_NOENT</code></a>]</dt> + <dd><var class="Ar">index</var> is not a valid file index in + <var class="Ar">archive</var>.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_extra_field_get.html">zip_file_extra_field_get(3)</a>, + <a class="Xr" href="zip_file_extra_field_set.html">zip_file_extra_field_set(3)</a>, + <a class="Xr" href="zip_file_extra_fields_count.html">zip_file_extra_fields_count(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_file_extra_field_delete</code>() and + <code class="Fn">zip_file_extra_field_delete_by_id</code>() were added in + libzip 0.11. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_file_extra_field_delete.man b/3rdparty/libzip/man/zip_file_extra_field_delete.man new file mode 100644 index 0000000000000000000000000000000000000000..ccc5071d74c9d2e328bdbc559f8b78ffefe2d62b --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_file_extra_field_delete.mdoc b/3rdparty/libzip/man/zip_file_extra_field_delete.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..005e7470b9cfbfcac805b725116cc38ce8a03511 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_file_extra_field_get.html b/3rdparty/libzip/man/zip_file_extra_field_get.html new file mode 100644 index 0000000000000000000000000000000000000000..0d7b305d69fd737df58276bbd8c2e688b7b9e23b --- /dev/null +++ b/3rdparty/libzip/man/zip_file_extra_field_get.html @@ -0,0 +1,176 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FILE_EXTRA_FIELD_GET(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FILE_EXTRA_FIELD_GET(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FILE_EXTRA_FIELD_GET(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_file_extra_field_get</code>, + <code class="Nm">zip_file_extra_field_get_by_id</code> — +<div class="Nd">get extra field for file in zip</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">const zip_uint8_t *</var> + <br/> + <code class="Fn">zip_file_extra_field_get</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_uint16_t + extra_field_index</var>, + <var class="Fa" style="white-space: nowrap;">zip_uint16_t *idp</var>, + <var class="Fa" style="white-space: nowrap;">zip_uint16_t *lenp</var>, + <var class="Fa" style="white-space: nowrap;">zip_flags_t flags</var>);</p> +<p class="Pp"><var class="Ft">const zip_uint8_t *</var> + <br/> + <code class="Fn">zip_file_extra_field_get_by_id</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_uint16_t + extra_field_id</var>, + <var class="Fa" style="white-space: nowrap;">zip_uint16_t + extra_field_index</var>, + <var class="Fa" style="white-space: nowrap;">zip_uint16_t *lenp</var>, + <var class="Fa" style="white-space: nowrap;">zip_flags_t flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_file_extra_field_get</code>() function returns the + extra field with index <var class="Ar">extra_field_index</var> for the file at + position <var class="Ar">index</var> in the zip archive. This pointer should + not be modified or <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html">free(3)</a>'d, and becomes + invalid when <var class="Ar">archive</var> is closed. If + <var class="Ar">idp</var> is not <code class="Dv">NULL</code>, the integer to + which it points will be set to the ID (two-byte signature) of the selected + extra field. If <var class="Ar">lenp</var> is not + <code class="Dv">NULL</code>, the integer to which it points will be set to + the length of the extra field. Generally speaking, <var class="Ar">lenp</var> + and <var class="Ar">idp</var> should be passed since only the extra field data + is returned (i.e., neither the ID nor the length, if the + <var class="Ar">idp</var> and <var class="Ar">lenp</var> arguments are not + provided). +<p class="Pp">The following <var class="Ar">flags</var> are supported:</p> +<div class="Bd-indent"> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_FL_CENTRAL"><code class="Dv" id="ZIP_FL_CENTRAL">ZIP_FL_CENTRAL</code></a></dt> + <dd>Return extra fields from the archive's central directory.</dd> + <dt><a class="permalink" href="#ZIP_FL_LOCAL"><code class="Dv" id="ZIP_FL_LOCAL">ZIP_FL_LOCAL</code></a></dt> + <dd>Return extra fields from the local file headers.</dd> + <dt><a class="permalink" href="#ZIP_FL_UNCHANGED"><code class="Dv" id="ZIP_FL_UNCHANGED">ZIP_FL_UNCHANGED</code></a></dt> + <dd>Return the original unchanged extra fields, ignoring any changes + made.</dd> +</dl> +</div> +<p class="Pp">The <code class="Fn">zip_file_extra_field_get_by_id</code>() + function returns the extra field with ID (two-byte signature) + <var class="Ar">extra_field_id</var> and index + <var class="Ar">extra_field_index</var> (in other words, the + <var class="Ar">extra_field_index</var><span class="No">'th</span> extra + field with ID <var class="Ar">extra_field_id</var>) The other arguments are + the same as for <code class="Fn">zip_file_extra_field_get</code>().</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, a pointer to an extra field is returned, or + <code class="Dv">NULL</code> if there is no extra field with that + <var class="Ar">extra_field_index</var> for the file with index + <var class="Ar">index</var>. In case of an error, <code class="Dv">NULL</code> + is returned and the error code in <var class="Ar">archive</var> is set to + indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_file_extra_field_get</code>() and + <code class="Fn">zip_file_extra_field_get_by_id</code>() fail if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_NOENT"><code class="Er" id="ZIP_ER_NOENT">ZIP_ER_NOENT</code></a>]</dt> + <dd><var class="Ar">index</var> is not a valid file index in + <var class="Ar">archive</var>, or <var class="Ar">extra_field_index</var> + is not a valid extra file index (for ID + <var class="Ar">extra_field_id</var>).</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_extra_field_delete.html">zip_file_extra_field_delete(3)</a>, + <a class="Xr" href="zip_file_extra_field_set.html">zip_file_extra_field_set(3)</a>, + <a class="Xr" href="zip_file_extra_fields_count.html">zip_file_extra_fields_count(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_file_extra_field_get</code>() and + <code class="Fn">zip_file_extra_field_get_by_id</code>() were added in libzip + 0.11. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +<section class="Sh"> +<h1 class="Sh" id="CAVEATS"><a class="permalink" href="#CAVEATS">CAVEATS</a></h1> +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 + <code class="Fn">zip_file_extra_field_get</code>() since they are used by + <a class="Xr" href="libzip.html">libzip(3)</a> internally. +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_file_extra_field_get.man b/3rdparty/libzip/man/zip_file_extra_field_get.man new file mode 100644 index 0000000000000000000000000000000000000000..39c54284f00983f0e627bf40cff807202b4ed210 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_file_extra_field_get.mdoc b/3rdparty/libzip/man/zip_file_extra_field_get.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..72b2c873b3bb8f79c1b9330b52826731bf4fff94 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_file_extra_field_set.html b/3rdparty/libzip/man/zip_file_extra_field_set.html new file mode 100644 index 0000000000000000000000000000000000000000..e9decdb7c19e9ae03693834b56f97f117cd991a8 --- /dev/null +++ b/3rdparty/libzip/man/zip_file_extra_field_set.html @@ -0,0 +1,148 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FILE_EXTRA_FIELD_SET(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FILE_EXTRA_FIELD_SET(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FILE_EXTRA_FIELD_SET(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_file_extra_field_set</code> — +<div class="Nd">set extra field for file in zip</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_file_extra_field_set</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_uint16_t + extra_field_id</var>, + <var class="Fa" style="white-space: nowrap;">zip_uint16_t + extra_field_index</var>, <var class="Fa" style="white-space: nowrap;">const + zip_uint8_t *extra_field_data</var>, + <var class="Fa" style="white-space: nowrap;">zip_uint16_t len</var>, + <var class="Fa" style="white-space: nowrap;">zip_flags_t flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_file_extra_field_set</code>() function sets the extra + field with ID (two-byte signature) <var class="Ar">extra_field_id</var> and + index <var class="Ar">extra_field_index</var> for the file at position + <var class="Ar">index</var> in the zip archive. The extra field's data will be + set to <var class="Ar">extra_field_data</var> and length + <var class="Ar">len</var>. If a new entry shall be appended, set + <var class="Ar">extra_field_index</var> to + <code class="Dv">ZIP_EXTRA_FIELD_NEW</code>. +<p class="Pp">At least one of the following <var class="Ar">flags</var> must be + set:</p> +<div class="Bd-indent"> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_FL_CENTRAL"><code class="Dv" id="ZIP_FL_CENTRAL">ZIP_FL_CENTRAL</code></a></dt> + <dd>Set extra field in the archive's central directory.</dd> + <dt><a class="permalink" href="#ZIP_FL_LOCAL"><code class="Dv" id="ZIP_FL_LOCAL">ZIP_FL_LOCAL</code></a></dt> + <dd>Set extra field in the local file headers.</dd> +</dl> +</div> +<p class="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 <code class="Fn">zip_file_extra_field_set</code>() since they + are set by <a class="Xr" href="libzip.html">libzip(3)</a> automatically when + needed.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error code in <var class="Ar">archive</var> is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_file_extra_field_set</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd>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 <var class="Ar">extra_field_index</var> is too + large.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_NOENT"><code class="Er" id="ZIP_ER_NOENT">ZIP_ER_NOENT</code></a>]</dt> + <dd><var class="Ar">index</var> is not a valid file index in + <var class="Ar">archive</var>.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_extra_field_delete.html">zip_file_extra_field_delete(3)</a>, + <a class="Xr" href="zip_file_extra_field_get.html">zip_file_extra_field_get(3)</a>, + <a class="Xr" href="zip_file_extra_fields_count.html">zip_file_extra_fields_count(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_file_extra_field_set</code>() was added in libzip 0.11. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_file_extra_field_set.man b/3rdparty/libzip/man/zip_file_extra_field_set.man new file mode 100644 index 0000000000000000000000000000000000000000..3db94fe430211c0b36ac214036ce4f43bd6f8c90 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_file_extra_field_set.mdoc b/3rdparty/libzip/man/zip_file_extra_field_set.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..3e6abc11636df38debf2a3780314fb55c0150371 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_file_extra_fields_count.html b/3rdparty/libzip/man/zip_file_extra_fields_count.html new file mode 100644 index 0000000000000000000000000000000000000000..591f0215e151c3d46a5374bc86172152b806aff3 --- /dev/null +++ b/3rdparty/libzip/man/zip_file_extra_fields_count.html @@ -0,0 +1,149 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FILE_EXTRA_FIELDS_COUNT(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FILE_EXTRA_FIELDS_COUNT(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FILE_EXTRA_FIELDS_COUNT(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_file_extra_fields_count</code>, + <code class="Nm">zip_file_extra_fields_count_by_id</code> — +<div class="Nd">count extra fields for file in zip</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int16_t</var> + <br/> + <code class="Fn">zip_file_extra_fields_count</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>);</p> +<p class="Pp"><var class="Ft">zip_int16_t</var> + <br/> + <code class="Fn">zip_file_extra_fields_count_by_id</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_uint16_t + extra_field_id</var>, + <var class="Fa" style="white-space: nowrap;">zip_flags_t flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_file_extra_fields_count</code>() function counts the + extra fields for the file at position <var class="Ar">index</var> in the zip + archive. +<p class="Pp">The following <var class="Ar">flags</var> are supported:</p> +<div class="Bd-indent"> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_FL_CENTRAL"><code class="Dv" id="ZIP_FL_CENTRAL">ZIP_FL_CENTRAL</code></a></dt> + <dd>Count extra fields from the archive's central directory.</dd> + <dt><a class="permalink" href="#ZIP_FL_LOCAL"><code class="Dv" id="ZIP_FL_LOCAL">ZIP_FL_LOCAL</code></a></dt> + <dd>Count extra fields from the local file headers.</dd> + <dt><a class="permalink" href="#ZIP_FL_UNCHANGED"><code class="Dv" id="ZIP_FL_UNCHANGED">ZIP_FL_UNCHANGED</code></a></dt> + <dd>Count the original unchanged extra fields, ignoring any changes made.</dd> +</dl> +</div> +<p class="Pp">The <code class="Fn">zip_file_extra_fields_count_by_id</code>() + function counts the extra fields with ID (two-byte signature) + <var class="Ar">extra_field_id</var>. The other arguments are the same as + for <code class="Fn">zip_file_extra_fields_count</code>().</p> +<p class="Pp">Extra fields that are the same in the central directory and the + local file header are merged into one. Therefore, the counts with + <code class="Dv">ZIP_FL_CENTRAL</code> and + <code class="Dv">ZIP_FL_LOCAL</code> do not need to add up to the same value + as when given <code class="Dv">ZIP_FL_CENTRAL|ZIP_FL_LOCAL</code> at the + same time.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, the requested number of extra fields is returned. + Otherwise, -1 is returned and the error code in <var class="Ar">archive</var> + is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_file_extra_fields_count</code>() and + <code class="Fn">zip_file_extra_fields_count_by_id</code>() fail if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_NOENT"><code class="Er" id="ZIP_ER_NOENT">ZIP_ER_NOENT</code></a>]</dt> + <dd><var class="Ar">index</var> is not a valid file index in + <var class="Ar">archive</var>.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_extra_field_delete.html">zip_file_extra_field_delete(3)</a>, + <a class="Xr" href="zip_file_extra_field_get.html">zip_file_extra_field_get(3)</a>, + <a class="Xr" href="zip_file_extra_field_set.html">zip_file_extra_field_set(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_file_extra_fields_count</code>() and + <code class="Fn">zip_file_extra_fields_count_by_id</code>() were added in + libzip 0.11. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_file_extra_fields_count.man b/3rdparty/libzip/man/zip_file_extra_fields_count.man new file mode 100644 index 0000000000000000000000000000000000000000..35a85e1470739d0f4be69d98366462fa2a437300 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_file_extra_fields_count.mdoc b/3rdparty/libzip/man/zip_file_extra_fields_count.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..47bb9a3f02699846dd9601fcf95b1d07b4cb940b --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_file_get_comment.html b/3rdparty/libzip/man/zip_file_get_comment.html new file mode 100644 index 0000000000000000000000000000000000000000..4b95548351b0ea9a8a52b7cffa7d36ea2c11a675 --- /dev/null +++ b/3rdparty/libzip/man/zip_file_get_comment.html @@ -0,0 +1,143 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_file_get_comment.mdoc -- get comment for file in zip + Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP files. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FILE_GET_COMMENT(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FILE_GET_COMMENT(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FILE_GET_COMMENT(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_file_get_comment</code> — +<div class="Nd">get comment for file in zip</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">const char *</var> + <br/> + <code class="Fn">zip_file_get_comment</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_uint32_t + *lenp</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_file_get_comment</code>() function returns the comment + for the file at position <var class="Ar">index</var> in the zip archive. The + name is in UTF-8 encoding unless <code class="Dv">ZIP_FL_ENC_RAW</code> was + specified (see below). This pointer should not be modified or + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html">free(3)</a>'d, and becomes invalid when + <var class="Ar">archive</var> is closed. If <var class="Ar">lenp</var> is not + <code class="Dv">NULL</code>, the integer to which it points will be set to + the length of the comment. If <var class="Ar">flags</var> is set to + <code class="Dv">ZIP_FL_UNCHANGED</code>, the original unchanged comment is + returned. +<p class="Pp">Additionally, the following <var class="Ar">flags</var> are + supported:</p> +<div class="Bd-indent"> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_FL_ENC_RAW"><code class="Dv" id="ZIP_FL_ENC_RAW">ZIP_FL_ENC_RAW</code></a></dt> + <dd>Return the unmodified comment as it is in the ZIP archive.</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_GUESS"><code class="Dv" id="ZIP_FL_ENC_GUESS">ZIP_FL_ENC_GUESS</code></a></dt> + <dd>(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.)</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_STRICT"><code class="Dv" id="ZIP_FL_ENC_STRICT">ZIP_FL_ENC_STRICT</code></a></dt> + <dd>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.</dd> +</dl> +</div> +<i class="Em">Note</i>: ASCII is a subset of both CP-437 and UTF-8. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, a pointer to the comment is returned, or + <code class="Dv">NULL</code> if there is no comment. In case of an error, + <code class="Dv">NULL</code> is returned and the error code in + <var class="Ar">archive</var> is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_file_get_comment</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">index</var> is not a valid file index in + <var class="Ar">archive</var>.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_set_comment.html">zip_file_set_comment(3)</a>, + <a class="Xr" href="zip_get_archive_comment.html">zip_get_archive_comment(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_file_get_comment</code>() was added in libzip 0.11. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">September 22, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_file_get_comment.man b/3rdparty/libzip/man/zip_file_get_comment.man new file mode 100644 index 0000000000000000000000000000000000000000..cdaa5c628562289cecba2568e5ad20484ee88610 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_file_get_comment.mdoc b/3rdparty/libzip/man/zip_file_get_comment.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..a554f13ca287b39349a189930914a9caa24349ce --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_file_get_error.html b/3rdparty/libzip/man/zip_file_get_error.html new file mode 100644 index 0000000000000000000000000000000000000000..d52f83a469eaefde44344a2249400e3a06081057 --- /dev/null +++ b/3rdparty/libzip/man/zip_file_get_error.html @@ -0,0 +1,95 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FILE_GET_ERROR(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FILE_GET_ERROR(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FILE_GET_ERROR(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_file_get_error</code> — +<div class="Nd">extract zip_error from zip_file</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_error_t *</var> + <br/> + <code class="Fn">zip_file_get_error</code>(<var class="Fa" style="white-space: nowrap;">zip_file_t + *zf</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<code class="Fn">zip_file_get_error</code>() function returns the zip_error + associated with the zip_file <var class="Ar">zf</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_file_get_error</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_file_get_error.man b/3rdparty/libzip/man/zip_file_get_error.man new file mode 100644 index 0000000000000000000000000000000000000000..d364ac08fc4af60dc6486f482c797a2fe6965249 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_file_get_error.mdoc b/3rdparty/libzip/man/zip_file_get_error.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..56628a1c78948bf59fc42f049d83a5e465b732f6 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_file_get_external_attributes.html b/3rdparty/libzip/man/zip_file_get_external_attributes.html new file mode 100644 index 0000000000000000000000000000000000000000..d5ce85919b09acd0158fb708658ddf3c13d3f83c --- /dev/null +++ b/3rdparty/libzip/man/zip_file_get_external_attributes.html @@ -0,0 +1,176 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FILE_GET_EXTERNAL_ATTRIBUTES(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FILE_GET_EXTERNAL_ATTRIBUTES(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FILE_GET_EXTERNAL_ATTRIBUTES(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_file_get_external_attributes</code> — +<div class="Nd">get external attributes for file in zip</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_file_get_external_attributes</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>, <var class="Fa" style="white-space: nowrap;">zip_uint8_t + *opsys</var>, <var class="Fa" style="white-space: nowrap;">zip_uint32_t + *attributes</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_file_get_external_attributes</code>() function returns + the operating system and external attributes for the file at position + <var class="Ar">index</var> in the zip archive. The external attributes + usually contain the operating system-specific file permissions. If + <var class="Ar">flags</var> is set to + <code class="Dv">ZIP_FL_UNCHANGED</code>, the original unchanged values are + returned. If <var class="Ar">opsys</var> or <var class="Ar">attributes</var> + are <code class="Dv">NULL</code>, they are not filled in. +<p class="Pp">The following operating systems are defined by the zip + specification:</p> +<ul class="Bl-item Bd-indent Bl-compact"> + <li><a class="permalink" href="#ZIP_OPSYS_ACORN_RISC"><code class="Dv" id="ZIP_OPSYS_ACORN_RISC">ZIP_OPSYS_ACORN_RISC</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_ALTERNATE_MVS"><code class="Dv" id="ZIP_OPSYS_ALTERNATE_MVS">ZIP_OPSYS_ALTERNATE_MVS</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_AMIGA"><code class="Dv" id="ZIP_OPSYS_AMIGA">ZIP_OPSYS_AMIGA</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_ATARI_ST"><code class="Dv" id="ZIP_OPSYS_ATARI_ST">ZIP_OPSYS_ATARI_ST</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_BEOS"><code class="Dv" id="ZIP_OPSYS_BEOS">ZIP_OPSYS_BEOS</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_CPM"><code class="Dv" id="ZIP_OPSYS_CPM">ZIP_OPSYS_CPM</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_DOS"><code class="Dv" id="ZIP_OPSYS_DOS">ZIP_OPSYS_DOS</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_MACINTOSH"><code class="Dv" id="ZIP_OPSYS_MACINTOSH">ZIP_OPSYS_MACINTOSH</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_MVS"><code class="Dv" id="ZIP_OPSYS_MVS">ZIP_OPSYS_MVS</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_OPENVMS"><code class="Dv" id="ZIP_OPSYS_OPENVMS">ZIP_OPSYS_OPENVMS</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_OS_2"><code class="Dv" id="ZIP_OPSYS_OS_2">ZIP_OPSYS_OS_2</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_OS_400"><code class="Dv" id="ZIP_OPSYS_OS_400">ZIP_OPSYS_OS_400</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_OS_X"><code class="Dv" id="ZIP_OPSYS_OS_X">ZIP_OPSYS_OS_X</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_TANDEM"><code class="Dv" id="ZIP_OPSYS_TANDEM">ZIP_OPSYS_TANDEM</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_UNIX"><code class="Dv" id="ZIP_OPSYS_UNIX">ZIP_OPSYS_UNIX</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_VFAT"><code class="Dv" id="ZIP_OPSYS_VFAT">ZIP_OPSYS_VFAT</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_VM_CMS"><code class="Dv" id="ZIP_OPSYS_VM_CMS">ZIP_OPSYS_VM_CMS</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_VSE"><code class="Dv" id="ZIP_OPSYS_VSE">ZIP_OPSYS_VSE</code></a></li> + <li><a class="permalink" href="#ZIP_OPSYS_WINDOWS_NTFS"><code class="Dv" id="ZIP_OPSYS_WINDOWS_NTFS">ZIP_OPSYS_WINDOWS_NTFS</code></a> + (uncommon, use <code class="Dv">ZIP_OPSYS_DOS</code> instead)</li> + <li><a class="permalink" href="#ZIP_OPSYS_Z_SYSTEM"><code class="Dv" id="ZIP_OPSYS_Z_SYSTEM">ZIP_OPSYS_Z_SYSTEM</code></a></li> +</ul> +<p class="Pp">The defines above follow the PKWARE Inc. Appnote; please note that + the InfoZIP Appnote has a slightly different mapping.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, 0 is returned. In case of an error, + <code class="Dv">-1</code> is returned and the error code in + <var class="Ar">archive</var> is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1> +The following code can be used to expand <var class="Ar">attributes</var> if the + operating system is <code class="Dv">ZIP_OPSYS_DOS</code>. +<div class="Bd Pp"> +<pre> +#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; +} +</pre> +</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_file_get_external_attributes</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">index</var> is not a valid file index in + <var class="Ar">archive</var>.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_set_external_attributes.html">zip_file_set_external_attributes(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_file_get_external_attributes</code>() was added in libzip + 0.11.2. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_file_get_external_attributes.man b/3rdparty/libzip/man/zip_file_get_external_attributes.man new file mode 100644 index 0000000000000000000000000000000000000000..acd3fbb49f45952004e63d9d750b4235721964e5 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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 <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; +} +.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/3rdparty/libzip/man/zip_file_get_external_attributes.mdoc b/3rdparty/libzip/man/zip_file_get_external_attributes.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..5b3cdcc81e77499105a2f260c2fbda9ae91db169 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <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; +} +.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/3rdparty/libzip/man/zip_file_rename.html b/3rdparty/libzip/man/zip_file_rename.html new file mode 100644 index 0000000000000000000000000000000000000000..c4d2aa9aba65b55c07808935bab1c22e2de6d67b --- /dev/null +++ b/3rdparty/libzip/man/zip_file_rename.html @@ -0,0 +1,132 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_file_rename.mdoc -- rename file in zip archive + Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FILE_RENAME(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FILE_RENAME(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FILE_RENAME(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_file_rename</code> — +<div class="Nd">rename file in zip archive</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_file_rename</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">const char + *name</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The file at position <var class="Ar">index</var> in the zip archive + <var class="Ar">archive</var> is renamed to <var class="Ar">name</var>. The + <var class="Ar">flags</var> argument can be any of: +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_FL_ENC_GUESS"><code class="Dv" id="ZIP_FL_ENC_GUESS">ZIP_FL_ENC_GUESS</code></a></dt> + <dd>Guess encoding of <var class="Ar">name</var> (default). (Only CP-437 and + UTF-8 are recognized.)</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_UTF_8"><code class="Dv" id="ZIP_FL_ENC_UTF_8">ZIP_FL_ENC_UTF_8</code></a></dt> + <dd>Interpret <var class="Ar">name</var> as UTF-8.</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_CP437"><code class="Dv" id="ZIP_FL_ENC_CP437">ZIP_FL_ENC_CP437</code></a></dt> + <dd>Interpret <var class="Ar">name</var> as code page 437 (CP-437).</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error code in <var class="Ar">archive</var> is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_file_rename</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_DELETED"><code class="Er" id="ZIP_ER_DELETED">ZIP_ER_DELETED</code></a>]</dt> + <dd>The file to be renamed has been deleted from the archive.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_EXISTS"><code class="Er" id="ZIP_ER_EXISTS">ZIP_ER_EXISTS</code></a>]</dt> + <dd>There is already a file called <var class="Ar">name</var> in the + archive.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">index</var> is not a valid file index in + <var class="Ar">archive</var>, <var class="Ar">name is</var> + <code class="Dv">NULL</code>, 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.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_unchange.html">zip_unchange(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_file_rename</code>() was added in libzip 0.11. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">September 22, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_file_rename.man b/3rdparty/libzip/man/zip_file_rename.man new file mode 100644 index 0000000000000000000000000000000000000000..4dc57f03883667129cbb7a2bf967101eec37410c --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_file_rename.mdoc b/3rdparty/libzip/man/zip_file_rename.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..a14fe6645ff25b25cee0c9e6ec2a20649a335e6d --- /dev/null +++ b/3rdparty/libzip/man/zip_file_rename.mdoc @@ -0,0 +1,104 @@ +.\" zip_file_rename.mdoc -- rename file in zip archive +.\" Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_file_set_comment.html b/3rdparty/libzip/man/zip_file_set_comment.html new file mode 100644 index 0000000000000000000000000000000000000000..5277baac8a235b5fa2924973a066c9424bf6f786 --- /dev/null +++ b/3rdparty/libzip/man/zip_file_set_comment.html @@ -0,0 +1,137 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_file_set_comment.mdoc -- set comment for file in zip + Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP files. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FILE_SET_COMMENT(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FILE_SET_COMMENT(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FILE_SET_COMMENT(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_file_set_comment</code> — +<div class="Nd">set comment for file in zip</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_file_set_comment</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">const char + *comment</var>, <var class="Fa" style="white-space: nowrap;">zip_uint16_t + len</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_file_set_comment</code>() function sets the comment for + the file at position <var class="Ar">index</var> in the zip archive to + <var class="Ar">comment</var> of length <var class="Ar">len</var>. If + <var class="Ar">comment</var> is <code class="Dv">NULL</code> and + <var class="Ar">len</var> is 0, the file comment will be removed. The + <var class="Ar">flags</var> argument can be any of: +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_FL_ENC_GUESS"><code class="Dv" id="ZIP_FL_ENC_GUESS">ZIP_FL_ENC_GUESS</code></a></dt> + <dd>Guess encoding of <var class="Ar">comment</var> (default). (Only CP-437 + and UTF-8 are recognized.)</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_UTF_8"><code class="Dv" id="ZIP_FL_ENC_UTF_8">ZIP_FL_ENC_UTF_8</code></a></dt> + <dd>Interpret <var class="Ar">comment</var> as UTF-8.</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_CP437"><code class="Dv" id="ZIP_FL_ENC_CP437">ZIP_FL_ENC_CP437</code></a></dt> + <dd>Interpret <var class="Ar">comment</var> as code page 437 (CP-437).</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in <var class="Ar">archive</var> is set to indicate the + error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_file_set_comment</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">index</var> is not a valid file index in + <var class="Ar">archive</var>, or <var class="Ar">len</var> is less than 0 + or longer than the maximum comment length in a zip file (65535), or + <var class="Ar">comment</var> is not a valid UTF-8 encoded string.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_RDONLY"><code class="Er" id="ZIP_ER_RDONLY">ZIP_ER_RDONLY</code></a>]</dt> + <dd>The <var class="Ar">archive</var> was opened in read-only mode.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_get_comment.html">zip_file_get_comment(3)</a>, + <a class="Xr" href="zip_get_archive_comment.html">zip_get_archive_comment(3)</a>, + <a class="Xr" href="zip_set_archive_comment.html">zip_set_archive_comment(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_file_set_comment</code>() was added in libzip 0.11. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">September 22, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_file_set_comment.man b/3rdparty/libzip/man/zip_file_set_comment.man new file mode 100644 index 0000000000000000000000000000000000000000..2b019c422364f2a752fdb8d50771e8f980a7127b --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_file_set_comment.mdoc b/3rdparty/libzip/man/zip_file_set_comment.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..4328aac6904466df472ab4fd2a407d1c2fbd5ad2 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_file_set_encryption.html b/3rdparty/libzip/man/zip_file_set_encryption.html new file mode 100644 index 0000000000000000000000000000000000000000..bcf453a25be88236b3f204f21422f65ec7899294 --- /dev/null +++ b/3rdparty/libzip/man/zip_file_set_encryption.html @@ -0,0 +1,150 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_file_set_encryption.mdoc -- set encryption method for file + Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP files. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FILE_SET_ENCRYPTION(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FILE_SET_ENCRYPTION(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FILE_SET_ENCRYPTION(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_file_set_encryption</code> — +<div class="Nd">set encryption method for file in zip</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_file_set_encryption</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_uint16_t + method</var>, <var class="Fa" style="white-space: nowrap;">const char + *password</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_file_set_encryption</code>() function sets the + encryption method for the file at position <var class="Ar">index</var> in the + zip archive to <var class="Ar">method</var> using the password + <var class="Ar">password</var>. The <var class="Ar">method</var> is the same + as returned by <a class="Xr" href="zip_stat.html">zip_stat(3)</a>. For the + <var class="Ar">method</var> argument, currently only the following values are + supported: +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_EM_NONE"><code class="Dv" id="ZIP_EM_NONE">ZIP_EM_NONE</code></a></dt> + <dd>No encryption.</dd> + <dt><a class="permalink" href="#ZIP_EM_AES_128"><code class="Dv" id="ZIP_EM_AES_128">ZIP_EM_AES_128</code></a></dt> + <dd>Winzip AES-128 encryption.</dd> + <dt><a class="permalink" href="#ZIP_EM_AES_192"><code class="Dv" id="ZIP_EM_AES_192">ZIP_EM_AES_192</code></a></dt> + <dd>Winzip AES-192 encryption.</dd> + <dt><a class="permalink" href="#ZIP_EM_AES_256"><code class="Dv" id="ZIP_EM_AES_256">ZIP_EM_AES_256</code></a></dt> + <dd>Winzip AES-256 encryption.</dd> + <dt><a class="permalink" href="#ZIP_EM_TRAD_PKWARE"><code class="Dv" id="ZIP_EM_TRAD_PKWARE">ZIP_EM_TRAD_PKWARE</code></a></dt> + <dd>Traditional PKWare encryption. Do not use this method, it is not secure. + It is only provided for backwards compatibility.</dd> +</dl> +<p class="Pp">If <var class="Ar">password</var> is <code class="Dv">NULL</code>, + the default password provided by + <a class="Xr" href="zip_set_default_password.html">zip_set_default_password(3)</a> + is used.</p> +<p class="Pp">The current encryption method for a file in a zip archive can be + determined using <a class="Xr" href="zip_stat.html">zip_stat(3)</a>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in <var class="Ar">archive</var> is set to indicate the + error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_file_set_encryption</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_ENCRNOTSUPP"><code class="Er" id="ZIP_ER_ENCRNOTSUPP">ZIP_ER_ENCRNOTSUPP</code></a>]</dt> + <dd>Unsupported compression method requested.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">index</var> is not a valid file index in + <var class="Ar">archive</var>, or the argument combination is + invalid.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_RDONLY"><code class="Er" id="ZIP_ER_RDONLY">ZIP_ER_RDONLY</code></a>]</dt> + <dd>Read-only zip file, no changes allowed.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_encryption_method_supported.html">zip_encryption_method_supported(3)</a>, + <a class="Xr" href="zip_fopen_encrypted.html">zip_fopen_encrypted(3)</a>, + <a class="Xr" href="zip_fopen_index_encrypted.html">zip_fopen_index_encrypted(3)</a>, + <a class="Xr" href="zip_set_default_password.html">zip_set_default_password(3)</a>, + <a class="Xr" href="zip_stat.html">zip_stat(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_file_set_encryption</code>() was added in libzip 1.2.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">April 2, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_file_set_encryption.man b/3rdparty/libzip/man/zip_file_set_encryption.man new file mode 100644 index 0000000000000000000000000000000000000000..a6414e46a0d0cf581c5bbf49482f54228b61ce29 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_file_set_encryption.mdoc b/3rdparty/libzip/man/zip_file_set_encryption.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..2bfd971b11255b52cfba9ea74f7a805c6b03d373 --- /dev/null +++ b/3rdparty/libzip/man/zip_file_set_encryption.mdoc @@ -0,0 +1,121 @@ +.\" zip_file_set_encryption.mdoc -- set encryption method for file +.\" Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_file_set_external_attributes.html b/3rdparty/libzip/man/zip_file_set_external_attributes.html new file mode 100644 index 0000000000000000000000000000000000000000..87a9f97ffb9042da7e79f97104a02de6b4d5e6fd --- /dev/null +++ b/3rdparty/libzip/man/zip_file_set_external_attributes.html @@ -0,0 +1,125 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FILE_SET_EXTERNAL_ATTRIBUTES(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FILE_SET_EXTERNAL_ATTRIBUTES(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FILE_SET_EXTERNAL_ATTRIBUTES(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_file_set_external_attributes</code> — +<div class="Nd">set external attributes for file in zip</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_file_set_external_attributes</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>, <var class="Fa" style="white-space: nowrap;">zip_uint8_t + opsys</var>, <var class="Fa" style="white-space: nowrap;">zip_uint32_t + attributes</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_file_set_external_attributes</code>() function sets the + operating system and external attributes for the file at position + <var class="Ar">index</var> in the zip archive. Currently, no + <var class="Ar">flags</var> are supported. +<p class="Pp">For a list of known <var class="Ar">opsys</var> values, see + <a class="Xr" href="zip_file_get_external_attributes.html">zip_file_get_external_attributes(3)</a>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in <var class="Ar">archive</var> is set to indicate the + error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_file_set_external_attributes</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">index</var> is not a valid file index in + <var class="Ar">archive</var>.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_RDONLY"><code class="Er" id="ZIP_ER_RDONLY">ZIP_ER_RDONLY</code></a>]</dt> + <dd>The <var class="Ar">archive</var> was opened in read-only mode.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_get_external_attributes.html">zip_file_get_external_attributes(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_file_set_external_attributes</code>() was added in libzip + 0.11.2. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_file_set_external_attributes.man b/3rdparty/libzip/man/zip_file_set_external_attributes.man new file mode 100644 index 0000000000000000000000000000000000000000..76c375ed8e35e6b491605f2291f6cbab3a77b350 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_file_set_external_attributes.mdoc b/3rdparty/libzip/man/zip_file_set_external_attributes.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..d7fa082331d7d1a91360aeaf0f7bcc5ec48b5c08 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_file_set_mtime.html b/3rdparty/libzip/man/zip_file_set_mtime.html new file mode 100644 index 0000000000000000000000000000000000000000..c7b479d446ffb225fa0941a128e3e795b841e6ef --- /dev/null +++ b/3rdparty/libzip/man/zip_file_set_mtime.html @@ -0,0 +1,164 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FILE_SET_MTIME(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FILE_SET_MTIME(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FILE_SET_MTIME(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_file_set_dostime</code>, + <code class="Nm">zip_file_set_mtime</code> — +<div class="Nd">set last modification time (mtime) for file in zip</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_file_set_dostime</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_uint16_t + dostime</var>, <var class="Fa" style="white-space: nowrap;">zip_uint16_t + dosdate</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_file_set_mtime</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">time_t + mtime</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_file_set_mtime</code>() function sets the last + modification time (mtime) for the file at position <var class="Ar">index</var> + in the zip archive to <var class="Ar">mtime</var>. Currently, no support for + any <var class="Ar">flags</var> is implemented. +<p class="Pp">In the zip archive, the time and date are saved as two 16-bit + integers. To set the values directly, call the + <code class="Fn">zip_file_set_dostime</code>() function. The values of the + time bytes are defined as follows:</p> +<div class="Bd-indent"> +<dl class="Bl-tag"> + <dt>0-4</dt> + <dd>seconds divided by two (1-2 = 1, 3-4 = 2, ...)</dd> + <dt>5-10</dt> + <dd>minute (0-59)</dd> + <dt>11-15</dt> + <dd>hour (0-23)</dd> +</dl> +</div> +<p class="Pp">The values of the date bytes are defined as follows:</p> +<div class="Bd-indent"> +<dl class="Bl-tag"> + <dt>0-4</dt> + <dd>day of the month (1-31)</dd> + <dt>5-8</dt> + <dd>month (January = 1, February = 2, ...)</dd> + <dt>9-15</dt> + <dd>year offset from 1980 (1980 = 0, 1981 = 1, ...)</dd> +</dl> +</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in <var class="Ar">archive</var> is set to indicate the + error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_file_set_dostime</code>() and + <code class="Fn">zip_file_set_mtime</code>() fail if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">index</var> is not a valid file index in + <var class="Ar">archive</var>.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_RDONLY"><code class="Er" id="ZIP_ER_RDONLY">ZIP_ER_RDONLY</code></a>]</dt> + <dd>The <var class="Ar">archive</var> was opened in read-only mode.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_stat.html">zip_stat(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_file_set_mtime</code>() was added in libzip 1.0. + <code class="Fn">zip_file_set_dostime</code>() was added in libzip 1.6. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +<section class="Sh"> +<h1 class="Sh" id="CAVEATS"><a class="permalink" href="#CAVEATS">CAVEATS</a></h1> +Following historical practice, the <code class="Fn">zip_file_set_mtime</code>() + function translates the time from the zip archive into the local time zone. If + you want to avoid this, use the <code class="Fn">zip_file_set_dostime</code>() + function instead. +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">August 24, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_file_set_mtime.man b/3rdparty/libzip/man/zip_file_set_mtime.man new file mode 100644 index 0000000000000000000000000000000000000000..d3928bcbba6a959611646d730428dd6c60db6c51 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_file_set_mtime.mdoc b/3rdparty/libzip/man/zip_file_set_mtime.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..f47c6b118408a4b696e669f36d7a6589837330b0 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_file_strerror.html b/3rdparty/libzip/man/zip_file_strerror.html new file mode 100644 index 0000000000000000000000000000000000000000..d9db6acaf5e6ded8f223d8058f05d8b4e18a40b1 --- /dev/null +++ b/3rdparty/libzip/man/zip_file_strerror.html @@ -0,0 +1,115 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_file_strerror.mdoc -- get string representation for a zip error + Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FILE_STRERROR(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FILE_STRERROR(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FILE_STRERROR(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_file_strerror</code>, <code class="Nm">zip_strerror</code> + — +<div class="Nd">get string representation for a zip error</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">const char *</var> + <br/> + <code class="Fn">zip_file_strerror</code>(<var class="Fa" style="white-space: nowrap;">zip_file_t + *file</var>);</p> +<p class="Pp"><var class="Ft">const char *</var> + <br/> + <code class="Fn">zip_strerror</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_strerror</code>() function returns a string describing + the last error for the zip archive <var class="Ar">archive</var>, while the + <code class="Fn">zip_file_strerror</code>() function does the same for a zip + file <var class="Ar">file</var> (one file in an archive). The returned string + must not be modified or freed, and becomes invalid when + <var class="Ar">archive</var> or <var class="Ar">file</var>, respectively, is + closed or on the next call to <code class="Fn">zip_strerror</code>() or + <code class="Fn">zip_file_strerror</code>(), respectively, for the same + archive. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +<code class="Fn">zip_file_strerror</code>() and + <code class="Fn">zip_strerror</code>() return a pointer to the error string. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_error_strerror.html">zip_error_strerror(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_file_strerror</code>() and + <code class="Fn">zip_strerror</code>() were added in libzip 0.6. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_file_strerror.man b/3rdparty/libzip/man/zip_file_strerror.man new file mode 100644 index 0000000000000000000000000000000000000000..8ee81a12ce9b2d6f311e18f04c231f528f872193 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_file_strerror.mdoc b/3rdparty/libzip/man/zip_file_strerror.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..f10073b9c842d0fd620820854cbcb83c9d283688 --- /dev/null +++ b/3rdparty/libzip/man/zip_file_strerror.mdoc @@ -0,0 +1,85 @@ +.\" zip_file_strerror.mdoc -- get string representation for a zip error +.\" Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_fopen.html b/3rdparty/libzip/man/zip_fopen.html new file mode 100644 index 0000000000000000000000000000000000000000..a34ac9d689960f5e5668438541de7ad7d386c452 --- /dev/null +++ b/3rdparty/libzip/man/zip_fopen.html @@ -0,0 +1,171 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FOPEN(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FOPEN(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FOPEN(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_fopen</code>, <code class="Nm">zip_fopen_index</code> + — +<div class="Nd">open file in zip archive for reading</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_file_t *</var> + <br/> + <code class="Fn">zip_fopen</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">const char + *fname</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>);</p> +<p class="Pp"><var class="Ft">zip_file_t *</var> + <br/> + <code class="Fn">zip_fopen_index</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_fopen</code>() function opens the file name + <var class="Ar">fname</var> in <var class="Ar">archive</var>. The + <var class="Ar">flags</var> argument specifies how the name lookup should be + done, according to the values are described in + <a class="Xr" href="zip_name_locate.html">zip_name_locate(3)</a>. Also, the + following values may be <i class="Em">or</i><span class="No">'ed</span> to it. +<div class="Bd-indent"> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_FL_COMPRESSED"><code class="Dv" id="ZIP_FL_COMPRESSED">ZIP_FL_COMPRESSED</code></a></dt> + <dd>Read the compressed data. Otherwise the data is uncompressed by + <code class="Fn">zip_fread</code>().</dd> + <dt><a class="permalink" href="#ZIP_FL_UNCHANGED"><code class="Dv" id="ZIP_FL_UNCHANGED">ZIP_FL_UNCHANGED</code></a></dt> + <dd>Read the original data from the zip archive, ignoring any changes made to + the file.</dd> +</dl> +</div> +<p class="Pp">The <code class="Fn">zip_fopen_index</code>() function opens the + file at position <var class="Ar">index</var>.</p> +<p class="Pp">If encrypted data is encountered, the functions call + <a class="Xr" href="zip_fopen_encrypted.html">zip_fopen_encrypted(3)</a> or + <a class="Xr" href="zip_fopen_index_encrypted.html">zip_fopen_index_encrypted(3)</a> + respectively, using the default password set with + <a class="Xr" href="zip_set_default_password.html">zip_set_default_password(3)</a>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, a <var class="Ft">struct zip_file</var> pointer is + returned. Otherwise, <code class="Dv">NULL</code> is returned and the error + code in <var class="Ar">archive</var> is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_CHANGED"><code class="Er" id="ZIP_ER_CHANGED">ZIP_ER_CHANGED</code></a>]</dt> + <dd>The file data has been changed.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_COMPNOTSUPP"><code class="Er" id="ZIP_ER_COMPNOTSUPP">ZIP_ER_COMPNOTSUPP</code></a>]</dt> + <dd>The compression method used is not supported.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_ENCRNOTSUPP"><code class="Er" id="ZIP_ER_ENCRNOTSUPP">ZIP_ER_ENCRNOTSUPP</code></a>]</dt> + <dd>The encryption method used is not supported.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_NOPASSWD"><code class="Er" id="ZIP_ER_NOPASSWD">ZIP_ER_NOPASSWD</code></a>]</dt> + <dd>The file is encrypted, but no password has been provided.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_READ"><code class="Er" id="ZIP_ER_READ">ZIP_ER_READ</code></a>]</dt> + <dd>A file read error occurred.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_SEEK"><code class="Er" id="ZIP_ER_SEEK">ZIP_ER_SEEK</code></a>]</dt> + <dd>A file seek error occurred.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_WRONGPASSWD"><code class="Er" id="ZIP_ER_WRONGPASSWD">ZIP_ER_WRONGPASSWD</code></a>]</dt> + <dd>The provided password does not match the password used for encryption. + Note that some incorrect passwords are not detected by the check done by + <code class="Fn">zip_fopen</code>().</dd> + <dt>[<a class="permalink" href="#ZIP_ER_ZLIB"><code class="Er" id="ZIP_ER_ZLIB">ZIP_ER_ZLIB</code></a>]</dt> + <dd>Initializing the zlib stream failed.</dd> +</dl> +<p class="Pp">The function <code class="Fn">zip_fopen</code>() may also fail and + set <var class="Va">zip_err</var> for any of the errors specified for the + routine + <a class="Xr" href="zip_name_locate.html">zip_name_locate(3)</a>.</p> +<p class="Pp">The function <code class="Fn">zip_fopen_index</code>() may also + fail with <code class="Er">ZIP_ER_INVAL</code> if + <var class="Ar">index</var> is invalid.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_fclose.html">zip_fclose(3)</a>, + <a class="Xr" href="zip_fread.html">zip_fread(3)</a>, + <a class="Xr" href="zip_fseek.html">zip_fseek(3)</a>, + <a class="Xr" href="zip_get_num_entries.html">zip_get_num_entries(3)</a>, + <a class="Xr" href="zip_name_locate.html">zip_name_locate(3)</a>, + <a class="Xr" href="zip_set_default_password.html">zip_set_default_password(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_fopen</code>() and + <code class="Fn">zip_fopen_index</code>() were added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_fopen.man b/3rdparty/libzip/man/zip_fopen.man new file mode 100644 index 0000000000000000000000000000000000000000..95e010007b2264bdcb1a244c93789f7dc4e1c268 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_fopen.mdoc b/3rdparty/libzip/man/zip_fopen.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..fb54f87c610c2a8f0bff46acfe42fd1476739489 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_fopen_encrypted.html b/3rdparty/libzip/man/zip_fopen_encrypted.html new file mode 100644 index 0000000000000000000000000000000000000000..f80a3ede8e2503ca9702ca363a983fcdfbb291b0 --- /dev/null +++ b/3rdparty/libzip/man/zip_fopen_encrypted.html @@ -0,0 +1,158 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_fopen_encrypted.mdoc -- open encrypted file in zip archive for reading + Copyright (C) 2011-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FOPEN_ENCRYPTED(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FOPEN_ENCRYPTED(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FOPEN_ENCRYPTED(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_fopen_encrypted</code>, + <code class="Nm">zip_fopen_index_encrypted</code> — +<div class="Nd">open encrypted file in zip archive for reading</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_file_t *</var> + <br/> + <code class="Fn">zip_fopen_encrypted</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">const char + *fname</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>, <var class="Fa" style="white-space: nowrap;">const char + *password</var>);</p> +<p class="Pp"><var class="Ft">zip_file_t *</var> + <br/> + <code class="Fn">zip_fopen_index_encrypted</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>, <var class="Fa" style="white-space: nowrap;">const char + *password</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_fopen_encrypted</code>() function opens the encrypted + file name <var class="Ar">fname</var> in <var class="Ar">archive</var> using + the password given in the <var class="Ar">password</var> argument. If + <var class="Ar">password</var> is <code class="Dv">NULL</code> or the empty + string, the default password is used (see + <a class="Xr" href="zip_set_default_password.html">zip_set_default_password(3)</a>). + The <var class="Ar">flags</var> argument are the same as for + <a class="Xr" href="zip_fopen.html">zip_fopen(3)</a>. +<p class="Pp">The <code class="Fn">zip_fopen_index_encrypted</code>() function + opens the file at position <var class="Ar">index</var>, see + <a class="Xr" href="zip_fopen_index.html">zip_fopen_index(3)</a>. These + functions are called automatically by + <a class="Xr" href="zip_fopen.html">zip_fopen(3)</a>; you only need to call + them if you want to specify a non-default password (see + <a class="Xr" href="zip_set_default_password.html">zip_set_default_password(3)</a>).</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, a <var class="Ft">struct zip_file</var> pointer is + returned. Otherwise, <code class="Dv">NULL</code> is returned and the error + code in <var class="Ar">archive</var> is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_NOPASSWD"><code class="Er" id="ZIP_ER_NOPASSWD">ZIP_ER_NOPASSWD</code></a>]</dt> + <dd>No password was provided.</dd> +</dl> +<p class="Pp">The function <code class="Fn">zip_fopen_encrypted</code>() may + also fail and set <var class="Va">zip_err</var> for any of the errors + specified for the routine + <a class="Xr" href="zip_fopen.html">zip_fopen(3)</a>.</p> +<p class="Pp">The function <code class="Fn">zip_fopen_index_encrypted</code>() + may also fail and set <var class="Va">zip_err</var> for any of the errors + specified for the routine + <a class="Xr" href="zip_fopen_index.html">zip_fopen_index(3)</a>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_fclose.html">zip_fclose(3)</a>, + <a class="Xr" href="zip_fopen.html">zip_fopen(3)</a>, + <a class="Xr" href="zip_fread.html">zip_fread(3)</a>, + <a class="Xr" href="zip_get_num_entries.html">zip_get_num_entries(3)</a>, + <a class="Xr" href="zip_name_locate.html">zip_name_locate(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_fopen_encrypted</code>() and + <code class="Fn">zip_fopen_index_encrypted</code>() were added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +<section class="Sh"> +<h1 class="Sh" id="CAVEATS"><a class="permalink" href="#CAVEATS">CAVEATS</a></h1> +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 <code class="Er">ZIP_ER_WRONGPASSWD</code>, 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. +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">September 15, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_fopen_encrypted.man b/3rdparty/libzip/man/zip_fopen_encrypted.man new file mode 100644 index 0000000000000000000000000000000000000000..8bf4e0cd8337e368e8e801bad60078e365e98d0c --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_fopen_encrypted.mdoc b/3rdparty/libzip/man/zip_fopen_encrypted.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..80fd4b7ea39d2fda025ad42296ebece1d857690c --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_fread.html b/3rdparty/libzip/man/zip_fread.html new file mode 100644 index 0000000000000000000000000000000000000000..eda3ebc83dc8b929cc17115b97d81467ae1c35d5 --- /dev/null +++ b/3rdparty/libzip/man/zip_fread.html @@ -0,0 +1,110 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FREAD(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FREAD(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FREAD(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_fread</code> — +<div class="Nd">read from file</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int64_t</var> + <br/> + <code class="Fn">zip_fread</code>(<var class="Fa" style="white-space: nowrap;">zip_file_t + *file</var>, <var class="Fa" style="white-space: nowrap;">void *buf</var>, + <var class="Fa" style="white-space: nowrap;">zip_uint64_t nbytes</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_fread</code>() function reads at most + <var class="Ar">nbytes</var> bytes from <var class="Ar">file</var> into + <var class="Ar">buf</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +If successful, the number of bytes actually read is returned. Otherwise, -1 is + returned. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_fclose.html">zip_fclose(3)</a>, + <a class="Xr" href="zip_fopen.html">zip_fopen(3)</a>, + <a class="Xr" href="zip_fseek.html">zip_fseek(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_fread</code>() was added in libzip 0.6. In libzip 0.10 the + return type was changed from <var class="Vt">ssize_t</var> to + <var class="Vt">zip_int64_t</var>. In libzip 0.10 the type of + <var class="Ar">nbytes</var> was changed from <var class="Vt">size_t</var> to + <var class="Vt">zip_uint64_t</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_fread.man b/3rdparty/libzip/man/zip_fread.man new file mode 100644 index 0000000000000000000000000000000000000000..d0eb517e9194cb3f563db8559be2e01a4cb9c407 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_fread.mdoc b/3rdparty/libzip/man/zip_fread.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..4d3e8d6c7f327258b75fc0f1563ca723ff5d5f3d --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_fseek.html b/3rdparty/libzip/man/zip_fseek.html new file mode 100644 index 0000000000000000000000000000000000000000..43900659f4080247df1d131955a3799c81c7de80 --- /dev/null +++ b/3rdparty/libzip/man/zip_fseek.html @@ -0,0 +1,110 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FSEEK(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FSEEK(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FSEEK(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_fseek</code> — +<div class="Nd">seek in file</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int8_t</var> + <br/> + <code class="Fn">zip_fseek</code>(<var class="Fa" style="white-space: nowrap;">zip_file_t + *file</var>, <var class="Fa" style="white-space: nowrap;">zip_int64_t + offset</var>, <var class="Fa" style="white-space: nowrap;">int + whence</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_fseek</code>() function seeks to the specified + <var class="Ar">offset</var> relative to <var class="Ar">whence</var>, just + like <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html">fseek(3)</a>. +<p class="Pp"><code class="Nm">zip_fseek</code> only works on uncompressed + (stored) data. When called on compressed data it will return an error.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +If successful, <code class="Nm">zip_fseek</code> returns 0. Otherwise, -1 is + returned. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_fclose.html">zip_fclose(3)</a>, + <a class="Xr" href="zip_fopen.html">zip_fopen(3)</a>, + <a class="Xr" href="zip_fread.html">zip_fread(3)</a>, + <a class="Xr" href="zip_ftell.html">zip_ftell(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_fseek</code>() was added in libzip 1.2.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_fseek.man b/3rdparty/libzip/man/zip_fseek.man new file mode 100644 index 0000000000000000000000000000000000000000..d69e0e6f415e4cca941e030e30d908950df1f735 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_fseek.mdoc b/3rdparty/libzip/man/zip_fseek.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..756ca2726e4e01da48521b4d5fc894ea265d99da --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_ftell.html b/3rdparty/libzip/man/zip_ftell.html new file mode 100644 index 0000000000000000000000000000000000000000..cd74df9d3db8a9d88e355c4c2da776ad3843fd32 --- /dev/null +++ b/3rdparty/libzip/man/zip_ftell.html @@ -0,0 +1,105 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_ftell.mdoc -- tell position in file + Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_FTELL(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_FTELL(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_FTELL(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_ftell</code> — +<div class="Nd">tell position in file</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int64_t</var> + <br/> + <code class="Fn">zip_ftell</code>(<var class="Fa" style="white-space: nowrap;">zip_file_t + *file</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_ftell</code>() function reports the current offset in + the file. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +If successful, <code class="Nm">zip_ftell</code> returns the current file + position. Otherwise, -1 is returned. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_fclose.html">zip_fclose(3)</a>, + <a class="Xr" href="zip_fopen.html">zip_fopen(3)</a>, + <a class="Xr" href="zip_fread.html">zip_fread(3)</a>, + <a class="Xr" href="zip_fseek.html">zip_fseek(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_ftell</code>() was added in libzip 1.2.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">July 21, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_ftell.man b/3rdparty/libzip/man/zip_ftell.man new file mode 100644 index 0000000000000000000000000000000000000000..2a441c64a8487f5afdeddb58b48765391abf9499 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_ftell.mdoc b/3rdparty/libzip/man/zip_ftell.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..dff0eff9d886e97a08fab0d3d84f98b1d6dca087 --- /dev/null +++ b/3rdparty/libzip/man/zip_ftell.mdoc @@ -0,0 +1,66 @@ +.\" zip_ftell.mdoc -- tell position in file +.\" Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_get_archive_comment.html b/3rdparty/libzip/man/zip_get_archive_comment.html new file mode 100644 index 0000000000000000000000000000000000000000..19f05962b9c605650437b9725c531608a652eb87 --- /dev/null +++ b/3rdparty/libzip/man/zip_get_archive_comment.html @@ -0,0 +1,131 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_get_archive_comment.mdoc -- get zip archive comment + Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_GET_ARCHIVE_COMMENT(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_GET_ARCHIVE_COMMENT(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_GET_ARCHIVE_COMMENT(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_get_archive_comment</code> — +<div class="Nd">get zip archive comment</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">const char *</var> + <br/> + <code class="Fn">zip_get_archive_comment</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">int + *lenp</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_get_archive_comment</code>() function returns the + comment for the entire zip archive. The return value is in UTF-8 encoding + unless <code class="Dv">ZIP_FL_ENC_RAW</code> was specified (see below). This + pointer should not be modified or + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html">free(3)</a>'d, and becomes invalid when + <var class="Ar">archive</var> is closed. If <var class="Ar">lenp</var> is not + <code class="Dv">NULL</code>, the integer to which it points will be set to + the length of the comment. If <var class="Ar">flags</var> is set to + <code class="Dv">ZIP_FL_UNCHANGED</code>, the original unchanged comment is + returned. +<p class="Pp">Additionally, the following <var class="Ar">flags</var> are + supported:</p> +<div class="Bd-indent"> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_FL_ENC_RAW"><code class="Dv" id="ZIP_FL_ENC_RAW">ZIP_FL_ENC_RAW</code></a></dt> + <dd>Return the unmodified archive comment as it is in the ZIP archive.</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_GUESS"><code class="Dv" id="ZIP_FL_ENC_GUESS">ZIP_FL_ENC_GUESS</code></a></dt> + <dd>(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.)</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_STRICT"><code class="Dv" id="ZIP_FL_ENC_STRICT">ZIP_FL_ENC_STRICT</code></a></dt> + <dd>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.</dd> +</dl> +</div> +<i class="Em">Note</i>: ASCII is a subset of both CP-437 and UTF-8. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, a pointer to the comment is returned, or + <code class="Dv">NULL</code> if there is no comment. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_get_comment.html">zip_file_get_comment(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_get_archive_comment</code>() was added in libzip 0.7. In + libzip 0.11 the type of <var class="Ar">flags</var> was changed from + <var class="Vt">int</var> to <var class="Vt">zip_flags_t</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">September 22, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_get_archive_comment.man b/3rdparty/libzip/man/zip_get_archive_comment.man new file mode 100644 index 0000000000000000000000000000000000000000..6c2d99cac022ea116675368fbcb4f871e8252c76 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_get_archive_comment.mdoc b/3rdparty/libzip/man/zip_get_archive_comment.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..1e2eb7e83b7e66f80a975e47a3c133c131d79432 --- /dev/null +++ b/3rdparty/libzip/man/zip_get_archive_comment.mdoc @@ -0,0 +1,112 @@ +.\" zip_get_archive_comment.mdoc -- get zip archive comment +.\" Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_get_archive_flag.html b/3rdparty/libzip/man/zip_get_archive_flag.html new file mode 100644 index 0000000000000000000000000000000000000000..9c0be949488c38757dbd6bbda1f6ebff0275222e --- /dev/null +++ b/3rdparty/libzip/man/zip_get_archive_flag.html @@ -0,0 +1,118 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_GET_ARCHIVE_FLAG(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_GET_ARCHIVE_FLAG(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_GET_ARCHIVE_FLAG(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_get_archive_flag</code> — +<div class="Nd">get status flags for zip</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_get_archive_flag</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flag</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_get_archive_flag</code>() function returns if the flag + <var class="Ar">flag</var> is set for the archive + <var class="Ar">archive</var>. The archive flags might have been changed with + <code class="Fn">zip_set_archive_flag</code>(); if <var class="Ar">flags</var> + is set to <code class="Dv">ZIP_FL_UNCHANGED</code>, the original unchanged + flags are tested. +<p class="Pp">Supported flags are:</p> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_AFL_RDONLY"><code class="Dv" id="ZIP_AFL_RDONLY">ZIP_AFL_RDONLY</code></a></dt> + <dd>The archive is read-only.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +<code class="Fn">zip_get_archive_flag</code>() returns 1 if + <var class="Ar">flag</var> is set for <var class="Ar">archive</var>, 0 if not, + and -1 if an error occurred. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_set_archive_flag.html">zip_set_archive_flag(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_get_archive_flag</code>() was added in libzip 0.9. In + libzip 0.11 the type of <var class="Ar">flag</var> was changed from + <var class="Vt">int</var> to <var class="Vt">zip_flags_t m</var> and the type + of <var class="Ar">flags</var> was changed from <var class="Vt">int</var> to + <var class="Vt">zip_flags_t</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_get_archive_flag.man b/3rdparty/libzip/man/zip_get_archive_flag.man new file mode 100644 index 0000000000000000000000000000000000000000..4f9d08b16327903aded1f01be06b0fbe3c2b1f89 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_get_archive_flag.mdoc b/3rdparty/libzip/man/zip_get_archive_flag.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..baf6b05966b7eca3a96e44138f1f1736b34b2b1a --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_get_error.html b/3rdparty/libzip/man/zip_get_error.html new file mode 100644 index 0000000000000000000000000000000000000000..7ba9468079983f061c1bb9b176ba9cbad486b9ab --- /dev/null +++ b/3rdparty/libzip/man/zip_get_error.html @@ -0,0 +1,97 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_GET_ERROR(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_GET_ERROR(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_GET_ERROR(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_get_error</code> — +<div class="Nd">get zip error for archive</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_error_t *</var> + <br/> + <code class="Fn">zip_get_error</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_get_error</code>() function returns the zip error for + the zip archive <var class="Ar">archive</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_error_code_system.html">zip_error_code_system(3)</a>, + <a class="Xr" href="zip_error_code_zip.html">zip_error_code_zip(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_get_error</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_get_error.man b/3rdparty/libzip/man/zip_get_error.man new file mode 100644 index 0000000000000000000000000000000000000000..9cddbc2a3e79048f9086f608804fbdab25e1f91e --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_get_error.mdoc b/3rdparty/libzip/man/zip_get_error.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..8ce2ea5e827e473a17fd5d0311f0dae26744ec1c --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_get_file_comment.html b/3rdparty/libzip/man/zip_get_file_comment.html new file mode 100644 index 0000000000000000000000000000000000000000..fe7492f246b50b9618af819745ef0616ce40eede --- /dev/null +++ b/3rdparty/libzip/man/zip_get_file_comment.html @@ -0,0 +1,105 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_GET_FILE_COMMENT(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_GET_FILE_COMMENT(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_GET_FILE_COMMENT(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_get_file_comment</code> — +<div class="Nd">get comment for file in zip (obsolete interface)</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">const char *</var> + <br/> + <code class="Fn">zip_get_file_comment</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">int *lenp</var>, + <var class="Fa" style="white-space: nowrap;">int flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_get_file_comment</code>() function is the obsolete + version of + <a class="Xr" href="zip_file_get_comment.html">zip_file_get_comment(3)</a>. + The only differences are the types of the <var class="Ar">lenp</var> and + <var class="Ar">flags</var> arguments. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_get_comment.html">zip_file_get_comment(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_get_file_comment</code>() was added in libzip 0.7. In + libzip 0.10 the type of <var class="Ar">index</var> was changed from + <var class="Vt">int</var> to <var class="Vt">zip_uint64_t</var>. It was + deprecated in libzip 0.11, use <code class="Fn">zip_file_get_comment</code>() + instead. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_get_file_comment.man b/3rdparty/libzip/man/zip_get_file_comment.man new file mode 100644 index 0000000000000000000000000000000000000000..011871daaaf1efcde75628cb3264c7aa51ba449c --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_get_file_comment.mdoc b/3rdparty/libzip/man/zip_get_file_comment.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..a22159e527e47438a329ba620bfaca6a50bcc20c --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_get_name.html b/3rdparty/libzip/man/zip_get_name.html new file mode 100644 index 0000000000000000000000000000000000000000..d3e747eba360be6f4102e9695d66361f22711571 --- /dev/null +++ b/3rdparty/libzip/man/zip_get_name.html @@ -0,0 +1,146 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_get_name.mdoc -- get name of file by index + Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_GET_NAME(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_GET_NAME(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_GET_NAME(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_get_name</code> — +<div class="Nd">get name of file by index</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">const char *</var> + <br/> + <code class="Fn">zip_get_name</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_get_name</code>() function returns the name of the file + at position <var class="Ar">index</var> in <var class="Ar">archive</var>. The + name is in UTF-8 encoding unless <code class="Dv">ZIP_FL_ENC_RAW</code> was + specified (see below). +<p class="Pp">If <var class="Ar">flags</var> is set to + <code class="Dv">ZIP_FL_UNCHANGED</code>, the original unchanged filename is + returned. The returned string must not be modified or freed, and becomes + invalid when <var class="Ar">archive</var> is closed.</p> +<p class="Pp">Additionally, the following <var class="Ar">flags</var> are + supported:</p> +<div class="Bd-indent"> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_FL_ENC_RAW"><code class="Dv" id="ZIP_FL_ENC_RAW">ZIP_FL_ENC_RAW</code></a></dt> + <dd>Return the unmodified names as it is in the ZIP archive.</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_GUESS"><code class="Dv" id="ZIP_FL_ENC_GUESS">ZIP_FL_ENC_GUESS</code></a></dt> + <dd>(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.)</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_STRICT"><code class="Dv" id="ZIP_FL_ENC_STRICT">ZIP_FL_ENC_STRICT</code></a></dt> + <dd>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.</dd> +</dl> +</div> +<i class="Em">Note</i>: ASCII is a subset of both CP-437 and UTF-8. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, a pointer to the name is returned. Otherwise, + <code class="Dv">NULL</code> and the error code in + <var class="Ar">archive</var> is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_get_name</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_DELETED"><code class="Er" id="ZIP_ER_DELETED">ZIP_ER_DELETED</code></a>]</dt> + <dd><var class="Ar">index</var> refers to a file that has been deleted (see + <a class="Xr" href="zip_delete.html">zip_delete(3)</a>).</dd> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">index</var> is not a valid file index in + <var class="Ar">archive</var>, or <var class="Ar">index</var> points to an + added file and <code class="Dv">ZIP_FL_UNCHANGED</code> is set.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_name_locate.html">zip_name_locate(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_get_name</code>() was added in libzip 0.6. In libzip 0.10 + the type of <var class="Ar">index</var> was changed from + <var class="Vt">int</var> to <var class="Vt">zip_uint64_t</var>. In libzip + 0.11 the type of <var class="Ar">flags</var> was changed from + <var class="Vt">int</var> to <var class="Vt">zip_flags_t</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">September 22, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_get_name.man b/3rdparty/libzip/man/zip_get_name.man new file mode 100644 index 0000000000000000000000000000000000000000..9a6351ea6e9b9269cecb0b2a4d724714508c225d --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_get_name.mdoc b/3rdparty/libzip/man/zip_get_name.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..bb1ea0a59f8e3c6a8e9bb6d57a3d620ac4f16285 --- /dev/null +++ b/3rdparty/libzip/man/zip_get_name.mdoc @@ -0,0 +1,132 @@ +.\" zip_get_name.mdoc -- get name of file by index +.\" Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_get_num_entries.html b/3rdparty/libzip/man/zip_get_num_entries.html new file mode 100644 index 0000000000000000000000000000000000000000..5c20530b0e44692d5de9bbae2f2d7bf452e34833 --- /dev/null +++ b/3rdparty/libzip/man/zip_get_num_entries.html @@ -0,0 +1,111 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_GET_NUM_ENTRIES(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_GET_NUM_ENTRIES(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_GET_NUM_ENTRIES(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_get_num_entries</code> — +<div class="Nd">get number of files in archive</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int64_t</var> + <br/> + <code class="Fn">zip_get_num_entries</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_get_num_entries</code>() function returns the number of + files in <var class="Ar">archive</var>. If <var class="Ar">flags</var> is set + to <code class="Dv">ZIP_FL_UNCHANGED</code>, the original number of entries is + returned. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +<code class="Fn">zip_get_num_entries</code>() returns the number of files in the + zip archive, or -1 if <var class="Ar">archive</var> is + <code class="Dv">NULL</code>. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_fopen_index.html">zip_fopen_index(3)</a>, + <a class="Xr" href="zip_stat_index.html">zip_stat_index(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_get_num_entries</code>() was added in libzip 0.10. In + libzip 0.11 the return type was changed from + <var class="Vt">zip_uint64_t</var> to <var class="Vt">zip_int64_t</var>. In + libzip 0.11 the type of <var class="Ar">flags</var> was changed from + <var class="Vt">int</var> to <var class="Vt">zip_flags_t</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_get_num_entries.man b/3rdparty/libzip/man/zip_get_num_entries.man new file mode 100644 index 0000000000000000000000000000000000000000..f33f6ecf44e3b5aeec21844eb11c58bb8fdd325e --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_get_num_entries.mdoc b/3rdparty/libzip/man/zip_get_num_entries.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..bfc70050f75fa78e13f339ef7824779832977fd2 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_get_num_files.html b/3rdparty/libzip/man/zip_get_num_files.html new file mode 100644 index 0000000000000000000000000000000000000000..d2f75fda40faaac6a9e444ac98137753c0dc1304 --- /dev/null +++ b/3rdparty/libzip/man/zip_get_num_files.html @@ -0,0 +1,110 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_GET_NUM_FILES(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_GET_NUM_FILES(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_GET_NUM_FILES(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_get_num_files</code> — +<div class="Nd">get number of files in archive (obsolete interface)</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_get_num_files</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<i class="Em">This function is deprecated</i>. <i class="Em">Use</i> + <a class="Xr" href="zip_get_num_entries.html">zip_get_num_entries(3)</a> + <i class="Em">instead</i>. +<p class="Pp">The <code class="Fn">zip_get_num_files</code>() function returns + the number of files in <var class="Ar">archive</var>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +<code class="Fn">zip_get_num_files</code>() returns the number of files in the + zip archive, or -1 if <var class="Ar">archive</var> is + <code class="Dv">NULL</code>. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_fopen_index.html">zip_fopen_index(3)</a>, + <a class="Xr" href="zip_stat_index.html">zip_stat_index(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_get_num_files</code>() was added in libzip 0.6. It was + deprecated in libzip 0.11, use + <code class="Fn">zip_get_num_entries</code>(<var class="Fa">instead</var>) + instead. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_get_num_files.man b/3rdparty/libzip/man/zip_get_num_files.man new file mode 100644 index 0000000000000000000000000000000000000000..0760eeda5c2784fa44b62d5ab87cc89cf90f69df --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_get_num_files.mdoc b/3rdparty/libzip/man/zip_get_num_files.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..30ebbc38cfa3d1f178ed92fd96a358b9f00026f5 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_libzip_version.html b/3rdparty/libzip/man/zip_libzip_version.html new file mode 100644 index 0000000000000000000000000000000000000000..3e454ca7bb23198d80f934a1978ef30ff9020475 --- /dev/null +++ b/3rdparty/libzip/man/zip_libzip_version.html @@ -0,0 +1,98 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_LIBZIP_VERSION(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_LIBZIP_VERSION(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_LIBZIP_VERSION(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_libzip_version</code> — +<div class="Nd">return run-time version of library</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">const char *</var> + <br/> + <code class="Fn">zip_libzip_version</code>(<var class="Fa" style="white-space: nowrap;">void</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<code class="Nm">zip_libzip_version</code> returns the version number of the + library as string in the format “$MAJOR.$MINOR.$MICRO$SUFFIX” + where <var class="Ar">$MAJOR</var> is the major version, + <var class="Ar">$MINOR</var> the minor, <var class="Ar">$MICRO</var> the + micro, and <var class="Ar">$SUFFIX</var> a suffix that's only set for + development versions. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_libzip_version</code>() was added in libzip 1.3.1. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_libzip_version.man b/3rdparty/libzip/man/zip_libzip_version.man new file mode 100644 index 0000000000000000000000000000000000000000..3b2bcee864c30d7f9c58b5f034602f611c1474df --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_libzip_version.mdoc b/3rdparty/libzip/man/zip_libzip_version.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..89737368c6c42f7976dbecb2d8c5b9123228610b --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_name_locate.html b/3rdparty/libzip/man/zip_name_locate.html new file mode 100644 index 0000000000000000000000000000000000000000..5d5dba6f212cede0e5c158772ad694ee7a50cff4 --- /dev/null +++ b/3rdparty/libzip/man/zip_name_locate.html @@ -0,0 +1,149 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_name_locate.mdoc -- get index of file by name + Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_NAME_LOCATE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_NAME_LOCATE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_NAME_LOCATE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_name_locate</code> — +<div class="Nd">get index of file by name</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int64_t</var> + <br/> + <code class="Fn">zip_name_locate</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">const char + *fname</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_name_locate</code>() function returns the index of the + file named <var class="Ar">fname</var> in <var class="Ar">archive</var>. If + <var class="Ar">archive</var> does not contain a file with that name, -1 is + returned. The <var class="Fa">flags</var> are specified by + <i class="Em">or</i><span class="No">'ing</span> the following values, or 0 + for none of them. +<div class="Bd-indent"> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_FL_NOCASE"><code class="Dv" id="ZIP_FL_NOCASE">ZIP_FL_NOCASE</code></a></dt> + <dd>Ignore case distinctions. (Will only work well if the file names are + ASCII.) With this flag, <code class="Fn">zip_name_locate</code>() will be + slow for archives with many files.</dd> + <dt><a class="permalink" href="#ZIP_FL_NODIR"><code class="Dv" id="ZIP_FL_NODIR">ZIP_FL_NODIR</code></a></dt> + <dd>Ignore directory part of file name in archive. With this flag, + <code class="Fn">zip_name_locate</code>() will be slow for archives with + many files.</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_RAW"><code class="Dv" id="ZIP_FL_ENC_RAW">ZIP_FL_ENC_RAW</code></a></dt> + <dd>Compare against the unmodified names as it is in the ZIP archive.</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_GUESS"><code class="Dv" id="ZIP_FL_ENC_GUESS">ZIP_FL_ENC_GUESS</code></a></dt> + <dd>(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.)</dd> + <dt><a class="permalink" href="#ZIP_FL_ENC_STRICT"><code class="Dv" id="ZIP_FL_ENC_STRICT">ZIP_FL_ENC_STRICT</code></a></dt> + <dd>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.</dd> +</dl> +</div> +<i class="Em">Note</i>: ASCII is a subset of both CP-437 and UTF-8. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +<code class="Fn">zip_name_locate</code>() returns the index of the file named + <var class="Ar">fname</var> or -1, if <var class="Ar">archive</var> does not + contain an entry of that name. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_name_locate</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd>One of the arguments is invalid.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_NOENT"><code class="Er" id="ZIP_ER_NOENT">ZIP_ER_NOENT</code></a>]</dt> + <dd>No entry of the name <var class="Ar">fname</var> is found in the + archive.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_get_name.html">zip_get_name(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_name_locate</code>() was added in libzip 0.6. In libzip + 0.11 the return type was changed from <var class="Vt">int</var> to + <var class="Vt">zip_int64_t</var>. In libzip 0.11 the type of + <var class="Ar">flags</var> was changed from <var class="Vt">int</var> to + <var class="Vt">zip_flags_t</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">September 22, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_name_locate.man b/3rdparty/libzip/man/zip_name_locate.man new file mode 100644 index 0000000000000000000000000000000000000000..1b910b089b73aeafa87fd08eede35d9d783d85b2 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_name_locate.mdoc b/3rdparty/libzip/man/zip_name_locate.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..6ffe5c35de9e2f991f9a52dd246b805798b860d7 --- /dev/null +++ b/3rdparty/libzip/man/zip_name_locate.mdoc @@ -0,0 +1,125 @@ +.\" zip_name_locate.mdoc -- get index of file by name +.\" Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_open.html b/3rdparty/libzip/man/zip_open.html new file mode 100644 index 0000000000000000000000000000000000000000..4edad5f9c6f41e95164a15d52ae0bceb6a34f4b5 --- /dev/null +++ b/3rdparty/libzip/man/zip_open.html @@ -0,0 +1,176 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_open.mdoc -- open zip archive + Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_OPEN(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_OPEN(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_OPEN(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_open</code>, <code class="Nm">zip_open_from_source</code> + — +<div class="Nd">open zip archive</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_t *</var> + <br/> + <code class="Fn">zip_open</code>(<var class="Fa" style="white-space: nowrap;">const + char *path</var>, <var class="Fa" style="white-space: nowrap;">int + flags</var>, <var class="Fa" style="white-space: nowrap;">int + *errorp</var>);</p> +<p class="Pp"><var class="Ft">zip_t *</var> + <br/> + <code class="Fn">zip_open_from_source</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *zs</var>, <var class="Fa" style="white-space: nowrap;">int flags</var>, + <var class="Fa" style="white-space: nowrap;">zip_error_t *ze</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_open</code>() function opens the zip archive specified + by <var class="Ar">path</var> and returns a pointer to a + <var class="Ft">struct zip</var>, used to manipulate the archive. The + <var class="Fa">flags</var> are specified by + <i class="Em">or</i><span class="No">'ing</span> the following values, or 0 + for none of them. +<div class="Bd-indent"> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_CHECKCONS"><code class="Dv" id="ZIP_CHECKCONS">ZIP_CHECKCONS</code></a></dt> + <dd>Perform additional stricter consistency checks on the archive, and error + if they fail.</dd> + <dt><a class="permalink" href="#ZIP_CREATE"><code class="Dv" id="ZIP_CREATE">ZIP_CREATE</code></a></dt> + <dd>Create the archive if it does not exist.</dd> + <dt><a class="permalink" href="#ZIP_EXCL"><code class="Dv" id="ZIP_EXCL">ZIP_EXCL</code></a></dt> + <dd>Error if archive already exists.</dd> + <dt><a class="permalink" href="#ZIP_TRUNCATE"><code class="Dv" id="ZIP_TRUNCATE">ZIP_TRUNCATE</code></a></dt> + <dd>If archive exists, ignore its current contents. In other words, handle it + the same way as an empty archive.</dd> + <dt><a class="permalink" href="#ZIP_RDONLY"><code class="Dv" id="ZIP_RDONLY">ZIP_RDONLY</code></a></dt> + <dd>Open archive in read-only mode.</dd> +</dl> +</div> +<p class="Pp">If an error occurs and <var class="Ar">errorp</var> is + non-<code class="Dv">NULL</code>, it will be set to the corresponding error + code.</p> +<p class="Pp">The <code class="Fn">zip_open_from_source</code>() function opens + a zip archive encapsulated by the zip_source <var class="Fa">zs</var> using + the provided <var class="Fa">flags</var>. In case of error, the zip_error + <var class="Fa">ze</var> is filled in.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion <code class="Fn">zip_open</code>() and + <code class="Fn">zip_open_from_source</code>() return a <var class="Ft">struct + zip</var> pointer. Otherwise, <code class="Dv">NULL</code> is returned and + <code class="Fn">zip_open</code>() sets <var class="Ar">*errorp</var> to + indicate the error, while + <code class="Fn">zip_open_from</code>(<var class="Fa">source</var>) sets + <var class="Ar">ze</var> to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +The archive specified by <var class="Ar">path</var> is opened unless: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_EXISTS"><code class="Er" id="ZIP_ER_EXISTS">ZIP_ER_EXISTS</code></a>]</dt> + <dd>The file specified by <var class="Ar">path</var> exists and + <code class="Dv">ZIP_EXCL</code> is set.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_INCONS"><code class="Er" id="ZIP_ER_INCONS">ZIP_ER_INCONS</code></a>]</dt> + <dd>Inconsistencies were found in the file specified by + <var class="Ar">path</var>. This error is often caused by specifying + <code class="Dv">ZIP_CHECKCONS</code> but can also happen without it.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd>The <var class="Ar">path</var> argument is + <code class="Dv">NULL</code>.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_NOENT"><code class="Er" id="ZIP_ER_NOENT">ZIP_ER_NOENT</code></a>]</dt> + <dd>The file specified by <var class="Ar">path</var> does not exist and + <code class="Dv">ZIP_CREATE</code> is not set.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_NOZIP"><code class="Er" id="ZIP_ER_NOZIP">ZIP_ER_NOZIP</code></a>]</dt> + <dd>The file specified by <var class="Ar">path</var> is not a zip + archive.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_OPEN"><code class="Er" id="ZIP_ER_OPEN">ZIP_ER_OPEN</code></a>]</dt> + <dd>The file specified by <var class="Ar">path</var> could not be opened.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_READ"><code class="Er" id="ZIP_ER_READ">ZIP_ER_READ</code></a>]</dt> + <dd>A read error occurred; see <var class="Va">errno</var> for details.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_SEEK"><code class="Er" id="ZIP_ER_SEEK">ZIP_ER_SEEK</code></a>]</dt> + <dd>The file specified by <var class="Ar">path</var> does not allow + seeks.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_close.html">zip_close(3)</a>, + <a class="Xr" href="zip_error_strerror.html">zip_error_strerror(3)</a>, + <a class="Xr" href="zip_fdopen.html">zip_fdopen(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_open</code>() and + <code class="Fn">zip_open_from_source</code>() were added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_open.man b/3rdparty/libzip/man/zip_open.man new file mode 100644 index 0000000000000000000000000000000000000000..bdc9a9c3b934db285cdabf9288033f403aff6dd6 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_open.mdoc b/3rdparty/libzip/man/zip_open.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..946eea3a711b041c392bebfe5e8bd9fe57ad0820 --- /dev/null +++ b/3rdparty/libzip/man/zip_open.mdoc @@ -0,0 +1,170 @@ +.\" zip_open.mdoc -- open zip archive +.\" Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_register_cancel_callback_with_state.html b/3rdparty/libzip/man/zip_register_cancel_callback_with_state.html new file mode 100644 index 0000000000000000000000000000000000000000..5872b43636dbdd431ad701e536400cb48f365a67 --- /dev/null +++ b/3rdparty/libzip/man/zip_register_cancel_callback_with_state.html @@ -0,0 +1,121 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_register_cancel_callback_with_state.mdoc -- allow cancelling during zip_close + Copyright (C) 2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_REGISTER_CANCEL_CALLBACK_WITH_STATE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_REGISTER_CANCEL_CALLBACK_WITH_STATE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_REGISTER_CANCEL_CALLBACK_WITH_STATE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_register_cancel_callback_with_state</code> — +<div class="Nd">allow cancelling during zip_close</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Vt">typedef void (*zip_cancel_callback)(zip_t *, + double, void *);</var></p> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_register_cancel_callback_with_state</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, + <var class="Fa" style="white-space: nowrap;">zip_cancel_callback + callback</var>, <var class="Fa" style="white-space: nowrap;">void + (*ud_free)(void *)</var>, <var class="Fa" style="white-space: nowrap;">void + *ud</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +This function can be used to cancel writing of a zip archive during + <a class="Xr" href="zip_close.html">zip_close(3)</a>. +<p class="Pp">The + <code class="Fn">zip_register_cancel_callback_with_state</code>() function + registers a callback function <var class="Ar">callback</var> for the zip + archive <var class="Ar">archive</var>. The <var class="Ar">ud_free</var> + function is called during cleanup for deleting the userdata supplied in + <var class="Ar">ud</var>.</p> +<p class="Pp">The callback function is called during + <a class="Xr" href="zip_close.html">zip_close(3)</a> in regular intervals + (after every zip archive entry that's completely written to disk, and while + writing data for entries) with zip archive <var class="Ar">archive</var>, + the current progress state (see + <a class="Xr" href="zip_register_progress_callback_with_state.html">zip_register_progress_callback_with_state(3)</a>) + as a <var class="Vt">double</var>, and the user-provided user-data + <var class="Ar">ud</var> as arguments. The progress state is a + <var class="Vt">double</var> in the range from 0.0 to 1.0.</p> +<p class="Pp">The callback function should be fast, since it will be called + often.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_close.html">zip_close(3)</a>, + <a class="Xr" href="zip_register_progress_callback_with_state.html">zip_register_progress_callback_with_state(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_register_cancel_callback_with_state</code>() was added in + libzip 1.6.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">April 6, 2021</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_register_cancel_callback_with_state.man b/3rdparty/libzip/man/zip_register_cancel_callback_with_state.man new file mode 100644 index 0000000000000000000000000000000000000000..7ddf69c6bf89624f8bb511fae603a5a31ed2ad3f --- /dev/null +++ b/3rdparty/libzip/man/zip_register_cancel_callback_with_state.man @@ -0,0 +1,94 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_register_cancel_callback_with_state.mdoc -- allow cancelling during zip_close +.\" Copyright (C) 2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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_CANCEL_CALLBACK_WITH_STATE" "3" "April 6, 2021" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_register_cancel_callback_with_state\fR +\- allow cancelling during zip_close +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include <zip.h>\fR +.sp +\fItypedef void (*zip_cancel_callback)(zip_t *, double, void *);\fR +.sp +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_register_cancel_callback_with_state\fR(\fIzip_t\ *archive\fR, \fIzip_cancel_callback\ callback\fR, \fIvoid\ (*ud_free)(void\ *)\fR, \fIvoid\ *ud\fR); +.PD +.SH "DESCRIPTION" +This function can be used to cancel writing of a zip archive during +zip_close(3). +.PP +The +\fBzip_register_cancel_callback_with_state\fR() +function registers a callback function +\fIcallback\fR +for the zip archive +\fIarchive\fR. +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 progress state (see +zip_register_progress_callback_with_state(3)) +as a +\fIdouble\fR, +and the user-provided user-data +\fIud\fR +as arguments. +The progress state is a +\fIdouble\fR +in the range from 0.0 to 1.0. +.PP +The callback function should be fast, since it will be called often. +.SH "SEE ALSO" +libzip(3), +zip_close(3), +zip_register_progress_callback_with_state(3) +.SH "HISTORY" +\fBzip_register_cancel_callback_with_state\fR() +was added in libzip 1.6.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/3rdparty/libzip/man/zip_register_cancel_callback_with_state.mdoc b/3rdparty/libzip/man/zip_register_cancel_callback_with_state.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..58fdc59b9d812f9bcd8f00fb92479b4af5c89f3f --- /dev/null +++ b/3rdparty/libzip/man/zip_register_cancel_callback_with_state.mdoc @@ -0,0 +1,88 @@ +.\" zip_register_cancel_callback_with_state.mdoc -- allow cancelling during zip_close +.\" Copyright (C) 2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 6, 2021 +.Dt ZIP_REGISTER_CANCEL_CALLBACK_WITH_STATE 3 +.Os +.Sh NAME +.Nm zip_register_cancel_callback_with_state +.Nd allow cancelling during zip_close +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Vt typedef void (*zip_cancel_callback)(zip_t *, double, void *); +.Ft void +.Fn zip_register_cancel_callback_with_state "zip_t *archive" "zip_cancel_callback callback" "void (*ud_free)(void *)" "void *ud" +.Sh DESCRIPTION +This function can be used to cancel writing of a zip archive during +.Xr zip_close 3 . +.Pp +The +.Fn zip_register_cancel_callback_with_state +function registers a callback function +.Ar callback +for the zip archive +.Ar archive . +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 progress state (see +.Xr zip_register_progress_callback_with_state 3 ) +as a +.Vt double , +and the user-provided user-data +.Ar ud +as arguments. +The progress state is a +.Vt double +in the range from 0.0 to 1.0. +.Pp +The callback function should be fast, since it will be called often. +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_close 3 , +.Xr zip_register_progress_callback_with_state 3 +.Sh HISTORY +.Fn zip_register_cancel_callback_with_state +was added in libzip 1.6.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/3rdparty/libzip/man/zip_register_progress_callback.html b/3rdparty/libzip/man/zip_register_progress_callback.html new file mode 100644 index 0000000000000000000000000000000000000000..e61b7ceb945d69d423b89c77e88b206d1e2e690d --- /dev/null +++ b/3rdparty/libzip/man/zip_register_progress_callback.html @@ -0,0 +1,111 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_REGISTER_PROGRESS_CALLBACK(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_REGISTER_PROGRESS_CALLBACK(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_REGISTER_PROGRESS_CALLBACK(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_register_progress_callback</code> — +<div class="Nd">provide updates during zip_close (obsolete interface)</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Vt">typedef void + (*zip_progress_callback_t)(double);</var></p> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_register_progress_callback</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, + <var class="Fa" style="white-space: nowrap;">zip_progress_callback_t + progress_callback</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_register_progress_callback</code>() is the + obsolete version of + <a class="Xr" href="zip_register_progress_callback_with_state.html">zip_register_progress_callback_with_state(3)</a>. +<p class="Pp">The <code class="Fn">zip_register_progress_callback</code>() + function registers a callback function + <var class="Ar">progress_callback</var> for the zip archive + <var class="Ar">archive</var>. This function is called during + <a class="Xr" href="zip_close.html">zip_close(3)</a> after every zip archive + entry that's completely written to disk. The value is a + <var class="Vt">double</var> in the range from 0.0 to 1.0. This can be used + to provide progress indicators for user interfaces.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_close.html">zip_close(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_register_progress_callback</code>() was added in libzip + 1.2.0. It was deprecated in libzip 1.3.0, use + <code class="Fn">zip_register_progress_callback_with_state</code>() instead. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_register_progress_callback.man b/3rdparty/libzip/man/zip_register_progress_callback.man new file mode 100644 index 0000000000000000000000000000000000000000..3d0e5b94dc92120b9ad272d3e3ebbacbe3140710 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_register_progress_callback.mdoc b/3rdparty/libzip/man/zip_register_progress_callback.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..9fd0cd0d7ca564d815e6651c3dd7a7e849a59bc2 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_register_progress_callback_with_state.html b/3rdparty/libzip/man/zip_register_progress_callback_with_state.html new file mode 100644 index 0000000000000000000000000000000000000000..b2f2bfde1c98d15bc75e5df8cedb0aa893a3b860 --- /dev/null +++ b/3rdparty/libzip/man/zip_register_progress_callback_with_state.html @@ -0,0 +1,119 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_register_progress_callback_with_state.mdoc -- provide updates during zip_close + Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_REGISTER_PROGRESS_CALLBACK_WITH_STATE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_REGISTER_PROGRESS_CALLBACK_WITH_STATE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_REGISTER_PROGRESS_CALLBACK_WITH_STATE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_register_progress_callback_with_state</code> — +<div class="Nd">provide updates during zip_close</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Vt">typedef void (*zip_progress_callback)(zip_t *, + double, void *);</var></p> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_register_progress_callback_with_state</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">double + precision</var>, + <var class="Fa" style="white-space: nowrap;">zip_progress_callback + callback</var>, <var class="Fa" style="white-space: nowrap;">void + (*ud_free)(void *)</var>, <var class="Fa" style="white-space: nowrap;">void + *ud</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_register_progress_callback_with_state</code>() function + registers a callback function <var class="Ar">callback</var> for the zip + archive <var class="Ar">archive</var>. The <var class="Ar">precision</var> + 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 <var class="Ar">ud_free</var> function is called during cleanup for + deleting the userdata supplied in <var class="Ar">ud</var>. +<p class="Pp">The callback function is called during + <a class="Xr" href="zip_close.html">zip_close(3)</a> in regular intervals + (after every zip archive entry that's completely written to disk, and while + writing data for entries) with zip archive <var class="Ar">archive</var>, + the current progression state as a <var class="Vt">double</var>, and the + user-provided user-data <var class="Ar">ud</var> as arguments. The + progression state is a <var class="Vt">double</var> in the range from 0.0 to + 1.0. This can be used to provide progress indicators for user + interfaces.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_close.html">zip_close(3)</a>, + <a class="Xr" href="zip_register_cancel_callback_with_state.html">zip_register_cancel_callback_with_state(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_register_progress_callback_with_state</code>() was added in + libzip 1.3.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_register_progress_callback_with_state.man b/3rdparty/libzip/man/zip_register_progress_callback_with_state.man new file mode 100644 index 0000000000000000000000000000000000000000..56c912d59b708d42a81002e3e497eaedefd73791 --- /dev/null +++ b/3rdparty/libzip/man/zip_register_progress_callback_with_state.man @@ -0,0 +1,93 @@ +.\" 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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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), +zip_register_cancel_callback_with_state(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/3rdparty/libzip/man/zip_register_progress_callback_with_state.mdoc b/3rdparty/libzip/man/zip_register_progress_callback_with_state.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..5d881b6c284406ba9e74021de3b2de2bcc540fef --- /dev/null +++ b/3rdparty/libzip/man/zip_register_progress_callback_with_state.mdoc @@ -0,0 +1,87 @@ +.\" zip_register_progress_callback_with_state.mdoc -- provide updates during zip_close +.\" Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 , +.Xr zip_register_cancel_callback_with_state 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/3rdparty/libzip/man/zip_rename.html b/3rdparty/libzip/man/zip_rename.html new file mode 100644 index 0000000000000000000000000000000000000000..22d9b454c8f706fe18d8440b54d36f3fcc56e5f5 --- /dev/null +++ b/3rdparty/libzip/man/zip_rename.html @@ -0,0 +1,104 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_RENAME(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_RENAME(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_RENAME(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_rename</code> — +<div class="Nd">rename file in zip archive (obsolete interface)</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_rename</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">const char + *name</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<code class="Fn">zip_rename</code>() is the obsolete version of + <a class="Xr" href="zip_file_rename.html">zip_file_rename(3)</a>. It is the + same as calling + <a class="Xr" href="zip_file_rename.html">zip_file_rename(3)</a> with an empty + flags argument. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_rename.html">zip_file_rename(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_rename</code>() was added in libzip 0.6. In libzip 0.10 the + type of <var class="Ar">index</var> was changed from <var class="Vt">int</var> + to <var class="Vt">zip_uint64_t</var>. It was deprecated in libzip 0.11, use + <code class="Fn">zip_file_rename</code>() instead. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_rename.man b/3rdparty/libzip/man/zip_rename.man new file mode 100644 index 0000000000000000000000000000000000000000..ea8b8c08b168c4ad6b6ce4efca832c4a7d4e234d --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_rename.mdoc b/3rdparty/libzip/man/zip_rename.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..ce3a748cf4a3e2a5287103fd58a71f97c37ec64b --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_set_archive_comment.html b/3rdparty/libzip/man/zip_set_archive_comment.html new file mode 100644 index 0000000000000000000000000000000000000000..6e0e7402a79f21b47bdcfc5478500fda9ed7001f --- /dev/null +++ b/3rdparty/libzip/man/zip_set_archive_comment.html @@ -0,0 +1,124 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_set_archive_comment.mdoc -- set zip archive comment + Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SET_ARCHIVE_COMMENT(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SET_ARCHIVE_COMMENT(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SET_ARCHIVE_COMMENT(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_set_archive_comment</code> — +<div class="Nd">set zip archive comment</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_set_archive_comment</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">const char + *comment</var>, <var class="Fa" style="white-space: nowrap;">zip_uint16_t + len</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_set_archive_comment</code>() function sets the comment + for the entire zip archive. If <var class="Ar">comment</var> is + <code class="Dv">NULL</code> and <var class="Ar">len</var> is 0, the archive + comment will be removed. <var class="Ar">comment</var> must be encoded in + ASCII or UTF-8. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in <var class="Ar">archive</var> is set to indicate the + error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_set_archive_comment</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">len</var> is less than 0 or longer than the maximum + comment length in a zip file (65535), or <var class="Ar">comment</var> is + not a valid UTF-8 encoded string.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_get_comment.html">zip_file_get_comment(3)</a>, + <a class="Xr" href="zip_file_set_comment.html">zip_file_set_comment(3)</a>, + <a class="Xr" href="zip_get_archive_comment.html">zip_get_archive_comment(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_set_archive_comment</code>() was added in libzip 0.7. In + libzip 0.11 the type of <var class="Ar">len</var> was changed from + <var class="Vt">int</var> to <var class="Vt">zip_uint16_t</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_set_archive_comment.man b/3rdparty/libzip/man/zip_set_archive_comment.man new file mode 100644 index 0000000000000000000000000000000000000000..2833cc07334915ee6bac8319818773778404ce33 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_set_archive_comment.mdoc b/3rdparty/libzip/man/zip_set_archive_comment.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..4fe8a25d0ad6ab33785cab76279d33deb779288b --- /dev/null +++ b/3rdparty/libzip/man/zip_set_archive_comment.mdoc @@ -0,0 +1,93 @@ +.\" zip_set_archive_comment.mdoc -- set zip archive comment +.\" Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_set_archive_flag.html b/3rdparty/libzip/man/zip_set_archive_flag.html new file mode 100644 index 0000000000000000000000000000000000000000..3cdebd90dc5199ea99ec31848b99e297ad3e7c89 --- /dev/null +++ b/3rdparty/libzip/man/zip_set_archive_flag.html @@ -0,0 +1,107 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SET_ARCHIVE_FLAG(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SET_ARCHIVE_FLAG(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SET_ARCHIVE_FLAG(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_set_archive_flag</code> — +<div class="Nd">set zip archive flag</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_set_archive_flag</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flag</var>, <var class="Fa" style="white-space: nowrap;">int + value</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_set_archive_flag</code>() function sets the flag + <var class="Ar">flag</var> for the archive <var class="Ar">archive</var> to + the value <var class="Ar">value</var>. +<p class="Pp">Currently there are no supported flags.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned, and -1 if an error occurred. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_get_archive_flag.html">zip_get_archive_flag(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_set_archive_flag</code>() was added in libzip 0.9. In + libzip 0.11 the type of <var class="Ar">flag</var> was changed from + <var class="Vt">int</var> to <var class="Vt">zip_flags_t</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_set_archive_flag.man b/3rdparty/libzip/man/zip_set_archive_flag.man new file mode 100644 index 0000000000000000000000000000000000000000..0cacf4c94690e0dcb95c2d3dc8b3b2ada3ae6d08 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_set_archive_flag.mdoc b/3rdparty/libzip/man/zip_set_archive_flag.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..116a340ffbef414c428938605f24607623ccd0e9 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_set_default_password.html b/3rdparty/libzip/man/zip_set_default_password.html new file mode 100644 index 0000000000000000000000000000000000000000..2f39f2a52abf932fe0c758023a851c487be34b07 --- /dev/null +++ b/3rdparty/libzip/man/zip_set_default_password.html @@ -0,0 +1,123 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_set_default_password.mdoc -- set default password for zip + Copyright (C) 2011-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP files. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SET_DEFAULT_PASSWORD(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SET_DEFAULT_PASSWORD(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SET_DEFAULT_PASSWORD(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_set_default_password</code> — +<div class="Nd">set default password for encrypted files in zip</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_set_default_password</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">const char + *password</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_set_default_password</code>() function sets the default + password used when accessing encrypted files. If + <var class="Ar">password</var> is <code class="Dv">NULL</code> or the empty + string, the default password is unset. +<p class="Pp">If you prefer a different password for single files, use + <a class="Xr" href="zip_fopen_encrypted.html">zip_fopen_encrypted(3)</a> + instead of <a class="Xr" href="zip_fopen.html">zip_fopen(3)</a>. Usually, + however, the same password is used for every file in an zip archive.</p> +<p class="Pp">The password is not verified when calling this function. See the + <a class="Sx" href="#CAVEATS">CAVEATS</a> section in + <a class="Xr" href="zip_fopen_encrypted.html">zip_fopen_encrypted(3)</a> for + more details about password handling.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in <var class="Ar">archive</var> is set to indicate the + error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_set_default_password</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_fopen.html">zip_fopen(3)</a>, + <a class="Xr" href="zip_fopen_encrypted.html">zip_fopen_encrypted(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_set_default_password</code>() was added in libzip 0.10. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">September 15, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_set_default_password.man b/3rdparty/libzip/man/zip_set_default_password.man new file mode 100644 index 0000000000000000000000000000000000000000..f2265e5139a1f67492370a26c56c0884035292be --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_set_default_password.mdoc b/3rdparty/libzip/man/zip_set_default_password.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..a1f1335463b1e4db1061749fcd674a898d5249c8 --- /dev/null +++ b/3rdparty/libzip/man/zip_set_default_password.mdoc @@ -0,0 +1,90 @@ +.\" zip_set_default_password.mdoc -- set default password for zip +.\" Copyright (C) 2011-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_set_file_comment.html b/3rdparty/libzip/man/zip_set_file_comment.html new file mode 100644 index 0000000000000000000000000000000000000000..048dc373dd71a71f7f94da06e76e0d05b0f18fac --- /dev/null +++ b/3rdparty/libzip/man/zip_set_file_comment.html @@ -0,0 +1,109 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SET_FILE_COMMENT(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SET_FILE_COMMENT(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SET_FILE_COMMENT(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_set_file_comment</code> — +<div class="Nd">set comment for file in zip (obsolete interface)</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_set_file_comment</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">const char + *comment</var>, <var class="Fa" style="white-space: nowrap;">int + len</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_set_file_comment</code>() function is the obsolete + version of + <a class="Xr" href="zip_file_set_comment.html">zip_file_set_comment(3)</a>. + The only differences are the type of the <var class="Ar">len</var> argument + and the additional <var class="Ar">flags</var> argument. + <code class="Fn">zip_set_file_comment</code>() is the same as calling + <a class="Xr" href="zip_file_set_comment.html">zip_file_set_comment(3)</a> + with an empty <var class="Ar">flags</var> argument. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_set_comment.html">zip_file_set_comment(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_set_file_comment</code>() was added in libzip 0.7. In + libzip 0.10 the type of <var class="Ar">index</var> was changed from + <var class="Vt">int</var> to <var class="Vt">zip_uint64_t</var>. It was + deprecated in libzip 0.11, use <code class="Fn">zip_file_set_comment</code>() + instead. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_set_file_comment.man b/3rdparty/libzip/man/zip_set_file_comment.man new file mode 100644 index 0000000000000000000000000000000000000000..2ba8a7c9f2993e5019ddf3e73c12200c20037cfc --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_set_file_comment.mdoc b/3rdparty/libzip/man/zip_set_file_comment.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..f6e2b378aa9ff6ef97373d7473b45a1d91631882 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_set_file_compression.html b/3rdparty/libzip/man/zip_set_file_compression.html new file mode 100644 index 0000000000000000000000000000000000000000..40db4e4dade4bba8d2f0144e29407851f66cb4c6 --- /dev/null +++ b/3rdparty/libzip/man/zip_set_file_compression.html @@ -0,0 +1,162 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_set_file_compression.mdoc -- set compression method and its flags + Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP files. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SET_FILE_COMPRESSION(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SET_FILE_COMPRESSION(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SET_FILE_COMPRESSION(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_set_file_compression</code> — +<div class="Nd">set compression method for file in zip</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_set_file_compression</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_int32_t + comp</var>, <var class="Fa" style="white-space: nowrap;">zip_uint32_t + comp_flags</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_set_file_compression</code>() function sets the + compression method for the file at position <var class="Ar">index</var> in the + zip archive to <var class="Ar">comp</var> with the compression method specific + <var class="Ar">comp_flags</var>. The <var class="Ar">comp</var> is the same + as returned by <a class="Xr" href="zip_stat.html">zip_stat(3)</a>. For the + <var class="Ar">comp</var> argument, currently only the following values are + supported: +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_CM_DEFAULT"><code class="Dv" id="ZIP_CM_DEFAULT">ZIP_CM_DEFAULT</code></a></dt> + <dd>default compression; currently the same as + <code class="Dv">ZIP_CM_DEFLATE</code>, but <var class="Ar">flags</var> + are ignored.</dd> + <dt><a class="permalink" href="#ZIP_CM_STORE"><code class="Dv" id="ZIP_CM_STORE">ZIP_CM_STORE</code></a></dt> + <dd>Store the file uncompressed.</dd> + <dt><a class="permalink" href="#ZIP_CM_BZIP2"><code class="Dv" id="ZIP_CM_BZIP2">ZIP_CM_BZIP2</code></a></dt> + <dd>Compress the file using the <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/bzip2.html">bzip2(1)</a> + algorithm.</dd> + <dt><a class="permalink" href="#ZIP_CM_DEFLATE"><code class="Dv" id="ZIP_CM_DEFLATE">ZIP_CM_DEFLATE</code></a></dt> + <dd>Deflate the file with the <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/zlib.html">zlib(3)</a> + algorithm and default options.</dd> + <dt><a class="permalink" href="#ZIP_CM_XZ"><code class="Dv" id="ZIP_CM_XZ">ZIP_CM_XZ</code></a></dt> + <dd>Use the <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/xz.html">xz(1)</a> algorithm for + compression</dd> + <dt><a class="permalink" href="#ZIP_CM_ZSTD"><code class="Dv" id="ZIP_CM_ZSTD">ZIP_CM_ZSTD</code></a></dt> + <dd>Use the <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/zstd.html">zstd(1)</a> algorithm for + compression</dd> +</dl> +<p class="Pp"><i class="Em">NOTE</i>: Only the deflate and store methods can be + assumed to be universally supported.</p> +<p class="Pp">The <var class="Ar">comp_flags</var> argument defines the + compression level. This value is dependent on the compression algorithm. In + general, lower numbers mean faster de/compression and higher numbers mean + slower de/compression. For <code class="Dv">ZIP_CM_BZIP</code>, + <code class="Dv">ZIP_CM_DEFLATE</code>, and + <code class="Dv">ZIP_CM_XZ</code> 1 is the fastest compression and 9 the + best, 0 chooses the default. For <code class="Dv">ZIP_CM_ZSTD</code> + possible values are + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ZSTD_minCLevel.html">ZSTD_minCLevel(3)</a> to + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ZSTD_maxCLevel.html">ZSTD_maxCLevel(3)</a>.</p> +<p class="Pp">Further compression method specific flags might be added over + time.</p> +<p class="Pp">The current compression method for a file in a zip archive can be + determined using <a class="Xr" href="zip_stat.html">zip_stat(3)</a>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in <var class="Ar">archive</var> is set to indicate the + error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_set_file_compression</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_COMPNOTSUPP"><code class="Er" id="ZIP_ER_COMPNOTSUPP">ZIP_ER_COMPNOTSUPP</code></a>]</dt> + <dd>Unsupported compression method requested.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">index</var> is not a valid file index in + <var class="Ar">archive</var>, or the argument combination is + invalid.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_RDONLY"><code class="Er" id="ZIP_ER_RDONLY">ZIP_ER_RDONLY</code></a>]</dt> + <dd>Read-only zip file, no changes allowed.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_compression_method_supported.html">zip_compression_method_supported(3)</a>, + <a class="Xr" href="zip_stat.html">zip_stat(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_set_file_compression</code>() was added in libzip 0.11. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">June 18, 2021</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_set_file_compression.man b/3rdparty/libzip/man/zip_set_file_compression.man new file mode 100644 index 0000000000000000000000000000000000000000..7f6630aa09d1b0efe1a8c59965ccdbfa3dbef8af --- /dev/null +++ b/3rdparty/libzip/man/zip_set_file_compression.man @@ -0,0 +1,155 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_set_file_compression.mdoc -- set compression method and its flags +.\" Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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" "June 18, 2021" "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 <zip.h>\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. +.TP 19n +\fRZIP_CM_XZ\fR +Use the +xz(1) +algorithm for compression +.TP 19n +\fRZIP_CM_ZSTD\fR +Use the +zstd(1) +algorithm for compression +.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. +This value is dependent on the compression algorithm. +In general, lower numbers mean faster de/compression and higher +numbers mean slower de/compression. +For +\fRZIP_CM_BZIP\fR, +\fRZIP_CM_DEFLATE\fR, +and +\fRZIP_CM_XZ\fR +1 is the fastest compression and 9 the best, 0 chooses the default. +For +\fRZIP_CM_ZSTD\fR +possible values are +ZSTD_minCLevel(3) +to +ZSTD_maxCLevel(3). +.PP +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/3rdparty/libzip/man/zip_set_file_compression.mdoc b/3rdparty/libzip/man/zip_set_file_compression.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..53a36141fca2d3f0096818f58dfde9940fe242ee --- /dev/null +++ b/3rdparty/libzip/man/zip_set_file_compression.mdoc @@ -0,0 +1,145 @@ +.\" zip_set_file_compression.mdoc -- set compression method and its flags +.\" Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP files. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 18, 2021 +.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. +.It Dv ZIP_CM_XZ +Use the +.Xr xz 1 +algorithm for compression +.It Dv ZIP_CM_ZSTD +Use the +.Xr zstd 1 +algorithm for compression +.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. +This value is dependent on the compression algorithm. +In general, lower numbers mean faster de/compression and higher +numbers mean slower de/compression. +For +.Dv ZIP_CM_BZIP , +.Dv ZIP_CM_DEFLATE , +and +.Dv ZIP_CM_XZ +1 is the fastest compression and 9 the best, 0 chooses the default. +For +.Dv ZIP_CM_ZSTD +possible values are +.Xr ZSTD_minCLevel 3 +to +.Xr ZSTD_maxCLevel 3 . +.Pp +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/3rdparty/libzip/man/zip_source.html b/3rdparty/libzip/man/zip_source.html new file mode 100644 index 0000000000000000000000000000000000000000..571040ec4167f2bb7e228a62008006774361864e --- /dev/null +++ b/3rdparty/libzip/man/zip_source.html @@ -0,0 +1,119 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_source.mdoc -- description of zip data source + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source</code> — +<div class="Nd">zip data source structure</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Vt">zip_source_t *zs</var>;</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +A <var class="Vt">struct zip_source</var> is a data source used by + <a class="Xr" href="libzip.html">libzip(3)</a> 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 + <a class="Xr" href="zip_source_buffer.html">zip_source_buffer(3)</a>, + <a class="Xr" href="zip_source_buffer_create.html">zip_source_buffer_create(3)</a>, + <a class="Xr" href="zip_source_file.html">zip_source_file(3)</a>, + <a class="Xr" href="zip_source_file_create.html">zip_source_file_create(3)</a>, + <a class="Xr" href="zip_source_filep.html">zip_source_filep(3)</a>, + <a class="Xr" href="zip_source_filep_create.html">zip_source_filep_create(3)</a>, + <a class="Xr" href="zip_source_function.html">zip_source_function(3)</a>, + <a class="Xr" href="zip_source_function_create.html">zip_source_function_create(3)</a>, + <a class="Xr" href="zip_source_window.html">zip_source_window(3)</a>, or + <a class="Xr" href="zip_source_zip.html">zip_source_zip(3)</a>. + <var class="Vt">zip_source_t</var> is reference counted, and created with a + reference count of 1. + <a class="Xr" href="zip_open_from_source.html">zip_open_from_source(3)</a>, + <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a>, and + <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a> will + decrement the reference count of the <var class="Vt">zip_source_t</var> when + they are done using it, so + <a class="Xr" href="zip_source_free.html">zip_source_free(3)</a> only needs to + be called when these functions return an error. Use + <a class="Xr" href="zip_source_keep.html">zip_source_keep(3)</a> to increase + the reference count, for example if you need the source after + <a class="Xr" href="zip_close.html">zip_close(3)</a>. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source_buffer.html">zip_source_buffer(3)</a>, + <a class="Xr" href="zip_source_file.html">zip_source_file(3)</a>, + <a class="Xr" href="zip_source_filep.html">zip_source_filep(3)</a>, + <a class="Xr" href="zip_source_free.html">zip_source_free(3)</a>, + <a class="Xr" href="zip_source_function.html">zip_source_function(3)</a>, + <a class="Xr" href="zip_source_window.html">zip_source_window(3)</a>, + <a class="Xr" href="zip_source_zip.html">zip_source_zip(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source.man b/3rdparty/libzip/man/zip_source.man new file mode 100644 index 0000000000000000000000000000000000000000..b683b56dd9ff7db51d492c3067cd9749bc3c522c --- /dev/null +++ b/3rdparty/libzip/man/zip_source.man @@ -0,0 +1,91 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source.mdoc -- description of zip data source +.\" Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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), +zip_source_window(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_window(3), +zip_source_zip(3) +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/3rdparty/libzip/man/zip_source.mdoc b/3rdparty/libzip/man/zip_source.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..0b3cafae933c90180dc282cbc0df1eac8f0567ae --- /dev/null +++ b/3rdparty/libzip/man/zip_source.mdoc @@ -0,0 +1,90 @@ +.\" zip_source.mdoc -- description of zip data source +.\" Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 , +.Xr zip_source_window 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_window 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/3rdparty/libzip/man/zip_source_begin_write.html b/3rdparty/libzip/man/zip_source_begin_write.html new file mode 100644 index 0000000000000000000000000000000000000000..b65682a5638fb31935de04f71c6f732b58518f75 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_begin_write.html @@ -0,0 +1,123 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_BEGIN_WRITE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_BEGIN_WRITE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_BEGIN_WRITE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_begin_write</code>, + <code class="Nm">zip_source_begin_write_cloning</code> — +<div class="Nd">prepare zip source for writing</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_source_begin_write</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_source_begin_write_cloning</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + offset</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The functions <code class="Fn">zip_source_begin_write</code>() and + <code class="Fn">zip_source_begin_write_cloning</code>() prepare + <var class="Fa">source</var> for writing. Usually this involves creating + temporary files or allocating buffers. +<p class="Pp"><code class="Fn">zip_source_begin_write_cloning</code>() preserves + the first <var class="Ar">offset</var> bytes of the original file. This is + done efficiently, and writes to <var class="Ar">source</var> won't overwrite + the original data until <code class="Fn">zip_commit_write</code>() is + called.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in <var class="Ar">source</var> is set to indicate the + error. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_source_commit_write.html">zip_source_commit_write(3)</a>, + <a class="Xr" href="zip_source_rollback_write.html">zip_source_rollback_write(3)</a>, + <a class="Xr" href="zip_source_seek_write.html">zip_source_seek_write(3)</a>, + <a class="Xr" href="zip_source_tell_write.html">zip_source_tell_write(3)</a>, + <a class="Xr" href="zip_source_write.html">zip_source_write(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_begin_write</code>() was added in libzip 1.0. +<p class="Pp"><code class="Fn">zip_source_begin_write_cloning</code>() was added + in libzip 1.4.0.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_begin_write.man b/3rdparty/libzip/man/zip_source_begin_write.man new file mode 100644 index 0000000000000000000000000000000000000000..a0a21c521217b831867c8cde43fbca09892d1819 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_begin_write.mdoc b/3rdparty/libzip/man/zip_source_begin_write.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..bef77e2627e04112376b591f1c2f5c15b8143015 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_buffer.html b/3rdparty/libzip/man/zip_source_buffer.html new file mode 100644 index 0000000000000000000000000000000000000000..6681cf2cf3aa9442421d2148bd6cba0b2724beb2 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_buffer.html @@ -0,0 +1,135 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_source_buffer.mdoc -- create zip data source from buffer + Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_BUFFER(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_BUFFER(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_BUFFER(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_buffer</code>, + <code class="Nm">zip_source_buffer_create</code> — +<div class="Nd">create zip data source from buffer</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_buffer</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">const void + *data</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + len</var>, <var class="Fa" style="white-space: nowrap;">int + freep</var>);</p> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_buffer_create</code>(<var class="Fa" style="white-space: nowrap;">const + void *data</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + len</var>, <var class="Fa" style="white-space: nowrap;">int freep</var>, + <var class="Fa" style="white-space: nowrap;">zip_error_t *error</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The functions <code class="Fn">zip_source_buffer</code>() and + <code class="Fn">zip_source_buffer_create</code>() create a zip source from + the buffer <var class="Ar">data</var> of size <var class="Ar">len</var>. If + <var class="Ar">freep</var> is non-zero, the buffer will be freed when it is + no longer needed. <var class="Ar">data</var> must remain valid for the + lifetime of the created source. +<p class="Pp">The source can be used to open a zip archive from.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, the created source is returned. Otherwise, + <code class="Dv">NULL</code> is returned and the error code in + <var class="Ar">archive</var> or <var class="Ar">error</var> is set to + indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_source_buffer</code>() and + <code class="Fn">zip_source_buffer_create</code>() fail if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">len</var> is greater than zero and + <var class="Ar">data</var> is <code class="Dv">NULL</code>.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a>, + <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a>, + <a class="Xr" href="zip_open_from_source.html">zip_open_from_source(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_buffer</code>() and + <code class="Fn">zip_source_buffer_create</code>() were added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_buffer.man b/3rdparty/libzip/man/zip_source_buffer.man new file mode 100644 index 0000000000000000000000000000000000000000..4a368d9e7e4035b604fbd619f3706a3e5ffb7d71 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_buffer.mdoc b/3rdparty/libzip/man/zip_source_buffer.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..081e7e2a488d4b50ed1164357a9306bfdac8fcd4 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_buffer.mdoc @@ -0,0 +1,102 @@ +.\" zip_source_buffer.mdoc -- create zip data source from buffer +.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_buffer_fragment.html b/3rdparty/libzip/man/zip_source_buffer_fragment.html new file mode 100644 index 0000000000000000000000000000000000000000..a40c2596f2ea0f6e312707a38d6b9619f450c146 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_buffer_fragment.html @@ -0,0 +1,150 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_source_buffer_fragment.mdoc -- create zip data source from multiple buffers + Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_BUFFER_FRAGMENT(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_BUFFER_FRAGMENT(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_BUFFER_FRAGMENT(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_buffer_fragment</code>, + <code class="Nm">zip_source_buffer_fragment_create</code> — +<div class="Nd">create zip data source from multiple buffer</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_buffer_fragment</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, + <var class="Fa" style="white-space: nowrap;">zip_buffer_fragment_t + *fragments</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + nfragments</var>, <var class="Fa" style="white-space: nowrap;">int + freep</var>);</p> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_buffer_fragment_create</code>(<var class="Fa" style="white-space: nowrap;">zip_buffer_fragment_t + *fragments</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + nfragments</var>, <var class="Fa" style="white-space: nowrap;">int + freep</var>, <var class="Fa" style="white-space: nowrap;">zip_error_t + *error</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The functions <code class="Fn">zip_source_buffer_fragment</code>() and + <code class="Fn">zip_source_buffer_fragment_create</code>() create a zip + source from the data in <var class="Ar">fragments</var>. + <var class="Ar">nfragments</var> specifies the number of fragments. If + <var class="Ar">freep</var> is non-zero, the data will be freed when it is no + longer needed. +<div class="Bd Pp"> +<pre> +struct zip_stat { + zip_uint8_t *data; /* pointer to the actual data */ + zip_uint64_t length; /* length of this fragment */ +}; +</pre> +</div> +<p class="Pp">The data <var class="Ar">fragments</var> point to must remain + valid for the lifetime of the created source. + <var class="Ar">fragments</var> itself can be discarded once the source is + created.</p> +<p class="Pp">The source can be used to open a zip archive from.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, the created source is returned. Otherwise, + <code class="Dv">NULL</code> is returned and the error code in + <var class="Ar">archive</var> or <var class="Ar">error</var> is set to + indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_source_buffer</code>() and + <code class="Fn">zip_source_buffer_create</code>() fail if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">nfragments</var> is greater than zero and + <var class="Ar">fragments</var> is <code class="Dv">NULL</code>.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a>, + <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a>, + <a class="Xr" href="zip_open_from_source.html">zip_open_from_source(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_buffer_fragment</code>() and + <code class="Fn">zip_source_buffer_fragment_create</code>() were added in + libzip 1.4.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_buffer_fragment.man b/3rdparty/libzip/man/zip_source_buffer_fragment.man new file mode 100644 index 0000000000000000000000000000000000000000..f0669778d2f0f3b48e7e56da8fc75ea01e2bfa11 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_buffer_fragment.mdoc b/3rdparty/libzip/man/zip_source_buffer_fragment.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..8965528f6f69069013d6586781c6b7bf7b265e7d --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_close.html b/3rdparty/libzip/man/zip_source_close.html new file mode 100644 index 0000000000000000000000000000000000000000..efe33754b987f90b6f6fe9adaae2f2d3f0a3fa97 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_close.html @@ -0,0 +1,105 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_source_close.mdoc -- close zip source (open for reading) + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_CLOSE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_CLOSE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_CLOSE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_close</code> — +<div class="Nd">close zip_source (which was open for reading)</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_source_close</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_source_close</code>() closes + <var class="Fa">source</var>, indicating that no more data will be read. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in <var class="Ar">source</var> is set to indicate the + error. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_source_free.html">zip_source_free(3)</a>, + <a class="Xr" href="zip_source_open.html">zip_source_open(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_close</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_close.man b/3rdparty/libzip/man/zip_source_close.man new file mode 100644 index 0000000000000000000000000000000000000000..cd886e81f01bc2acdc4510584161c85c9187e8bc --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_close.mdoc b/3rdparty/libzip/man/zip_source_close.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..197695d9893968174f8ff0a7f8e27720fa4cd048 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_close.mdoc @@ -0,0 +1,67 @@ +.\" zip_source_close.mdoc -- close zip source (open for reading) +.\" Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_commit_write.html b/3rdparty/libzip/man/zip_source_commit_write.html new file mode 100644 index 0000000000000000000000000000000000000000..0ac6950e11dc2760bb130dc8418226e30805974e --- /dev/null +++ b/3rdparty/libzip/man/zip_source_commit_write.html @@ -0,0 +1,109 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_COMMIT_WRITE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_COMMIT_WRITE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_COMMIT_WRITE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_commit_write</code> — +<div class="Nd">finalize changes to zip source</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_source_commit_write</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_source_commit_write</code>() finishes writing + data to <var class="Fa">source</var> and replaces the original with the newly + written data. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in <var class="Ar">source</var> is set to indicate the + error. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_source_begin_write.html">zip_source_begin_write(3)</a>, + <a class="Xr" href="zip_source_rollback_write.html">zip_source_rollback_write(3)</a>, + <a class="Xr" href="zip_source_seek_write.html">zip_source_seek_write(3)</a>, + <a class="Xr" href="zip_source_tell_write.html">zip_source_tell_write(3)</a>, + <a class="Xr" href="zip_source_write.html">zip_source_write(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_commit_write</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_commit_write.man b/3rdparty/libzip/man/zip_source_commit_write.man new file mode 100644 index 0000000000000000000000000000000000000000..2df6abb5741440ea0799f65959db55dda5f92d3a --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_commit_write.mdoc b/3rdparty/libzip/man/zip_source_commit_write.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..69c4f1b35e5c2abe5beaf644f40c1df1739d55ea --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_error.html b/3rdparty/libzip/man/zip_source_error.html new file mode 100644 index 0000000000000000000000000000000000000000..492cf6fd76ebc4f2e1f4452ae90081d70c0332cf --- /dev/null +++ b/3rdparty/libzip/man/zip_source_error.html @@ -0,0 +1,97 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_ERROR(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_ERROR(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_ERROR(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_error</code> — +<div class="Nd">get zip error for data source</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_error_t *</var> + <br/> + <code class="Fn">zip_source_error</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_source_error</code>() function returns the zip error + for the data source <var class="Ar">source</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_error_code_system.html">zip_error_code_system(3)</a>, + <a class="Xr" href="zip_error_code_zip.html">zip_error_code_zip(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_error</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_error.man b/3rdparty/libzip/man/zip_source_error.man new file mode 100644 index 0000000000000000000000000000000000000000..62e7544b7d8c465a43a52c2b16b9a14077ea3365 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_error.mdoc b/3rdparty/libzip/man/zip_source_error.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..af098d1bcdd3f0b2e1ab8ed7fc56312ba5d237c9 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_file.html b/3rdparty/libzip/man/zip_source_file.html new file mode 100644 index 0000000000000000000000000000000000000000..6cb7a9f7e443429f1e3a5617c1e47cc79974ffc1 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_file.html @@ -0,0 +1,141 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_source_file.mdoc -- create data source from a file + Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_FILE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_FILE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_FILE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_file</code>, + <code class="Nm">zip_source_file_create</code> — +<div class="Nd">create data source from a file</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_file</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">const char + *fname</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + start</var>, <var class="Fa" style="white-space: nowrap;">zip_int64_t + len</var>);</p> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_file_create</code>(<var class="Fa" style="white-space: nowrap;">const + char *fname</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + start</var>, <var class="Fa" style="white-space: nowrap;">zip_int64_t + len</var>, <var class="Fa" style="white-space: nowrap;">zip_error_t + *error</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The functions <code class="Fn">zip_source_file</code>() and + <code class="Fn">zip_source_file_create</code>() create a zip source from a + file. They open <var class="Ar">fname</var> and read <var class="Ar">len</var> + bytes from offset <var class="Ar">start</var> from it. If + <var class="Ar">len</var> is 0 or -1, the whole file (starting from + <var class="Ar">start</var>) is used. +<p class="Pp">If the file supports seek, the source can be used to open a zip + archive from.</p> +<p class="Pp">The file is opened and read when the data from the source is used, + usually by <code class="Fn">zip_close</code>() or + <code class="Fn">zip_open_from_source</code>().</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, the created source is returned. Otherwise, + <code class="Dv">NULL</code> is returned and the error code in + <var class="Ar">archive</var> or <var class="Ar">error</var> is set to + indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_source_file</code>() and + <code class="Fn">zip_source_file_create</code>() fail if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">fname</var>, <var class="Ar">start</var>, or + <var class="Ar">len</var> are invalid.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_OPEN"><code class="Er" id="ZIP_ER_OPEN">ZIP_ER_OPEN</code></a>]</dt> + <dd>Opening <var class="Ar">fname</var> failed.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a>, + <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_file</code>() and + <code class="Fn">zip_source_file_create</code>() were added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_file.man b/3rdparty/libzip/man/zip_source_file.man new file mode 100644 index 0000000000000000000000000000000000000000..56471f9043288e5965275f489279215998a48407 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_file.mdoc b/3rdparty/libzip/man/zip_source_file.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..cffd4936f22fd7440e23dc9060638325f7d217d1 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_file.mdoc @@ -0,0 +1,114 @@ +.\" zip_source_file.mdoc -- create data source from a file +.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_filep.html b/3rdparty/libzip/man/zip_source_filep.html new file mode 100644 index 0000000000000000000000000000000000000000..96a3584e2b0d79d45d2c404d47eb8c8363c1004a --- /dev/null +++ b/3rdparty/libzip/man/zip_source_filep.html @@ -0,0 +1,137 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_source_filep.mdoc -- create data source from a file stream + Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_FILEP(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_FILEP(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_FILEP(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_filep</code>, + <code class="Nm">zip_source_filep_create</code> — +<div class="Nd">create data source from FILE *</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_filep</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">FILE + *file</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + start</var>, <var class="Fa" style="white-space: nowrap;">zip_int64_t + len</var>);</p> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_filep_create</code>(<var class="Fa" style="white-space: nowrap;">FILE + *file</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + start</var>, <var class="Fa" style="white-space: nowrap;">zip_int64_t + len</var>, <var class="Fa" style="white-space: nowrap;">zip_error_t + *error</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The functions <code class="Fn">zip_source_filep</code>() and + <code class="Fn">zip_source_filep_create</code>() create a zip source from a + file stream. They read <var class="Ar">len</var> bytes from offset + <var class="Ar">start</var> from the open file stream + <var class="Ar">file</var>. If <var class="Ar">len</var> is 0 or -1, the whole + file (starting from <var class="Ar">start</var>) is used. +<p class="Pp">If the file stream supports seeking, the source can be used to + open a read-only zip archive from.</p> +<p class="Pp">The file stream is closed when the source is being freed, usually + by <a class="Xr" href="zip_close.html">zip_close(3)</a>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, the created source is returned. Otherwise, + <code class="Dv">NULL</code> is returned and the error code in + <var class="Ar">archive</var> or <var class="Ar">error</var> is set to + indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_source_filep</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">file</var>, <var class="Ar">start</var>, or + <var class="Ar">len</var> are invalid.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a>, + <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_filep</code>() and + <code class="Fn">zip_source_filep_create</code>() were added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_filep.man b/3rdparty/libzip/man/zip_source_filep.man new file mode 100644 index 0000000000000000000000000000000000000000..f7c96f95e7624e42220f0a9c9c13b14bcba65d6c --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_filep.mdoc b/3rdparty/libzip/man/zip_source_filep.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..088c75075f6c3db5455c4770ec4b4798477652d4 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_filep.mdoc @@ -0,0 +1,107 @@ +.\" zip_source_filep.mdoc -- create data source from a file stream +.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_free.html b/3rdparty/libzip/man/zip_source_free.html new file mode 100644 index 0000000000000000000000000000000000000000..abf319a84d151ce36dee16e7c217838cc355ffc1 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_free.html @@ -0,0 +1,104 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_FREE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_FREE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_FREE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_free</code> — +<div class="Nd">free zip data source</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_source_free</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_source_free</code>() decrements the reference + count of <var class="Ar">source</var> and frees it if the reference count + drops to 0. If <var class="Ar">source</var> is <code class="Dv">NULL</code>, + it does nothing. +<p class="Pp"><i class="Em">NOTE</i>: This function should not be called on a + <var class="Ar">source</var> after it was used successfully in a + <a class="Xr" href="zip_open_from_source.html">zip_open_from_source(3)</a>, + <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a>, or + <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a> call.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_source_keep.html">zip_source_keep(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_free</code>() was added in libzip 0.6. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_free.man b/3rdparty/libzip/man/zip_source_free.man new file mode 100644 index 0000000000000000000000000000000000000000..5f7967188940a2cff70fedf663b1d3a74e0a9fa9 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_free.mdoc b/3rdparty/libzip/man/zip_source_free.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..816f7a1e1fd553dfb65a05967f5216e2d5986e16 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_function.html b/3rdparty/libzip/man/zip_source_function.html new file mode 100644 index 0000000000000000000000000000000000000000..b0f05b8ec823786a4319a6a930fcac9f2aa71769 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_function.html @@ -0,0 +1,380 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_source_function.mdoc -- create data source from function + Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_FUNCTION(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_FUNCTION(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_FUNCTION(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_function</code>, + <code class="Nm">zip_source_function_create</code> — +<div class="Nd">create data source from function</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_function</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, + <var class="Fa" style="white-space: nowrap;">zip_source_callback fn</var>, + <var class="Fa" style="white-space: nowrap;">void *userdata</var>);</p> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_function_create</code>(<var class="Fa" style="white-space: nowrap;">zip_source_callback + fn</var>, <var class="Fa" style="white-space: nowrap;">void *userdata</var>, + <var class="Fa" style="white-space: nowrap;">zip_error_t *error</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The functions <code class="Fn">zip_source_function</code>() and + <code class="Fn">zip_source_function_create</code>() creates a zip source from + the user-provided function <var class="Ar">fn</var>, which must be of the + following type: +<p class="Pp"><var class="Ft">typedef zip_int64_t</var> + <code class="Fn">(*zip_source_callback)</code>(<var class="Fa">void + *userdata</var>, <var class="Fa">void *data</var>, + <var class="Fa">zip_uint64_t len</var>, <var class="Fa">zip_source_cmd_t + cmd</var>);</p> +<p class="Pp"><var class="Ar">archive</var> or <var class="Ar">error</var> are + used for reporting errors and can be <code class="Dv">NULL</code>.</p> +<p class="Pp">When called by the library, the first argument is the + <var class="Ar">userdata</var> argument supplied to the function. The next + two arguments are a buffer <var class="Ar">data</var> of size + <var class="Ar">len</var> when data is passed in or expected to be returned, + or else <code class="Dv">NULL</code> and 0. The last argument, + <var class="Ar">cmd</var>, specifies which action the function should + perform.</p> +<p class="Pp">Depending on the uses, there are three useful sets of commands to + be supported by a <code class="Fn">zip_source_callback</code>():</p> +<dl class="Bl-tag"> + <dt>read source</dt> + <dd>Providing streamed data (for file data added to archives). Must support + <code class="Dv">ZIP_SOURCE_OPEN</code>, + <code class="Dv">ZIP_SOURCE_READ</code>, + <code class="Dv">ZIP_SOURCE_CLOSE</code>, + <code class="Dv">ZIP_SOURCE_STAT</code>, and + <code class="Dv">ZIP_SOURCE_ERROR</code>.</dd> + <dt>seekable read source</dt> + <dd>Same as previous, but from a source allowing reading from arbitrary + offsets (also for read-only zip archive). Must additionally support + <code class="Dv">ZIP_SOURCE_SEEK</code>, + <code class="Dv">ZIP_SOURCE_TELL</code>, and + <code class="Dv">ZIP_SOURCE_SUPPORTS</code>.</dd> + <dt>read/write source</dt> + <dd>Same as previous, but additionally allowing writing (also for writable zip + archives). Must additionally support + <code class="Dv">ZIP_SOURCE_BEGIN_WRITE</code>, + <code class="Dv">ZIP_SOURCE_COMMIT_WRITE</code>, + <code class="Dv">ZIP_SOURCE_ROLLBACK_WRITE</code>, + <code class="Dv">ZIP_SOURCE_SEEK_WRITE</code>, + <code class="Dv">ZIP_SOURCE_TELL_WRITE</code>, and + <code class="Dv">ZIP_SOURCE_REMOVE</code>.</dd> +</dl> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_ACCEPT_EMPTY</code></h2> +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. +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_BEGIN_WRITE</code></h2> +Prepare the source for writing. Use this to create any temporary file(s). +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_BEGIN_WRITE_CLONING</code></h2> +Prepare the source for writing, keeping the first <var class="Ar">len</var> + 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 + <code class="Dv">ZIP_SOURCE_ROLLBACK_WRITE</code>). +<p class="Pp">The next write should happen at byte + <var class="Ar">offset</var>.</p> +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_CLOSE</code></h2> +Reading is done. +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_COMMIT_WRITE</code></h2> +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. +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_ERROR</code></h2> +Get error information. <var class="Ar">data</var> 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 + <a class="Xr" href="zip_errors.html">zip_errors(3)</a> for details on the + error codes. If the source stores error information in a zip_error_t, use + <a class="Xr" href="zip_error_to_data.html">zip_error_to_data(3)</a> and + return its return value. Otherwise, return 2 * sizeof(int). +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_FREE</code></h2> +Clean up and free all resources, including <var class="Ar">userdata</var>. The + callback function will not be called again. +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_GET_FILE_ATTRIBUTES</code></h2> +Provide information about various data. Then the data should be put in the + appropriate entry in the passed <var class="Vt">zip_file_attributes_t</var> + argument, and the appropriate <code class="Dv">ZIP_FILE_ATTRIBUTES_*</code> + value must be or'ed into the <var class="Ar">valid</var> member to denote that + the corresponding data has been provided. A + <var class="Vt">zip_file_attributes_t</var> structure can be initialized using + <a class="Xr" href="zip_file_attributes_init.html">zip_file_attributes_init(3)</a>. +<dl class="Bl-tag"> + <dt>ASCII mode</dt> + <dd>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 <var class="Ar">ascii</var>, flag + <code class="Dv">ZIP_FILE_ATTRIBUTES_ASCII</code>.</dd> + <dt>General Purpose Bit Flags (limited to Compression Flags)</dt> + <dd>The general purpose bit flag in the zip in the local and central directory + headers contain information about the compression method. Member + <var class="Ar">general_purpose_bit_flags</var> and + <var class="Ar">general_purpose_bit_mask</var> to denote which members + have been set; flag + <code class="Dv">ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS</code>.</dd> + <dt>External File Attributes</dt> + <dd>The external file attributes (usually operating system-specific). Member + <var class="Ar">external_file_attributes</var>, flag + <code class="Dv">ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES</code>.</dd> + <dt>Version Needed</dt> + <dd>A minimum version needed required to unpack this entry (in the usual + "major * 10 + minor" format). Member + <var class="Ar">version_needed</var>, flag + <code class="Dv">ZIP_FILE_ATTRIBUTES_VERSION_NEEDED</code>.</dd> + <dt>Operating System</dt> + <dd>One of the operating systems as defined by the + <code class="Dv">ZIP_OPSYS_*</code> variables (see + <span class="Pa">zip.h</span>). This value affects the interpretation of + the external file attributes. Member <var class="Ar">host_system</var>, + flag <code class="Dv">ZIP_FILE_ATTRIBUTES_HOST_SYSTEM</code>.</dd> +</dl> +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_OPEN</code></h2> +Prepare for reading. +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_READ</code></h2> +Read data into the buffer <var class="Ar">data</var> of size + <var class="Ar">len</var>. Return the number of bytes placed into + <var class="Ar">data</var> on success, and zero for end-of-file. +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_REMOVE</code></h2> +Remove the underlying file. This is called if a zip archive is empty when + closed. +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_ROLLBACK_WRITE</code></h2> +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. +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_SEEK</code></h2> +Specify position to read next byte from, like + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html">fseek(3)</a>. Use + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ZIP_SOURCE_GET_ARGS.html">ZIP_SOURCE_GET_ARGS(3)</a> to + decode the arguments into the following struct: +<div class="Bd Pp"> +<pre> +struct zip_source_args_seek { + zip_int64_t offset; + int whence; +}; +</pre> +</div> +<p class="Pp">If the size of the source's data is known, use + <a class="Xr" href="zip_source_seek_compute_offset.html">zip_source_seek_compute_offset(3)</a> + to validate the arguments and compute the new offset.</p> +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_SEEK_WRITE</code></h2> +Specify position to write next byte to, like + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html">fseek(3)</a>. See + <code class="Dv">ZIP_SOURCE_SEEK</code> for details. +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_STAT</code></h2> +Get meta information for the input data. <var class="Ar">data</var> points to an + allocated <var class="Vt">struct zip_stat</var>, which should be initialized + using <a class="Xr" href="zip_stat_init.html">zip_stat_init(3)</a> and then + filled in. +<p class="Pp">For uncompressed, unencrypted data, all information is optional. + However, fill in as much information as is readily available.</p> +<p class="Pp">If the data is compressed, + <code class="Dv">ZIP_STAT_COMP_METHOD</code>, + <code class="Dv">ZIP_STAT_SIZE</code>, and + <code class="Dv">ZIP_STAT_CRC</code> must be filled in.</p> +<p class="Pp">If the data is encrypted, + <code class="Dv">ZIP_STAT_ENCRYPTION_METHOD</code>, + <code class="Dv">ZIP_STAT_COMP_METHOD</code>, + <code class="Dv">ZIP_STAT_SIZE</code>, and + <code class="Dv">ZIP_STAT_CRC</code> must be filled in.</p> +<p class="Pp">Information only available after the source has been read (e.g., + size) can be omitted in an earlier call. <i class="Em">NOTE</i>: + <code class="Fn">zip_source_function</code>() may be called with this + argument even after being called with + <code class="Dv">ZIP_SOURCE_CLOSE</code>.</p> +<p class="Pp">Return sizeof(struct zip_stat) on success.</p> +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_SUPPORTS</code></h2> +Return bitmap specifying which commands are supported. Use + <a class="Xr" href="zip_source_make_command_bitmap.html">zip_source_make_command_bitmap(3)</a>. + If this command is not implemented, the source is assumed to be a read source + without seek support. +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_TELL</code></h2> +Return the current read offset in the source, like + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftell.html">ftell(3)</a>. +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_TELL_WRITE</code></h2> +Return the current write offset in the source, like + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftell.html">ftell(3)</a>. +</section> +<section class="Ss"> +<h2 class="Ss"><code class="Dv">ZIP_SOURCE_WRITE</code></h2> +Write data to the source. Return number of bytes written. +</section> +<section class="Ss"> +<h2 class="Ss" id="Return_Values"><a class="permalink" href="#Return_Values">Return + Values</a></h2> +Commands should return -1 on error. <code class="Dv">ZIP_SOURCE_ERROR</code> + will be called to retrieve the error code. On success, commands return 0, + unless specified otherwise in the description above. +</section> +<section class="Ss"> +<h2 class="Ss" id="Calling_Conventions"><a class="permalink" href="#Calling_Conventions">Calling + Conventions</a></h2> +The library will always issue <code class="Dv">ZIP_SOURCE_OPEN</code> before + issuing <code class="Dv">ZIP_SOURCE_READ</code>, + <code class="Dv">ZIP_SOURCE_SEEK</code>, or + <code class="Dv">ZIP_SOURCE_TELL</code>. When it no longer wishes to read from + this source, it will issue <code class="Dv">ZIP_SOURCE_CLOSE</code>. If the + library wishes to read the data again, it will issue + <code class="Dv">ZIP_SOURCE_OPEN</code> a second time. If the function is + unable to provide the data again, it should return -1. +<p class="Pp"><code class="Dv">ZIP_SOURCE_BEGIN_WRITE</code> or + <code class="Dv">ZIP_SOURCE_BEGIN_WRITE_CLONING</code> will be called before + <code class="Dv">ZIP_SOURCE_WRITE</code>, + <code class="Dv">ZIP_SOURCE_SEEK_WRITE</code>, or + <code class="Dv">ZIP_SOURCE_TELL_WRITE</code>. When writing is complete, + either <code class="Dv">ZIP_SOURCE_COMMIT_WRITE</code> or + <code class="Dv">ZIP_SOURCE_ROLLBACK_WRITE</code> will be called.</p> +<p class="Pp"><code class="Dv">ZIP_SOURCE_ACCEPT_EMPTY</code>, + <code class="Dv">ZIP_SOURCE_GET_FILE_ATTRIBUTES</code>, and + <code class="Dv">ZIP_SOURCE_STAT</code> can be issued at any time.</p> +<p class="Pp"><code class="Dv">ZIP_SOURCE_ERROR</code> will only be issued in + response to the function returning -1.</p> +<p class="Pp"><code class="Dv">ZIP_SOURCE_FREE</code> will be the last command + issued; if <code class="Dv">ZIP_SOURCE_OPEN</code> was called and succeeded, + <code class="Dv">ZIP_SOURCE_CLOSE</code> will be called before + <code class="Dv">ZIP_SOURCE_FREE</code>, and similarly for + <code class="Dv">ZIP_SOURCE_BEGIN_WRITE</code> or + <code class="Dv">ZIP_SOURCE_BEGIN_WRITE_CLONING</code> and + <code class="Dv">ZIP_SOURCE_COMMIT_WRITE</code> or + <code class="Dv">ZIP_SOURCE_ROLLBACK_WRITE</code>.</p> +</section> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, the created source is returned. Otherwise, + <code class="Dv">NULL</code> is returned and the error code in + <var class="Ar">archive</var> or <var class="Ar">error</var> is set to + indicate the error (unless it is <code class="Dv">NULL</code>). +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_source_function</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a>, + <a class="Xr" href="zip_file_attributes_init.html">zip_file_attributes_init(3)</a>, + <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_stat_init.html">zip_stat_init(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_function</code>() and + <code class="Fn">zip_source_function_create</code>() were added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">April 17, 2020</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_function.man b/3rdparty/libzip/man/zip_source_function.man new file mode 100644 index 0000000000000000000000000000000000000000..4fc01d900f64f69476409227f83b9a6001c83a7a --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_function.mdoc b/3rdparty/libzip/man/zip_source_function.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..8272ea1327e231d0591d4733c006c18fe3d8dc4c --- /dev/null +++ b/3rdparty/libzip/man/zip_source_function.mdoc @@ -0,0 +1,399 @@ +.\" zip_source_function.mdoc -- create data source from function +.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_is_deleted.html b/3rdparty/libzip/man/zip_source_is_deleted.html new file mode 100644 index 0000000000000000000000000000000000000000..166c7d34f5c05ddc9b7c180fbf779a14d655b281 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_is_deleted.html @@ -0,0 +1,103 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_IS_DELETED(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_IS_DELETED(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_IS_DELETED(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_is_deleted</code> — +<div class="Nd">check if zip_source is deleted</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_source_is_deleted</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_source_is_deleted</code>() returns whether the + zip_source was deleted. This can for example happen when all entries are + removed from a zip archive. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +<code class="Fn">zip_source_is_deleted</code>() returns 1 if the zip_source is + deleted and 0 otherwise. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_is_deleted</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_is_deleted.man b/3rdparty/libzip/man/zip_source_is_deleted.man new file mode 100644 index 0000000000000000000000000000000000000000..89dab743bd0603d33615ef7a6f8eab8b33f3afb9 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_is_deleted.mdoc b/3rdparty/libzip/man/zip_source_is_deleted.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..9903058f78e62e37e1270ae10af884829186c436 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_keep.html b/3rdparty/libzip/man/zip_source_keep.html new file mode 100644 index 0000000000000000000000000000000000000000..fc7d1d16f67d67235c3e784a42bdb6afd7ca9097 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_keep.html @@ -0,0 +1,97 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_KEEP(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_KEEP(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_KEEP(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_keep</code> — +<div class="Nd">increment reference count of zip data source</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_source_keep</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_source_keep</code>() increments the reference + count of <var class="Ar">source</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_source_free.html">zip_source_free(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_keep</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_keep.man b/3rdparty/libzip/man/zip_source_keep.man new file mode 100644 index 0000000000000000000000000000000000000000..488673cbea7aecc37ef638c4d26057b009bcbdc3 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_keep.mdoc b/3rdparty/libzip/man/zip_source_keep.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..122c4f84a9ce2c0bab1a9db312519140871555b1 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_make_command_bitmap.html b/3rdparty/libzip/man/zip_source_make_command_bitmap.html new file mode 100644 index 0000000000000000000000000000000000000000..d6ce945ebe8e62265a3f7805db58c08bf7c66848 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_make_command_bitmap.html @@ -0,0 +1,99 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_MAKE_COMMAND_BITMAP(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_MAKE_COMMAND_BITMAP(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_MAKE_COMMAND_BITMAP(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_make_command_bitmap</code> — +<div class="Nd">create bitmap of supported source operations</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int64_t</var> + <br/> + <code class="Fn">zip_source_make_command_bitmap</code>(<var class="Fa" style="white-space: nowrap;">zip_source_cmd_t + command</var>, <var class="Fa" style="white-space: nowrap;">...</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_source_make_command_bitmap</code>() function returns a + bitmap of source commands suitable as return value for + <code class="Dv">ZIP_SOURCE_SUPPORTS</code>. It includes all the commands from + the argument list, which must be terminated by -1. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source_function.html">zip_source_function(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_make_command_bitmap</code>() was added in libzip + 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_make_command_bitmap.man b/3rdparty/libzip/man/zip_source_make_command_bitmap.man new file mode 100644 index 0000000000000000000000000000000000000000..3dc3ed5d0bc2ea895b2d832d115c0e71e5156463 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_make_command_bitmap.mdoc b/3rdparty/libzip/man/zip_source_make_command_bitmap.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..28d296f2f1ec87f927463574d632b838a0f2c79a --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_open.html b/3rdparty/libzip/man/zip_source_open.html new file mode 100644 index 0000000000000000000000000000000000000000..9dc5a579a463b71d953ca9e8ec7d5d4e191a2b64 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_open.html @@ -0,0 +1,108 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_OPEN(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_OPEN(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_OPEN(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_open</code> — +<div class="Nd">open zip_source for reading</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_source_open</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_source_open</code>() opens + <var class="Fa">source</var> for reading. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in <var class="Ar">source</var> is set to indicate the + error. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_source_begin_write.html">zip_source_begin_write(3)</a>, + <a class="Xr" href="zip_source_close.html">zip_source_close(3)</a>, + <a class="Xr" href="zip_source_read.html">zip_source_read(3)</a>, + <a class="Xr" href="zip_source_seek.html">zip_source_seek(3)</a>, + <a class="Xr" href="zip_source_tell.html">zip_source_tell(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_open</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_open.man b/3rdparty/libzip/man/zip_source_open.man new file mode 100644 index 0000000000000000000000000000000000000000..dc337baf6392737ecc03359431ce919efa22ebcb --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_open.mdoc b/3rdparty/libzip/man/zip_source_open.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..00371f64f01727ef90781e39dfd6da88dc7f45d7 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_read.html b/3rdparty/libzip/man/zip_source_read.html new file mode 100644 index 0000000000000000000000000000000000000000..1269a42e6960eace3c053f47f029a7179cf82235 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_read.html @@ -0,0 +1,112 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_READ(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_READ(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_READ(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_read</code> — +<div class="Nd">read data from zip source</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int64_t</var> + <br/> + <code class="Fn">zip_source_read</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>, <var class="Fa" style="white-space: nowrap;">void + *data</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + len</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_source_read</code>() reads up to + <var class="Ar">len</var> bytes of data from <var class="Ar">source</var> at + the current read offset into the buffer <var class="Ar">data</var>. +<p class="Pp">The zip source <var class="Ar">source</var> has to be opened for + reading by calling + <a class="Xr" href="zip_source_open.html">zip_source_open(3)</a> first.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +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 <var class="Ar">source</var> is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_source_seek.html">zip_source_seek(3)</a>, + <a class="Xr" href="zip_source_tell.html">zip_source_tell(3)</a>, + <a class="Xr" href="zip_source_write.html">zip_source_write(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_read</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_read.man b/3rdparty/libzip/man/zip_source_read.man new file mode 100644 index 0000000000000000000000000000000000000000..78ea1bf334eb376d0946f136a0f5ad641cce2309 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_read.mdoc b/3rdparty/libzip/man/zip_source_read.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..1e7bc02d0b4a8ac146c59db03938ff7a36a7dc0b --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_rollback_write.html b/3rdparty/libzip/man/zip_source_rollback_write.html new file mode 100644 index 0000000000000000000000000000000000000000..9ba26954c7033dd0bae0d0a539d4e76d2de699fb --- /dev/null +++ b/3rdparty/libzip/man/zip_source_rollback_write.html @@ -0,0 +1,110 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_ROLLBACK_WRITE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_ROLLBACK_WRITE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_ROLLBACK_WRITE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_rollback_write</code> — +<div class="Nd">undo changes to zip source</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_source_rollback_write</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_source_rollback_write</code>() reverts changes + written to <var class="Fa">source</var>, restoring the data before + <a class="Xr" href="zip_source_begin_write.html">zip_source_begin_write(3)</a> + was called. Usually this removes temporary files or frees buffers. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in <var class="Ar">source</var> is set to indicate the + error. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_source_begin_write.html">zip_source_begin_write(3)</a>, + <a class="Xr" href="zip_source_commit_write.html">zip_source_commit_write(3)</a>, + <a class="Xr" href="zip_source_seek_write.html">zip_source_seek_write(3)</a>, + <a class="Xr" href="zip_source_tell_write.html">zip_source_tell_write(3)</a>, + <a class="Xr" href="zip_source_write.html">zip_source_write(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_rollback_write</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_rollback_write.man b/3rdparty/libzip/man/zip_source_rollback_write.man new file mode 100644 index 0000000000000000000000000000000000000000..1665dbe96d262ce913c078aade4383aed5f58b7f --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_rollback_write.mdoc b/3rdparty/libzip/man/zip_source_rollback_write.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..50a2a603b307222e98f515d1c7e06897bdcbb3c3 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_seek.html b/3rdparty/libzip/man/zip_source_seek.html new file mode 100644 index 0000000000000000000000000000000000000000..6fad8030046cfb89089e4807e15c85b70f083ae8 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_seek.html @@ -0,0 +1,120 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_SEEK(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_SEEK(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_SEEK(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_seek</code> — +<div class="Nd">set read offset in zip source</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_source_seek</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>, <var class="Fa" style="white-space: nowrap;">zip_int64_t + offset</var>, <var class="Fa" style="white-space: nowrap;">int + whence</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_source_seek</code>() sets the current read + offset for <var class="Fa">source</var>. Just like in + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html">fseek(3)</a>, depending on the + <var class="Ar">whence</var> argument, the <var class="Ar">offset</var> is + counted relative from: +<div class="Bd-indent"> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#SEEK_SET"><code class="Dv" id="SEEK_SET">SEEK_SET</code></a></dt> + <dd>start of file</dd> + <dt><a class="permalink" href="#SEEK_CUR"><code class="Dv" id="SEEK_CUR">SEEK_CUR</code></a></dt> + <dd>current read offset in file</dd> + <dt><a class="permalink" href="#SEEK_END"><code class="Dv" id="SEEK_END">SEEK_END</code></a></dt> + <dd>end of file</dd> +</dl> +</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in <var class="Ar">source</var> is set to indicate the + error. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_source_read.html">zip_source_read(3)</a>, + <a class="Xr" href="zip_source_tell.html">zip_source_tell(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_seek</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_seek.man b/3rdparty/libzip/man/zip_source_seek.man new file mode 100644 index 0000000000000000000000000000000000000000..399597ed9ca449c8e09f4fc5be60c86e65e69f35 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_seek.mdoc b/3rdparty/libzip/man/zip_source_seek.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..6518ba7007d2b2b987e863059211c69bac4cd2c2 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_seek_compute_offset.html b/3rdparty/libzip/man/zip_source_seek_compute_offset.html new file mode 100644 index 0000000000000000000000000000000000000000..15fee4545bed5451f34145e1fb6c4683ffd2f591 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_seek_compute_offset.html @@ -0,0 +1,119 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_SEEK_COMPUTE_OFFSET(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_SEEK_COMPUTE_OFFSET(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_SEEK_COMPUTE_OFFSET(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_seek_compute_offset</code> — +<div class="Nd">validate arguments and compute offset</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int64_t</var> + <br/> + <code class="Fn">zip_source_seek_compute_offset</code>(<var class="Fa" style="white-space: nowrap;">zip_uint64_t + offset</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + length</var>, <var class="Fa" style="white-space: nowrap;">void *data</var>, + <var class="Fa" style="white-space: nowrap;">zip_uint64_t data_length</var>, + <var class="Fa" style="white-space: nowrap;">zip_error_t *error</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +Use this function to compute the offset for a + <code class="Dv">ZIP_SOURCE_SEEK</code> or + <code class="Dv">ZIP_SOURCE_SEEK_WRITE</code> command. + <var class="Ar">data</var> and <var class="Ar">data_length</var> are the + arguments to the source callback, <var class="Ar">offset</var> is the current + offset and <var class="Ar">length</var> is the length of the source data or, + for <code class="Dv">ZIP_SOURCE_SEEK_WRITE</code>, the amount of data written. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +On success, it returns the new offset, on error it returns -1 and sets + <var class="Ar">error</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_source_seek_compute_offset</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd>One of the arguments is invalid or the seek would place the offset outside + the data.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="zip_source_function.html">zip_source_function(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_seek_compute_offset</code>() was added in libzip + 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_seek_compute_offset.man b/3rdparty/libzip/man/zip_source_seek_compute_offset.man new file mode 100644 index 0000000000000000000000000000000000000000..a1b1cc13d42fbc1f61505ee247ce767450e70d3d --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_seek_compute_offset.mdoc b/3rdparty/libzip/man/zip_source_seek_compute_offset.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..bcf159a839da3af9ece2f73ea61bbb3f7dea0014 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_seek_write.html b/3rdparty/libzip/man/zip_source_seek_write.html new file mode 100644 index 0000000000000000000000000000000000000000..76eb2669ece8b65013200f65ac64f38ed6b8ca0e --- /dev/null +++ b/3rdparty/libzip/man/zip_source_seek_write.html @@ -0,0 +1,123 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_SEEK_WRITE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_SEEK_WRITE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_SEEK_WRITE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_seek_write</code> — +<div class="Nd">set write offset in zip source</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_source_seek_write</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>, <var class="Fa" style="white-space: nowrap;">zip_int64_t + offset</var>, <var class="Fa" style="white-space: nowrap;">int + whence</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_source_seek_write</code>() sets the current + write offset for <var class="Fa">source</var>. Just like in + <a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html">fseek(3)</a>, depending on the + <var class="Ar">whence</var> argument, the <var class="Ar">offset</var> is + counted relative from: +<div class="Bd-indent"> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#SEEK_SET"><code class="Dv" id="SEEK_SET">SEEK_SET</code></a></dt> + <dd>start of file</dd> + <dt><a class="permalink" href="#SEEK_CUR"><code class="Dv" id="SEEK_CUR">SEEK_CUR</code></a></dt> + <dd>current write offset in file</dd> + <dt><a class="permalink" href="#SEEK_END"><code class="Dv" id="SEEK_END">SEEK_END</code></a></dt> + <dd>end of file</dd> +</dl> +</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in <var class="Ar">source</var> is set to indicate the + error. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_source_begin_write.html">zip_source_begin_write(3)</a>, + <a class="Xr" href="zip_source_commit_write.html">zip_source_commit_write(3)</a>, + <a class="Xr" href="zip_source_rollback_write.html">zip_source_rollback_write(3)</a>, + <a class="Xr" href="zip_source_tell_write.html">zip_source_tell_write(3)</a>, + <a class="Xr" href="zip_source_write.html">zip_source_write(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_seek_write</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_seek_write.man b/3rdparty/libzip/man/zip_source_seek_write.man new file mode 100644 index 0000000000000000000000000000000000000000..567588d4214c46e3eabfc1db4467344649983089 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_seek_write.mdoc b/3rdparty/libzip/man/zip_source_seek_write.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..fac01593986e51cbf7974da399574ea63f632c9c --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_stat.html b/3rdparty/libzip/man/zip_source_stat.html new file mode 100644 index 0000000000000000000000000000000000000000..9e1cb4fe563ff729ae2c0b2171ea08d3d56f287e --- /dev/null +++ b/3rdparty/libzip/man/zip_source_stat.html @@ -0,0 +1,154 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_source_stat.mdoc -- get information about zip source + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_STAT(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_STAT(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_STAT(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_stat</code> — +<div class="Nd">get information about zip_source</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_source_stat</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>, <var class="Fa" style="white-space: nowrap;">zip_stat_t + *sb</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_source_stat</code>() function obtains information about + the zip source <var class="Ar">source</var> +<p class="Pp">The <var class="Ar">sb</var> argument is a pointer to a + <var class="Ft">struct zip_source_stat</var> (shown below), into which + information about the zip source is placed.</p> +<div class="Bd Pp"> +<pre> +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 */ +}; +</pre> +</div> +The structure pointed to by <var class="Ar">sb</var> must be initialized with + <code class="Fn">zip_stat_init</code>(<var class="Fa">3</var>) before calling + <code class="Fn">zip_source_stat</code>(). +<p class="Pp">The <var class="Ar">valid</var> field of the structure specifies + which other fields are valid. Check if the flag defined by the following + defines are in <var class="Ar">valid</var> before accessing the fields:</p> +<div class="Bd-indent"> +<dl class="Bl-tag Bl-compact"> + <dt><a class="permalink" href="#ZIP_STAT_NAME"><code class="Dv" id="ZIP_STAT_NAME">ZIP_STAT_NAME</code></a></dt> + <dd><var class="Ar">name</var></dd> + <dt><a class="permalink" href="#ZIP_STAT_INDEX"><code class="Dv" id="ZIP_STAT_INDEX">ZIP_STAT_INDEX</code></a></dt> + <dd><var class="Ar">index</var></dd> + <dt><a class="permalink" href="#ZIP_STAT_SIZE"><code class="Dv" id="ZIP_STAT_SIZE">ZIP_STAT_SIZE</code></a></dt> + <dd><var class="Ar">size</var></dd> + <dt><a class="permalink" href="#ZIP_STAT_COMP_SIZE"><code class="Dv" id="ZIP_STAT_COMP_SIZE">ZIP_STAT_COMP_SIZE</code></a></dt> + <dd><var class="Ar">comp_size</var></dd> + <dt><a class="permalink" href="#ZIP_STAT_MTIME"><code class="Dv" id="ZIP_STAT_MTIME">ZIP_STAT_MTIME</code></a></dt> + <dd><var class="Ar">mtime</var></dd> + <dt><a class="permalink" href="#ZIP_STAT_CRC"><code class="Dv" id="ZIP_STAT_CRC">ZIP_STAT_CRC</code></a></dt> + <dd><var class="Ar">crc</var></dd> + <dt><a class="permalink" href="#ZIP_STAT_COMP_METHOD"><code class="Dv" id="ZIP_STAT_COMP_METHOD">ZIP_STAT_COMP_METHOD</code></a></dt> + <dd><var class="Ar">comp_method</var></dd> + <dt><a class="permalink" href="#ZIP_STAT_ENCRYPTION_METHOD"><code class="Dv" id="ZIP_STAT_ENCRYPTION_METHOD">ZIP_STAT_ENCRYPTION_METHOD</code></a></dt> + <dd><var class="Ar">encryption_method</var></dd> + <dt><a class="permalink" href="#ZIP_STAT_FLAGS"><code class="Dv" id="ZIP_STAT_FLAGS">ZIP_STAT_FLAGS</code></a></dt> + <dd><var class="Ar">flags</var></dd> +</dl> +</div> +<p class="Pp"><i class="Em">NOTE</i>: Some fields may only be filled out after + all data has been read from the source, for example the + <var class="Ar">crc</var> or <var class="Ar">size</var> fields.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in <var class="Ar">source</var> is set to indicate the + error. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_stat</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_stat.man b/3rdparty/libzip/man/zip_source_stat.man new file mode 100644 index 0000000000000000000000000000000000000000..598b22ffceb6bde98c7397bf48bedb4dabdccbb9 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_stat.mdoc b/3rdparty/libzip/man/zip_source_stat.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..b5916a8b5efec0de3bb01e8613631e0f1df250ba --- /dev/null +++ b/3rdparty/libzip/man/zip_source_stat.mdoc @@ -0,0 +1,125 @@ +.\" zip_source_stat.mdoc -- get information about zip source +.\" Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_tell.html b/3rdparty/libzip/man/zip_source_tell.html new file mode 100644 index 0000000000000000000000000000000000000000..4668d5bc406cf0d0a14826f39b007575b60b013a --- /dev/null +++ b/3rdparty/libzip/man/zip_source_tell.html @@ -0,0 +1,108 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_TELL(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_TELL(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_TELL(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_tell</code> — +<div class="Nd">report current read offset in zip source</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int64_t</var> + <br/> + <code class="Fn">zip_source_tell</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_source_tell</code>() returns the current read + offset for <var class="Fa">source</var>. The return value can be passed to + <a class="Xr" href="zip_source_seek.html">zip_source_seek(3)</a> with + <var class="Ar">whence</var> set to <code class="Dv">SEEK_SET</code> to return + to the same location in the source. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion the current read offset is returned. Otherwise, -1 is + returned and the error information in <var class="Ar">source</var> is set to + indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_source_read.html">zip_source_read(3)</a>, + <a class="Xr" href="zip_source_tell_write.html">zip_source_tell_write(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_tell</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_tell.man b/3rdparty/libzip/man/zip_source_tell.man new file mode 100644 index 0000000000000000000000000000000000000000..088ec861d62cd71d50c6233dcf432bc9e9426f2f --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_tell.mdoc b/3rdparty/libzip/man/zip_source_tell.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..e8249184bda58ec28b59f54ec2569344ae9982a9 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_tell_write.html b/3rdparty/libzip/man/zip_source_tell_write.html new file mode 100644 index 0000000000000000000000000000000000000000..3c6f9082bb85968178645b37b866a5b060234a76 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_tell_write.html @@ -0,0 +1,112 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_TELL_WRITE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_TELL_WRITE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_TELL_WRITE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_tell_write</code> — +<div class="Nd">report current write offset in zip source</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int64_t</var> + <br/> + <code class="Fn">zip_source_tell_write</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_source_tell_write</code>() returns the current + write offset for <var class="Fa">source</var>. The return value can be passed + to + <a class="Xr" href="zip_source_seek_write.html">zip_source_seek_write(3)</a> + with <var class="Ar">whence</var> set to <code class="Dv">SEEK_SET</code> to + return to the same location in the source. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion the current write offset is returned. Otherwise, -1 + is returned and the error information in <var class="Ar">source</var> is set + to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_source_begin_write.html">zip_source_begin_write(3)</a>, + <a class="Xr" href="zip_source_commit_write.html">zip_source_commit_write(3)</a>, + <a class="Xr" href="zip_source_rollback_write.html">zip_source_rollback_write(3)</a>, + <a class="Xr" href="zip_source_tell.html">zip_source_tell(3)</a>, + <a class="Xr" href="zip_source_write.html">zip_source_write(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_tell_write</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_tell_write.man b/3rdparty/libzip/man/zip_source_tell_write.man new file mode 100644 index 0000000000000000000000000000000000000000..4208e5cc562366004dfef41a7bb02ca838b3456c --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_tell_write.mdoc b/3rdparty/libzip/man/zip_source_tell_write.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..00fc3b1c7c937d0e8574460852ea8b640274bd46 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_win32a.html b/3rdparty/libzip/man/zip_source_win32a.html new file mode 100644 index 0000000000000000000000000000000000000000..44dd02bf4c6239b8e62d7d069f81fc6af51cc173 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_win32a.html @@ -0,0 +1,143 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_source_win32a.mdoc -- create data source using a win32 ANSI name + Copyright (C) 2015-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_WIN32A(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_WIN32A(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_WIN32A(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_win32a</code>, + <code class="Nm">zip_source_win32a_create</code> — +<div class="Nd">create data source from a Windows ANSI file name</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_win32a</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">const char + *fname</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + start</var>, <var class="Fa" style="white-space: nowrap;">zip_int64_t + len</var>);</p> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_win32a_create</code>(<var class="Fa" style="white-space: nowrap;">const + char *fname</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + start</var>, <var class="Fa" style="white-space: nowrap;">zip_int64_t + len</var>, <var class="Fa" style="white-space: nowrap;">zip_error_t + *error</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The functions <code class="Fn">zip_source_win32a</code>() and + <code class="Fn">zip_source_win32a_create</code>() create a zip source on + Windows using a Windows ANSI name. They open <var class="Ar">fname</var> and + read <var class="Ar">len</var> bytes from offset <var class="Ar">start</var> + from it. If <var class="Ar">len</var> is 0 or -1, the whole file (starting + from <var class="Ar">start</var>) is used. +<p class="Pp">If the file supports seek, the source can be used to open a zip + archive from.</p> +<p class="Pp">The file is opened and read when the data from the source is used, + usually by <code class="Fn">zip_close</code>() or + <code class="Fn">zip_open_from_source</code>().</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, the created source is returned. Otherwise, + <code class="Dv">NULL</code> is returned and the error code in + <var class="Ar">archive</var> or <var class="Ar">error</var> is set to + indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_source_win32a</code>() and + <code class="Fn">zip_source_win32a_create</code>() fail if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">fname</var>, <var class="Ar">start</var>, or + <var class="Ar">len</var> are invalid.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_OPEN"><code class="Er" id="ZIP_ER_OPEN">ZIP_ER_OPEN</code></a>]</dt> + <dd>Opening <var class="Ar">fname</var> failed.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a>, + <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_source_win32handle.html">zip_source_win32handle(3)</a>, + <a class="Xr" href="zip_source_win32w.html">zip_source_win32w(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_win32a</code>() and + <code class="Fn">zip_source_win32a_create</code>() were added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_win32a.man b/3rdparty/libzip/man/zip_source_win32a.man new file mode 100644 index 0000000000000000000000000000000000000000..c6144d35c09b4149ed651ad2820583c036b3dfd8 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_win32a.mdoc b/3rdparty/libzip/man/zip_source_win32a.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..557ae7d36a8bb379cf27218519ff183c4e2568ff --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_win32handle.html b/3rdparty/libzip/man/zip_source_win32handle.html new file mode 100644 index 0000000000000000000000000000000000000000..41c8f2c0cc1401c9672ffc0789efa742abbc5875 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_win32handle.html @@ -0,0 +1,143 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_source_handle.mdoc -- create data source from a Windows file handle + Copyright (C) 2015-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_WIN32HANDLE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_WIN32HANDLE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_WIN32HANDLE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_win32handle</code>, + <code class="Nm">zip_source_win32handle_create</code> — +<div class="Nd">create data source from a Windows file handle</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_win32handle</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">HANDLE h</var>, + <var class="Fa" style="white-space: nowrap;">zip_uint64_t start</var>, + <var class="Fa" style="white-space: nowrap;">zip_int64_t len</var>);</p> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_win32handle_create</code>(<var class="Fa" style="white-space: nowrap;">HANDLE + h</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + start</var>, <var class="Fa" style="white-space: nowrap;">zip_int64_t + len</var>, <var class="Fa" style="white-space: nowrap;">zip_error_t + *error</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The functions <code class="Fn">zip_source_win32handle</code>() and + <code class="Fn">zip_source_win32handle_create</code>() create a zip source + from a Windows file handle. They open <var class="Ar">fname</var> and read + <var class="Ar">len</var> bytes from offset <var class="Ar">start</var> from + it. If <var class="Ar">len</var> is 0 or -1, the whole file (starting from + <var class="Ar">start</var>) is used. +<p class="Pp">If the file supports seek, the source can be used to open a zip + archive from.</p> +<p class="Pp">The file is opened and read when the data from the source is used, + usually by <code class="Fn">zip_close</code>() or + <code class="Fn">zip_open_from_source</code>().</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, the created source is returned. Otherwise, + <code class="Dv">NULL</code> is returned and the error code in + <var class="Ar">archive</var> or <var class="Ar">error</var> is set to + indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_source_w32handle</code>() and + <code class="Fn">zip_source_w32handle_create</code>() fail if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">fname</var>, <var class="Ar">start</var>, or + <var class="Ar">len</var> are invalid.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_OPEN"><code class="Er" id="ZIP_ER_OPEN">ZIP_ER_OPEN</code></a>]</dt> + <dd>Opening <var class="Ar">fname</var> failed.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a>, + <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_source_win32a.html">zip_source_win32a(3)</a>, + <a class="Xr" href="zip_source_win32w.html">zip_source_win32w(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_win32handle</code>() and + <code class="Fn">zip_source_win32handle_create</code>() were added in libzip + 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_win32handle.man b/3rdparty/libzip/man/zip_source_win32handle.man new file mode 100644 index 0000000000000000000000000000000000000000..b014a7ba256513d50ae2e04fc3f26a93403a3079 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_win32handle.mdoc b/3rdparty/libzip/man/zip_source_win32handle.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..ab015435022a47bcbe68c4049ba1c89cc916f37b --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_win32w.html b/3rdparty/libzip/man/zip_source_win32w.html new file mode 100644 index 0000000000000000000000000000000000000000..f2e118933713374f0abe3dfb34395edb2ba2f761 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_win32w.html @@ -0,0 +1,142 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_source_win32w.mdoc -- create data source using a win32 Unicode name + Copyright (C) 2015-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_WIN32W(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_WIN32W(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_WIN32W(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_win32w</code>, + <code class="Nm">zip_source_win32w_create</code> — +<div class="Nd">create data source from a Windows Unicode file name</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_win32w</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">const wchar_t + *fname</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + start</var>, <var class="Fa" style="white-space: nowrap;">zip_int64_t + len</var>);</p> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_win32w_create</code>(<var class="Fa" style="white-space: nowrap;">const + wchar_t *fname</var>, + <var class="Fa" style="white-space: nowrap;">zip_uint64_t start</var>, + <var class="Fa" style="white-space: nowrap;">zip_int64_t len</var>, + <var class="Fa" style="white-space: nowrap;">zip_error_t *error</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The functions <code class="Fn">zip_source_win32w</code>() and + <code class="Fn">zip_source_win32w_create</code>() create a zip source on + Windows using a Windows Unicode name. They open <var class="Ar">fname</var> + and read <var class="Ar">len</var> bytes from offset + <var class="Ar">start</var> from it. If <var class="Ar">len</var> is 0 or -1, + the whole file (starting from <var class="Ar">start</var>) is used. +<p class="Pp">If the file supports seek, the source can be used to open a zip + archive from.</p> +<p class="Pp">The file is opened and read when the data from the source is used, + usually by <code class="Fn">zip_close</code>() or + <code class="Fn">zip_open_from_source</code>().</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, the created source is returned. Otherwise, + <code class="Dv">NULL</code> is returned and the error code in + <var class="Ar">archive</var> or <var class="Ar">error</var> is set to + indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_source_win32w</code>() and + <code class="Fn">zip_source_win32w_create</code>() fail if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">fname</var>, <var class="Ar">start</var>, or + <var class="Ar">len</var> are invalid.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_OPEN"><code class="Er" id="ZIP_ER_OPEN">ZIP_ER_OPEN</code></a>]</dt> + <dd>Opening <var class="Ar">fname</var> failed.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a>, + <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_source_win32a.html">zip_source_win32a(3)</a>, + <a class="Xr" href="zip_source_win32handle.html">zip_source_win32handle(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_win32w</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">June 22, 2018</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_win32w.man b/3rdparty/libzip/man/zip_source_win32w.man new file mode 100644 index 0000000000000000000000000000000000000000..e1241fc40a1a26539f91018ca9763169d3d52b90 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_win32w.mdoc b/3rdparty/libzip/man/zip_source_win32w.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..904760bcb32c79933fa420a26427578f09ff1b74 --- /dev/null +++ b/3rdparty/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-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_window.html b/3rdparty/libzip/man/zip_source_window.html new file mode 100644 index 0000000000000000000000000000000000000000..aa38ca7ecef770ea7f91fae1cfa334c4b6a22644 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_window.html @@ -0,0 +1,123 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_source_window.mdoc -- create zip data source overlay + Copyright (C) 2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_WINDOW(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_WINDOW(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_WINDOW(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_window_create</code> — +<div class="Nd">create zip data source overlay</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_window_create</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + start</var>, <var class="Fa" style="white-space: nowrap;">zip_int64_t + len</var>, <var class="Fa" style="white-space: nowrap;">zip_error_t + *error</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_source_window_create</code>() function create a zip + source from an underlying zip source, restricting access to a particular + window starting at byte <var class="Ar">start</var> and having size + <var class="Ar">len</var>. If <var class="Ar">len</var> is -1, the window + spans to the end of the underlying source. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, the created source is returned. Otherwise, + <code class="Dv">NULL</code> is returned and the error code in + <var class="Ar">error</var> is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_source_window_create</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">src</var> is <code class="Dv">NULL</code>; there is an + integer overflow adding <var class="Ar">start</var> and + <var class="Ar">len</var>; or <var class="Ar">len</var> is less than + -1.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a> + <a class="Xr" href="zip_source.html">zip_source(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_window_create</code>() was added in libzip 1.8.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">April 29, 2021</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_window.man b/3rdparty/libzip/man/zip_source_window.man new file mode 100644 index 0000000000000000000000000000000000000000..8b53ac8f86b982e126ba6c0e7feaa59792d20721 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_window.man @@ -0,0 +1,96 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_window.mdoc -- create zip data source overlay +.\" Copyright (C) 2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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_WINDOW" "3" "April 29, 2021" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_window_create\fR +\- create zip data source overlay +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include <zip.h>\fR +.sp +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_window_create\fR(\fIzip_source_t\ *source\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_source_window_create\fR() +function create a zip source from an underlying zip source, +restricting access to a particular window starting at byte +\fIstart\fR +and having size +\fIlen\fR. +If +\fIlen\fR +is \-1, the window spans to the end of the underlying source. +.SH "RETURN VALUES" +Upon successful completion, the created source is returned. +Otherwise, +\fRNULL\fR +is returned and the error code in +\fIerror\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_source_window_create\fR() +fails if: +.TP 19n +[\fRZIP_ER_INVAL\fR] +\fIsrc\fR +is +\fRNULL\fR; +there is an integer overflow adding +\fIstart\fR +and +\fIlen\fR; +or +\fIlen\fR +is less than \-1. +.TP 19n +[\fRZIP_ER_MEMORY\fR] +Required memory could not be allocated. +.SH "SEE ALSO" +libzip(3), +zip_source(3) +zip_source(3) +.SH "HISTORY" +\fBzip_source_window_create\fR() +was added in libzip 1.8.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/3rdparty/libzip/man/zip_source_window.mdoc b/3rdparty/libzip/man/zip_source_window.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..a6c952478c665ff02adc65cda2360a37135ac11b --- /dev/null +++ b/3rdparty/libzip/man/zip_source_window.mdoc @@ -0,0 +1,91 @@ +.\" zip_source_window.mdoc -- create zip data source overlay +.\" Copyright (C) 2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 29, 2021 +.Dt ZIP_SOURCE_WINDOW 3 +.Os +.Sh NAME +.Nm zip_source_window_create +.Nd create zip data source overlay +.Sh LIBRARY +libzip (-lzip) +.Sh SYNOPSIS +.In zip.h +.Ft zip_source_t * +.Fn zip_source_window_create "zip_source_t *source" "zip_uint64_t start" "zip_int64_t len" "zip_error_t *error" +.Sh DESCRIPTION +The +.Fn zip_source_window_create +function create a zip source from an underlying zip source, +restricting access to a particular window starting at byte +.Ar start +and having size +.Ar len . +If +.Ar len +is \-1, the window spans to the end of the underlying source. +.Sh RETURN VALUES +Upon successful completion, the created source is returned. +Otherwise, +.Dv NULL +is returned and the error code in +.Ar error +is set to indicate the error. +.Sh ERRORS +.Fn zip_source_window_create +fails if: +.Bl -tag -width Er +.It Bq Er ZIP_ER_INVAL +.Ar src +is +.Dv NULL ; +there is an integer overflow adding +.Ar start +and +.Ar len ; +or +.Ar len +is less than \-1. +.It Bq Er ZIP_ER_MEMORY +Required memory could not be allocated. +.El +.Sh SEE ALSO +.Xr libzip 3 , +.Xr zip_source 3 +.Xr zip_source 3 +.Sh HISTORY +.Fn zip_source_window_create +was added in libzip 1.8.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/3rdparty/libzip/man/zip_source_write.html b/3rdparty/libzip/man/zip_source_write.html new file mode 100644 index 0000000000000000000000000000000000000000..88749bce8e7b22f092aeb0d94c2c6f92c4be78b6 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_write.html @@ -0,0 +1,115 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_WRITE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_WRITE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_WRITE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_write</code> — +<div class="Nd">write data to zip source</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_int64_t</var> + <br/> + <code class="Fn">zip_source_write</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t + *source</var>, <var class="Fa" style="white-space: nowrap;">const void + *data</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + len</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The function <code class="Fn">zip_source_write</code>() writes + <var class="Ar">len</var> bytes from the buffer <var class="Ar">data</var> to + the zip source <var class="Ar">source</var> at the current write offset. +<p class="Pp">The zip source <var class="Ar">source</var> has to be prepared for + writing by calling + <a class="Xr" href="zip_source_begin_write.html">zip_source_begin_write(3)</a> + first.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion the number of bytes written is returned. Otherwise, + -1 is returned and the error information in <var class="Ar">source</var> is + set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a>, + <a class="Xr" href="zip_source_begin_write.html">zip_source_begin_write(3)</a>, + <a class="Xr" href="zip_source_commit_write.html">zip_source_commit_write(3)</a>, + <a class="Xr" href="zip_source_rollback_write.html">zip_source_rollback_write(3)</a>, + <a class="Xr" href="zip_source_seek_write.html">zip_source_seek_write(3)</a>, + <a class="Xr" href="zip_source_tell_write.html">zip_source_tell_write(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_write</code>() was added in libzip 1.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_write.man b/3rdparty/libzip/man/zip_source_write.man new file mode 100644 index 0000000000000000000000000000000000000000..58d808ee20bc002894990a503a39a40d6c2d1574 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_source_write.mdoc b/3rdparty/libzip/man/zip_source_write.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..00836b03480fd09435f74762c9b86c5f34e1a0a7 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_source_zip.html b/3rdparty/libzip/man/zip_source_zip.html new file mode 100644 index 0000000000000000000000000000000000000000..067e72576f3d0e36fd498c38eaf7d2693ee77be3 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_zip.html @@ -0,0 +1,157 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zip_source_zip.mdoc -- create data source from zip file + Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_SOURCE_ZIP(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_SOURCE_ZIP(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_SOURCE_ZIP(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_source_zip</code>, + <code class="Nm">zip_source_zip_create</code> — +<div class="Nd">create data source from zip file</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_zip</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_t + *srcarchive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + srcidx</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + start</var>, <var class="Fa" style="white-space: nowrap;">zip_int64_t + len</var>);</p> +<p class="Pp"><var class="Ft">zip_source_t *</var> + <br/> + <code class="Fn">zip_source_zip_create</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *srcarchive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + srcidx</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + start</var>, <var class="Fa" style="white-space: nowrap;">zip_int64_t + len</var>, <var class="Fa" style="white-space: nowrap;">zip_error_t + *error</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The functions <code class="Fn">zip_source_zip</code>() and + <code class="Fn">zip_source_zip_create</code>() create a zip source from a + file in a zip archive. The <var class="Ar">srcarchive</var> argument is the + (open) zip archive containing the source zip file at index + <var class="Ar">srcidx</var>. <var class="Ar">len</var> bytes from offset + <var class="Ar">start</var> will be used in the zip_source. If + <var class="Ar">len</var> is 0 or -1, the rest of the file, starting from + <var class="Ar">start</var>, is used. If <var class="Ar">start</var> is zero + and <var class="Ar">len</var> is -1, the whole file will be copied without + decompressing it. +<p class="Pp">Supported flags are:</p> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#ZIP_FL_UNCHANGED"><code class="Dv" id="ZIP_FL_UNCHANGED">ZIP_FL_UNCHANGED</code></a></dt> + <dd>Try to get the original data without any changes that may have been made + to <var class="Ar">srcarchive</var> after opening it.</dd> + <dt><a class="permalink" href="#ZIP_FL_RECOMPRESS"><code class="Dv" id="ZIP_FL_RECOMPRESS">ZIP_FL_RECOMPRESS</code></a></dt> + <dd>When adding the data from <var class="Ar">srcarchive</var>, re-compress it + using the current settings instead of copying the compressed data.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion, the created source is returned. Otherwise, + <code class="Dv">NULL</code> is returned and the error code in + <var class="Ar">archive</var> or <var class="Ar">error</var> is set to + indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_source_zip</code>() and + <code class="Fn">zip_source_zip_create</code>() fail if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_CHANGED"><code class="Er" id="ZIP_ER_CHANGED">ZIP_ER_CHANGED</code></a>]</dt> + <dd>Unchanged data was requested, but it is not available.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">srcarchive</var>, <var class="Ar">srcidx</var>, + <var class="Ar">start</var>, or <var class="Ar">len</var> are + invalid.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt> + <dd>Required memory could not be allocated.</dd> +</dl> +Additionally, it can return all error codes from + <code class="Fn">zip_stat_index</code>() and + <code class="Fn">zip_fopen_index</code>(). +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a>, + <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a>, + <a class="Xr" href="zip_source.html">zip_source(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_source_zip</code>() was added in libzip 1.0. + <code class="Fn">zip_source_zip_create</code>() was added in libzip 1.8.0. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">April 4, 2021</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_source_zip.man b/3rdparty/libzip/man/zip_source_zip.man new file mode 100644 index 0000000000000000000000000000000000000000..14f1b24d2796b5fd59a84979212c4ad3d5e33f2a --- /dev/null +++ b/3rdparty/libzip/man/zip_source_zip.man @@ -0,0 +1,145 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_source_zip.mdoc -- create data source from zip file +.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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" "April 4, 2021" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_source_zip\fR, +\fBzip_source_zip_create\fR +\- create data source from zip file +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include <zip.h>\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 +.PP +\fIzip_source_t *\fR +.br +.PD 0 +.HP 4n +\fBzip_source_zip_create\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, \fIzip_error_t\ *error\fR); +.PD +.SH "DESCRIPTION" +The functions +\fBzip_source_zip\fR() +and +\fBzip_source_zip_create\fR() +create 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 +or +\fIerror\fR +is set to indicate the error. +.SH "ERRORS" +\fBzip_source_zip\fR() +and +\fBzip_source_zip_create\fR() +fail 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. +\fBzip_source_zip_create\fR() +was added in libzip 1.8.0. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fItk@giga.or.at\fR> diff --git a/3rdparty/libzip/man/zip_source_zip.mdoc b/3rdparty/libzip/man/zip_source_zip.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..27f33451b65a5ee6b5b21a0742d0a54081b04c09 --- /dev/null +++ b/3rdparty/libzip/man/zip_source_zip.mdoc @@ -0,0 +1,131 @@ +.\" zip_source_zip.mdoc -- create data source from zip file +.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 4, 2021 +.Dt ZIP_SOURCE_ZIP 3 +.Os +.Sh NAME +.Nm zip_source_zip , +.Nm zip_source_zip_create +.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" +.Ft zip_source_t * +.Fn zip_source_zip_create "zip_t *srcarchive" "zip_uint64_t srcidx" "zip_flags_t flags" "zip_uint64_t start" "zip_int64_t len" "zip_error_t *error" +.Sh DESCRIPTION +The functions +.Fn zip_source_zip +and +.Fn zip_source_zip_create +create 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 +or +.Ar error +is set to indicate the error. +.Sh ERRORS +.Fn zip_source_zip +and +.Fn zip_source_zip_create +fail 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. +.Fn zip_source_zip_create +was added in libzip 1.8.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/3rdparty/libzip/man/zip_stat.html b/3rdparty/libzip/man/zip_stat.html new file mode 100644 index 0000000000000000000000000000000000000000..699c78f64b006dee57b0bea9a0742da81a1e15c2 --- /dev/null +++ b/3rdparty/libzip/man/zip_stat.html @@ -0,0 +1,190 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_STAT(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_STAT(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_STAT(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_stat</code>, <code class="Nm">zip_stat_index</code> + — +<div class="Nd">get information about file</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_stat</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">const char + *fname</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>, <var class="Fa" style="white-space: nowrap;">zip_stat_t + *sb</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_stat_index</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t + flags</var>, <var class="Fa" style="white-space: nowrap;">zip_stat_t + *sb</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_stat</code>() function obtains information about the + file named <var class="Ar">fname</var> in <var class="Ar">archive</var>. The + <var class="Ar">flags</var> argument specifies how the name lookup should be + done. Its values are described in + <a class="Xr" href="zip_name_locate.html">zip_name_locate(3)</a>. Also, + <code class="Dv">ZIP_FL_UNCHANGED</code> may be + <i class="Em">or</i><span class="No">'ed</span> to it to request information + about the original file in the archive, ignoring any changes made. +<p class="Pp">The <code class="Fn">zip_stat_index</code>() function obtains + information about the file at position <var class="Ar">index</var>.</p> +<p class="Pp">The <var class="Ar">sb</var> argument is a pointer to a + <var class="Ft">struct zip_stat</var> (shown below), into which information + about the file is placed.</p> +<div class="Bd Pp"> +<pre> +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 */ +}; +</pre> +</div> +The structure pointed to by <var class="Ar">sb</var> must be allocated before + calling <code class="Fn">zip_stat</code>() or + <code class="Fn">zip_stat_index</code>(). +<p class="Pp">The <var class="Ar">valid</var> field of the structure specifies + which other fields are valid. Check if the flag defined by the following + defines are in <var class="Ar">valid</var> before accessing the fields:</p> +<div class="Bd-indent"> +<dl class="Bl-tag Bl-compact"> + <dt><a class="permalink" href="#ZIP_STAT_NAME"><code class="Dv" id="ZIP_STAT_NAME">ZIP_STAT_NAME</code></a></dt> + <dd><var class="Ar">name</var></dd> + <dt><a class="permalink" href="#ZIP_STAT_INDEX"><code class="Dv" id="ZIP_STAT_INDEX">ZIP_STAT_INDEX</code></a></dt> + <dd><var class="Ar">index</var></dd> + <dt><a class="permalink" href="#ZIP_STAT_SIZE"><code class="Dv" id="ZIP_STAT_SIZE">ZIP_STAT_SIZE</code></a></dt> + <dd><var class="Ar">size</var></dd> + <dt><a class="permalink" href="#ZIP_STAT_COMP_SIZE"><code class="Dv" id="ZIP_STAT_COMP_SIZE">ZIP_STAT_COMP_SIZE</code></a></dt> + <dd><var class="Ar">comp_size</var></dd> + <dt><a class="permalink" href="#ZIP_STAT_MTIME"><code class="Dv" id="ZIP_STAT_MTIME">ZIP_STAT_MTIME</code></a></dt> + <dd><var class="Ar">mtime</var></dd> + <dt><a class="permalink" href="#ZIP_STAT_CRC"><code class="Dv" id="ZIP_STAT_CRC">ZIP_STAT_CRC</code></a></dt> + <dd><var class="Ar">crc</var></dd> + <dt><a class="permalink" href="#ZIP_STAT_COMP_METHOD"><code class="Dv" id="ZIP_STAT_COMP_METHOD">ZIP_STAT_COMP_METHOD</code></a></dt> + <dd><var class="Ar">comp_method</var></dd> + <dt><a class="permalink" href="#ZIP_STAT_ENCRYPTION_METHOD"><code class="Dv" id="ZIP_STAT_ENCRYPTION_METHOD">ZIP_STAT_ENCRYPTION_METHOD</code></a></dt> + <dd><var class="Ar">encryption_method</var></dd> + <dt><a class="permalink" href="#ZIP_STAT_FLAGS"><code class="Dv" id="ZIP_STAT_FLAGS">ZIP_STAT_FLAGS</code></a></dt> + <dd><var class="Ar">flags</var></dd> +</dl> +</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error information in <var class="Ar">archive</var> is set to indicate the + error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +The function <code class="Fn">zip_stat</code>() can fail for any of the errors + specified for the routine + <a class="Xr" href="zip_name_locate.html">zip_name_locate(3)</a>. +<p class="Pp">The function <code class="Fn">zip_stat_index</code>() fails and + sets the error information to <code class="Er">ZIP_ER_INVAL</code> if + <var class="Ar">index</var> is invalid. If + <code class="Dv">ZIP_FL_UNCHANGED</code> is not set and no information can + be obtained from the source callback, the error information is set to + <code class="Er">ZIP_ER_CHANGED</code>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_get_num_entries.html">zip_get_num_entries(3)</a>, + <a class="Xr" href="zip_name_locate.html">zip_name_locate(3)</a>, + <a class="Xr" href="zip_stat_init.html">zip_stat_init(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_stat</code>() was added in libzip 0.6. In libzip 0.11 the + type of <var class="Ar">flags</var> was changed from <var class="Vt">int</var> + to <var class="Vt">zip_flags_t</var>. +<p class="Pp"><code class="Fn">zip_stat_index</code>() was added in libzip 0.6. + In libzip 0.10 the type of <var class="Ar">index</var> was changed from + <var class="Vt">int</var> to <var class="Vt">zip_uint64_t</var>. In libzip + 0.11 the type of <var class="Ar">flags</var> was changed from + <var class="Vt">int</var> to <var class="Vt">zip_flags_t</var>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_stat.man b/3rdparty/libzip/man/zip_stat.man new file mode 100644 index 0000000000000000000000000000000000000000..93b6fdd5cbae94cf6eac91a5fe8a2a9621e1f291 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_stat.mdoc b/3rdparty/libzip/man/zip_stat.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..4d5661ef4c76789e1445919a4ff95fe85d93765f --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_stat_init.html b/3rdparty/libzip/man/zip_stat_init.html new file mode 100644 index 0000000000000000000000000000000000000000..99b36dee22601d4cd8ced00c7048fa8283d2f9e5 --- /dev/null +++ b/3rdparty/libzip/man/zip_stat_init.html @@ -0,0 +1,109 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_STAT_INIT(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_STAT_INIT(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_STAT_INIT(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_stat_init</code> — +<div class="Nd">initialize zip_stat structure</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">void</var> + <br/> + <code class="Fn">zip_stat_init</code>(<var class="Fa" style="white-space: nowrap;">zip_stat_t + *sb</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +The <code class="Fn">zip_stat_init</code>() function initializes the members of + a struct zip_stat. The current members are described in + <a class="Xr" href="zip_stat.html">zip_stat(3)</a>, but this function should + be used to initialize it to make sure none are missed. The structure pointed + to by <var class="Ar">sb</var> must be allocated before calling + <code class="Fn">zip_stat_init</code>(). +<p class="Pp">This function should be used by functions provided to + <a class="Xr" href="zip_source_function.html">zip_source_function(3)</a> + when returning <code class="Dv">ZIP_SOURCE_STAT</code> information to make + sure all fields are initialized.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +If <var class="Ar">sb</var> is valid, the function is always successful. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_stat.html">zip_stat(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_stat_init</code>() was added in libzip 0.8. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_stat_init.man b/3rdparty/libzip/man/zip_stat_init.man new file mode 100644 index 0000000000000000000000000000000000000000..75f3ea9b4d9f284546cbf3cb56e112c6f0ea11f9 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_stat_init.mdoc b/3rdparty/libzip/man/zip_stat_init.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..0d464a6149c2a65ae487fae21e46c41ba35649a2 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_unchange.html b/3rdparty/libzip/man/zip_unchange.html new file mode 100644 index 0000000000000000000000000000000000000000..671abede5869fe661842f807dc5c68c433ef59c1 --- /dev/null +++ b/3rdparty/libzip/man/zip_unchange.html @@ -0,0 +1,116 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_UNCHANGE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_UNCHANGE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_UNCHANGE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_unchange</code> — +<div class="Nd">undo changes to file in zip archive</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_unchange</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t + index</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +Changes to the file at position <var class="Ar">index</var> are reverted. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error code in <var class="Ar">archive</var> is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<code class="Fn">zip_unchange</code>() fails if: +<dl class="Bl-tag"> + <dt>[<a class="permalink" href="#ZIP_ER_EXISTS"><code class="Er" id="ZIP_ER_EXISTS">ZIP_ER_EXISTS</code></a>]</dt> + <dd>Unchanging the name would result in a duplicate name in the archive.</dd> + <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt> + <dd><var class="Ar">index</var> is not a valid file index in + <var class="Ar">zip</var>.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_unchange_all.html">zip_unchange_all(3)</a>, + <a class="Xr" href="zip_unchange_archive.html">zip_unchange_archive(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_unchange</code>() was added in libzip 0.6. In libzip 0.10 + the type of <var class="Ar">index</var> was changed from + <var class="Vt">int</var> to <var class="Vt">zip_uint64_t</var>. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_unchange.man b/3rdparty/libzip/man/zip_unchange.man new file mode 100644 index 0000000000000000000000000000000000000000..c7ec25f55d1863753a4d90da1d8d45ff75a7e1e0 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_unchange.mdoc b/3rdparty/libzip/man/zip_unchange.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..6bde36bb5af1d0d541c81c3097fe312eef6ddb3c --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_unchange_all.html b/3rdparty/libzip/man/zip_unchange_all.html new file mode 100644 index 0000000000000000000000000000000000000000..ab94a0038f2744006560c0b8ace5a4fb2e6aa26c --- /dev/null +++ b/3rdparty/libzip/man/zip_unchange_all.html @@ -0,0 +1,103 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_UNCHANGE_ALL(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_UNCHANGE_ALL(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_UNCHANGE_ALL(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_unchange_all</code> — +<div class="Nd">undo all changes in a zip archive</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_unchange_all</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +All changes to files and global information in <var class="Ar">archive</var> are + reverted. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error code in <var class="Ar">archive</var> is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_unchange.html">zip_unchange(3)</a>, + <a class="Xr" href="zip_unchange_archive.html">zip_unchange_archive(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_unchange_all</code>() was added in libzip 0.6. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_unchange_all.man b/3rdparty/libzip/man/zip_unchange_all.man new file mode 100644 index 0000000000000000000000000000000000000000..4fcbee3205dc52fc5c6564e0253b9b3cfe80e465 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_unchange_all.mdoc b/3rdparty/libzip/man/zip_unchange_all.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..b676eb557a7f7d33bebec950e8a218e5d626663b --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zip_unchange_archive.html b/3rdparty/libzip/man/zip_unchange_archive.html new file mode 100644 index 0000000000000000000000000000000000000000..f40ea4edcd4b4e937493371cc0ed5e8ce667085c --- /dev/null +++ b/3rdparty/libzip/man/zip_unchange_archive.html @@ -0,0 +1,103 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIP_UNCHANGE_ARCHIVE(3)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIP_UNCHANGE_ARCHIVE(3)</td> + <td class="head-vol">Library Functions Manual</td> + <td class="head-rtitle">ZIP_UNCHANGE_ARCHIVE(3)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zip_unchange_archive</code> — +<div class="Nd">undo global changes to zip archive</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1> +libzip (-lzip) +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<code class="In">#include <<a class="In">zip.h</a>></code> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">zip_unchange_archive</code>(<var class="Fa" style="white-space: nowrap;">zip_t + *archive</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +Revert all global changes to the archive <var class="Ar">archive</var>. This + reverts changes to the archive comment and global flags. +</section> +<section class="Sh"> +<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN + VALUES</a></h1> +Upon successful completion 0 is returned. Otherwise, -1 is returned and the + error code in <var class="Ar">archive</var> is set to indicate the error. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="libzip.html">libzip(3)</a>, + <a class="Xr" href="zip_unchange.html">zip_unchange(3)</a>, + <a class="Xr" href="zip_unchange_all.html">zip_unchange_all(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Fn">zip_unchange_archive</code>() was added in libzip 0.7. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zip_unchange_archive.man b/3rdparty/libzip/man/zip_unchange_archive.man new file mode 100644 index 0000000000000000000000000000000000000000..430eafc00c787923a2442f6b7fcca5ba2bf47ca7 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 <zip.h>\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/3rdparty/libzip/man/zip_unchange_archive.mdoc b/3rdparty/libzip/man/zip_unchange_archive.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..b3b3d3f1ad8b02d9f1f576545c93de196871f155 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/zipcmp.html b/3rdparty/libzip/man/zipcmp.html new file mode 100644 index 0000000000000000000000000000000000000000..9c341dae34b963536e9a26da461185b6773068cc --- /dev/null +++ b/3rdparty/libzip/man/zipcmp.html @@ -0,0 +1,126 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zipcmp.mdoc -- compare zip archives + Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIPCMP(1)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIPCMP(1)</td> + <td class="head-vol">General Commands Manual</td> + <td class="head-rtitle">ZIPCMP(1)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zipcmp</code> — +<div class="Nd">compare contents of zip archives</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<table class="Nm"> + <tr> + <td><code class="Nm">zipcmp</code></td> + <td>[<code class="Fl">-ChipqtVv</code>] <var class="Ar">archive1 + archive2</var></td> + </tr> +</table> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<code class="Nm">zipcmp</code> compares the zip archives or directories + <var class="Ar">archive1</var> and <var class="Ar">archive2</var> and checks + if they contain the same files, comparing their names, uncompressed sizes, and + CRCs. File order and compressed size differences are ignored. +<p class="Pp">Supported options:</p> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#C"><code class="Fl" id="C">-C</code></a></dt> + <dd>Check consistency of archives. Results in an error if archive is + inconsistent or not valid according to the zip specification.</dd> + <dt><a class="permalink" href="#h"><code class="Fl" id="h">-h</code></a></dt> + <dd>Display a short help message and exit.</dd> + <dt><a class="permalink" href="#i"><code class="Fl" id="i">-i</code></a></dt> + <dd>Compare names ignoring case distinctions.</dd> + <dt><a class="permalink" href="#p"><code class="Fl" id="p">-p</code></a></dt> + <dd>Enable paranoid checks. Compares extra fields, comments, and other meta + data. (Automatically disabled if one of the archives is a directory.) + These checks are skipped for files where the data differs.</dd> + <dt><a class="permalink" href="#q"><code class="Fl" id="q">-q</code></a></dt> + <dd>Quiet mode. Compare <code class="Fl">-v</code>.</dd> + <dt><a class="permalink" href="#t"><code class="Fl" id="t">-t</code></a></dt> + <dd>Test zip files by comparing the contents to their checksums.</dd> + <dt><a class="permalink" href="#V"><code class="Fl" id="V">-V</code></a></dt> + <dd>Display version information and exit.</dd> + <dt><a class="permalink" href="#v"><code class="Fl" id="v">-v</code></a></dt> + <dd>Verbose mode. Print details about differences to stdout. (This is the + default.)</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="EXIT_STATUS"><a class="permalink" href="#EXIT_STATUS">EXIT + STATUS</a></h1> +<code class="Nm">zipcmp</code> exits 0 if the two archives contain the same + files, 1 if they differ, and >1 if an error occurred. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="zipmerge.html">zipmerge(1)</a>, + <a class="Xr" href="ziptool.html">ziptool(1)</a>, + <a class="Xr" href="libzip.html">libzip(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Nm">zipcmp</code> was added in libzip 0.6. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">March 17, 2021</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zipcmp.man b/3rdparty/libzip/man/zipcmp.man new file mode 100644 index 0000000000000000000000000000000000000000..a5a8b1ba9b045ef28d89459a6edd7d2cb94c53bb --- /dev/null +++ b/3rdparty/libzip/man/zipcmp.man @@ -0,0 +1,102 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zipcmp.mdoc -- compare zip archives +.\" Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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" "March 17, 2021" "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\-ChipqtVv\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\-C\fR +Check consistency of archives. +Results in an error if archive is inconsistent or not valid +according to the zip specification. +.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, comments, and other meta data. +(Automatically disabled if one of the archives is a directory.) +These checks are skipped for files where the data differs. +.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/3rdparty/libzip/man/zipcmp.mdoc b/3rdparty/libzip/man/zipcmp.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..d1b151301f9541ff76923a6c30f52529c4526014 --- /dev/null +++ b/3rdparty/libzip/man/zipcmp.mdoc @@ -0,0 +1,95 @@ +.\" zipcmp.mdoc -- compare zip archives +.\" Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 March 17, 2021 +.Dt ZIPCMP 1 +.Os +.Sh NAME +.Nm zipcmp +.Nd compare contents of zip archives +.Sh SYNOPSIS +.Nm +.Op Fl ChipqtVv +.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 C +Check consistency of archives. +Results in an error if archive is inconsistent or not valid +according to the zip specification. +.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, comments, and other meta data. +(Automatically disabled if one of the archives is a directory.) +These checks are skipped for files where the data differs. +.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/3rdparty/libzip/man/zipmerge.html b/3rdparty/libzip/man/zipmerge.html new file mode 100644 index 0000000000000000000000000000000000000000..86651b3d6842e591c040410ba2132eff9686339d --- /dev/null +++ b/3rdparty/libzip/man/zipmerge.html @@ -0,0 +1,132 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated file. Do not edit. + zipmerge.mdoc -- merge zip archives + Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIPMERGE(1)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIPMERGE(1)</td> + <td class="head-vol">General Commands Manual</td> + <td class="head-rtitle">ZIPMERGE(1)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">zipmerge</code> — +<div class="Nd">merge zip archives</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<table class="Nm"> + <tr> + <td><code class="Nm">zipmerge</code></td> + <td>[<code class="Fl">-DhIiSsV</code>] <var class="Ar">target-zip</var> + <var class="Ar">source-zip</var> [<var class="Ar">source-zip + ...</var>]</td> + </tr> +</table> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<code class="Nm">zipmerge</code> merges the source zip archives + <var class="Ar">source-zip</var> into the target zip archive + <var class="Ar">target-zip</var>. By default, files in the source zip archives + overwrite existing files of the same name in the target zip archive. +<p class="Pp">Supported options:</p> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#D"><code class="Fl" id="D">-D</code></a></dt> + <dd>Ignore directory components in file name comparisons. This option is slow + for archives with many files.</dd> + <dt><a class="permalink" href="#h"><code class="Fl" id="h">-h</code></a></dt> + <dd>Display a short help message and exit.</dd> + <dt><a class="permalink" href="#I"><code class="Fl" id="I">-I</code></a></dt> + <dd>Ignore case in file name comparisons This option is slow for archives with + many files.</dd> + <dt><a class="permalink" href="#i"><code class="Fl" id="i">-i</code></a></dt> + <dd>Ask before overwriting files. See also <code class="Fl">-s</code>.</dd> + <dt><a class="permalink" href="#S"><code class="Fl" id="S">-S</code></a></dt> + <dd>Do not overwrite files that have the same size and CRC32 in both the + source and target archives.</dd> + <dt><a class="permalink" href="#s"><code class="Fl" id="s">-s</code></a></dt> + <dd>When <code class="Fl">-i</code> is given, do not before overwriting files + that have the same size and CRC32.</dd> + <dt><a class="permalink" href="#V"><code class="Fl" id="V">-V</code></a></dt> + <dd>Display version information and exit.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="EXIT_STATUS"><a class="permalink" href="#EXIT_STATUS">EXIT + STATUS</a></h1> +<code class="Nm">zipmerge</code> exits 0 on success and >1 if an error + occurred. +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="zipcmp.html">zipcmp(1)</a>, + <a class="Xr" href="ziptool.html">ziptool(1)</a>, + <a class="Xr" href="libzip.html">libzip(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Nm">zipmerge</code> was added in libzip 0.6. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +<section class="Sh"> +<h1 class="Sh" id="CAVEATS"><a class="permalink" href="#CAVEATS">CAVEATS</a></h1> +<code class="Nm">zipmerge</code> uses one open file descriptor per zip archive. + If you need to merge a lot of zip archives, check your shell's file descriptor + ulimit and either increase it or run <code class="Nm">zipmerge</code> multiple + times with e.g. 1000 source zip archives each time. +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">March 17, 2021</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/zipmerge.man b/3rdparty/libzip/man/zipmerge.man new file mode 100644 index 0000000000000000000000000000000000000000..31f8e582edf875179777a490eaacff27fd870976 --- /dev/null +++ b/3rdparty/libzip/man/zipmerge.man @@ -0,0 +1,104 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zipmerge.mdoc -- merge zip archives +.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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" "March 17, 2021" "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> +.SH "CAVEATS" +\fBzipmerge\fR +uses one open file descriptor per zip archive. +If you need to merge a lot of zip archives, check your shell's +file descriptor ulimit and either increase it or run +\fBzipmerge\fR +multiple times with e.g. 1000 source zip archives each time. diff --git a/3rdparty/libzip/man/zipmerge.mdoc b/3rdparty/libzip/man/zipmerge.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..1325f8cf869856004a01bb9691810daecb08e0b6 --- /dev/null +++ b/3rdparty/libzip/man/zipmerge.mdoc @@ -0,0 +1,98 @@ +.\" zipmerge.mdoc -- merge zip archives +.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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 March 17, 2021 +.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 +.Sh CAVEATS +.Nm +uses one open file descriptor per zip archive. +If you need to merge a lot of zip archives, check your shell's +file descriptor ulimit and either increase it or run +.Nm +multiple times with e.g. 1000 source zip archives each time. diff --git a/3rdparty/libzip/man/ziptool.html b/3rdparty/libzip/man/ziptool.html new file mode 100644 index 0000000000000000000000000000000000000000..b5fd2b12e2099571d5599ebc2438468709a80d00 --- /dev/null +++ b/3rdparty/libzip/man/ziptool.html @@ -0,0 +1,315 @@ +<!DOCTYPE html> +<html> +<!-- This is an automatically generated 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<head> + <meta charset="utf-8"/> + <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/> + <title>ZIPTOOL(1)</title> +</head> +<body> +<table class="head"> + <tr> + <td class="head-ltitle">ZIPTOOL(1)</td> + <td class="head-vol">General Commands Manual</td> + <td class="head-rtitle">ZIPTOOL(1)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<code class="Nm">ziptool</code> — +<div class="Nd">modify zip archives</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<table class="Nm"> + <tr> + <td><code class="Nm">ziptool</code></td> + <td>[<code class="Fl">-ceghnrst</code>] [<code class="Fl">-l</code> + <var class="Ar">length</var>] [<code class="Fl">-o</code> + <var class="Ar">offset</var>] <var class="Ar">zip-archive</var> + <code class="Cm">command</code> [<var class="Ar">command-args ...</var>] + [<code class="Cm">command</code> [<var class="Ar">command-args ...</var>] + ...]</td> + </tr> +</table> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<code class="Nm">ziptool</code> modifies the zip archive + <var class="Ar">zip-archive</var> according to the + <var class="Ar">commands</var> given. +<p class="Pp">Supported options:</p> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#c"><code class="Fl" id="c">-c</code></a></dt> + <dd>Check zip archive consistency when opening it.</dd> + <dt><a class="permalink" href="#e"><code class="Fl" id="e">-e</code></a></dt> + <dd>Error if archive already exists (only useful with + <code class="Fl">-n</code>).</dd> + <dt><a class="permalink" href="#g"><code class="Fl" id="g">-g</code></a></dt> + <dd>Guess file name encoding (for <code class="Cm">stat</code> command).</dd> + <dt><a class="permalink" href="#h"><code class="Fl" id="h">-h</code></a></dt> + <dd>Display help.</dd> + <dt><a class="permalink" href="#l"><code class="Fl" id="l">-l</code></a> + <var class="Ar">length</var></dt> + <dd>Only read <var class="Ar">length</var> bytes of archive. See also + <code class="Fl">-o</code>.</dd> + <dt><a class="permalink" href="#n"><code class="Fl" id="n">-n</code></a></dt> + <dd>Create archive if it doesn't exist. See also + <code class="Fl">-e</code>.</dd> + <dt><a class="permalink" href="#o"><code class="Fl" id="o">-o</code></a> + <var class="Ar">offset</var></dt> + <dd>Start reading input archive from <var class="Ar">offset</var>. See also + <code class="Fl">-l</code>.</dd> + <dt><a class="permalink" href="#r"><code class="Fl" id="r">-r</code></a></dt> + <dd>Print raw file name encoding without translation (for + <code class="Cm">stat</code> command).</dd> + <dt><a class="permalink" href="#s"><code class="Fl" id="s">-s</code></a></dt> + <dd>Follow file name convention strictly (for <code class="Cm">stat</code> + command).</dd> + <dt><a class="permalink" href="#t"><code class="Fl" id="t">-t</code></a></dt> + <dd>Disregard current file contents, if any. <i class="Em">Note</i>: use this + with care, it deletes all existing file contents when you modify the + archive.</dd> +</dl> +<section class="Ss"> +<h2 class="Ss" id="Commands"><a class="permalink" href="#Commands">Commands</a></h2> +For all commands below, the index is zero-based. In other words, the first entry + in the zip archive has index 0. +<p class="Pp">Supported commands and arguments are:</p> +<dl class="Bl-tag"> + <dt><a class="permalink" href="#add"><code class="Cm" id="add">add</code></a> + <var class="Ar">name content</var></dt> + <dd>Add file called <var class="Ar">name</var> using the string + <var class="Ar">content</var> from the command line as data.</dd> + <dt><a class="permalink" href="#add_dir"><code class="Cm" id="add_dir">add_dir</code></a> + <var class="Ar">name</var></dt> + <dd>Add directory <var class="Ar">name</var>.</dd> + <dt><a class="permalink" href="#add_file"><code class="Cm" id="add_file">add_file</code></a> + <var class="Ar">name file_to_add offset len</var></dt> + <dd>Add file <var class="Ar">name</var> to archive, using + <var class="Ar">len</var> bytes from the file + <var class="Ar">file_to_add</var> as input data, starting at + <var class="Ar">offset</var>.</dd> + <dt><a class="permalink" href="#add_from_zip"><code class="Cm" id="add_from_zip">add_from_zip</code></a> + <var class="Ar">name archivename index offset len</var></dt> + <dd>Add file called <var class="Ar">name</var> to archive using data from + another zip archive <var class="Ar">archivename</var> using the entry with + index <var class="Ar">index</var> and reading <var class="Ar">len</var> + bytes from <var class="Ar">offset</var>.</dd> + <dt><a class="permalink" href="#cat"><code class="Cm" id="cat">cat</code></a> + <var class="Ar">index</var></dt> + <dd>Output file contents for entry <var class="Ar">index</var> to stdout.</dd> + <dt><a class="permalink" href="#count_extra"><code class="Cm" id="count_extra">count_extra</code></a> + <var class="Ar">index flags</var></dt> + <dd>Print the number of extra fields for archive entry + <var class="Ar">index</var> using <var class="Ar">flags</var>.</dd> + <dt><a class="permalink" href="#count_extra_by_id"><code class="Cm" id="count_extra_by_id">count_extra_by_id</code></a> + <var class="Ar">index extra_id flags</var></dt> + <dd>Print number of extra fields of type <var class="Ar">extra_id</var> for + archive entry <var class="Ar">index</var> using + <var class="Ar">flags</var>.</dd> + <dt><a class="permalink" href="#delete"><code class="Cm" id="delete">delete</code></a> + <var class="Ar">index</var></dt> + <dd>Remove entry at <var class="Ar">index</var> from zip archive.</dd> + <dt><a class="permalink" href="#delete_extra"><code class="Cm" id="delete_extra">delete_extra</code></a> + <var class="Ar">index extra_idx flags</var></dt> + <dd>Remove extra field number <var class="Ar">extra_idx</var> from archive + entry <var class="Ar">index</var> using <var class="Ar">flags</var>.</dd> + <dt><a class="permalink" href="#delete_extra_by_id"><code class="Cm" id="delete_extra_by_id">delete_extra_by_id</code></a> + <var class="Ar">index extra_id extra_index flags</var></dt> + <dd>Remove extra field number <var class="Ar">extra_index</var> of type + <var class="Ar">extra_id</var> from archive entry + <var class="Ar">index</var> using <var class="Ar">flags</var>.</dd> + <dt><a class="permalink" href="#get_archive_comment"><code class="Cm" id="get_archive_comment">get_archive_comment</code></a></dt> + <dd>Print archive comment.</dd> + <dt><a class="permalink" href="#get_extra"><code class="Cm" id="get_extra">get_extra</code></a> + <var class="Ar">index extra_index flags</var></dt> + <dd>Print extra field <var class="Ar">extra_index</var> for archive entry + <var class="Ar">index</var> using <var class="Ar">flags</var>.</dd> + <dt><a class="permalink" href="#get_extra_by_id"><code class="Cm" id="get_extra_by_id">get_extra_by_id</code></a> + <var class="Ar">index extra_id extra_index flags</var></dt> + <dd>Print extra field <var class="Ar">extra_index</var> of type + <var class="Ar">extra_id</var> for archive entry + <var class="Ar">index</var> using <var class="Ar">flags</var>.</dd> + <dt><a class="permalink" href="#get_file_comment"><code class="Cm" id="get_file_comment">get_file_comment</code></a> + <var class="Ar">index</var></dt> + <dd>Get file comment for archive entry <var class="Ar">index</var>.</dd> + <dt><a class="permalink" href="#get_num_entries"><code class="Cm" id="get_num_entries">get_num_entries</code></a> + <var class="Ar">flags</var></dt> + <dd>Print number of entries in archive using <var class="Ar">flags</var>.</dd> + <dt><a class="permalink" href="#name_locate"><code class="Cm" id="name_locate">name_locate</code></a> + <var class="Ar">name flags</var></dt> + <dd>Find entry in archive with the filename <var class="Ar">name</var> using + <var class="Ar">flags</var> and print its index.</dd> + <dt><a class="permalink" href="#rename"><code class="Cm" id="rename">rename</code></a> + <var class="Ar">index name</var></dt> + <dd>Rename archive entry <var class="Ar">index</var> to + <var class="Ar">name</var>.</dd> + <dt><a class="permalink" href="#replace_file_contents"><code class="Cm" id="replace_file_contents">replace_file_contents</code></a> + <var class="Ar">index data</var></dt> + <dd>Replace file contents for archive entry <var class="Ar">index</var> with + the string <var class="Ar">data</var>.</dd> + <dt><a class="permalink" href="#set_archive_comment"><code class="Cm" id="set_archive_comment">set_archive_comment</code></a> + <var class="Ar">comment</var></dt> + <dd>Set archive comment to <var class="Ar">comment</var>.</dd> + <dt><a class="permalink" href="#set_extra"><code class="Cm" id="set_extra">set_extra</code></a> + <var class="Ar">index extra_id extra_index flags value</var></dt> + <dd>Set extra field number <var class="Ar">extra_index</var> of type + <var class="Ar">extra_id</var> for archive entry + <var class="Ar">index</var> using <var class="Ar">flags</var> to + <var class="Ar">value</var>.</dd> + <dt><a class="permalink" href="#set_file_comment"><code class="Cm" id="set_file_comment">set_file_comment</code></a> + <var class="Ar">index comment</var></dt> + <dd>Set file comment for archive entry <var class="Ar">index</var> to string + <var class="Ar">comment</var>.</dd> + <dt><a class="permalink" href="#set_file_compression"><code class="Cm" id="set_file_compression">set_file_compression</code></a> + <var class="Ar">index method compression_flags</var></dt> + <dd>Set file compression method for archive entry <var class="Ar">index</var> + to <var class="Ar">method</var> using + <var class="Ar">compression_flags</var>. <i class="Em">Note</i>: + Currently, <var class="Ar">compression_flags</var> are ignored.</dd> + <dt><a class="permalink" href="#set_file_encryption"><code class="Cm" id="set_file_encryption">set_file_encryption</code></a> + <var class="Ar">index method password</var></dt> + <dd>Set file encryption method for archive entry <var class="Ar">index</var> + to <var class="Ar">method</var> with password + <var class="Ar">password</var>.</dd> + <dt><a class="permalink" href="#set_file_mtime"><code class="Cm" id="set_file_mtime">set_file_mtime</code></a> + <var class="Ar">index timestamp</var></dt> + <dd>Set file modification time for archive entry <var class="Ar">index</var> + to UNIX mtime <var class="Ar">timestamp</var>.</dd> + <dt><a class="permalink" href="#set_file_mtime_all"><code class="Cm" id="set_file_mtime_all">set_file_mtime_all</code></a> + <var class="Ar">timestamp</var></dt> + <dd>Set file modification time for all archive entries to UNIX mtime + <var class="Ar">timestamp</var>.</dd> + <dt><a class="permalink" href="#set_password"><code class="Cm" id="set_password">set_password</code></a> + <var class="Ar">password</var></dt> + <dd>Set default password for encryption/decryption to + <var class="Ar">password</var>.</dd> + <dt><a class="permalink" href="#stat"><code class="Cm" id="stat">stat</code></a> + <var class="Ar">index</var></dt> + <dd>Print information about archive entry <var class="Ar">index</var>.</dd> +</dl> +</section> +<section class="Ss"> +<h2 class="Ss" id="Flags"><a class="permalink" href="#Flags">Flags</a></h2> +Some commands take flag arguments. Supported flags are: +<div class="Bd-indent"> +<dl class="Bl-tag Bl-compact"> + <dt><var class="Ar">C</var></dt> + <dd><a class="permalink" href="#ZIP_FL_NOCASE"><code class="Dv" id="ZIP_FL_NOCASE">ZIP_FL_NOCASE</code></a></dd> + <dt><var class="Ar">c</var></dt> + <dd><a class="permalink" href="#ZIP_FL_CENTRAL"><code class="Dv" id="ZIP_FL_CENTRAL">ZIP_FL_CENTRAL</code></a></dd> + <dt><var class="Ar">d</var></dt> + <dd><a class="permalink" href="#ZIP_FL_NODIR"><code class="Dv" id="ZIP_FL_NODIR">ZIP_FL_NODIR</code></a></dd> + <dt><var class="Ar">l</var></dt> + <dd><a class="permalink" href="#ZIP_FL_LOCAL"><code class="Dv" id="ZIP_FL_LOCAL">ZIP_FL_LOCAL</code></a></dd> + <dt><var class="Ar">u</var></dt> + <dd><a class="permalink" href="#ZIP_FL_UNCHANGED"><code class="Dv" id="ZIP_FL_UNCHANGED">ZIP_FL_UNCHANGED</code></a></dd> +</dl> +</div> +</section> +<section class="Ss"> +<h2 class="Ss" id="Compression_Methods"><a class="permalink" href="#Compression_Methods">Compression + Methods</a></h2> +Some commands take compression method arguments. Supported methods are: +<ul class="Bl-bullet Bd-indent Bl-compact"> + <li><a class="permalink" href="#default"><code class="Dv" id="default">default</code></a></li> + <li><a class="permalink" href="#deflate"><code class="Dv" id="deflate">deflate</code></a></li> + <li><a class="permalink" href="#store"><code class="Dv" id="store">store</code></a></li> +</ul> +</section> +<section class="Ss"> +<h2 class="Ss" id="Encryption_Methods"><a class="permalink" href="#Encryption_Methods">Encryption + Methods</a></h2> +Some commands take encryption method arguments. Supported methods are: +<ul class="Bl-bullet Bd-indent Bl-compact"> + <li><a class="permalink" href="#none"><code class="Dv" id="none">none</code></a></li> + <li><a class="permalink" href="#AES-128"><code class="Dv" id="AES-128">AES-128</code></a></li> + <li><a class="permalink" href="#AES-192"><code class="Dv" id="AES-192">AES-192</code></a></li> + <li><a class="permalink" href="#AES-256"><code class="Dv" id="AES-256">AES-256</code></a></li> +</ul> +</section> +</section> +<section class="Sh"> +<h1 class="Sh" id="EXIT_STATUS"><a class="permalink" href="#EXIT_STATUS">EXIT + STATUS</a></h1> +The <code class="Nm">ziptool</code> utility exits 0 on success, + and >0 if an error occurs. +</section> +<section class="Sh"> +<h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1> +Add a file called <span class="Pa">teststring.txt</span> to the zip archive + <span class="Pa">testbuffer.zip</span> with data “This is a + test.\n” where “\n” is replaced with a newline character: +<div class="Bd Pp Bd-indent"> +<pre> +ziptool testbuffer.zip add teststring.txt \"This is a test.\n\" +</pre> +</div> +<p class="Pp">Delete the first file from the zip archive + <span class="Pa">testfile.zip</span>:</p> +<div class="Bd Pp Bd-indent"> +<pre> +ziptool testfile.zip delete 0 +</pre> +</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<a class="Xr" href="zipcmp.html">zipcmp(1)</a>, + <a class="Xr" href="zipmerge.html">zipmerge(1)</a>, + <a class="Xr" href="libzip.html">libzip(3)</a> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<code class="Nm">ziptool</code> was added in libzip 1.1. +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<span class="An">Dieter Baron</span> + <<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and + <span class="An">Thomas Klausner</span> + <<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">December 18, 2017</td> + <td class="foot-os">NiH</td> + </tr> +</table> +</body> +</html> diff --git a/3rdparty/libzip/man/ziptool.man b/3rdparty/libzip/man/ziptool.man new file mode 100644 index 0000000000000000000000000000000000000000..da9829aa78924cde569a75e475c957b439761a49 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/man/ziptool.mdoc b/3rdparty/libzip/man/ziptool.mdoc new file mode 100644 index 0000000000000000000000000000000000000000..751eeb0c4ab68e241c3f7f693610cd66280a05c2 --- /dev/null +++ b/3rdparty/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 <libzip@nih.at> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/regress/CMakeLists.txt b/3rdparty/libzip/regress/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f0bd29f04187059bf03a86ddca0a5cb7dfc2bfc --- /dev/null +++ b/3rdparty/libzip/regress/CMakeLists.txt @@ -0,0 +1,96 @@ +check_function_exists(getopt HAVE_GETOPT) + +set(TEST_PROGRAMS + add_from_filep + can_clone_file + fopen_unchanged + fseek + fuzz_main + nonrandomopentest + liboverride-test +) + +set(GETOPT_USERS + fread + tryopen +) + +set(HOLE_USERS + hole + ziptool_regress +) + +set(ZIP_PROGRAMS ${TEST_PROGRAMS} ${GETOPT_USERS} ${HOLE_USERS}) + +foreach(PROGRAM IN LISTS ZIP_PROGRAMS) + add_executable(${PROGRAM} ${PROGRAM}.c) + target_include_directories(${PROGRAM} PRIVATE BEFORE ${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}) + target_link_libraries(${PROGRAM} zip) +endforeach() + +# both programs using source_hole.c also use getopt +if(NOT HAVE_GETOPT) + foreach(PROGRAM IN LISTS GETOPT_USERS HOLE_USERS) + target_sources(${PROGRAM} PRIVATE ../src/getopt.c) + target_include_directories(${PROGRAM} PRIVATE BEFORE ${PROJECT_SOURCE_DIR}/src) + endforeach() +endif(NOT HAVE_GETOPT) + +foreach(PROGRAM IN LISTS HOLE_USERS) + target_sources(${PROGRAM} PRIVATE source_hole.c) +endforeach() + +# for including ziptool.c +target_include_directories(ziptool_regress PRIVATE BEFORE ${PROJECT_SOURCE_DIR}/src) + +set(DL_USERS + # malloc + nonrandomopen + liboverride +) + +foreach(PROGRAM IN LISTS DL_USERS) + add_library(${PROGRAM} MODULE ${PROGRAM}.c) + target_include_directories(${PROGRAM} PRIVATE BEFORE ${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}) +endforeach() + +add_custom_target(cleanup + COMMAND ${CMAKE_COMMAND} -DDIR=${PROJECT_BINARY_DIR}/regress -P ${PROJECT_SOURCE_DIR}/regress/cleanup.cmake + ) + +add_custom_target(testinput + ALL + VERBATIM + COMMAND ${CMAKE_COMMAND} -E tar x ${PROJECT_SOURCE_DIR}/regress/manyfiles-zip.zip + COMMAND ${CMAKE_COMMAND} -E tar x ${PROJECT_SOURCE_DIR}/regress/bigzero-zip.zip + DEPENDS ${PROJECT_SOURCE_DIR}/regress/manyfiles-zip.zip ${PROJECT_SOURCE_DIR}/regress/bigzero-zip.zip +) + +set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES + bigzero.zip + manyfiles-133000.zip + manyfiles-65536.zip + manyfiles-fewer.zip + manyfiles-more.zip + manyfiles-zip64-modulo.zip + manyfiles-zip64.zip + manyfiles.zip +) + +set(path "$<TARGET_FILE_DIR:zip>;$ENV{PATH}") +if (TARGET zlib) + set(path "$<TARGET_FILE_DIR:zlib>;${path}") +endif() +string(REPLACE ";" "\\;" path "${path}") + +set(ENV{srcdir} ${PROJECT_SOURCE_DIR}/regress) + +file(GLOB EXTRA_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/*.test) +foreach(FULL_CASE IN LISTS EXTRA_TESTS) + get_filename_component(CASE ${FULL_CASE} NAME) + add_test(NAME ${CASE} COMMAND ${PERL_EXECUTABLE} ${PROJECT_BINARY_DIR}/regress/runtest -v --bin-sub-directory $<CONFIG> ${PROJECT_SOURCE_DIR}/regress/${CASE}) + set_tests_properties(${CASE} PROPERTIES SKIP_RETURN_CODE 77) + set_tests_properties(${CASE} PROPERTIES ENVIRONMENT "PATH=${path}") +endforeach() + +add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) diff --git a/3rdparty/libzip/regress/NiHTest.pm b/3rdparty/libzip/regress/NiHTest.pm new file mode 100644 index 0000000000000000000000000000000000000000..752dbbf16a257c7595837165c89c1a174c547b6b --- /dev/null +++ b/3rdparty/libzip/regress/NiHTest.pm @@ -0,0 +1,1415 @@ +package NiHTest; + +use strict; +use warnings; + +use Cwd; +use File::Copy; +use File::Path qw(mkpath remove_tree); +use Getopt::Long qw(:config posix_default bundling no_ignore_case); +use IPC::Open3; +#use IPC::Cmd qw(run); +use Storable qw(dclone); +use Symbol 'gensym'; +use UNIVERSAL; + +#use Data::Dumper qw(Dumper); + +# NiHTest -- package to run regression tests +# Copyright (C) 2002-2016 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 <ckmame@nih.at> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. The names of the authors may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# runtest TESTNAME +# +# files: +# TESTNAME.test: test scenario +# +# test scenario: +# Lines beginning with # are comments. +# +# The following commands are recognized; return and args must +# appear exactly once, the others are optional. +# +# args ARGS +# run program with command line arguments ARGS +# +# description TEXT +# description of what test is for +# +# features FEATURE ... +# only run test if all FEATUREs are present, otherwise skip it. +# +# file TEST IN OUT +# copy file IN as TEST, compare against OUT after program run. +# +# file-del TEST IN +# copy file IN as TEST, check that it is removed by program. +# +# file-new TEST OUT +# check that file TEST is created by program and compare +# against OUT. +# +# mkdir MODE NAME +# create directory NAME with permissions MODE. +# +# precheck COMMAND ARGS ... +# if COMMAND exits with non-zero status, skip test. +# +# preload LIBRARY +# pre-load LIBRARY before running program. +# +# program PRG +# run PRG instead of ckmame. +# +# return RET +# RET is the expected exit code +# +# setenv VAR VALUE +# set environment variable VAR to VALUE. +# +# stderr TEXT +# program is expected to produce the error message TEXT. If +# multiple stderr commands are used, the messages are +# expected in the order given. +# +# stderr-replace REGEX REPLACEMENT +# run regex replacement over expected and got stderr output. +# +# stdin TEST +# Provide TEXT to program's stdin. +# +# stdin-file FILE +# pipe FILE to program's stdin. +# +# stdout TEXT +# program is expected to print TEXT to stdout. If multiple +# stdout commands are used, the messages are expected in +# the order given. +# +# touch MTIME FILE +# set last modified timestamp of FILE to MTIME (seconds since epoch). +# If FILE doesn't exist, an empty file is created. +# +# ulimit C VALUE +# set ulimit -C to VALUE while running the program. +# +# exit status +# runtest uses the following exit codes: +# 0: test passed +# 1: test failed +# 2: other error +# 77: test was skipped +# +# environment variables: +# RUN_GDB: if set, run gdb on program in test environment +# KEEP_BROKEN: if set, don't delete test environment if test failed +# NO_CLEANUP: if set, don't delete test environment +# SETUP_ONLY: if set, exit after creating test environment +# VERBOSE: if set, be more verbose (e. g., output diffs) + +my %EXIT_CODES = ( + PASS => 0, + FAIL => 1, + SKIP => 77, + ERROR => 99 + ); + +# MARK: - Public API + +sub new { + my $class = UNIVERSAL::isa ($_[0], __PACKAGE__) ? shift : __PACKAGE__; + my $self = bless {}, $class; + + my ($opts) = @_; + + $self->{default_program} = $opts->{default_program}; + $self->{zipcmp} = $opts->{zipcmp} // 'zipcmp'; + $self->{zipcmp_flags} = $opts->{zipcmp_flags} // '-p'; + + $self->{directives} = { + args => { type => 'string...', once => 1, required => 1 }, + description => { type => 'string', once => 1 }, + features => { type => 'string...', once => 1 }, + file => { type => 'string string string' }, + 'file-del' => { type => 'string string' }, + 'file-new' => { type => 'string string' }, + mkdir => { type => 'string string' }, + precheck => { type => 'string...' }, + preload => { type => 'string', once => 1 }, + program => { type => 'string', once => 1 }, + 'return' => { type => 'int', once => 1, required => 1 }, + setenv => { type => 'string string' }, + stderr => { type => 'string' }, + 'stderr-replace' => { type => 'string string' }, + stdin => { type => 'string' }, + 'stdin-file' => { type => 'string', once => 1 }, + stdout => { type => 'string' }, + touch => { type => 'int string' }, + ulimit => { type => 'char string' } + }; + + $self->{compare_by_type} = {}; + $self->{copy_by_type} = {}; + $self->{hooks} = {}; + + $self->get_variable('srcdir', $opts); + $self->get_variable('top_builddir', $opts); + + $self->{in_sandbox} = 0; + + $self->{verbose} = $ENV{VERBOSE}; + $self->{keep_broken} = $ENV{KEEP_BROKEN}; + $self->{no_cleanup} = $ENV{NO_CLEANUP}; + $self->{setup_only} = $ENV{SETUP_ONLY}; + + return $self; +} + + +sub add_comparator { + my ($self, $ext, $sub) = @_; + + return $self->add_file_proc('compare_by_type', $ext, $sub); +} + + +sub add_copier { + my ($self, $ext, $sub) = @_; + + return $self->add_file_proc('copy_by_type', $ext, $sub); +} + + +sub add_directive { + my ($self, $name, $def) = @_; + + if (exists($self->{directives}->{$name})) { + $self->die("directive $name already defined"); + } + + # TODO: validate $def + + $self->{directives}->{$name} = $def; + + return 1; +} + + +sub add_file_proc { + my ($self, $proc, $ext, $sub) = @_; + + $self->{$proc}->{$ext} = [] unless (defined($self->{$proc}->{$ext})); + unshift @{$self->{$proc}->{$ext}}, $sub; + + return 1; +} + + +sub add_hook { + my ($self, $hook, $sub) = @_; + + $self->{hooks}->{$hook} = [] unless (defined($self->{hooks}->{$hook})); + push @{$self->{hooks}->{$hook}}, $sub; + + return 1; +} + + +sub add_variant { + my ($self, $name, $hooks) = @_; + + if (!defined($self->{variants})) { + $self->{variants} = []; + $self->add_directive('variants' => { type => 'string...', once => 1 }); + } + for my $variant (@{$self->{variants}}) { + if ($variant->{name} eq $name) { + $self->die("variant $name already defined"); + } + } + + push @{$self->{variants}}, { name => $name, hooks => $hooks }; + + return 1; +} + + +sub end { + my ($self, @results) = @_; + + my $result = 'PASS'; + + for my $r (@results) { + if ($r eq 'ERROR' || ($r eq 'FAIL' && $result ne 'ERROR')) { + $result = $r; + } + } + + $self->end_test($result); +} + + +sub run { + my ($self, @argv) = @_; + + $self->setup(@argv); + + $self->end($self->runtest()); +} + + +sub runtest { + my ($self) = @_; + + if (defined($self->{variants})) { + my @results = (); + $self->{original_test} = $self->{test}; + + my %variants; + + if (defined($self->{test}->{variants})) { + %variants = map { $_ => 1; } @{$self->{test}->{variants}}; + } + + for my $variant (@{$self->{variants}}) { + next if (defined($self->{test}->{variants}) && !exists($variants{$variant->{name}})); + + $self->{variant_hooks} = $variant->{hooks}; + $self->{test} = dclone($self->{original_test}); + $self->{variant} = $variant->{name}; + $self->mangle_test_for_variant(); + push @results, $self->runtest_one($variant->{name}); + } + + return @results; + } + else { + return $self->runtest_one(); + } +} + + +sub runtest_one { + my ($self, $tag) = @_; + + $ENV{TZ} = "UTC"; + $ENV{LC_CTYPE} = "C"; + $ENV{POSIXLY_CORRECT} = 1; + $self->sandbox_create($tag); + $self->sandbox_enter(); + + my $ok = 1; + $ok &= $self->copy_files(); + $ok &= $self->run_hook('post_copy_files'); + $ok &= $self->touch_files(); + $ok &= $self->run_hook('prepare_sandbox'); + return 'ERROR' unless ($ok); + + if ($self->{setup_only}) { + $self->sandbox_leave(); + return 'SKIP'; + } + + for my $env (@{$self->{test}->{'setenv'}}) { + $ENV{$env->[0]} = $env->[1]; + } + my $preload_env_var = 'LD_PRELOAD'; + if ($^O eq 'darwin') { + $preload_env_var = 'DYLD_INSERT_LIBRARIES'; + } + if (defined($self->{test}->{'preload'})) { + if (-f cwd() . "/../.libs/$self->{test}->{'preload'}") { + $ENV{$preload_env_var} = cwd() . "/../.libs/$self->{test}->{'preload'}"; + } else { + $ENV{$preload_env_var} = cwd() . "/../lib$self->{test}->{'preload'}"; + } + } + + $self->run_program(); + + for my $env (@{$self->{test}->{'setenv'}}) { + delete ${ENV{$env->[0]}}; + } + if (defined($self->{test}->{'preload'})) { + delete ${ENV{$preload_env_var}}; + } + + if ($self->{test}->{stdin}) { + $self->{stdin} = [ @{$self->{test}->{stdin}} ]; + } + + if ($self->{test}->{stdout}) { + $self->{expected_stdout} = [ @{$self->{test}->{stdout}} ]; + } + else { + $self->{expected_stdout} = []; + } + if ($self->{test}->{stderr}) { + $self->{expected_stderr} = [ @{$self->{test}->{stderr}} ]; + } + else { + $self->{expected_stderr} = []; + } + + $self->run_hook('post_run_program'); + + my @failed = (); + + if ($self->{exit_status} != ($self->{test}->{return} // 0)) { + push @failed, 'exit status'; + if ($self->{verbose}) { + print "Unexpected exit status:\n"; + print "-" . ($self->{test}->{return} // 0) . "\n+$self->{exit_status}\n"; + } + } + + if (!$self->compare_arrays($self->{expected_stdout}, $self->{stdout}, 'output')) { + push @failed, 'output'; + } + if (!$self->compare_arrays($self->{expected_stderr}, $self->{stderr}, 'error output')) { + push @failed, 'error output'; + } + if (!$self->compare_files()) { + push @failed, 'files'; + } + + $self->{failed} = \@failed; + + $self->run_hook('checks'); + + my $result = scalar(@{$self->{failed}}) == 0 ? 'PASS' : 'FAIL'; + + $self->sandbox_leave(); + if (!($self->{no_cleanup} || ($self->{keep_broken} && $result eq 'FAIL'))) { + $self->sandbox_remove(); + } + + $self->print_test_result($tag, $result, join ', ', @{$self->{failed}}); + + return $result; +} + + +sub setup { + my ($self, @argv) = @_; + + my @save_argv = @ARGV; + @ARGV = @argv; + my $ok = GetOptions( + 'help|h' => \my $help, + 'bin-sub-directory=s' => \$self->{bin_sub_directory}, + 'keep-broken|k' => \$self->{keep_broken}, + 'no-cleanup' => \$self->{no_cleanup}, + # 'run-gdb' => \$self->{run_gdb}, + 'setup-only' => \$self->{setup_only}, + 'verbose|v' => \$self->{verbose} + ); + @argv = @ARGV; + @ARGV = @save_argv; + + if (!$ok || scalar(@argv) != 1 || $help) { + print STDERR "Usage: $0 [-hv] [--bin-sub-directory DIR] [--keep-broken] [--no-cleanup] [--setup-only] testcase\n"; + exit(1); + } + + my $testcase = shift @argv; + + $testcase .= '.test' unless ($testcase =~ m/\.test$/); + + my $testcase_file = $self->find_file($testcase); + + $self->die("cannot find test case $testcase") unless ($testcase_file); + + $testcase =~ s,^(?:.*/)?([^/]*)\.test$,$1,; + $self->{testname} = $testcase; + + $self->die("error in test case definition") unless $self->parse_case($testcase_file); + + $self->check_features_requirement() if ($self->{test}->{features}); + $self->run_precheck() if ($self->{test}->{precheck}); + + $self->end_test('SKIP') if ($self->{test}->{preload} && ($^O eq 'darwin' || $^O eq 'MSWin32')); + $self->end_test('SKIP') if (($self->{test}->{stdin} || $self->{test}->{'stdin-file'}) && $^O eq 'MSWin32'); +} + + +# MARK: - Internal Methods + +sub add_file { + my ($self, $file) = @_; + + if (defined($self->{files}->{$file->{destination}})) { + $self->warn("duplicate specification for input file $file->{destination}"); + return undef; + } + + $self->{files}->{$file->{destination}} = $file; + + return 1; +} + + +sub check_features_requirement() { + my ($self) = @_; + + my %features; + + my $fh; + unless (open($fh, '<', "$self->{top_builddir}/config.h")) { + $self->die("cannot open config.h in top builddir $self->{top_builddir}"); + } + while (my $line = <$fh>) { + if ($line =~ m/^#define HAVE_([A-Z0-9_a-z]*)/) { + $features{$1} = 1; + } + } + close($fh); + + my @missing = (); + for my $feature (@{$self->{test}->{features}}) { + if (!$features{$feature}) { + push @missing, $feature; + } + } + + if (scalar @missing > 0) { + my $reason = "missing features"; + if (scalar(@missing) == 1) { + $reason = "missing feature"; + } + $self->print_test_result('SKIP', "$reason: " . (join ' ', @missing)); + $self->end_test('SKIP'); + } + + return 1; +} + + +sub comparator_zip { + my ($self, $got, $expected) = @_; + + my $zipcmp = (-f $self->{zipcmp}) ? $self->{zipcmp} : $self->find_program('zipcmp'); + my @args = ($zipcmp, $self->{verbose} ? '-v' : '-q'); + push @args, $self->{zipcmp_flags} if ($self->{zipcmp_flags}); + push @args, ($expected, $got); + + my $ret = system(@args); + + return $ret == 0; +} + + +sub compare_arrays() { + my ($self, $a, $b, $tag) = @_; + + my $ok = 1; + + if (scalar(@$a) != scalar(@$b)) { + $ok = 0; + } + else { + for (my $i = 0; $i < scalar(@$a); $i++) { + if ($a->[$i] ne $b->[$i]) { + $ok = 0; + last; + } + } + } + + if (!$ok && $self->{verbose}) { + print "Unexpected $tag:\n"; + print "--- expected\n+++ got\n"; + + diff_arrays($a, $b); + } + + return $ok; +} + +sub file_cmp($$) { + my ($a, $b) = @_; + my $result = 0; + open my $fha, "< $a"; + open my $fhb, "< $b"; + binmode $fha; + binmode $fhb; + BYTE: while (!eof $fha && !eof $fhb) { + if (getc $fha ne getc $fhb) { + $result = 1; + last BYTE; + } + } + $result = 1 if eof $fha != eof $fhb; + close $fha; + close $fhb; + return $result; +} + +sub compare_file($$$) { + my ($self, $got, $expected) = @_; + + my $real_expected = $self->find_file($expected); + unless ($real_expected) { + $self->warn("cannot find expected result file $expected"); + return 0; + } + + my $ok = $self->run_comparator($got, $real_expected); + + if (!defined($ok)) { + my $ret; + if ($self->{verbose}) { + $ret = system('diff', '-u', $real_expected, $got); + } + else { + $ret = file_cmp($real_expected, $got); + } + $ok = ($ret == 0); + } + + return $ok; +} + +sub list_files { + my ($root) = @_; + my $ls; + + my @files = (); + my @dirs = ($root); + + while (scalar(@dirs) > 0) { + my $dir = shift @dirs; + + opendir($ls, $dir); + unless ($ls) { + # TODO: handle error + } + while (my $entry = readdir($ls)) { + my $file = "$dir/$entry"; + if ($dir eq '.') { + $file = $entry; + } + + if (-f $file) { + push @files, "$file"; + } + if (-d $file && $entry ne '.' && $entry ne '..') { + push @dirs, "$file"; + } + } + closedir($ls); + } + + return @files; +} + +sub compare_files() { + my ($self) = @_; + + my $ok = 1; + + + my @files_got = sort(list_files(".")); + my @files_should = (); + + for my $file (sort keys %{$self->{files}}) { + push @files_should, $file if ($self->{files}->{$file}->{result} || $self->{files}->{$file}->{ignore}); + } + + $self->{files_got} = \@files_got; + $self->{files_should} = \@files_should; + + unless ($self->run_hook('post_list_files')) { + return 0; + } + + $ok = $self->compare_arrays($self->{files_should}, $self->{files_got}, 'files'); + + for my $file (@{$self->{files_got}}) { + my $file_def = $self->{files}->{$file}; + next unless ($file_def && $file_def->{result}); + + $ok &= $self->compare_file($file, $file_def->{result}); + } + + return $ok; +} + + +sub copy_files { + my ($self) = @_; + + my $ok = 1; + + for my $filename (sort keys %{$self->{files}}) { + my $file = $self->{files}->{$filename}; + next unless ($file->{source}); + + my $src = $self->find_file($file->{source}); + unless ($src) { + $self->warn("cannot find input file $file->{source}"); + $ok = 0; + next; + } + + if ($file->{destination} =~ m,/,) { + my $dir = $file->{destination}; + $dir =~ s,/[^/]*$,,; + if (! -d $dir) { + mkpath($dir); + } + } + + my $this_ok = $self->run_copier($src, $file->{destination}); + if (defined($this_ok)) { + $ok &= $this_ok; + } + else { + unless (copy($src, $file->{destination})) { + $self->warn("cannot copy $src to $file->{destination}: $!"); + $ok = 0; + } + } + } + + if (defined($self->{test}->{mkdir})) { + for my $dir_spec (@{$self->{test}->{mkdir}}) { + my ($mode, $dir) = @$dir_spec; + if (! -d $dir) { + unless (mkdir($dir, oct($mode))) { + $self->warn("cannot create directory $dir: $!"); + $ok = 0; + } + } + } + } + + $self->die("failed to copy input files") unless ($ok); +} + + +sub die() { + my ($self, $msg) = @_; + + print STDERR "$0: $msg\n" if ($msg); + + $self->end_test('ERROR'); +} + + +sub end_test { + my ($self, $status) = @_; + + my $exit_code = $EXIT_CODES{$status} // $EXIT_CODES{ERROR}; + + $self->exit($exit_code); +} + + + +sub exit() { + my ($self, $status) = @_; + ### TODO: cleanup + + exit($status); +} + + +sub find_file() { + my ($self, $fname) = @_; + + for my $dir (('', "$self->{srcdir}/")) { + my $f = "$dir$fname"; + $f = "../$f" if ($self->{in_sandbox} && $dir !~ m,^(\w:)?/,); + + return $f if (-f $f); + } + + return undef; +} + + +sub get_extension { + my ($self, $fname) = @_; + + my $ext = $fname; + if ($ext =~ m/\./) { + $ext =~ s/.*\.//; + } + else { + $ext = ''; + } + + return $ext; +} + + +sub get_variable { + my ($self, $name, $opts) = @_; + + $self->{$name} = $opts->{$name} // $ENV{$name}; + if (!defined($self->{$name}) || $self->{$name} eq '') { + my $fh; + unless (open($fh, '<', 'Makefile')) { + $self->die("cannot open Makefile: $!"); + } + while (my $line = <$fh>) { + chomp $line; + if ($line =~ m/^$name = (.*)/) { + $self->{$name} = $1; + last; + } + } + close ($fh); + } + if (!defined($self->{$name}) || $self->{$name} eq '') { + $self->die("cannot get variable $name"); + } +} + + +sub mangle_test_for_variant { + my ($self) = @_; + + $self->{test}->{stdout} = $self->strip_tags($self->{variant}, $self->{test}->{stdout}); + $self->{test}->{stderr} = $self->strip_tags($self->{variant}, $self->{test}->{stderr}); + $self->run_hook('mangle_test'); + + return 1; +} + +sub parse_args { + my ($self, $type, $str) = @_; + + if ($type eq 'string...') { + my $args = []; + + while ($str ne '') { + if ($str =~ m/^\"/) { + unless ($str =~ m/^\"([^\"]*)\"\s*(.*)/) { + $self->warn_file_line("unclosed quote in [$str]"); + return undef; + } + push @$args, $1; + $str = $2; + } + else { + $str =~ m/^(\S+)\s*(.*)/; + push @$args, $1; + $str = $2; + } + } + + return $args; + } + elsif ($type =~ m/(\s|\.\.\.$)/) { + my $ellipsis = 0; + if ($type =~ m/(.*)\.\.\.$/) { + $ellipsis = 1; + $type = $1; + } + my @types = split /\s+/, $type; + my @strs = split /\s+/, $str; + my $optional = 0; + for (my $i = scalar(@types) - 1; $i >= 0; $i--) { + last unless ($types[$i] =~ m/(.*)\?$/); + $types[$i] = $1; + $optional++; + } + + if ($ellipsis && $optional > 0) { + # TODO: check this when registering a directive + $self->warn_file_line("can't use ellipsis together with optional arguments"); + return undef; + } + if (!$ellipsis && (scalar(@strs) < scalar(@types) - $optional || scalar(@strs) > scalar(@types))) { + my $expected = scalar(@types); + if ($optional > 0) { + $expected = ($expected - $optional) . "-$expected"; + } + $self->warn_file_line("expected $expected arguments, got " . (scalar(@strs))); + return undef; + } + + my $args = []; + + my $n = scalar(@types); + for (my $i=0; $i<scalar(@strs); $i++) { + my $val = $self->parse_args(($i >= $n ? $types[$n-1] : $types[$i]), $strs[$i]); + return undef unless (defined($val)); + push @$args, $val; + } + + return $args; + } + else { + if ($type eq 'string') { + return $str; + } + elsif ($type eq 'int') { + if ($str !~ m/^\d+$/) { + $self->warn_file_line("illegal int [$str]"); + return undef; + } + return $str+0; + } + elsif ($type eq 'char') { + if ($str !~ m/^.$/) { + $self->warn_file_line("illegal char [$str]"); + return undef; + } + return $str; + } + else { + $self->warn_file_line("unknown type $type"); + return undef; + } + } +} + + +sub parse_case() { + my ($self, $fname) = @_; + + my $ok = 1; + + open TST, "< $fname" or $self->die("cannot open test case $fname: $!"); + + $self->{testcase_fname} = $fname; + + my %test = (); + + while (my $line = <TST>) { + $line =~ s/(\n|\r)//g; + + next if ($line =~ m/^\#/); + + unless ($line =~ m/(\S*)(?:\s(.*))?/) { + $self->warn_file_line("cannot parse line $line"); + $ok = 0; + next; + } + my ($cmd, $argstring) = ($1, $2//""); + + my $def = $self->{directives}->{$cmd}; + + unless ($def) { + $self->warn_file_line("unknown directive $cmd in test file"); + $ok = 0; + next; + } + + my $args = $self->parse_args($def->{type}, $argstring); + + unless (defined($args)) { + $ok = 0; + next; + } + + if ($def->{once}) { + if (defined($test{$cmd})) { + $self->warn_file_line("directive $cmd appeared twice in test file"); + } + $test{$cmd} = $args; + } + else { + $test{$cmd} = [] unless (defined($test{$cmd})); + push @{$test{$cmd}}, $args; + } + } + + close TST; + + return undef unless ($ok); + + for my $cmd (sort keys %test) { + if ($self->{directives}->{$cmd}->{required} && !defined($test{$cmd})) { + $self->warn_file("required directive $cmd missing in test file"); + $ok = 0; + } + } + + if ($test{'stdin-file'} && $test{stdin}) { + $self->warn_file("both stdin-file and stdin provided, choose one"); + $ok = 0; + } + + if (defined($self->{variants})) { + if (defined($test{variants})) { + for my $name (@{$test{variants}}) { + my $found = 0; + for my $variant (@{$self->{variants}}) { + if ($name eq $variant->{name}) { + $found = 1; + last; + } + } + if ($found == 0) { + $self->warn_file("unknown variant $name"); + $ok = 0; + } + } + } + } + + return undef unless ($ok); + + if (defined($test{'stderr-replace'}) && defined($test{stderr})) { + $test{stderr} = [ map { $self->stderr_rewrite($test{'stderr-replace'}, $_); } @{$test{stderr}} ]; + } + + if (!defined($test{program})) { + $test{program} = $self->{default_program}; + } + + $self->{test} = \%test; + + $self->run_hook('mangle_program'); + + if (!$self->parse_postprocess_files()) { + return 0; + } + + return $self->run_hook('post_parse'); +} + + +sub parse_postprocess_files { + my ($self) = @_; + + $self->{files} = {}; + + my $ok = 1; + + for my $file (@{$self->{test}->{file}}) { + $ok = 0 unless ($self->add_file({ source => $file->[1], destination => $file->[0], result => $file->[2] })); + } + + for my $file (@{$self->{test}->{'file-del'}}) { + $ok = 0 unless ($self->add_file({ source => $file->[1], destination => $file->[0], result => undef })); + } + + for my $file (@{$self->{test}->{'file-new'}}) { + $ok = 0 unless ($self->add_file({ source => undef, destination => $file->[0], result => $file->[1] })); + } + + return $ok; +} + + +sub print_test_result { + my ($self, $tag, $result, $reason) = @_; + + if ($self->{verbose}) { + print "$self->{testname}"; + print " ($tag)" if ($tag); + print " -- $result"; + print ": $reason" if ($reason); + print "\n"; + } +} + + +sub run_comparator { + my ($self, $got, $expected) = @_; + + return $self->run_file_proc('compare_by_type', $got, $expected); +} + + +sub run_copier { + my ($self, $src, $dest) = @_; + + return $self->run_file_proc('copy_by_type', $src, $dest); +} + + +sub run_file_proc { + my ($self, $proc, $got, $expected) = @_; + + my $ext = ($self->get_extension($got)) . '/' . ($self->get_extension($expected)); + + if ($self->{variant}) { + if (defined($self->{$proc}->{"$self->{variant}/$ext"})) { + for my $sub (@{$self->{$proc}->{"$self->{variant}/$ext"}}) { + my $ret = $sub->($self, $got, $expected); + return $ret if (defined($ret)); + } + } + } + if (defined($self->{$proc}->{$ext})) { + for my $sub (@{$self->{$proc}->{$ext}}) { + my $ret = $sub->($self, $got, $expected); + return $ret if (defined($ret)); + } + } + + return undef; +} + + +sub run_hook { + my ($self, $hook) = @_; + + my $ok = 1; + + my @hooks = (); + + if (defined($self->{variant_hooks}) && defined($self->{variant_hooks}->{$hook})) { + push @hooks, $self->{variant_hooks}->{$hook}; + } + if (defined($self->{hooks}->{$hook})) { + push @hooks, @{$self->{hooks}->{$hook}}; + } + + for my $sub (@hooks) { + unless ($sub->($self, $hook, $self->{variant})) { + $self->warn("hook $hook failed"); + $ok = 0; + } + } + + return $ok; +} + + +sub args_decode { + my ($str, $srcdir) = @_; + + if ($str =~ m/\\/) { + $str =~ s/\\a/\a/gi; + $str =~ s/\\b/\b/gi; + $str =~ s/\\f/\f/gi; + $str =~ s/\\n/\n/gi; + $str =~ s/\\r/\r/gi; + $str =~ s/\\t/\t/gi; + $str =~ s/\\v/\cK/gi; + $str =~ s/\\s/ /gi; + # TODO: \xhh, \ooo + $str =~ s/\\(.)/$1/g; + } + + if ($srcdir !~ m,^/,) { + $srcdir = "../$srcdir"; + } + + if ($str =~ m/^\$srcdir(.*)/) { + $str = "$srcdir$1"; + } + + return $str; +} + + +sub run_precheck { + my ($self) = @_; + + for my $precheck (@{$self->{test}->{precheck}}) { + unless (system(@{$precheck}) == 0) { + $self->print_test_result('SKIP', "precheck failed"); + $self->end_test('SKIP'); + } + } + + return 1; +} + + +sub find_program() { + my ($self, $pname) = @_; + + my @directories = ("."); + if ($self->{bin_sub_directory}) { + push @directories, $self->{bin_sub_directory}; + } + + for my $up (('.', '..', '../..', '../../..')) { + for my $sub (('.', 'src')) { + for my $dir (@directories) { + for my $ext (('', '.exe')) { + my $f = "$up/$sub/$dir/$pname$ext"; + return $f if (-f $f); + } + } + } + } + + return undef; +} + + +sub run_program { + my ($self) = @_; + my ($stdin, $stdout, $stderr); + $stderr = gensym; + + my @cmd = ($self->find_program($self->{test}->{program}), map ({ args_decode($_, $self->{srcdir}); } @{$self->{test}->{args}})); + + ### TODO: catch errors? + + my $pid; + if ($self->{test}->{'stdin-file'}) { + open(SPLAT, '<', $self->{test}->{'stdin-file'}); + my $is_marked = eof SPLAT; # mark used + $pid = open3("<&SPLAT", $stdout, $stderr, @cmd); + } + else { + $pid = open3($stdin, $stdout, $stderr, @cmd); + } + $self->{stdout} = []; + $self->{stderr} = []; + + if ($self->{test}->{stdin}) { + foreach my $line (@{$self->{test}->{stdin}}) { + print $stdin $line . "\n"; + } + close($stdin); + } + + while (my $line = <$stdout>) { + $line =~ s/(\n|\r)//g; + push @{$self->{stdout}}, $line; + } + my $prg = $self->{test}->{program}; + $prg =~ s,.*/,,; + while (my $line = <$stderr>) { + $line =~ s/(\n|\r)//g; + $line =~ s/^[^: ]*$prg(\.exe)?: //; + if (defined($self->{test}->{'stderr-replace'})) { + $line = $self->stderr_rewrite($self->{test}->{'stderr-replace'}, $line); + } + push @{$self->{stderr}}, $line; + } + + waitpid($pid, 0); + + $self->{exit_status} = $? >> 8; +} + +sub sandbox_create { + my ($self, $tag) = @_; + + $tag = ($tag ? "-$tag" : ""); + $self->{sandbox_dir} = "sandbox-$self->{testname}$tag.d$$"; + + $self->die("sandbox $self->{sandbox_dir} already exists") if (-e $self->{sandbox_dir}); + + mkdir($self->{sandbox_dir}) or $self->die("cannot create sandbox $self->{sandbox_dir}: $!"); + + return 1; +} + + +sub sandbox_enter { + my ($self) = @_; + + $self->die("internal error: cannot enter sandbox before creating it") unless (defined($self->{sandbox_dir})); + + return if ($self->{in_sandbox}); + + chdir($self->{sandbox_dir}) or $self->die("cannot cd into sandbox $self->{sandbox_dir}: $!"); + + $self->{in_sandbox} = 1; +} + + +sub sandbox_leave { + my ($self) = @_; + + return if (!$self->{in_sandbox}); + + chdir('..') or $self->die("cannot leave sandbox: $!"); + + $self->{in_sandbox} = 0; +} + + +sub sandbox_remove { + my ($self) = @_; + + remove_tree($self->{sandbox_dir}); + + return 1; +} + + +sub strip_tags { + my ($self, $tag, $lines) = @_; + + my @stripped = (); + + for my $line (@$lines) { + if ($line =~ m/^<([a-zA-Z0-9_]*)> (.*)/) { + if ($1 eq $tag) { + push @stripped, $2; + } + } + else { + push @stripped, $line; + } + } + + return \@stripped; +} + + +sub touch_files { + my ($self) = @_; + + my $ok = 1; + + if (defined($self->{test}->{touch})) { + for my $args (@{$self->{test}->{touch}}) { + my ($mtime, $fname) = @$args; + + if (!-f $fname) { + my $fh; + unless (open($fh, "> $fname") and close($fh)) { + # TODO: error message + $ok = 0; + next; + } + } + unless (utime($mtime, $mtime, $fname) == 1) { + # TODO: error message + $ok = 0; + } + } + } + + return $ok; +} + + +sub warn { + my ($self, $msg) = @_; + + print STDERR "$0: $msg\n"; +} + + +sub warn_file { + my ($self, $msg) = @_; + + $self->warn("$self->{testcase_fname}: $msg"); +} + + +sub warn_file_line { + my ($self, $msg) = @_; + + $self->warn("$self->{testcase_fname}:$.: $msg"); +} + +sub stderr_rewrite { + my ($self, $pattern, $line) = @_; + for my $repl (@{$pattern}) { + $line =~ s/$repl->[0]/$repl->[1]/; + } + return $line; +} + + +# MARK: array diff + +sub diff_arrays { + my ($a, $b) = @_; + + my ($i, $j); + for ($i = $j = 0; $i < scalar(@$a) || $j < scalar(@$b);) { + if ($i >= scalar(@$a)) { + print "+$b->[$j]\n"; + $j++; + } + elsif ($j >= scalar(@$b)) { + print "-$a->[$i]\n"; + $i++; + } + elsif ($a->[$i] eq $b->[$j]) { + print " $a->[$i]\n"; + $i++; + $j++; + } + else { + my ($off_a, $off_b) = find_best_offsets($a, $i, $b, $j); + my ($off_b_2, $off_a_2) = find_best_offsets($b, $j, $a, $i); + + if ($off_a + $off_b > $off_a_2 + $off_b_2) { + $off_a = $off_a_2; + $off_b = $off_b_2; + } + + for (my $off = 0; $off < $off_a; $off++) { + print "-$a->[$i]\n"; + $i++; + } + for (my $off = 0; $off < $off_b; $off++) { + print "+$b->[$j]\n"; + $j++; + } + } + } + +} + +sub find_best_offsets { + my ($a, $i, $b, $j) = @_; + + my ($best_a, $best_b); + + for (my $off_a = 0; $off_a < (defined($best_a) ? $best_a + $best_b : scalar(@$a) - $i); $off_a++) { + my $off_b = find_entry($a->[$i+$off_a], $b, $j, defined($best_a) ? $best_a + $best_b - $off_a : scalar(@$b) - $j); + + next unless (defined($off_b)); + + if (!defined($best_a) || $best_a + $best_b > $off_a + $off_b) { + $best_a = $off_a; + $best_b = $off_b; + } + } + + if (!defined($best_a)) { + return (scalar(@$a) - $i, scalar(@$b) - $j); + } + + return ($best_a, $best_b); +} + +sub find_entry { + my ($entry, $array, $start, $max_offset) = @_; + + for (my $offset = 0; $offset < $max_offset; $offset++) { + return $offset if ($array->[$start + $offset] eq $entry); + } + + return undef; +} + +1; diff --git a/3rdparty/libzip/regress/add_dir.test b/3rdparty/libzip/regress/add_dir.test new file mode 100644 index 0000000000000000000000000000000000000000..b6a4d371c0b8fc67064064ce693b4b102ce288ce --- /dev/null +++ b/3rdparty/libzip/regress/add_dir.test @@ -0,0 +1,4 @@ +# add directories to zip +return 0 +args testdir.zip add_dir testdir/ add_dir testdir-noslash +file-new testdir.zip testdir.zip diff --git a/3rdparty/libzip/regress/add_from_buffer.test b/3rdparty/libzip/regress/add_from_buffer.test new file mode 100644 index 0000000000000000000000000000000000000000..6963c58af54796fadebbf7ecf7a66b08c714f58e --- /dev/null +++ b/3rdparty/libzip/regress/add_from_buffer.test @@ -0,0 +1,4 @@ +# add buffer contents as file to zip +return 0 +args testbuffer.zip add teststring.txt "This is a test, and it seems to have been successful.\n" +file-new testbuffer.zip testbuffer.zip diff --git a/3rdparty/libzip/regress/add_from_file.test b/3rdparty/libzip/regress/add_from_file.test new file mode 100644 index 0000000000000000000000000000000000000000..4f97d27814b1ab31942dadd30416063ced6e6428 --- /dev/null +++ b/3rdparty/libzip/regress/add_from_file.test @@ -0,0 +1,5 @@ +# add file to zip +return 0 +args -- testfile.zip add_file testfile.txt testfile.txt 0 -1 +file testfile.txt testfile.txt testfile.txt +file-new testfile.zip testfile.zip diff --git a/3rdparty/libzip/regress/add_from_file_duplicate.test b/3rdparty/libzip/regress/add_from_file_duplicate.test new file mode 100644 index 0000000000000000000000000000000000000000..018b260a71f6cc7598ee875ad43db2bbd0605508 --- /dev/null +++ b/3rdparty/libzip/regress/add_from_file_duplicate.test @@ -0,0 +1,6 @@ +# add already existing file to zip, making duplicate names +return 1 +args -- testfile.zip add_file testfile.txt testfile.txt 0 -1 +file testfile.txt testfile.txt testfile.txt +file testfile.zip testfile.zip testfile.zip +stderr can't add file 'testfile.txt': File already exists diff --git a/3rdparty/libzip/regress/add_from_file_twice_duplicate.test b/3rdparty/libzip/regress/add_from_file_twice_duplicate.test new file mode 100644 index 0000000000000000000000000000000000000000..511c90b2f13f0a7aa158db01548325265b510b1a --- /dev/null +++ b/3rdparty/libzip/regress/add_from_file_twice_duplicate.test @@ -0,0 +1,6 @@ +# add file to zip twice, making duplicate names +return 1 +args -- testfile.zip add_file testfile.txt testfile.txt 0 -1 add_file testfile.txt testfile.txt 0 -1 +file testfile.txt testfile.txt testfile.txt +file-new testfile.zip testfile.zip +stderr can't add file 'testfile.txt': File already exists diff --git a/3rdparty/libzip/regress/add_from_file_unchange.test b/3rdparty/libzip/regress/add_from_file_unchange.test new file mode 100644 index 0000000000000000000000000000000000000000..dff1c2f68e19409c041be3afa8a8b250b6c667e7 --- /dev/null +++ b/3rdparty/libzip/regress/add_from_file_unchange.test @@ -0,0 +1,4 @@ +# add file to zip, but revert before closing +return 0 +args -- testfile.zip add_file testfile.txt testfile.txt 0 -1 unchange 0 +file testfile.txt testfile.txt testfile.txt diff --git a/3rdparty/libzip/regress/add_from_filep.c b/3rdparty/libzip/regress/add_from_filep.c new file mode 100644 index 0000000000000000000000000000000000000000..53aec850c4fd2d76ac4a6735c236ea7870bf1f17 --- /dev/null +++ b/3rdparty/libzip/regress/add_from_filep.c @@ -0,0 +1,96 @@ +/* + add_from_filep.c -- test case for adding file to archive + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <errno.h> +#include <stdio.h> +#include <string.h> + +#include "zip.h" + +static const char *prg; + +int +main(int argc, char *argv[]) { + const char *archive; + const char *file; + const char *name; + zip_t *za; + zip_source_t *zs; + int err; + FILE *fp; + + prg = argv[0]; + + if (argc != 3) { + fprintf(stderr, "usage: %s archive file\n", prg); + return 1; + } + + archive = argv[1]; + file = argv[2]; + + if ((za = zip_open(archive, ZIP_CREATE, &err)) == NULL) { + zip_error_t error; + zip_error_init_with_code(&error, err); + fprintf(stderr, "%s: can't open zip archive '%s': %s\n", prg, archive, zip_error_strerror(&error)); + zip_error_fini(&error); + return 1; + } + + if ((fp = fopen(file, "rb")) == NULL) { + fprintf(stderr, "%s: can't open input file '%s': %s\n", prg, file, strerror(errno)); + return 1; + } + + if ((zs = zip_source_filep(za, fp, 0, -1)) == NULL) { + fprintf(stderr, "%s: error creating file source for '%s': %s\n", prg, file, zip_strerror(za)); + return 1; + } + + if ((name = strrchr(file, '/')) == NULL) + name = file; + + if (zip_add(za, name, zs) == -1) { + zip_source_free(zs); + fprintf(stderr, "%s: can't add file '%s': %s\n", prg, file, zip_strerror(za)); + return 1; + } + + if (zip_close(za) == -1) { + fprintf(stderr, "%s: can't close zip archive '%s': %s\n", prg, archive, zip_strerror(za)); + return 1; + } + + return 0; +} diff --git a/3rdparty/libzip/regress/add_from_filep.test b/3rdparty/libzip/regress/add_from_filep.test new file mode 100644 index 0000000000000000000000000000000000000000..3a2a8cfe3e46396bbed03bd17dd9cc712d6d184a --- /dev/null +++ b/3rdparty/libzip/regress/add_from_filep.test @@ -0,0 +1,6 @@ +# add file to zip +program add_from_filep +return 0 +args testfile.zip testfile.txt +file testfile.txt testfile.txt testfile.txt +file-new testfile.zip testfile.zip diff --git a/3rdparty/libzip/regress/add_from_stdin.test b/3rdparty/libzip/regress/add_from_stdin.test new file mode 100644 index 0000000000000000000000000000000000000000..07f6c4a3cebe833478c280f478a0906b1cdbda5c --- /dev/null +++ b/3rdparty/libzip/regress/add_from_stdin.test @@ -0,0 +1,5 @@ +# add stdin to zip +stdin This is a test, and it seems to have been successful. +args -- teststdin.zip add_file teststring.txt /dev/stdin 0 -1 +return 0 +file-new teststdin.zip teststdin.zip diff --git a/3rdparty/libzip/regress/add_from_zip_closed.test b/3rdparty/libzip/regress/add_from_zip_closed.test new file mode 100644 index 0000000000000000000000000000000000000000..4c52e56c3b4926da02c2aed935517785b6447260 --- /dev/null +++ b/3rdparty/libzip/regress/add_from_zip_closed.test @@ -0,0 +1,5 @@ +# add deflated file from zip to zip, but close the source before it can be read +return 1 +args -- testfile.zip add_from_zip abac-repeat.txt testdeflated.zzip 0 0 -1 zin_close 0 +file testdeflated.zzip testdeflated.zip testdeflated.zip +stderr can't close zip archive 'testfile.zip': Containing zip archive was closed diff --git a/3rdparty/libzip/regress/add_from_zip_deflated.test b/3rdparty/libzip/regress/add_from_zip_deflated.test new file mode 100644 index 0000000000000000000000000000000000000000..ecff27dd414d279fbedc6d3c6fc00ff91691bb93 --- /dev/null +++ b/3rdparty/libzip/regress/add_from_zip_deflated.test @@ -0,0 +1,5 @@ +# add deflated file from zip to zip +return 0 +args -- testfile.zip add_from_zip abac-repeat.txt testdeflated.zzip 0 0 -1 +file testdeflated.zzip testdeflated.zip testdeflated.zip +file-new testfile.zip testdeflated.zip diff --git a/3rdparty/libzip/regress/add_from_zip_deflated2.test b/3rdparty/libzip/regress/add_from_zip_deflated2.test new file mode 100644 index 0000000000000000000000000000000000000000..ad7b4b60430c4e154e1bf65381cee6bf1a5f760b --- /dev/null +++ b/3rdparty/libzip/regress/add_from_zip_deflated2.test @@ -0,0 +1,5 @@ +# add deflated files from zip to zip +return 0 +args -- testfile.zip add_from_zip abac-repeat.txt testdeflated.zzip 0 0 -1 add_from_zip abac-repeat2.txt testdeflated.zzip 0 0 -1 +file testdeflated.zzip testdeflated.zip testdeflated.zip +file-new testfile.zip testdeflated2.zip diff --git a/3rdparty/libzip/regress/add_from_zip_partial_deflated.test b/3rdparty/libzip/regress/add_from_zip_partial_deflated.test new file mode 100644 index 0000000000000000000000000000000000000000..69e95c6c85fe7d2fa03de75ee718bbc9f015f5e7 --- /dev/null +++ b/3rdparty/libzip/regress/add_from_zip_partial_deflated.test @@ -0,0 +1,5 @@ +# add parts of a file from zip to zip +return 0 +args -- testfile.zip add_from_zip first firstsecond.zzip 0 0 9 add_from_zip second firstsecond.zzip 0 9 -1 +file firstsecond.zzip firstsecond.zip firstsecond.zip +file-new testfile.zip firstsecond-split-stored.zip diff --git a/3rdparty/libzip/regress/add_from_zip_partial_stored.test b/3rdparty/libzip/regress/add_from_zip_partial_stored.test new file mode 100644 index 0000000000000000000000000000000000000000..41ebf21388dc067bd97164cf79be229eec5e67c7 --- /dev/null +++ b/3rdparty/libzip/regress/add_from_zip_partial_stored.test @@ -0,0 +1,5 @@ +# add parts of a file from zip to zip +return 0 +args -- testfile.zip add_from_zip first firstsecond.zzip 1 0 9 add_from_zip second firstsecond.zzip 1 9 -1 +file firstsecond.zzip firstsecond.zip firstsecond.zip +file-new testfile.zip firstsecond-split-stored.zip diff --git a/3rdparty/libzip/regress/add_from_zip_stored.test b/3rdparty/libzip/regress/add_from_zip_stored.test new file mode 100644 index 0000000000000000000000000000000000000000..2fcbe80cc7a24460bf85b5ba2f4e8d241febf8ad --- /dev/null +++ b/3rdparty/libzip/regress/add_from_zip_stored.test @@ -0,0 +1,5 @@ +# add stored file from zip to zip +return 0 +args -- testfile.zip add_from_zip abac-repeat.txt teststored.zzip 0 0 -1 +file teststored.zzip teststored.zip teststored.zip +file-new testfile.zip testdeflated.zip diff --git a/3rdparty/libzip/regress/add_stored.test b/3rdparty/libzip/regress/add_stored.test new file mode 100644 index 0000000000000000000000000000000000000000..ea96f2532de7a0a23d7df43239b3d00cfd11e76d --- /dev/null +++ b/3rdparty/libzip/regress/add_stored.test @@ -0,0 +1,4 @@ +# add file, set compression method to ZIP_CM_STORE +return 0 +args -n test.zip add foo foo set_file_compression 0 store 0 +file-new test.zip foo-stored.zip diff --git a/3rdparty/libzip/regress/add_stored_in_memory.test b/3rdparty/libzip/regress/add_stored_in_memory.test new file mode 100644 index 0000000000000000000000000000000000000000..50467c6e72776aa89f6f21a69a657d3113aa2320 --- /dev/null +++ b/3rdparty/libzip/regress/add_stored_in_memory.test @@ -0,0 +1,4 @@ +# add file, set compression method to ZIP_CM_STORE +return 0 +args -mn test.zip add foo foo set_file_compression 0 store 0 +file-new test.zip foo-stored.zip diff --git a/3rdparty/libzip/regress/bigstored.zh b/3rdparty/libzip/regress/bigstored.zh new file mode 100644 index 0000000000000000000000000000000000000000..2a53bff036b0708978a8767d8b6b52892da91fed Binary files /dev/null and b/3rdparty/libzip/regress/bigstored.zh differ diff --git a/3rdparty/libzip/regress/bigzero-zip.zip b/3rdparty/libzip/regress/bigzero-zip.zip new file mode 100644 index 0000000000000000000000000000000000000000..158cb6de22147d50603f20ac7c8868896ae6e365 Binary files /dev/null and b/3rdparty/libzip/regress/bigzero-zip.zip differ diff --git a/3rdparty/libzip/regress/bogus.zip b/3rdparty/libzip/regress/bogus.zip new file mode 100644 index 0000000000000000000000000000000000000000..7e538b626db328b401819c0685032b86d0c9c4c9 --- /dev/null +++ b/3rdparty/libzip/regress/bogus.zip @@ -0,0 +1 @@ +bogus data diff --git a/3rdparty/libzip/regress/broken.zip b/3rdparty/libzip/regress/broken.zip new file mode 100644 index 0000000000000000000000000000000000000000..2008c3244d97007f63d7f6be2e9a71d17a123bdb Binary files /dev/null and b/3rdparty/libzip/regress/broken.zip differ diff --git a/3rdparty/libzip/regress/buffer-fragment-read.test b/3rdparty/libzip/regress/buffer-fragment-read.test new file mode 100644 index 0000000000000000000000000000000000000000..1337560bd6e6ff9e2491a6a1245cf1764c015e96 --- /dev/null +++ b/3rdparty/libzip/regress/buffer-fragment-read.test @@ -0,0 +1,5 @@ +# test reading from a buffer fragment source +return 0 +args -mF 1024 test.zip cat 1 +file test.zip cm-default.zip cm-default.zip +stdout uncompressable diff --git a/3rdparty/libzip/regress/buffer-fragment-write.test b/3rdparty/libzip/regress/buffer-fragment-write.test new file mode 100644 index 0000000000000000000000000000000000000000..f3ebc1e04aad6bdd287a97ba65dce2458f56e811 --- /dev/null +++ b/3rdparty/libzip/regress/buffer-fragment-write.test @@ -0,0 +1,4 @@ +# rename file inside zip archive +return 0 +args -mF 100 rename.zip rename 1 notfile2 +file rename.zip testcomment.zip rename_ok.zip diff --git a/3rdparty/libzip/regress/can_clone_file.c b/3rdparty/libzip/regress/can_clone_file.c new file mode 100644 index 0000000000000000000000000000000000000000..887947de5cffede92d83cba65d839bbe63846850 --- /dev/null +++ b/3rdparty/libzip/regress/can_clone_file.c @@ -0,0 +1,127 @@ +/* + can_clone_file.c -- does the current filesystem support cloning + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#include "config.h" + +#ifdef HAVE_CLONEFILE +#include <errno.h> +#include <stdio.h> +#include <string.h> +#include <sys/attr.h> +#include <sys/mount.h> +#include <sys/param.h> +#include <unistd.h> +#elif defined(HAVE_FICLONERANGE) +#include <errno.h> +#include <linux/fs.h> +#include <stdio.h> +#include <string.h> +#include <sys/ioctl.h> +#include <unistd.h> +#endif + +int +main(int argc, char *argv[]) { +#ifdef HAVE_CLONEFILE + struct statfs fs; + struct attrlist attribute_list; + struct { + uint32_t size; + vol_capabilities_attr_t capabilities; + } volume_attributes; + + if (statfs(".", &fs) < 0) { + fprintf(stderr, "%s: can't get mount point of current directory: %s\n", argv[0], strerror(errno)); + exit(1); + } + + /* Not all volumes support clonefile(). A volume can be tested for + clonefile() support by using getattrlist(2) to get the volume + capabilities attribute ATTR_VOL_CAPABILITIES, and then testing the + VOL_CAP_INT_CLONE flag. */ + + memset(&attribute_list, 0, sizeof(attribute_list)); + attribute_list.bitmapcount = ATTR_BIT_MAP_COUNT; + attribute_list.volattr = ATTR_VOL_INFO | ATTR_VOL_CAPABILITIES; + memset(&volume_attributes, 0, sizeof(volume_attributes)); + + if (getattrlist(fs.f_mntonname, &attribute_list, &volume_attributes, sizeof(volume_attributes), 0) < 0) { + fprintf(stderr, "%s: can't get volume capabilities of '%s': %s\n", argv[0], fs.f_mntonname, strerror(errno)); + exit(1); + } + + if (volume_attributes.capabilities.capabilities[VOL_CAPABILITIES_INTERFACES] & VOL_CAP_INT_CLONE) { + exit(0); + } +#elif defined(HAVE_FICLONERANGE) + char namea[32] = "a.fioclone.XXXXXX"; + char nameb[32] = "b.fioclone.XXXXXX"; + int fda, fdb, ret; + struct file_clone_range range; + + if ((fda = mkstemp(namea)) < 0) { + fprintf(stderr, "can't create temp file a: %s\n", strerror(errno)); + exit(1); + } + if ((fdb = mkstemp(nameb)) < 0) { + fprintf(stderr, "can't create temp file b: %s\n", strerror(errno)); + (void)close(fda); + (void)remove(namea); + exit(1); + } + if (write(fda, "test\n", 5) < 0) { + fprintf(stderr, "can't write temp file a: %s\n", strerror(errno)); + (void)close(fda); + (void)remove(namea); + close(fdb); + (void)remove(nameb); + exit(1); + } + range.src_fd = fda; + range.src_offset = 0; + range.src_length = 0; + range.dest_offset = 0; + ret = ioctl(fdb, FICLONERANGE, &range); + (void)close(fda); + (void)close(fdb); + (void)remove(namea); + (void)remove(nameb); + if (ret >= 0) { + exit(0); + } +#endif + + exit(1); +} diff --git a/3rdparty/libzip/regress/cancel_45.test b/3rdparty/libzip/regress/cancel_45.test new file mode 100644 index 0000000000000000000000000000000000000000..ad273d3448859456b173fa1f2ed2876963049d27 --- /dev/null +++ b/3rdparty/libzip/regress/cancel_45.test @@ -0,0 +1,8 @@ +# test default compression stores if smaller; test cancel after 45% +return 1 +args -n test.zip cancel 45 add compressable aaaaaaaaaaaaaa add uncompressable uncompressable add_nul large-compressable 8200 add_file large-uncompressable large-uncompressable 0 -1 +file large-uncompressable large-uncompressable large-uncompressable +stdout 0.0% done +stdout 25.0% done +stdout 50.0% done +stderr can't close zip archive 'test.zip': Operation cancelled diff --git a/3rdparty/libzip/regress/cancel_90.test b/3rdparty/libzip/regress/cancel_90.test new file mode 100644 index 0000000000000000000000000000000000000000..f4cf0284446b974c2832bc6cd697ba0e58ad1354 --- /dev/null +++ b/3rdparty/libzip/regress/cancel_90.test @@ -0,0 +1,10 @@ +# test default compression stores if smaller; test cancel after 90% +return 1 +args -n test.zip cancel 90 add compressable aaaaaaaaaaaaaa add uncompressable uncompressable add_nul large-compressable 8200 add_file large-uncompressable large-uncompressable 0 -1 +file large-uncompressable large-uncompressable large-uncompressable +stdout 0.0% done +stdout 25.0% done +stdout 50.0% done +stdout 75.0% done +stdout 100.0% done +stderr can't close zip archive 'test.zip': Operation cancelled diff --git a/3rdparty/libzip/regress/cleanup.cmake b/3rdparty/libzip/regress/cleanup.cmake new file mode 100644 index 0000000000000000000000000000000000000000..94fd13ffbe8d12c162f4717a931afef766306074 --- /dev/null +++ b/3rdparty/libzip/regress/cleanup.cmake @@ -0,0 +1,7 @@ +# expect variable DIR +FILE(GLOB CLEANDIRS "${DIR}/sandbox-*.d[0-9]*") +IF (CLEANDIRS) + MESSAGE(STATUS "Removing ${CLEANDIRS}") + FILE(REMOVE_RECURSE ${CLEANDIRS}) +ENDIF() + diff --git a/3rdparty/libzip/regress/clone-buffer-add.test b/3rdparty/libzip/regress/clone-buffer-add.test new file mode 100644 index 0000000000000000000000000000000000000000..c66791bff07c653e01b720056cafd5c901f5b0a2 --- /dev/null +++ b/3rdparty/libzip/regress/clone-buffer-add.test @@ -0,0 +1,4 @@ +# test cloning archive from buffer, add new file +return 0 +args -mF 100 test.zzip add new "A new file." set_file_mtime 3 1512998132 +file test.zzip gap.zip gap-add.zip diff --git a/3rdparty/libzip/regress/clone-buffer-delete.test b/3rdparty/libzip/regress/clone-buffer-delete.test new file mode 100644 index 0000000000000000000000000000000000000000..f7c987cb1634e3fdfefc9f8bd60aa9e197cb83b1 --- /dev/null +++ b/3rdparty/libzip/regress/clone-buffer-delete.test @@ -0,0 +1,4 @@ +# test cloning archive from buffer, deleting a file +return 0 +args -mF 100 test.zzip delete 2 +file test.zzip gap.zip gap-delete.zip diff --git a/3rdparty/libzip/regress/clone-buffer-replace.test b/3rdparty/libzip/regress/clone-buffer-replace.test new file mode 100644 index 0000000000000000000000000000000000000000..cb21f339fc75ca3eb5a05b1f69447e2f96798591 --- /dev/null +++ b/3rdparty/libzip/regress/clone-buffer-replace.test @@ -0,0 +1,4 @@ +# test cloning archive from buffer, replacing a file +return 0 +args -mF 100 test.zzip replace_file_contents 2 "A changed file." set_file_mtime 2 1512998082 +file test.zzip gap.zip gap-replace.zip diff --git a/3rdparty/libzip/regress/clone-fs-add.test b/3rdparty/libzip/regress/clone-fs-add.test new file mode 100644 index 0000000000000000000000000000000000000000..f187cb720b5c59052ee9d0dcf2eea8a44ff4b740 --- /dev/null +++ b/3rdparty/libzip/regress/clone-fs-add.test @@ -0,0 +1,5 @@ +# test cloning archive from filesystem, add new file +precheck ./can_clone_file +return 0 +args test.zzip add new "A new file." set_file_mtime 3 1512998132 +file test.zzip gap.zip gap-add.zip diff --git a/3rdparty/libzip/regress/clone-fs-delete.test b/3rdparty/libzip/regress/clone-fs-delete.test new file mode 100644 index 0000000000000000000000000000000000000000..aea602f994b50edfee3f57ca2bb9d848048c8900 --- /dev/null +++ b/3rdparty/libzip/regress/clone-fs-delete.test @@ -0,0 +1,5 @@ +# test cloning archive from filesystem, deleting a file +precheck ./can_clone_file +return 0 +args test.zzip delete 2 +file test.zzip gap.zip gap-delete.zip diff --git a/3rdparty/libzip/regress/clone-fs-replace.test b/3rdparty/libzip/regress/clone-fs-replace.test new file mode 100644 index 0000000000000000000000000000000000000000..3d3b8f360ab1c916faa09f738f6d7cadd99fc535 --- /dev/null +++ b/3rdparty/libzip/regress/clone-fs-replace.test @@ -0,0 +1,5 @@ +# test cloning archive from filesystem, replacing a file +precheck ./can_clone_file +return 0 +args test.zzip replace_file_contents 2 "A changed file." set_file_mtime 2 1512998082 +file test.zzip gap.zip gap-replace.zip diff --git a/3rdparty/libzip/regress/cm-default.test b/3rdparty/libzip/regress/cm-default.test new file mode 100644 index 0000000000000000000000000000000000000000..03e720050c119483d2cee6e81d5ad5c77a36a9ea --- /dev/null +++ b/3rdparty/libzip/regress/cm-default.test @@ -0,0 +1,5 @@ +# test default compression stores if smaller +return 0 +args -n test.zip add compressable aaaaaaaaaaaaaa add uncompressable uncompressable add_nul large-compressable 8200 add_file large-uncompressable large-uncompressable 0 -1 +file-new test.zip cm-default.zip +file large-uncompressable large-uncompressable large-uncompressable diff --git a/3rdparty/libzip/regress/cm-default.zip b/3rdparty/libzip/regress/cm-default.zip new file mode 100644 index 0000000000000000000000000000000000000000..3eba2a32cfcaafb1089233f8ed7f4aa23758c828 Binary files /dev/null and b/3rdparty/libzip/regress/cm-default.zip differ diff --git a/3rdparty/libzip/regress/count_entries.test b/3rdparty/libzip/regress/count_entries.test new file mode 100644 index 0000000000000000000000000000000000000000..564acdca510bf0426260fad0da726730fb9bceca --- /dev/null +++ b/3rdparty/libzip/regress/count_entries.test @@ -0,0 +1,5 @@ +# zip_open: count entries for archive with >65k entries +args manyfiles.zip get_num_entries 0 +return 0 +file manyfiles.zip manyfiles.zip manyfiles.zip +stdout 70000 entries in archive diff --git a/3rdparty/libzip/regress/decrypt-correct-password-aes128.test b/3rdparty/libzip/regress/decrypt-correct-password-aes128.test new file mode 100644 index 0000000000000000000000000000000000000000..470ba30ffd2451a1be29d70e7c22270ff4c0d25d --- /dev/null +++ b/3rdparty/libzip/regress/decrypt-correct-password-aes128.test @@ -0,0 +1,6 @@ +# test AES decryption support, extract file using correct password +features CRYPTO +return 0 +args encrypt.zzip set_password foofoofoo cat 1 +file encrypt.zzip encrypt-aes128.zip encrypt-aes128.zip +stdout encrypted diff --git a/3rdparty/libzip/regress/decrypt-correct-password-aes192.test b/3rdparty/libzip/regress/decrypt-correct-password-aes192.test new file mode 100644 index 0000000000000000000000000000000000000000..a66dd16f829152378bf4b897fc703189c06ba9d7 --- /dev/null +++ b/3rdparty/libzip/regress/decrypt-correct-password-aes192.test @@ -0,0 +1,6 @@ +# test AES decryption support, extract file using correct password +features CRYPTO +return 0 +args encrypt.zzip set_password foofoofoo cat 1 +file encrypt.zzip encrypt-aes192.zip encrypt-aes192.zip +stdout encrypted diff --git a/3rdparty/libzip/regress/decrypt-correct-password-aes256.test b/3rdparty/libzip/regress/decrypt-correct-password-aes256.test new file mode 100644 index 0000000000000000000000000000000000000000..4eddea8a1dd6bf84a4b872274f34c9d68b16efb0 --- /dev/null +++ b/3rdparty/libzip/regress/decrypt-correct-password-aes256.test @@ -0,0 +1,6 @@ +# test AES decryption support, extract file using correct password +features CRYPTO +return 0 +args encrypt.zzip set_password foofoofoo cat 1 +file encrypt.zzip encrypt-aes256.zip encrypt-aes256.zip +stdout encrypted diff --git a/3rdparty/libzip/regress/decrypt-correct-password-pkware-2.test b/3rdparty/libzip/regress/decrypt-correct-password-pkware-2.test new file mode 100644 index 0000000000000000000000000000000000000000..24f43b54d48178e31d56aac3c5df2cf88dedc1f2 --- /dev/null +++ b/3rdparty/libzip/regress/decrypt-correct-password-pkware-2.test @@ -0,0 +1,9 @@ +# test decryption support, extract file using correct password +return 0 +args encrypt.zzip set_password 1234 cat 0 +file encrypt.zzip encrypt-1234.zip encrypt-1234.zip +stdout I would love to try or hear the sample audio your app can produce. I do not want to purchase, because I've purchased so many apps that say they do something and do not deliver. +stdout +stdout Can you please add audio samples with text you've converted? I'd love to see the end results. +stdout +stdout Thanks! diff --git a/3rdparty/libzip/regress/decrypt-correct-password-pkware.test b/3rdparty/libzip/regress/decrypt-correct-password-pkware.test new file mode 100644 index 0000000000000000000000000000000000000000..c12639458213be9719c566bb50ea89ccfc7cb371 --- /dev/null +++ b/3rdparty/libzip/regress/decrypt-correct-password-pkware.test @@ -0,0 +1,5 @@ +# test decryption support, extract file using correct password +return 0 +args encrypt.zzip set_password foo cat 0 +file encrypt.zzip encrypt.zip encrypt.zip +stdout foo diff --git a/3rdparty/libzip/regress/decrypt-no-password-aes256.test b/3rdparty/libzip/regress/decrypt-no-password-aes256.test new file mode 100644 index 0000000000000000000000000000000000000000..6140a42f7903280b43499f1500deb3ef6898ff3f --- /dev/null +++ b/3rdparty/libzip/regress/decrypt-no-password-aes256.test @@ -0,0 +1,6 @@ +# test AES decryption support, no password provided +features CRYPTO +return 1 +args encrypt.zzip cat 1 +file encrypt.zzip encrypt-aes256.zip encrypt-aes256.zip +stderr can't open file at index '1': No password provided diff --git a/3rdparty/libzip/regress/decrypt-wrong-password-aes128.test b/3rdparty/libzip/regress/decrypt-wrong-password-aes128.test new file mode 100644 index 0000000000000000000000000000000000000000..fa4b789e39cacf9410b30da0105a0c31506443ac --- /dev/null +++ b/3rdparty/libzip/regress/decrypt-wrong-password-aes128.test @@ -0,0 +1,6 @@ +# test AES decryption support, extract file using wrong password +features CRYPTO +return 1 +args encrypt.zzip set_password notfoonotfoo cat 1 +file encrypt.zzip encrypt-aes128.zip encrypt-aes128.zip +stderr can't open file at index '1': Wrong password provided diff --git a/3rdparty/libzip/regress/decrypt-wrong-password-aes192.test b/3rdparty/libzip/regress/decrypt-wrong-password-aes192.test new file mode 100644 index 0000000000000000000000000000000000000000..f04d0da04c4f8330e4a4296cd0c5da0fccddd6b6 --- /dev/null +++ b/3rdparty/libzip/regress/decrypt-wrong-password-aes192.test @@ -0,0 +1,6 @@ +# test AES decryption support, extract file using wrong password +features CRYPTO +return 1 +args encrypt.zzip set_password notfoonotfoo cat 1 +file encrypt.zzip encrypt-aes192.zip encrypt-aes192.zip +stderr can't open file at index '1': Wrong password provided diff --git a/3rdparty/libzip/regress/decrypt-wrong-password-aes256.test b/3rdparty/libzip/regress/decrypt-wrong-password-aes256.test new file mode 100644 index 0000000000000000000000000000000000000000..836b5b1a8ddc488303ce993a0dad3a14a9c3dac0 --- /dev/null +++ b/3rdparty/libzip/regress/decrypt-wrong-password-aes256.test @@ -0,0 +1,6 @@ +# test AES decryption support, extract file using wrong password +features CRYPTO +return 1 +args encrypt.zzip set_password notfoonotfoo cat 1 +file encrypt.zzip encrypt-aes256.zip encrypt-aes256.zip +stderr can't open file at index '1': Wrong password provided diff --git a/3rdparty/libzip/regress/decrypt-wrong-password-pkware-2.test b/3rdparty/libzip/regress/decrypt-wrong-password-pkware-2.test new file mode 100644 index 0000000000000000000000000000000000000000..fb1e66c8b45101694ad32fee3748dac6c5a150ee --- /dev/null +++ b/3rdparty/libzip/regress/decrypt-wrong-password-pkware-2.test @@ -0,0 +1,7 @@ +# test decryption support, extract file using wrong password (correct: "1234") +# In some cases, like this one, the password, even if incorrect, passes the +# minimal verification that's possible due to the zip file format specification. +return 1 +args encrypt.zzip set_password sample cat 0 +file encrypt.zzip encrypt-1234.zip encrypt-1234.zip +stderr can't read file at index '0': Zlib error: data error diff --git a/3rdparty/libzip/regress/decrypt-wrong-password-pkware.test b/3rdparty/libzip/regress/decrypt-wrong-password-pkware.test new file mode 100644 index 0000000000000000000000000000000000000000..02749557e46d08e5b98b2fe4533f8bd8ee72c75b --- /dev/null +++ b/3rdparty/libzip/regress/decrypt-wrong-password-pkware.test @@ -0,0 +1,5 @@ +# test decryption support, extract file using wrong password +return 1 +args encrypt.zzip set_password notfoo cat 0 +file encrypt.zzip encrypt.zip encrypt.zip +stderr can't open file at index '0': Wrong password provided diff --git a/3rdparty/libzip/regress/delete_add_same.test b/3rdparty/libzip/regress/delete_add_same.test new file mode 100644 index 0000000000000000000000000000000000000000..54c0e5a7324bda7b87051d2dea5e6b954e7a86b3 --- /dev/null +++ b/3rdparty/libzip/regress/delete_add_same.test @@ -0,0 +1,5 @@ +# delete entry in zip archive then add file of same name +# time is now(), so use zipcmp +return 0 +args testfile.zip delete 0 add testfile.txt test +file testfile.zip testfile.zip test2.zip diff --git a/3rdparty/libzip/regress/delete_invalid.test b/3rdparty/libzip/regress/delete_invalid.test new file mode 100644 index 0000000000000000000000000000000000000000..9a06306bf0a795f67277f5803c3f3c4c55edacdc --- /dev/null +++ b/3rdparty/libzip/regress/delete_invalid.test @@ -0,0 +1,5 @@ +# delete last entry in zip archive +return 1 +args testfile.zzip delete 5 +file testfile.zzip testfile.zip testfile.zip +stderr can't delete file at index '5': Invalid argument diff --git a/3rdparty/libzip/regress/delete_last.test b/3rdparty/libzip/regress/delete_last.test new file mode 100644 index 0000000000000000000000000000000000000000..3b415b50ede837c76c3fac058a66fd7bcd0f8b03 --- /dev/null +++ b/3rdparty/libzip/regress/delete_last.test @@ -0,0 +1,4 @@ +# delete last entry in zip archive +return 0 +args testfile.zzip delete 0 +file-del testfile.zzip testfile.zip diff --git a/3rdparty/libzip/regress/delete_multiple_last.test b/3rdparty/libzip/regress/delete_multiple_last.test new file mode 100644 index 0000000000000000000000000000000000000000..71ac983543f6a519d2be6753ad60cb6fa2dfd868 --- /dev/null +++ b/3rdparty/libzip/regress/delete_multiple_last.test @@ -0,0 +1,4 @@ +# delete multiple entries in zip archive, emptying it +return 0 +args testfile.zzip delete 0 delete 1 delete 2 delete 3 +file-del testfile.zzip testcomment.zip diff --git a/3rdparty/libzip/regress/delete_multiple_partial.test b/3rdparty/libzip/regress/delete_multiple_partial.test new file mode 100644 index 0000000000000000000000000000000000000000..272fab3cfe0c00dbfa53e7e6f682b89acd97ef81 --- /dev/null +++ b/3rdparty/libzip/regress/delete_multiple_partial.test @@ -0,0 +1,4 @@ +# delete some entries in zip archive +return 0 +args testfile.zip delete 1 delete 3 +file testfile.zip testcomment.zip testcomment13.zip diff --git a/3rdparty/libzip/regress/delete_renamed_rename.test b/3rdparty/libzip/regress/delete_renamed_rename.test new file mode 100644 index 0000000000000000000000000000000000000000..e81996c41dc2a5309ef5b3bda9ba116f8a6fb5c2 --- /dev/null +++ b/3rdparty/libzip/regress/delete_renamed_rename.test @@ -0,0 +1,5 @@ +# delete renamed entry in zip archive then rename file to same name +# file date is now(), so use zipcmp +return 0 +args testfile.zip rename 0 something add test test delete 0 rename 1 testfile.txt +file testfile.zip testfile.zip test2.zip diff --git a/3rdparty/libzip/regress/encrypt-1234.zip b/3rdparty/libzip/regress/encrypt-1234.zip new file mode 100644 index 0000000000000000000000000000000000000000..09ef679a9bcffcabdec2bf50e2e19b6b0428eb65 Binary files /dev/null and b/3rdparty/libzip/regress/encrypt-1234.zip differ diff --git a/3rdparty/libzip/regress/encrypt-aes128-noentropy.zip b/3rdparty/libzip/regress/encrypt-aes128-noentropy.zip new file mode 100644 index 0000000000000000000000000000000000000000..01d5bc607b181bdcc9bdf7ba5b55d97b7d6de767 Binary files /dev/null and b/3rdparty/libzip/regress/encrypt-aes128-noentropy.zip differ diff --git a/3rdparty/libzip/regress/encrypt-aes128.zip b/3rdparty/libzip/regress/encrypt-aes128.zip new file mode 100644 index 0000000000000000000000000000000000000000..e48c3c93430b90533a27fb4586e004805911c367 Binary files /dev/null and b/3rdparty/libzip/regress/encrypt-aes128.zip differ diff --git a/3rdparty/libzip/regress/encrypt-aes192-noentropy.zip b/3rdparty/libzip/regress/encrypt-aes192-noentropy.zip new file mode 100644 index 0000000000000000000000000000000000000000..0a9ad4b3fa24c3d11fddc2001de3fcb2a380b373 Binary files /dev/null and b/3rdparty/libzip/regress/encrypt-aes192-noentropy.zip differ diff --git a/3rdparty/libzip/regress/encrypt-aes192.zip b/3rdparty/libzip/regress/encrypt-aes192.zip new file mode 100644 index 0000000000000000000000000000000000000000..98865ce41e14ece71c9b09122639604473b2abc5 Binary files /dev/null and b/3rdparty/libzip/regress/encrypt-aes192.zip differ diff --git a/3rdparty/libzip/regress/encrypt-aes256-noentropy.zip b/3rdparty/libzip/regress/encrypt-aes256-noentropy.zip new file mode 100644 index 0000000000000000000000000000000000000000..b3a6cad0193db4559ef5cdd96c6718cee6dbb318 Binary files /dev/null and b/3rdparty/libzip/regress/encrypt-aes256-noentropy.zip differ diff --git a/3rdparty/libzip/regress/encrypt-aes256.zip b/3rdparty/libzip/regress/encrypt-aes256.zip new file mode 100644 index 0000000000000000000000000000000000000000..6349cb257fdeabbc3fbbd6051fde6c43dff3f191 Binary files /dev/null and b/3rdparty/libzip/regress/encrypt-aes256.zip differ diff --git a/3rdparty/libzip/regress/encrypt-none.zip b/3rdparty/libzip/regress/encrypt-none.zip new file mode 100644 index 0000000000000000000000000000000000000000..c7ba696f5d9a8c5a8a967070404ee8413094faa7 Binary files /dev/null and b/3rdparty/libzip/regress/encrypt-none.zip differ diff --git a/3rdparty/libzip/regress/encrypt-pkware-noentropy.zip b/3rdparty/libzip/regress/encrypt-pkware-noentropy.zip new file mode 100644 index 0000000000000000000000000000000000000000..e0c39a7ce77b84aba948e8a61153dad50de8fbee Binary files /dev/null and b/3rdparty/libzip/regress/encrypt-pkware-noentropy.zip differ diff --git a/3rdparty/libzip/regress/encrypt.test b/3rdparty/libzip/regress/encrypt.test new file mode 100644 index 0000000000000000000000000000000000000000..f9aad430c454ff4f867fc47ad4298ab7ec1a4d5f --- /dev/null +++ b/3rdparty/libzip/regress/encrypt.test @@ -0,0 +1,23 @@ +# test encryption support +# TODO: only checks recognition of encrypted entries for now. +return 0 +args encrypt.zzip stat 0 stat 1 +file encrypt.zzip encrypt.zip encrypt.zip +stdout name: 'encrypted' +stdout index: '0' +stdout size: '4' +stdout compressed size: '16' +stdout mtime: 'Mon Apr 24 2006 16:01:34' +stdout crc: '7e3265a8' +stdout compression method: '0' +stdout encryption method: '1' +stdout +stdout name: 'plain' +stdout index: '1' +stdout size: '4' +stdout compressed size: '4' +stdout mtime: 'Mon Apr 24 2006 16:01:42' +stdout crc: '7e3265a8' +stdout compression method: '0' +stdout encryption method: '0' +stdout diff --git a/3rdparty/libzip/regress/encrypt.zip b/3rdparty/libzip/regress/encrypt.zip new file mode 100644 index 0000000000000000000000000000000000000000..e50aa385af35d6350cff9feab308fb6c4526cc59 Binary files /dev/null and b/3rdparty/libzip/regress/encrypt.zip differ diff --git a/3rdparty/libzip/regress/encrypt_plus_extra.zip b/3rdparty/libzip/regress/encrypt_plus_extra.zip new file mode 100644 index 0000000000000000000000000000000000000000..6936865426ac6823e0f121d2fa7646736dde6ec7 Binary files /dev/null and b/3rdparty/libzip/regress/encrypt_plus_extra.zip differ diff --git a/3rdparty/libzip/regress/encrypt_plus_extra_modified_c.zip b/3rdparty/libzip/regress/encrypt_plus_extra_modified_c.zip new file mode 100644 index 0000000000000000000000000000000000000000..f50d6496e37e8089e0e1722e219b4963bcdce0fb Binary files /dev/null and b/3rdparty/libzip/regress/encrypt_plus_extra_modified_c.zip differ diff --git a/3rdparty/libzip/regress/encrypt_plus_extra_modified_l.zip b/3rdparty/libzip/regress/encrypt_plus_extra_modified_l.zip new file mode 100644 index 0000000000000000000000000000000000000000..a546022e0b1f054e59ed0847b6bc76b3772bad41 Binary files /dev/null and b/3rdparty/libzip/regress/encrypt_plus_extra_modified_l.zip differ diff --git a/3rdparty/libzip/regress/encryption-nonrandom-aes128.test b/3rdparty/libzip/regress/encryption-nonrandom-aes128.test new file mode 100644 index 0000000000000000000000000000000000000000..4fae471c1093e0969175c2ecc81f3f175e89c275 --- /dev/null +++ b/3rdparty/libzip/regress/encryption-nonrandom-aes128.test @@ -0,0 +1,7 @@ +features CRYPTO +precheck ./liboverride-test +description encrypt file without entropy, to make results repeatable +return 0 +preload nonrandomopen.so +args encrypt.zzip set_file_encryption 1 AES-128 no-entropy +file encrypt.zzip encrypt-none.zip encrypt-aes128-noentropy.zip diff --git a/3rdparty/libzip/regress/encryption-nonrandom-aes192.test b/3rdparty/libzip/regress/encryption-nonrandom-aes192.test new file mode 100644 index 0000000000000000000000000000000000000000..7f0335ae791d8f5f24b2805f9cc1b986c9b2f3f8 --- /dev/null +++ b/3rdparty/libzip/regress/encryption-nonrandom-aes192.test @@ -0,0 +1,7 @@ +features CRYPTO +precheck ./liboverride-test +description encrypt file without entropy, to make results repeatable +return 0 +preload nonrandomopen.so +args encrypt.zzip set_file_encryption 1 AES-192 no-entropy +file encrypt.zzip encrypt-none.zip encrypt-aes192-noentropy.zip diff --git a/3rdparty/libzip/regress/encryption-nonrandom-aes256.test b/3rdparty/libzip/regress/encryption-nonrandom-aes256.test new file mode 100644 index 0000000000000000000000000000000000000000..9d8d6ace56860ef7363fd9f62b65abc4b003a657 --- /dev/null +++ b/3rdparty/libzip/regress/encryption-nonrandom-aes256.test @@ -0,0 +1,7 @@ +features CRYPTO +precheck ./liboverride-test +description encrypt file without entropy, to make results repeatable +return 0 +preload nonrandomopen.so +args encrypt.zzip set_file_encryption 1 AES-256 no-entropy +file encrypt.zzip encrypt-none.zip encrypt-aes256-noentropy.zip diff --git a/3rdparty/libzip/regress/encryption-nonrandom-pkware.test b/3rdparty/libzip/regress/encryption-nonrandom-pkware.test new file mode 100644 index 0000000000000000000000000000000000000000..2d14e40440a7f620dc2c660d5cc4c10af8ac1165 --- /dev/null +++ b/3rdparty/libzip/regress/encryption-nonrandom-pkware.test @@ -0,0 +1,7 @@ +features CRYPTO +precheck ./liboverride-test +description encrypt file by Traditional PKWARE +return 0 +preload nonrandomopen.so +args encrypt.zzip set_file_encryption 1 PKWARE no-entropy +file encrypt.zzip encrypt-none.zip encrypt-pkware-noentropy.zip diff --git a/3rdparty/libzip/regress/encryption-remove.test b/3rdparty/libzip/regress/encryption-remove.test new file mode 100644 index 0000000000000000000000000000000000000000..207910085c99e746493d5e859265536a2525df97 --- /dev/null +++ b/3rdparty/libzip/regress/encryption-remove.test @@ -0,0 +1,5 @@ +# test AES decryption support, remove encryption from file that has it +features CRYPTO +return 0 +args encrypt.zzip set_password foofoofoo set_file_encryption 1 none "" +file encrypt.zzip encrypt-aes128.zip encrypt-none.zip diff --git a/3rdparty/libzip/regress/encryption-stat.test b/3rdparty/libzip/regress/encryption-stat.test new file mode 100644 index 0000000000000000000000000000000000000000..d84d8fcb7f170f1724792b3ff4f916d75961ed86 --- /dev/null +++ b/3rdparty/libzip/regress/encryption-stat.test @@ -0,0 +1,23 @@ +features CRYPTO +description encrypt file, look at stat before commit +return 0 +args encrypt.zzip stat 1 set_file_encryption 1 AES-128 no-entropy stat 1 unchange_all +file encrypt.zzip encrypt-none.zip encrypt-none.zip +stdout name: 'encrypted' +stdout index: '1' +stdout size: '10' +stdout compressed size: '10' +stdout mtime: 'Sat Jan 14 2017 21:27:26' +stdout crc: 'fb8c5e55' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'encrypted' +stdout index: '1' +stdout size: '10' +stdout compressed size: '10' +stdout mtime: 'Sat Jan 14 2017 21:27:26' +stdout crc: 'fb8c5e55' +stdout compression method: '0' +stdout encryption method: '257' +stdout diff --git a/3rdparty/libzip/regress/extra_add.test b/3rdparty/libzip/regress/extra_add.test new file mode 100644 index 0000000000000000000000000000000000000000..c2020f1bf46562777587faffb99e0efab35b7155 --- /dev/null +++ b/3rdparty/libzip/regress/extra_add.test @@ -0,0 +1,7 @@ +# add extra field +#args encrypt.zip set_extra 0 2345 65535 cl extrafieldcontent +args encrypt.zip set_extra 0 2345 65535 cl extrafieldcontent get_extra_by_id 0 2345 0 c get_extra_by_id 0 2345 0 l +return 0 +file encrypt.zip encrypt.zip encrypt_plus_extra.zip +stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74 +stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74 diff --git a/3rdparty/libzip/regress/extra_add_multiple.test b/3rdparty/libzip/regress/extra_add_multiple.test new file mode 100644 index 0000000000000000000000000000000000000000..262375598409add74bdf0260e8b13b9ce49a5066 --- /dev/null +++ b/3rdparty/libzip/regress/extra_add_multiple.test @@ -0,0 +1,8 @@ +# add extra fields +args testfile.zip set_extra 0 2345 65535 cl extra1 set_extra 0 2345 65535 cl extra2 set_extra 0 2345 0 c extra1c set_extra 0 2345 1 l extra2l get_extra_by_id 0 2345 0 c get_extra_by_id 0 2345 1 c get_extra_by_id 0 2345 0 l get_extra_by_id 0 2345 1 l +return 0 +file testfile.zip testfile.zip testfile-plus-extra.zip +stdout Extra field 0x0929: len 7, data 0x65787472613163 +stdout Extra field 0x0929: len 6, data 0x657874726132 +stdout Extra field 0x0929: len 6, data 0x657874726131 +stdout Extra field 0x0929: len 7, data 0x6578747261326c diff --git a/3rdparty/libzip/regress/extra_count.test b/3rdparty/libzip/regress/extra_count.test new file mode 100644 index 0000000000000000000000000000000000000000..7d80e02353509dff731ff2e3b695a83101337513 --- /dev/null +++ b/3rdparty/libzip/regress/extra_count.test @@ -0,0 +1,10 @@ +# count extra fields for index +args encrypt.zip count_extra 0 l count_extra 0 c count_extra 0 lc count_extra 1 l count_extra 1 c count_extra 1 lc +return 0 +file encrypt.zip encrypt.zip encrypt.zip +stdout Extra field count: 2 +stdout Extra field count: 2 +stdout Extra field count: 4 +stdout Extra field count: 2 +stdout Extra field count: 2 +stdout Extra field count: 4 diff --git a/3rdparty/libzip/regress/extra_count_by_id.test b/3rdparty/libzip/regress/extra_count_by_id.test new file mode 100644 index 0000000000000000000000000000000000000000..5029935d7759384a432544d81c0c32426809d0aa --- /dev/null +++ b/3rdparty/libzip/regress/extra_count_by_id.test @@ -0,0 +1,22 @@ +# count extra fields for index +args encrypt.zip count_extra_by_id 0 0 l count_extra_by_id 0 1 l count_extra_by_id 0 21589 l count_extra_by_id 0 30805 l count_extra_by_id 0 21844 l count_extra_by_id 0 12345 l count_extra_by_id 0 0 c count_extra_by_id 0 1 c count_extra_by_id 0 21589 c count_extra_by_id 0 30805 c count_extra_by_id 0 21844 c count_extra_by_id 0 12345 c count_extra_by_id 0 0 cl count_extra_by_id 0 1 cl count_extra_by_id 0 21589 cl count_extra_by_id 0 30805 cl count_extra_by_id 0 21844 cl count_extra_by_id 0 12345 cl +return 0 +file encrypt.zip encrypt.zip encrypt.zip +stdout Extra field count: 0 +stdout Extra field count: 0 +stdout Extra field count: 1 +stdout Extra field count: 1 +stdout Extra field count: 0 +stdout Extra field count: 0 +stdout Extra field count: 0 +stdout Extra field count: 0 +stdout Extra field count: 1 +stdout Extra field count: 1 +stdout Extra field count: 0 +stdout Extra field count: 0 +stdout Extra field count: 0 +stdout Extra field count: 0 +stdout Extra field count: 2 +stdout Extra field count: 2 +stdout Extra field count: 0 +stdout Extra field count: 0 diff --git a/3rdparty/libzip/regress/extra_count_ignore_zip64.test b/3rdparty/libzip/regress/extra_count_ignore_zip64.test new file mode 100644 index 0000000000000000000000000000000000000000..1766997fb1b152e4b37475eb47ba8eb94016e2b7 --- /dev/null +++ b/3rdparty/libzip/regress/extra_count_ignore_zip64.test @@ -0,0 +1,7 @@ +# count extra fields for index +args bigzero.zip count_extra 0 l count_extra 0 c count_extra 0 lc +return 0 +file bigzero.zip bigzero.zip bigzero.zip +stdout Extra field count: 0 +stdout Extra field count: 0 +stdout Extra field count: 0 diff --git a/3rdparty/libzip/regress/extra_delete.test b/3rdparty/libzip/regress/extra_delete.test new file mode 100644 index 0000000000000000000000000000000000000000..9bccc9091eecd5e07a782245af2ac85bf42b8832 --- /dev/null +++ b/3rdparty/libzip/regress/extra_delete.test @@ -0,0 +1,14 @@ +# delete extra field by index +args encrypt.zip get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l delete_extra 0 2 c delete_extra 0 0 l get_extra 0 0 c get_extra 0 1 c get_extra 0 0 l get_extra 0 1 l +file encrypt.zip encrypt_plus_extra.zip encrypt.zip +return 0 +stdout Extra field 0x5455: len 5, data 0x033dda4c44 +stdout Extra field 0x7855: len 0 +stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74 +stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74 +stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44 +stdout Extra field 0x7855: len 4, data 0x64001400 +stdout Extra field 0x5455: len 5, data 0x033dda4c44 +stdout Extra field 0x7855: len 0 +stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44 +stdout Extra field 0x7855: len 4, data 0x64001400 diff --git a/3rdparty/libzip/regress/extra_delete_by_id.test b/3rdparty/libzip/regress/extra_delete_by_id.test new file mode 100644 index 0000000000000000000000000000000000000000..4c8fa006f475eab60dbd16f819ec1909eb41c1fb --- /dev/null +++ b/3rdparty/libzip/regress/extra_delete_by_id.test @@ -0,0 +1,6 @@ +# delete extra field by id and index +#args encrypt.zip set_extra 0 2345 65535 cl extrafieldcontent +args encrypt.zip delete_extra_by_id 0 2345 0 c delete_extra_by_id 0 2345 0 l get_extra_by_id 0 2345 0 c +return 1 +file encrypt.zip encrypt_plus_extra.zip encrypt.zip +stderr can't get extra field data for file at index 0, extra field id 2345, ef index 0, flags 512: No such file diff --git a/3rdparty/libzip/regress/extra_field_align.test b/3rdparty/libzip/regress/extra_field_align.test new file mode 100644 index 0000000000000000000000000000000000000000..3bb51c9511c6213ff6b9dc22a7e9f2ca1ba221c9 --- /dev/null +++ b/3rdparty/libzip/regress/extra_field_align.test @@ -0,0 +1,32 @@ +# try opening simulated Android APK zipaligned files, and similar inconsistent files +setenv LANG C +program tryopen +file extra_field_align_1-0.zzip extra_field_align_1-0.zip extra_field_align_1-0.zip +file extra_field_align_1-ff.zzip extra_field_align_1-ff.zip extra_field_align_1-ff.zip +file extra_field_align_2-0.zzip extra_field_align_2-0.zip extra_field_align_2-0.zip +file extra_field_align_2-ff.zzip extra_field_align_2-ff.zip extra_field_align_2-ff.zip +file extra_field_align_3-0.zzip extra_field_align_3-0.zip extra_field_align_3-0.zip +file extra_field_align_3-ff.zzip extra_field_align_3-ff.zip extra_field_align_3-ff.zip +file extra_field_align_4-ff.zzip extra_field_align_4-ff.zip extra_field_align_4-ff.zip +file extra_field_align_1-ef_00.zzip extra_field_align_1-ef_00.zip extra_field_align_1-ef_00.zip +file extra_field_align_1-ef_ff.zzip extra_field_align_1-ef_ff.zip extra_field_align_1-ef_ff.zip +file extra_field_align_2-ef_00.zzip extra_field_align_2-ef_00.zip extra_field_align_2-ef_00.zip +file extra_field_align_2-ef_ff.zzip extra_field_align_2-ef_ff.zip extra_field_align_2-ef_ff.zip +file extra_field_align_3-ef_00.zzip extra_field_align_3-ef_00.zip extra_field_align_3-ef_00.zip +file extra_field_align_3-ef_ff.zzip extra_field_align_3-ef_ff.zip extra_field_align_3-ef_ff.zip +args -c extra_field_align_1-0.zzip extra_field_align_1-ff.zzip extra_field_align_2-0.zzip extra_field_align_2-ff.zzip extra_field_align_3-0.zzip extra_field_align_3-ff.zzip extra_field_align_4-ff.zzip extra_field_align_1-ef_00.zzip extra_field_align_1-ef_ff.zzip extra_field_align_2-ef_00.zzip extra_field_align_2-ef_ff.zzip extra_field_align_3-ef_00.zzip extra_field_align_3-ef_ff.zzip +return 1 +stdout opening 'extra_field_align_1-0.zzip' succeeded, 1 entries +stdout opening 'extra_field_align_1-ff.zzip' returned error 21/15 +stdout opening 'extra_field_align_2-0.zzip' succeeded, 1 entries +stdout opening 'extra_field_align_2-ff.zzip' returned error 21/15 +stdout opening 'extra_field_align_3-0.zzip' succeeded, 1 entries +stdout opening 'extra_field_align_3-ff.zzip' returned error 21/15 +stdout opening 'extra_field_align_4-ff.zzip' succeeded, 1 entries +stdout opening 'extra_field_align_1-ef_00.zzip' succeeded, 1 entries +stdout opening 'extra_field_align_1-ef_ff.zzip' returned error 21/15 +stdout opening 'extra_field_align_2-ef_00.zzip' succeeded, 1 entries +stdout opening 'extra_field_align_2-ef_ff.zzip' returned error 21/15 +stdout opening 'extra_field_align_3-ef_00.zzip' succeeded, 1 entries +stdout opening 'extra_field_align_3-ef_ff.zzip' returned error 21/15 +stderr 6 errors diff --git a/3rdparty/libzip/regress/extra_field_align_1-0.zip b/3rdparty/libzip/regress/extra_field_align_1-0.zip new file mode 100644 index 0000000000000000000000000000000000000000..11aaaace23735017774baf4e51cd6eec9cac79b9 Binary files /dev/null and b/3rdparty/libzip/regress/extra_field_align_1-0.zip differ diff --git a/3rdparty/libzip/regress/extra_field_align_1-ef_00.zip b/3rdparty/libzip/regress/extra_field_align_1-ef_00.zip new file mode 100644 index 0000000000000000000000000000000000000000..c07777b0016ced4ba93730e2a6fa3ac46f3cda10 Binary files /dev/null and b/3rdparty/libzip/regress/extra_field_align_1-ef_00.zip differ diff --git a/3rdparty/libzip/regress/extra_field_align_1-ef_ff.zip b/3rdparty/libzip/regress/extra_field_align_1-ef_ff.zip new file mode 100644 index 0000000000000000000000000000000000000000..d62e0ec2ca51785166f561558090759e42a3c2c0 Binary files /dev/null and b/3rdparty/libzip/regress/extra_field_align_1-ef_ff.zip differ diff --git a/3rdparty/libzip/regress/extra_field_align_1-ff.zip b/3rdparty/libzip/regress/extra_field_align_1-ff.zip new file mode 100644 index 0000000000000000000000000000000000000000..6b05df2f24ae3e9c29a9f1cae162634e281275de Binary files /dev/null and b/3rdparty/libzip/regress/extra_field_align_1-ff.zip differ diff --git a/3rdparty/libzip/regress/extra_field_align_2-0.zip b/3rdparty/libzip/regress/extra_field_align_2-0.zip new file mode 100644 index 0000000000000000000000000000000000000000..c7072d2d2288b9d503c378141a753ef5e846055b Binary files /dev/null and b/3rdparty/libzip/regress/extra_field_align_2-0.zip differ diff --git a/3rdparty/libzip/regress/extra_field_align_2-ef_00.zip b/3rdparty/libzip/regress/extra_field_align_2-ef_00.zip new file mode 100644 index 0000000000000000000000000000000000000000..68e40891573b9b79a4388369824de553efe78eba Binary files /dev/null and b/3rdparty/libzip/regress/extra_field_align_2-ef_00.zip differ diff --git a/3rdparty/libzip/regress/extra_field_align_2-ef_ff.zip b/3rdparty/libzip/regress/extra_field_align_2-ef_ff.zip new file mode 100644 index 0000000000000000000000000000000000000000..be9510b6384ab4cd616e3fd9f8150564fc8c36b2 Binary files /dev/null and b/3rdparty/libzip/regress/extra_field_align_2-ef_ff.zip differ diff --git a/3rdparty/libzip/regress/extra_field_align_2-ff.zip b/3rdparty/libzip/regress/extra_field_align_2-ff.zip new file mode 100644 index 0000000000000000000000000000000000000000..7bf88a0539442e87fee15e730408a01adbf48258 Binary files /dev/null and b/3rdparty/libzip/regress/extra_field_align_2-ff.zip differ diff --git a/3rdparty/libzip/regress/extra_field_align_3-0.zip b/3rdparty/libzip/regress/extra_field_align_3-0.zip new file mode 100644 index 0000000000000000000000000000000000000000..401e7b060c6b12978bb04269bcd5d9ecfbe4d159 Binary files /dev/null and b/3rdparty/libzip/regress/extra_field_align_3-0.zip differ diff --git a/3rdparty/libzip/regress/extra_field_align_3-ef_00.zip b/3rdparty/libzip/regress/extra_field_align_3-ef_00.zip new file mode 100644 index 0000000000000000000000000000000000000000..326f98d528100cc0612a16c25c66b3a0d4cb2a67 Binary files /dev/null and b/3rdparty/libzip/regress/extra_field_align_3-ef_00.zip differ diff --git a/3rdparty/libzip/regress/extra_field_align_3-ef_ff.zip b/3rdparty/libzip/regress/extra_field_align_3-ef_ff.zip new file mode 100644 index 0000000000000000000000000000000000000000..ab9d81f0dbbb7cfb05f10e75856fb10228ce6681 Binary files /dev/null and b/3rdparty/libzip/regress/extra_field_align_3-ef_ff.zip differ diff --git a/3rdparty/libzip/regress/extra_field_align_3-ff.zip b/3rdparty/libzip/regress/extra_field_align_3-ff.zip new file mode 100644 index 0000000000000000000000000000000000000000..c6fde73b420e9883bab1992cbd2aed7cd22a4861 Binary files /dev/null and b/3rdparty/libzip/regress/extra_field_align_3-ff.zip differ diff --git a/3rdparty/libzip/regress/extra_field_align_4-ff.zip b/3rdparty/libzip/regress/extra_field_align_4-ff.zip new file mode 100644 index 0000000000000000000000000000000000000000..c23966f4336695b0f9c2697a6cc0da0ce60570ba Binary files /dev/null and b/3rdparty/libzip/regress/extra_field_align_4-ff.zip differ diff --git a/3rdparty/libzip/regress/extra_get.test b/3rdparty/libzip/regress/extra_get.test new file mode 100644 index 0000000000000000000000000000000000000000..4f458877407e6ff8a9b61a81207982ad72407fcf --- /dev/null +++ b/3rdparty/libzip/regress/extra_get.test @@ -0,0 +1,9 @@ +# get extra fields for index +args encrypt.zip get_extra 0 0 l get_extra 0 0 c get_extra 0 1 l get_extra 0 1 c get_extra 0 2 l +return 1 +file encrypt.zip encrypt.zip encrypt.zip +stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44 +stdout Extra field 0x5455: len 5, data 0x033dda4c44 +stdout Extra field 0x7855: len 4, data 0x64001400 +stdout Extra field 0x7855: len 0 +stderr can't get extra field data for file at index 0, extra field 2, flags 256: No such file diff --git a/3rdparty/libzip/regress/extra_get_by_id.test b/3rdparty/libzip/regress/extra_get_by_id.test new file mode 100644 index 0000000000000000000000000000000000000000..67f49671bdc5a76a0289802ddbce2b91f4eb03e4 --- /dev/null +++ b/3rdparty/libzip/regress/extra_get_by_id.test @@ -0,0 +1,9 @@ +# get extra_by_id fields for index +args encrypt.zip get_extra_by_id 0 21589 0 l get_extra_by_id 0 30805 0 l get_extra_by_id 0 21589 0 c get_extra_by_id 0 30805 0 c get_extra_by_id 0 21544 0 c +return 1 +file encrypt.zip encrypt.zip encrypt.zip +stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44 +stdout Extra field 0x7855: len 4, data 0x64001400 +stdout Extra field 0x5455: len 5, data 0x033dda4c44 +stdout Extra field 0x7855: len 0 +stderr can't get extra field data for file at index 0, extra field id 21544, ef index 0, flags 512: No such file diff --git a/3rdparty/libzip/regress/extra_set.test b/3rdparty/libzip/regress/extra_set.test new file mode 100644 index 0000000000000000000000000000000000000000..ccdbdc96853d4c439b3424aafe3e9be1689fb65d --- /dev/null +++ b/3rdparty/libzip/regress/extra_set.test @@ -0,0 +1,14 @@ +# set extra field +args -- encrypt get_extra 0 0 c get_extra 0 1 c get_extra 0 0 l get_extra 0 1 l set_extra 0 2345 -1 l extrafieldcontent set_extra 0 2345 -1 c extrafieldcontent get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l +file encrypt encrypt.zip encrypt_plus_extra.zip +return 0 +stdout Extra field 0x5455: len 5, data 0x033dda4c44 +stdout Extra field 0x7855: len 0 +stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44 +stdout Extra field 0x7855: len 4, data 0x64001400 +stdout Extra field 0x5455: len 5, data 0x033dda4c44 +stdout Extra field 0x7855: len 0 +stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74 +stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44 +stdout Extra field 0x7855: len 4, data 0x64001400 +stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74 diff --git a/3rdparty/libzip/regress/extra_set_modify_c.test b/3rdparty/libzip/regress/extra_set_modify_c.test new file mode 100644 index 0000000000000000000000000000000000000000..dca49f436284160ae45e3176f7da30568c436bed --- /dev/null +++ b/3rdparty/libzip/regress/extra_set_modify_c.test @@ -0,0 +1,16 @@ +# change existing central extra field +args encrypt.zip get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l set_extra 0 2345 0 c Extrafieldcontent get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l +file encrypt.zip encrypt_plus_extra.zip encrypt_plus_extra_modified_c.zip +return 0 +stdout Extra field 0x5455: len 5, data 0x033dda4c44 +stdout Extra field 0x7855: len 0 +stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74 +stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74 +stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44 +stdout Extra field 0x7855: len 4, data 0x64001400 +stdout Extra field 0x5455: len 5, data 0x033dda4c44 +stdout Extra field 0x7855: len 0 +stdout Extra field 0x0929: len 17, data 0x45787472616669656c64636f6e74656e74 +stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74 +stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44 +stdout Extra field 0x7855: len 4, data 0x64001400 diff --git a/3rdparty/libzip/regress/extra_set_modify_l.test b/3rdparty/libzip/regress/extra_set_modify_l.test new file mode 100644 index 0000000000000000000000000000000000000000..4dda9b7cebadbe0b00f46039db4f354a90428e3e --- /dev/null +++ b/3rdparty/libzip/regress/extra_set_modify_l.test @@ -0,0 +1,16 @@ +# change existing local extra field +args encrypt.zip get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l set_extra 0 2345 0 l Extrafieldcontent get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l +file encrypt.zip encrypt_plus_extra.zip encrypt_plus_extra_modified_l.zip +return 0 +stdout Extra field 0x5455: len 5, data 0x033dda4c44 +stdout Extra field 0x7855: len 0 +stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74 +stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74 +stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44 +stdout Extra field 0x7855: len 4, data 0x64001400 +stdout Extra field 0x5455: len 5, data 0x033dda4c44 +stdout Extra field 0x7855: len 0 +stdout Extra field 0x0929: len 17, data 0x65787472616669656c64636f6e74656e74 +stdout Extra field 0x0929: len 17, data 0x45787472616669656c64636f6e74656e74 +stdout Extra field 0x5455: len 9, data 0x033dda4c444dda4c44 +stdout Extra field 0x7855: len 4, data 0x64001400 diff --git a/3rdparty/libzip/regress/fdopen_ok.test b/3rdparty/libzip/regress/fdopen_ok.test new file mode 100644 index 0000000000000000000000000000000000000000..ff478bb2b393b1c866d980e236d6cc0f39b80178 --- /dev/null +++ b/3rdparty/libzip/regress/fdopen_ok.test @@ -0,0 +1,15 @@ +# zip_fdopen: stdin opens fine +program ../src/ziptool +args /dev/stdin stat 0 +stdin-file test.zip +return 0 +file test.zip test.zip test.zip +stdout name: 'test' +stdout index: '0' +stdout size: '5' +stdout compressed size: '5' +stdout mtime: 'Mon Oct 06 2003 15:46:42' +stdout crc: '3bb935c6' +stdout compression method: '0' +stdout encryption method: '0' +stdout diff --git a/3rdparty/libzip/regress/file_comment_encmismatch.test b/3rdparty/libzip/regress/file_comment_encmismatch.test new file mode 100644 index 0000000000000000000000000000000000000000..a2b8209463b057b0cb4315194339e764fd80aadd --- /dev/null +++ b/3rdparty/libzip/regress/file_comment_encmismatch.test @@ -0,0 +1,4 @@ +# set file comment to UTF-8 for CP437 encoded filename (adds InfoZIP extra field) +return 0 +args testfile.zip set_file_comment 0 ÄÖÜßäöü +file testfile.zip test-cp437.zip test-cp437-comment-utf-8.zip diff --git a/3rdparty/libzip/regress/filename_duplicate.zip b/3rdparty/libzip/regress/filename_duplicate.zip new file mode 100644 index 0000000000000000000000000000000000000000..96a11e7dd330e2dbcd006ae5fecf030eb6b7ab72 Binary files /dev/null and b/3rdparty/libzip/regress/filename_duplicate.zip differ diff --git a/3rdparty/libzip/regress/filename_duplicate_empty.zip b/3rdparty/libzip/regress/filename_duplicate_empty.zip new file mode 100644 index 0000000000000000000000000000000000000000..c4af0d8455c52a12d7d31e57b70ca203d06cbbc6 Binary files /dev/null and b/3rdparty/libzip/regress/filename_duplicate_empty.zip differ diff --git a/3rdparty/libzip/regress/filename_empty.zip b/3rdparty/libzip/regress/filename_empty.zip new file mode 100644 index 0000000000000000000000000000000000000000..d32e4e72244cc30fef2055efc3491e713c3cc132 Binary files /dev/null and b/3rdparty/libzip/regress/filename_empty.zip differ diff --git a/3rdparty/libzip/regress/fileorder.zip b/3rdparty/libzip/regress/fileorder.zip new file mode 100644 index 0000000000000000000000000000000000000000..3fcd81a66b6ddf4129101cc36f3cfe873c393d46 Binary files /dev/null and b/3rdparty/libzip/regress/fileorder.zip differ diff --git a/3rdparty/libzip/regress/firstsecond-split-deflated.zip b/3rdparty/libzip/regress/firstsecond-split-deflated.zip new file mode 100644 index 0000000000000000000000000000000000000000..35b9a5c6d8852e1392aa65a5d19f1a249e1111e0 Binary files /dev/null and b/3rdparty/libzip/regress/firstsecond-split-deflated.zip differ diff --git a/3rdparty/libzip/regress/firstsecond-split-stored.zip b/3rdparty/libzip/regress/firstsecond-split-stored.zip new file mode 100644 index 0000000000000000000000000000000000000000..35f0684bf9d8d7d4a8a568110559881c5f769b56 Binary files /dev/null and b/3rdparty/libzip/regress/firstsecond-split-stored.zip differ diff --git a/3rdparty/libzip/regress/firstsecond.zip b/3rdparty/libzip/regress/firstsecond.zip new file mode 100644 index 0000000000000000000000000000000000000000..a9117e373a2be8412ad15233b69a4b3ea44ad6d3 Binary files /dev/null and b/3rdparty/libzip/regress/firstsecond.zip differ diff --git a/3rdparty/libzip/regress/foo-stored.zip b/3rdparty/libzip/regress/foo-stored.zip new file mode 100644 index 0000000000000000000000000000000000000000..d3adc8022793ed62d69976ca9316d2d5a961c011 Binary files /dev/null and b/3rdparty/libzip/regress/foo-stored.zip differ diff --git a/3rdparty/libzip/regress/fopen_unchanged.c b/3rdparty/libzip/regress/fopen_unchanged.c new file mode 100644 index 0000000000000000000000000000000000000000..8e2ee2689ff3296ac45d41b75a23062505e22ada --- /dev/null +++ b/3rdparty/libzip/regress/fopen_unchanged.c @@ -0,0 +1,90 @@ +/* + fopen_unchanged.c -- test case for adding file and reading from unchanged + Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "zip.h" + +const char *teststr = "This is a test.\n"; +const char *file = "teststring.txt"; + +int +main(int argc, char *argv[]) { + const char *archive; + zip_t *za; + zip_source_t *zs; + int err; + + if (argc != 2) { + fprintf(stderr, "usage: %s archive\n", argv[0]); + return 1; + } + + archive = argv[1]; + + if ((za = zip_open(archive, ZIP_CREATE, &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); + return 1; + } + + if ((zs = zip_source_buffer(za, teststr, strlen(teststr), 0)) == NULL) { + fprintf(stderr, "can't create zip_source from buffer: %s\n", zip_strerror(za)); + exit(1); + } + + if (zip_add(za, file, zs) == -1) { + fprintf(stderr, "can't add file '%s': %s\n", file, zip_strerror(za)); + (void)zip_source_free(zs); + (void)zip_close(za); + return 1; + } + + if (zip_fopen(za, file, ZIP_FL_UNCHANGED) == NULL) { + fprintf(stderr, "can't zip_fopen file '%s': %s\n", file, zip_strerror(za)); + (void)zip_discard(za); + return 1; + } + + if (zip_close(za) == -1) { + fprintf(stderr, "can't close zip archive '%s': %s\n", archive, zip_strerror(za)); + return 1; + } + + return 0; +} diff --git a/3rdparty/libzip/regress/fopen_unchanged.test b/3rdparty/libzip/regress/fopen_unchanged.test new file mode 100644 index 0000000000000000000000000000000000000000..885f8b7ba3cd9641afb1b209e6d9562b58f16c16 --- /dev/null +++ b/3rdparty/libzip/regress/fopen_unchanged.test @@ -0,0 +1,5 @@ +# add buffer contents as file to zip, then read unchanged from it +program fopen_unchanged +return 1 +args testbuffer.zip +stderr can't zip_fopen file 'teststring.txt': No such file diff --git a/3rdparty/libzip/regress/fread.c b/3rdparty/libzip/regress/fread.c new file mode 100644 index 0000000000000000000000000000000000000000..f644282c7438c168b9aac8d3e96419eb9c447c1e --- /dev/null +++ b/3rdparty/libzip/regress/fread.c @@ -0,0 +1,212 @@ +/* + fread.c -- test cases for reading from zip archives + Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdio.h> +#include <stdlib.h> + +#ifndef HAVE_GETOPT +#include "getopt.h" +#endif + +#include "zip.h" + +enum when { WHEN_NEVER, WHEN_OPEN, WHEN_READ, WHEN_CLOSE }; + +const char *when_name[] = {"no", "zip_fopen", "zip_fread", "zip_fclose"}; + +static int do_read(zip_t *z, const char *name, zip_flags_t flags, enum when when_ex, int ze_ex, int se_ex); + +int verbose; + +const char *progname; +#define USAGE "usage: %s [-v] archive\n" + +int +main(int argc, char *argv[]) { + int fail, ze; + int c; + zip_t *z; + zip_source_t *zs; + char *archive; + zip_int64_t idx; + + verbose = 0; + fail = 0; + + progname = argv[0]; + + while ((c = getopt(argc, argv, "v")) != -1) { + switch (c) { + case 'v': + verbose = 1; + break; + + default: + fprintf(stderr, USAGE, progname); + return 1; + } + } + + + if (argc - optind != 1) { + fprintf(stderr, USAGE, progname); + return 1; + } + + archive = argv[optind]; + + if ((z = zip_open(archive, 0, &ze)) == NULL) { + zip_error_t error; + zip_error_init_with_code(&error, ze); + fprintf(stderr, "%s: can't open zip archive '%s': %s\n", progname, archive, zip_error_strerror(&error)); + zip_error_fini(&error); + return 1; + } + + fail += do_read(z, "storedok", 0, WHEN_NEVER, 0, 0); + fail += do_read(z, "deflateok", 0, WHEN_NEVER, 0, 0); + fail += do_read(z, "storedcrcerror", 0, WHEN_READ, ZIP_ER_CRC, 0); + fail += do_read(z, "deflatecrcerror", 0, WHEN_READ, ZIP_ER_CRC, 0); + fail += do_read(z, "deflatezliberror", 0, WHEN_READ, ZIP_ER_ZLIB, -3); +#ifndef __clang_analyzer__ /* This test intentionally violates nullability. */ + fail += do_read(z, NULL, 0, WHEN_OPEN, ZIP_ER_INVAL, 0); +#endif + fail += do_read(z, "nosuchfile", 0, WHEN_OPEN, ZIP_ER_NOENT, 0); + fail += do_read(z, "deflatezliberror", ZIP_FL_COMPRESSED, WHEN_NEVER, 0, 0); + fail += do_read(z, "deflatecrcerror", ZIP_FL_COMPRESSED, WHEN_NEVER, 0, 0); + fail += do_read(z, "storedcrcerror", ZIP_FL_COMPRESSED, WHEN_READ, ZIP_ER_CRC, 0); + fail += do_read(z, "storedok", ZIP_FL_COMPRESSED, WHEN_NEVER, 0, 0); + + fail += do_read(z, "cryptok", 0, WHEN_OPEN, ZIP_ER_NOPASSWD, 0); + zip_set_default_password(z, "crypt"); + fail += do_read(z, "cryptok", 0, WHEN_NEVER, 0, 0); + zip_set_default_password(z, "wrong"); + fail += do_read(z, "cryptok", 0, WHEN_OPEN, ZIP_ER_WRONGPASSWD, 0); + zip_set_default_password(z, NULL); + + zs = zip_source_buffer(z, "asdf", 4, 0); + if ((idx = zip_name_locate(z, "storedok", 0)) < 0) { + fprintf(stderr, "%s: can't locate 'storedok' in zip archive '%s': %s\n", progname, archive, zip_strerror(z)); + fail++; + } + else { + if (zip_replace(z, (zip_uint64_t)idx, zs) < 0) { + fprintf(stderr, "%s: can't replace 'storedok' in zip archive '%s': %s\n", progname, archive, zip_strerror(z)); + fail++; + } + else { + fail += do_read(z, "storedok", 0, WHEN_OPEN, ZIP_ER_CHANGED, 0); + fail += do_read(z, "storedok", ZIP_FL_UNCHANGED, WHEN_NEVER, 0, 0); + } + } + if ((idx = zip_name_locate(z, "storedok", 0)) < 0) { + fprintf(stderr, "%s: can't locate 'storedok' in zip archive '%s': %s\n", progname, archive, zip_strerror(z)); + fail++; + } + else { + if (zip_delete(z, (zip_uint64_t)idx) < 0) { + fprintf(stderr, "%s: can't replace 'storedok' in zip archive '%s': %s\n", progname, archive, zip_strerror(z)); + fail++; + } + else { + fail += do_read(z, "storedok", 0, WHEN_OPEN, ZIP_ER_NOENT, 0); + fail += do_read(z, "storedok", ZIP_FL_UNCHANGED, WHEN_NEVER, 0, 0); + } + } + zs = zip_source_buffer(z, "asdf", 4, 0); + if (zip_file_add(z, "new_file", zs, 0) < 0) { + fprintf(stderr, "%s: can't add file to zip archive '%s': %s\n", progname, archive, zip_strerror(z)); + fail++; + } + else { + fail += do_read(z, "new_file", 0, WHEN_OPEN, ZIP_ER_CHANGED, 0); + } + + zip_unchange_all(z); + if (zip_close(z) == -1) { + fprintf(stderr, "%s: can't close zip archive '%s': %s\n", progname, archive, zip_strerror(z)); + return 1; + } + + exit(fail ? 1 : 0); +} + + +static int +do_read(zip_t *z, const char *name, zip_flags_t flags, enum when when_ex, int ze_ex, int se_ex) { + zip_file_t *zf; + enum when when_got; + zip_error_t error_got, error_ex; + zip_error_t *zf_error; + int err; + char b[8192]; + zip_int64_t n; + + when_got = WHEN_NEVER; + zip_error_init(&error_got); + zip_error_init(&error_ex); + zip_error_set(&error_ex, ze_ex, se_ex); + + if ((zf = zip_fopen(z, name, flags)) == NULL) { + when_got = WHEN_OPEN; + zf_error = zip_get_error(z); + zip_error_set(&error_got, zip_error_code_zip(zf_error), zip_error_code_system(zf_error)); + } + else { + while ((n = zip_fread(zf, b, sizeof(b))) > 0) + ; + if (n < 0) { + when_got = WHEN_READ; + zf_error = zip_file_get_error(zf); + zip_error_set(&error_got, zip_error_code_zip(zf_error), zip_error_code_system(zf_error)); + } + err = zip_fclose(zf); + if (when_got == WHEN_NEVER && err != 0) { + when_got = WHEN_CLOSE; + zip_error_init_with_code(&error_got, err); + } + } + + if (when_got != when_ex || zip_error_code_zip(&error_got) != zip_error_code_zip(&error_ex) || zip_error_code_system(&error_got) != zip_error_code_system(&error_ex)) { + printf("%s: %s: got %s error (%s), expected %s error (%s)\n", progname, name, when_name[when_got], zip_error_strerror(&error_got), when_name[when_ex], zip_error_strerror(&error_ex)); + zip_error_fini(&error_got); + zip_error_fini(&error_ex); + return 1; + } + else if (verbose) + printf("%s: %s: passed\n", progname, name); + + return 0; +} diff --git a/3rdparty/libzip/regress/fread.test b/3rdparty/libzip/regress/fread.test new file mode 100644 index 0000000000000000000000000000000000000000..234e1a15057f6f347fd349ce929f1afe07774e83 --- /dev/null +++ b/3rdparty/libzip/regress/fread.test @@ -0,0 +1,5 @@ +# various tests for zip_fread +program fread +args broken.zip +return 0 +file broken.zip broken.zip broken.zip diff --git a/3rdparty/libzip/regress/fseek.c b/3rdparty/libzip/regress/fseek.c new file mode 100644 index 0000000000000000000000000000000000000000..41b7c3f3d515668b69a10ca2960d846243510ef1 --- /dev/null +++ b/3rdparty/libzip/regress/fseek.c @@ -0,0 +1,104 @@ +/* + fseek.c -- test tool for seeking in zip archives + Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdlib.h> + +#include "zip.h" + +const char *progname; +#define USAGE "usage: %s archive index offset\n" + +int +main(int argc, char *argv[]) { + int ze; + zip_t *z; + zip_file_t *zf; + char *archive; + zip_int64_t offset, n; + zip_uint64_t index; + char b[1024]; + + progname = argv[0]; + + if (argc != 4) { + fprintf(stderr, USAGE, progname); + return 1; + } + + archive = argv[1]; + index = strtoull(argv[2], NULL, 10); + offset = (zip_int64_t)strtoull(argv[3], NULL, 10); + + if ((z = zip_open(archive, 0, &ze)) == NULL) { + zip_error_t error; + zip_error_init_with_code(&error, ze); + fprintf(stderr, "%s: can't open zip archive '%s': %s\n", progname, archive, zip_error_strerror(&error)); + zip_error_fini(&error); + return 1; + } + + if ((zf = zip_fopen_index(z, index, 0)) == NULL) { + fprintf(stderr, "%s: can't open file in archive '%s': %s\n", progname, archive, zip_error_strerror(zip_file_get_error(zf))); + zip_close(z); + return 1; + } + + if (zip_fseek(zf, offset, SEEK_SET) < 0) { + fprintf(stderr, "%s: zip_fseek failed: %s\n", progname, zip_error_strerror(zip_file_get_error(zf))); + zip_fclose(zf); + zip_close(z); + return 1; + } + + while ((n = zip_fread(zf, b, sizeof(b))) > 0) { + printf("%.*s", (int)n, b); + } + if (n < 0) { + fprintf(stderr, "%s: zip_fread failed: %s\n", progname, zip_error_strerror(zip_file_get_error(zf))); + zip_fclose(zf); + zip_close(z); + return 1; + } + + if (zip_fclose(zf) == -1) { + fprintf(stderr, "%s: can't close zip archive entry %" PRIu64 " in '%s': %s\n", progname, index, archive, zip_strerror(z)); + return 1; + } + + if (zip_close(z) == -1) { + fprintf(stderr, "%s: can't close zip archive '%s': %s\n", progname, archive, zip_strerror(z)); + return 1; + } + + return 0; +} diff --git a/3rdparty/libzip/regress/fseek_deflated.test b/3rdparty/libzip/regress/fseek_deflated.test new file mode 100644 index 0000000000000000000000000000000000000000..7c560afee2813e139a8b266f6f495a0a768b96ea --- /dev/null +++ b/3rdparty/libzip/regress/fseek_deflated.test @@ -0,0 +1,6 @@ +# unsuccessful fseek test because data is compressed +program fseek +args test.zip 0 2 +return 1 +file test.zip testdeflated.zip testdeflated.zip +stderr zip_fseek failed: Operation not supported diff --git a/3rdparty/libzip/regress/fseek_fail.test b/3rdparty/libzip/regress/fseek_fail.test new file mode 100644 index 0000000000000000000000000000000000000000..be78a9a9a1d105f5de9683a398215221c9eac022 --- /dev/null +++ b/3rdparty/libzip/regress/fseek_fail.test @@ -0,0 +1,6 @@ +# successful fseek test +program fseek +args test.zip 0 8 +return 1 +file test.zip test.zip test.zip +stderr zip_fseek failed: Invalid argument diff --git a/3rdparty/libzip/regress/fseek_ok.test b/3rdparty/libzip/regress/fseek_ok.test new file mode 100644 index 0000000000000000000000000000000000000000..29cfe67f29317520f8ef84fd4ad9568c18cf2222 --- /dev/null +++ b/3rdparty/libzip/regress/fseek_ok.test @@ -0,0 +1,6 @@ +# successful fseek test +program fseek +args test.zip 0 2 +return 0 +file test.zip test.zip test.zip +stdout st diff --git a/3rdparty/libzip/regress/fuzz_main.c b/3rdparty/libzip/regress/fuzz_main.c new file mode 100644 index 0000000000000000000000000000000000000000..0a99d3318e377089cdfdc986d08bd4f8dd302e08 --- /dev/null +++ b/3rdparty/libzip/regress/fuzz_main.c @@ -0,0 +1,50 @@ +#include "zip_read_fuzzer.cc" +#include <stdio.h> +#include <stdlib.h> + +/* fuzz target entry point, works without libFuzzer */ + +int +main(int argc, char **argv) { + FILE *f; + char *buf = NULL; + long siz_buf; + + if (argc < 2) { + fprintf(stderr, "no input file\n"); + goto err; + } + + f = fopen(argv[1], "rb"); + if (f == NULL) { + fprintf(stderr, "error opening input file %s\n", argv[1]); + goto err; + } + + fseek(f, 0, SEEK_END); + + siz_buf = ftell(f); + rewind(f); + + if (siz_buf < 1) { + goto err; + } + + buf = (char *)malloc(siz_buf); + if (buf == NULL) { + fprintf(stderr, "malloc() failed\n"); + goto err; + } + + if (fread(buf, siz_buf, 1, f) != 1) { + fprintf(stderr, "fread() failed\n"); + goto err; + } + + (void)LLVMFuzzerTestOneInput((uint8_t *)buf, siz_buf); + +err: + free(buf); + + return 0; +} diff --git a/3rdparty/libzip/regress/gap-add.zip b/3rdparty/libzip/regress/gap-add.zip new file mode 100644 index 0000000000000000000000000000000000000000..e1a015927771d04bc0adc99c550297b55fe8a5c4 Binary files /dev/null and b/3rdparty/libzip/regress/gap-add.zip differ diff --git a/3rdparty/libzip/regress/gap-delete.zip b/3rdparty/libzip/regress/gap-delete.zip new file mode 100644 index 0000000000000000000000000000000000000000..7d73d008c4e579a08db5ee9482c2600d52468983 Binary files /dev/null and b/3rdparty/libzip/regress/gap-delete.zip differ diff --git a/3rdparty/libzip/regress/gap-replace.zip b/3rdparty/libzip/regress/gap-replace.zip new file mode 100644 index 0000000000000000000000000000000000000000..27e058053d74ad7ea1af03253cbda5375e345d4f Binary files /dev/null and b/3rdparty/libzip/regress/gap-replace.zip differ diff --git a/3rdparty/libzip/regress/gap.zip b/3rdparty/libzip/regress/gap.zip new file mode 100644 index 0000000000000000000000000000000000000000..85e3bc7b71f11c5783d32d267dabe96d74d16c4a Binary files /dev/null and b/3rdparty/libzip/regress/gap.zip differ diff --git a/3rdparty/libzip/regress/get_comment.test b/3rdparty/libzip/regress/get_comment.test new file mode 100644 index 0000000000000000000000000000000000000000..5f2df0a7a8409225b259fe6d9b9f4bb02863c12b --- /dev/null +++ b/3rdparty/libzip/regress/get_comment.test @@ -0,0 +1,14 @@ +# show comments of a zip archive +return 0 +args testcomment.zip get_archive_comment get_file_comment 0 get_file_comment 1 get_file_comment 2 get_file_comment 3 +file testcomment.zip testcomment.zip testcomment.zip +stdout Archive comment: This is the archive comment for the file. +stdout +stdout Long. +stdout +stdout Longer. +stdout +stdout No comment for 'file1' +stdout File comment for 'file2': First one had no comment. +stdout File comment for 'file3': Third one. +stdout File comment for 'file4': Last. diff --git a/3rdparty/libzip/regress/hole.c b/3rdparty/libzip/regress/hole.c new file mode 100644 index 0000000000000000000000000000000000000000..e15033c6c278e5a93c2e40ea59ca95ee7c46d562 --- /dev/null +++ b/3rdparty/libzip/regress/hole.c @@ -0,0 +1,190 @@ +/* + hole.c -- convert huge files with mostly NULs to/from source_hole + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdio.h> +#include <stdlib.h> + +#ifndef HAVE_GETOPT +#include "getopt.h" +#endif + +#include "zip.h" + +/* public API */ + +zip_source_t *source_hole_create(const char *, int flags, zip_error_t *); + +const char *progname; + + +static int +copy_source(zip_source_t *from, zip_source_t *to) { + zip_uint8_t buf[8192]; + zip_int64_t n; + + if (zip_source_open(from) < 0) { + fprintf(stderr, "%s: can't open source for reading: %s\n", progname, zip_error_strerror(zip_source_error(from))); + return -1; + } + + if (zip_source_begin_write(to) < 0) { + fprintf(stderr, "%s: can't open source for writing: %s\n", progname, zip_error_strerror(zip_source_error(to))); + zip_source_close(from); + return -1; + } + + while ((n = zip_source_read(from, buf, sizeof(buf))) > 0) { + if (zip_source_write(to, buf, (zip_uint64_t)n) != n) { + fprintf(stderr, "%s: can't write to source: %s\n", progname, zip_error_strerror(zip_source_error(to))); + zip_source_close(from); + zip_source_rollback_write(to); + return -1; + } + } + + if (n < 0) { + fprintf(stderr, "%s: can't read from source: %s\n", progname, zip_error_strerror(zip_source_error(from))); + zip_source_close(from); + zip_source_rollback_write(to); + return -1; + } + + zip_source_close(from); + + if (zip_source_commit_write(to) < 0) { + fprintf(stderr, "%s: can't commit source: %s\n", progname, zip_error_strerror(zip_source_error(to))); + zip_source_rollback_write(to); + return -1; + } + + return 0; +} + + +static zip_source_t * +open_compressed(const char *fname, int flags) { + zip_error_t error; + zip_source_t *src; + + zip_error_init(&error); + + if ((src = source_hole_create(fname, flags, &error)) == NULL) { + fprintf(stderr, "%s: can't open compressed file %s: %s\n", progname, fname, zip_error_strerror(&error)); + zip_error_fini(&error); + exit(1); + } + + return src; +} + + +static zip_source_t * +open_file(const char *fname) { + zip_error_t error; + zip_source_t *src; + + zip_error_init(&error); + + if ((src = zip_source_file_create(fname, 0, 0, &error)) == NULL) { + fprintf(stderr, "%s: can't open file %s: %s\n", progname, fname, zip_error_strerror(&error)); + zip_error_fini(&error); + exit(1); + } + + return src; +} + + +static void +usage(void) { + fprintf(stderr, "usage: %s [-du] in out\n", progname); + fprintf(stderr, "\nOptions:\n -d decompress in\n -u update in\n"); + exit(1); +} + + +int +main(int argc, char **argv) { + zip_source_t *from; + zip_source_t *to; + int c, err; + int compress = 1; + int decompress = 0; + + progname = argv[0]; + + while ((c = getopt(argc, argv, "du")) != -1) { + switch (c) { + case 'd': + compress = 0; + decompress = 1; + break; + + case 'u': + compress = 1; + decompress = 1; + break; + + default: + usage(); + break; + } + } + + if (optind + 2 != argc) { + usage(); + } + + if (decompress) { + from = open_compressed(argv[optind], 0); + } + else { + from = open_file(argv[optind]); + } + + if (compress) { + to = open_compressed(argv[optind + 1], ZIP_CREATE); + } + else { + to = open_file(argv[optind + 1]); + } + + err = copy_source(from, to); + + zip_source_free(from); + zip_source_free(to); + + exit(err < 0 ? 1 : 0); +} diff --git a/3rdparty/libzip/regress/incons-archive-comment-longer.zip b/3rdparty/libzip/regress/incons-archive-comment-longer.zip new file mode 100644 index 0000000000000000000000000000000000000000..28d7ed365f9218f5177adae4bd35004f4d817562 Binary files /dev/null and b/3rdparty/libzip/regress/incons-archive-comment-longer.zip differ diff --git a/3rdparty/libzip/regress/incons-archive-comment-shorter.zip b/3rdparty/libzip/regress/incons-archive-comment-shorter.zip new file mode 100644 index 0000000000000000000000000000000000000000..d23cad4681d07443bc8309cb2530006d776c61bc Binary files /dev/null and b/3rdparty/libzip/regress/incons-archive-comment-shorter.zip differ diff --git a/3rdparty/libzip/regress/incons-cdoffset.zip b/3rdparty/libzip/regress/incons-cdoffset.zip new file mode 100644 index 0000000000000000000000000000000000000000..153e7a821ec88385d1c2f94ca0d434cb25f630a0 Binary files /dev/null and b/3rdparty/libzip/regress/incons-cdoffset.zip differ diff --git a/3rdparty/libzip/regress/incons-central-compression-method.zip b/3rdparty/libzip/regress/incons-central-compression-method.zip new file mode 100644 index 0000000000000000000000000000000000000000..1bf78f272af373bcc14ec4d880949d6bc5cdff3a Binary files /dev/null and b/3rdparty/libzip/regress/incons-central-compression-method.zip differ diff --git a/3rdparty/libzip/regress/incons-central-compsize-larger-toolarge.zip b/3rdparty/libzip/regress/incons-central-compsize-larger-toolarge.zip new file mode 100644 index 0000000000000000000000000000000000000000..1c82ef667918515108a178a662476b5aad6608ab Binary files /dev/null and b/3rdparty/libzip/regress/incons-central-compsize-larger-toolarge.zip differ diff --git a/3rdparty/libzip/regress/incons-central-compsize-larger.zip b/3rdparty/libzip/regress/incons-central-compsize-larger.zip new file mode 100644 index 0000000000000000000000000000000000000000..67e9a998919f6ba07c4e800ceaee31f5fb7a125c Binary files /dev/null and b/3rdparty/libzip/regress/incons-central-compsize-larger.zip differ diff --git a/3rdparty/libzip/regress/incons-central-compsize-smaller.zip b/3rdparty/libzip/regress/incons-central-compsize-smaller.zip new file mode 100644 index 0000000000000000000000000000000000000000..97dd14a798613a3a4111cafde27717cf96b225d9 Binary files /dev/null and b/3rdparty/libzip/regress/incons-central-compsize-smaller.zip differ diff --git a/3rdparty/libzip/regress/incons-central-crc.zip b/3rdparty/libzip/regress/incons-central-crc.zip new file mode 100644 index 0000000000000000000000000000000000000000..1f882ac66a6c407b043108b3234b675094750b4e Binary files /dev/null and b/3rdparty/libzip/regress/incons-central-crc.zip differ diff --git a/3rdparty/libzip/regress/incons-central-date.zip b/3rdparty/libzip/regress/incons-central-date.zip new file mode 100644 index 0000000000000000000000000000000000000000..6c831ca4867eba78403ec79be491a891026b9fa8 Binary files /dev/null and b/3rdparty/libzip/regress/incons-central-date.zip differ diff --git a/3rdparty/libzip/regress/incons-central-file-comment-longer.zip b/3rdparty/libzip/regress/incons-central-file-comment-longer.zip new file mode 100644 index 0000000000000000000000000000000000000000..b34c6612435cda05e33e36d95ca455986fd75fcb Binary files /dev/null and b/3rdparty/libzip/regress/incons-central-file-comment-longer.zip differ diff --git a/3rdparty/libzip/regress/incons-central-file-comment-shorter.zip b/3rdparty/libzip/regress/incons-central-file-comment-shorter.zip new file mode 100644 index 0000000000000000000000000000000000000000..7769a9afc860f542232e3d0edcdcbb3b3e0d5c34 Binary files /dev/null and b/3rdparty/libzip/regress/incons-central-file-comment-shorter.zip differ diff --git a/3rdparty/libzip/regress/incons-central-magic-bad.zip b/3rdparty/libzip/regress/incons-central-magic-bad.zip new file mode 100644 index 0000000000000000000000000000000000000000..954563baa48f6eaaa1220964a02e19237b23bc2a Binary files /dev/null and b/3rdparty/libzip/regress/incons-central-magic-bad.zip differ diff --git a/3rdparty/libzip/regress/incons-central-magic-bad2.zip b/3rdparty/libzip/regress/incons-central-magic-bad2.zip new file mode 100644 index 0000000000000000000000000000000000000000..f99d9b7194ef44adab07e3e989fb78a7fbb198f3 Binary files /dev/null and b/3rdparty/libzip/regress/incons-central-magic-bad2.zip differ diff --git a/3rdparty/libzip/regress/incons-central-size-larger.zip b/3rdparty/libzip/regress/incons-central-size-larger.zip new file mode 100644 index 0000000000000000000000000000000000000000..0779ce62ec2c50e2172e50cc78e6fa3ca153cc1f Binary files /dev/null and b/3rdparty/libzip/regress/incons-central-size-larger.zip differ diff --git a/3rdparty/libzip/regress/incons-data.zip b/3rdparty/libzip/regress/incons-data.zip new file mode 100644 index 0000000000000000000000000000000000000000..e2ab58ae89a80795698d5391a9c45d5632a955dc Binary files /dev/null and b/3rdparty/libzip/regress/incons-data.zip differ diff --git a/3rdparty/libzip/regress/incons-ef-central-size-wrong.zip b/3rdparty/libzip/regress/incons-ef-central-size-wrong.zip new file mode 100644 index 0000000000000000000000000000000000000000..a3f4cc118b108f3c5249d966cdbdbd9a9b8d6639 Binary files /dev/null and b/3rdparty/libzip/regress/incons-ef-central-size-wrong.zip differ diff --git a/3rdparty/libzip/regress/incons-ef-local-id-size.zip b/3rdparty/libzip/regress/incons-ef-local-id-size.zip new file mode 100644 index 0000000000000000000000000000000000000000..44ce2f77d5d441993821bf954f4899a3b72019f2 Binary files /dev/null and b/3rdparty/libzip/regress/incons-ef-local-id-size.zip differ diff --git a/3rdparty/libzip/regress/incons-ef-local-id.zip b/3rdparty/libzip/regress/incons-ef-local-id.zip new file mode 100644 index 0000000000000000000000000000000000000000..aad552155198823b66c95fbc89766e9692effe3e Binary files /dev/null and b/3rdparty/libzip/regress/incons-ef-local-id.zip differ diff --git a/3rdparty/libzip/regress/incons-ef-local-size.zip b/3rdparty/libzip/regress/incons-ef-local-size.zip new file mode 100644 index 0000000000000000000000000000000000000000..ad167101591b99e449980fd7599095b1844eb098 Binary files /dev/null and b/3rdparty/libzip/regress/incons-ef-local-size.zip differ diff --git a/3rdparty/libzip/regress/incons-eocd-magic-bad.zip b/3rdparty/libzip/regress/incons-eocd-magic-bad.zip new file mode 100644 index 0000000000000000000000000000000000000000..9e49e56a3982572ff6a8017c9ecffb403c5d0711 Binary files /dev/null and b/3rdparty/libzip/regress/incons-eocd-magic-bad.zip differ diff --git a/3rdparty/libzip/regress/incons-file-count-high.zip b/3rdparty/libzip/regress/incons-file-count-high.zip new file mode 100644 index 0000000000000000000000000000000000000000..876a886f643409f02a28af38f16ca725f4da5f4a Binary files /dev/null and b/3rdparty/libzip/regress/incons-file-count-high.zip differ diff --git a/3rdparty/libzip/regress/incons-file-count-low.zip b/3rdparty/libzip/regress/incons-file-count-low.zip new file mode 100644 index 0000000000000000000000000000000000000000..4af9038886fe5217b977dd209a3a00b07f9dc24d Binary files /dev/null and b/3rdparty/libzip/regress/incons-file-count-low.zip differ diff --git a/3rdparty/libzip/regress/incons-file-count-overflow.zip b/3rdparty/libzip/regress/incons-file-count-overflow.zip new file mode 100644 index 0000000000000000000000000000000000000000..461722c3c761cfb0de00332fb8e6426f795b786f Binary files /dev/null and b/3rdparty/libzip/regress/incons-file-count-overflow.zip differ diff --git a/3rdparty/libzip/regress/incons-local-compression-method.zip b/3rdparty/libzip/regress/incons-local-compression-method.zip new file mode 100644 index 0000000000000000000000000000000000000000..2e70f592de4227371d9b820c6c21cdc6532b0cba Binary files /dev/null and b/3rdparty/libzip/regress/incons-local-compression-method.zip differ diff --git a/3rdparty/libzip/regress/incons-local-compsize-larger.zip b/3rdparty/libzip/regress/incons-local-compsize-larger.zip new file mode 100644 index 0000000000000000000000000000000000000000..6fc27e05df312e86fe81a725dc93afa80cfa2dc0 Binary files /dev/null and b/3rdparty/libzip/regress/incons-local-compsize-larger.zip differ diff --git a/3rdparty/libzip/regress/incons-local-compsize-smaller.zip b/3rdparty/libzip/regress/incons-local-compsize-smaller.zip new file mode 100644 index 0000000000000000000000000000000000000000..75f14635778e11f3cb74feb00dc964e89c635900 Binary files /dev/null and b/3rdparty/libzip/regress/incons-local-compsize-smaller.zip differ diff --git a/3rdparty/libzip/regress/incons-local-crc.zip b/3rdparty/libzip/regress/incons-local-crc.zip new file mode 100644 index 0000000000000000000000000000000000000000..6f74b150ffba03dcc49a782f80dca3268e6e4bd9 Binary files /dev/null and b/3rdparty/libzip/regress/incons-local-crc.zip differ diff --git a/3rdparty/libzip/regress/incons-local-filename-long.zip b/3rdparty/libzip/regress/incons-local-filename-long.zip new file mode 100644 index 0000000000000000000000000000000000000000..42b4a1ff136a9cedd2636d82294be63e353f4edf Binary files /dev/null and b/3rdparty/libzip/regress/incons-local-filename-long.zip differ diff --git a/3rdparty/libzip/regress/incons-local-filename-missing.zip b/3rdparty/libzip/regress/incons-local-filename-missing.zip new file mode 100644 index 0000000000000000000000000000000000000000..71d3eb287b2072fb85fd14a2d6740233f4b4fb61 Binary files /dev/null and b/3rdparty/libzip/regress/incons-local-filename-missing.zip differ diff --git a/3rdparty/libzip/regress/incons-local-filename-short.zip b/3rdparty/libzip/regress/incons-local-filename-short.zip new file mode 100644 index 0000000000000000000000000000000000000000..c69be1bc0695deb94ea46d4a745bf7180c5f39a2 Binary files /dev/null and b/3rdparty/libzip/regress/incons-local-filename-short.zip differ diff --git a/3rdparty/libzip/regress/incons-local-filename.zip b/3rdparty/libzip/regress/incons-local-filename.zip new file mode 100644 index 0000000000000000000000000000000000000000..18782354e8dcbc6bd5a3b48c816202261177353f Binary files /dev/null and b/3rdparty/libzip/regress/incons-local-filename.zip differ diff --git a/3rdparty/libzip/regress/incons-local-magic-bad.zip b/3rdparty/libzip/regress/incons-local-magic-bad.zip new file mode 100644 index 0000000000000000000000000000000000000000..9a6a061736b101b8a753f0ad9924c2ed6657f6de Binary files /dev/null and b/3rdparty/libzip/regress/incons-local-magic-bad.zip differ diff --git a/3rdparty/libzip/regress/incons-local-size-larger.zip b/3rdparty/libzip/regress/incons-local-size-larger.zip new file mode 100644 index 0000000000000000000000000000000000000000..4e0bb430b2f176e524aae96e1ae45a18d5c07a60 Binary files /dev/null and b/3rdparty/libzip/regress/incons-local-size-larger.zip differ diff --git a/3rdparty/libzip/regress/junk-at-end.zip b/3rdparty/libzip/regress/junk-at-end.zip new file mode 100644 index 0000000000000000000000000000000000000000..30387b3f61c145f63946d088b765e2695fb6912f Binary files /dev/null and b/3rdparty/libzip/regress/junk-at-end.zip differ diff --git a/3rdparty/libzip/regress/junk-at-start.zip b/3rdparty/libzip/regress/junk-at-start.zip new file mode 100644 index 0000000000000000000000000000000000000000..8c983255bf84e2bddd16e9964abdcee63132bb59 Binary files /dev/null and b/3rdparty/libzip/regress/junk-at-start.zip differ diff --git a/3rdparty/libzip/regress/junk_at_end.test b/3rdparty/libzip/regress/junk_at_end.test new file mode 100644 index 0000000000000000000000000000000000000000..41d94558a1e8d8045769efbf837ffd85a9432789 --- /dev/null +++ b/3rdparty/libzip/regress/junk_at_end.test @@ -0,0 +1,5 @@ +# test archive with junk at end of file +args -l 412 junk-at-end.zzip get_num_entries 0 +return 0 +file junk-at-end.zzip junk-at-end.zip junk-at-end.zip +stdout 3 entries in archive \ No newline at end of file diff --git a/3rdparty/libzip/regress/junk_at_start.test b/3rdparty/libzip/regress/junk_at_start.test new file mode 100644 index 0000000000000000000000000000000000000000..d018ffca9cd29ace62ab3c705012a8a8329158f4 --- /dev/null +++ b/3rdparty/libzip/regress/junk_at_start.test @@ -0,0 +1,5 @@ +# test archive with junk at start of file +args -o 4 junk-at-start.zzip get_num_entries 0 +return 0 +file junk-at-start.zzip junk-at-start.zip junk-at-start.zip +stdout 3 entries in archive \ No newline at end of file diff --git a/3rdparty/libzip/regress/large-uncompressable b/3rdparty/libzip/regress/large-uncompressable new file mode 100644 index 0000000000000000000000000000000000000000..e7e26d9fa9f653ddce6a719f29b973684e22ab41 Binary files /dev/null and b/3rdparty/libzip/regress/large-uncompressable differ diff --git a/3rdparty/libzip/regress/liboverride-test.c b/3rdparty/libzip/regress/liboverride-test.c new file mode 100644 index 0000000000000000000000000000000000000000..29e478022ac4b80c66fb6abade71738eb8df817c --- /dev/null +++ b/3rdparty/libzip/regress/liboverride-test.c @@ -0,0 +1,101 @@ +/* + liboverride.c -- override function called by zip_open() + + Copyright (C) 2017-2021 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 <ckmame@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The name of the author may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef _WIN32 +int main(int argc, const char *argv[]) { + /* Symbol override is not supported on Windows. */ + if (argc > 1 && strcmp(argv[1], "-v") == 0) { + printf("not supported on Windows\n"); + } + exit(1); +} +#else + +#include <errno.h> +#include <unistd.h> + +#include "zip.h" + +/* + Some systems bind functions called and defined within a shared library, so the override doesn't work. This program calls zip_open and checks whether the override worked. + */ + +int +main(int argc, const char *argv[]) { + int verbose = 0; + int error_code; + + if (argc > 1 && strcmp(argv[1], "-v") == 0) { + verbose = 1; + } + + if (getenv("LIBOVERRIDE_SET") == NULL) { + char *cwd = getcwd(NULL, 0); + char *so = (char *)malloc(strlen(cwd) + 64); + sprintf(so, "%s/libliboverride.so", cwd); + setenv("LIBOVERRIDE_SET", "1", 1); + setenv("LD_PRELOAD", so, 1); + execv(argv[0], (void *)argv); + if (verbose) { + printf("exec failed: %s\n", strerror(errno)); + } + exit(2); + } + + if (zip_open("nosuchfile", 0, &error_code) != NULL) { + /* We expect failure. */ + if (verbose) { + printf("open succeded\n"); + } + exit(1); + } + if (error_code != 32000) { + /* Override didn't take, we didn't get its magic error code. */ + if (verbose) { + printf("got unexpected error %d\n", error_code); + } + exit(1); + } + + if (verbose) { + printf("success\n"); + } + exit(0); +} + +#endif /* not Windows */ diff --git a/3rdparty/libzip/regress/liboverride.c b/3rdparty/libzip/regress/liboverride.c new file mode 100644 index 0000000000000000000000000000000000000000..200f7127a26ce5d118f75fd6d60462177eec23a7 --- /dev/null +++ b/3rdparty/libzip/regress/liboverride.c @@ -0,0 +1,48 @@ +/* + liboverride.c -- override function called by zip_open() + + Copyright (C) 2017-2021 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 <ckmame@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The name of the author may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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" + +/* + Some systems bind functions called and defined within a shared library, so the override doesn't work. This overrides a function called by zip_open to return an invalid error code so we can check whether the override works. + */ + +zip_source_t * +zip_source_file_create(const char *fname, zip_uint64_t start, zip_int64_t length, zip_error_t *error) { + if (error != NULL) { + error->zip_err = 32000; + } + + return NULL; +} diff --git a/3rdparty/libzip/regress/lzma-no-eos.zip b/3rdparty/libzip/regress/lzma-no-eos.zip new file mode 100644 index 0000000000000000000000000000000000000000..883d851b674497fa604e1986876878b162b21d2a Binary files /dev/null and b/3rdparty/libzip/regress/lzma-no-eos.zip differ diff --git a/3rdparty/libzip/regress/malloc.c b/3rdparty/libzip/regress/malloc.c new file mode 100644 index 0000000000000000000000000000000000000000..1141104311fc80f1ca7f62fa4f5d7266fa8c362a --- /dev/null +++ b/3rdparty/libzip/regress/malloc.c @@ -0,0 +1,162 @@ +/* + malloc.c -- override *alloc() to allow testing special cases + Copyright (C) 2015-2021 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 <ckmame@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The name of the author may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdio.h> +#include <stdlib.h> +/* #include <string.h> */ +#include <errno.h> +#define __USE_GNU +#include <dlfcn.h> +#undef __USE_GNU + +#include "config.h" + +#if !defined(RTLD_NEXT) +#define RTLD_NEXT RTLD_DEFAULT +#endif + +#if defined(HAVE___PROGNAME) +extern char *__progname; +#endif + +#if defined(HAVE_GETPROGNAME) +/* all fine */ +#else +const char * +getprogname(void) { +#if defined(HAVE___PROGNAME) + return __progname; +#else + return NULL; +#endif +} +#endif + +static int inited = 0; +static size_t count = 0; +static size_t max_count = 0; +static size_t min_size = 0; +static void *(*real_malloc)(size_t size) = NULL; +static void *(*real_calloc)(size_t number, size_t size) = NULL; +static void *(*real_realloc)(void *ptr, size_t size) = NULL; + +static const char *myname = NULL; + +/* TODO: add sentinel -- check if particular size is malloced before doing other stuff */ +/* TODO: catch free for sentinel too */ +/* TODO: optionally, catch malloc of particular size */ + +static void +init(void) { + char *foo; + myname = getprogname(); + if (!myname) + myname = "(unknown)"; + if ((foo = getenv("MALLOC_MAX_COUNT")) != NULL) + max_count = strtoul(foo, NULL, 0); + if ((foo = getenv("MALLOC_MIN_SIZE")) != NULL) + min_size = strtoul(foo, NULL, 0); + real_calloc = dlsym(RTLD_NEXT, "calloc"); + if (!real_calloc) + abort(); + real_malloc = dlsym(RTLD_NEXT, "malloc"); + if (!real_malloc) + abort(); + real_realloc = dlsym(RTLD_NEXT, "realloc"); + if (!real_realloc) + abort(); + inited = 1; +} + +void * +calloc(size_t number, size_t size) { + void *ret; + + if (!inited) { + init(); + } + + if (number >= min_size / size && count >= max_count) { + errno = ENOMEM; + return NULL; + } + + ret = real_calloc(number, size); + if (size >= min_size) { + count++; + } + + return ret; +} + +void * +malloc(size_t size) { + void *ret; + + if (!inited) { + init(); + } + + if (size >= min_size && count >= max_count) { + errno = ENOMEM; + return NULL; + } + + ret = real_malloc(size); + if (size >= min_size) { + count++; + } + + return ret; +} + +void * +realloc(void *ptr, size_t size) { + void *ret; + + if (!inited) { + init(); + } + + if (size >= min_size && count >= max_count) { + errno = ENOMEM; + return NULL; + } + + ret = real_realloc(ptr, size); + if (size >= min_size) { + count++; + } + + return ret; +} diff --git a/3rdparty/libzip/regress/manyfiles-zip.zip b/3rdparty/libzip/regress/manyfiles-zip.zip new file mode 100644 index 0000000000000000000000000000000000000000..19ad57d66f0a9a153e93d8248e7f08a43863b79d Binary files /dev/null and b/3rdparty/libzip/regress/manyfiles-zip.zip differ diff --git a/3rdparty/libzip/regress/multidisk.zip b/3rdparty/libzip/regress/multidisk.zip new file mode 100644 index 0000000000000000000000000000000000000000..28dafb9ecc8f8ba1c7449166cae4e758c7f4766f Binary files /dev/null and b/3rdparty/libzip/regress/multidisk.zip differ diff --git a/3rdparty/libzip/regress/name_locate.test b/3rdparty/libzip/regress/name_locate.test new file mode 100644 index 0000000000000000000000000000000000000000..1f792312bf933d31d592d4400391f0ddffc5eb72 --- /dev/null +++ b/3rdparty/libzip/regress/name_locate.test @@ -0,0 +1,27 @@ +# various tests for zip_name_locate +args test.zip name_locate nosuchfile 0 name_locate test 0 name_locate "" 0 name_locate TeSt 0 name_locate TeSt C name_locate testdir/test2 0 name_locate tesTdir/tESt2 C name_locate testdir/test2 d name_locate tesTdir/tESt2 dC name_locate test2 0 name_locate test2 d name_locate TeST2 dC delete 0 name_locate test 0 name_locate test u add new teststring name_locate new 0 name_locate new u add "" teststring name_locate "" 0 unchange_all name_locate test 0 name_locate new 0 +stderr can't find entry with name 'nosuchfile' using flags '0' +stdout name 'test' using flags '0' found at index 0 +stderr can't find entry with name '' using flags '0' +stderr can't find entry with name 'TeSt' using flags '0' +stdout name 'TeSt' using flags 'C' found at index 0 +stdout name 'testdir/test2' using flags '0' found at index 2 +stdout name 'tesTdir/tESt2' using flags 'C' found at index 2 +stderr can't find entry with name 'testdir/test2' using flags 'd' +stderr can't find entry with name 'tesTdir/tESt2' using flags 'dC' +stderr can't find entry with name 'test2' using flags '0' +stdout name 'test2' using flags 'd' found at index 2 +stdout name 'TeST2' using flags 'dC' found at index 2 +# delete 0 +stderr can't find entry with name 'test' using flags '0' +stdout name 'test' using flags 'u' found at index 0 +# add "new" +stdout name 'new' using flags '0' found at index 3 +stderr can't find entry with name 'new' using flags 'u' +# add "" +stdout name '' using flags '0' found at index 4 +# unchange all +stdout name 'test' using flags '0' found at index 0 +stderr can't find entry with name 'new' using flags '0' +return 0 +file test.zip test.zip test.zip diff --git a/3rdparty/libzip/regress/nihtest.conf.in b/3rdparty/libzip/regress/nihtest.conf.in new file mode 100644 index 0000000000000000000000000000000000000000..0a32f78d9673f647ffc5e2d6d1258731d7fca3f0 --- /dev/null +++ b/3rdparty/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/3rdparty/libzip/regress/nonrandomopen.c b/3rdparty/libzip/regress/nonrandomopen.c new file mode 100644 index 0000000000000000000000000000000000000000..4523f032a4ad7c26237be408489ccb08d7f9bac3 --- /dev/null +++ b/3rdparty/libzip/regress/nonrandomopen.c @@ -0,0 +1,44 @@ +/* + nonrandomopen.c -- override zip_secure_random + + Copyright (C) 2017-2021 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 <ckmame@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The name of the author may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <string.h> + +#include "zipint.h" + +bool +zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) { + memset(buffer, 0, length); + + return true; +} diff --git a/3rdparty/libzip/regress/nonrandomopentest.c b/3rdparty/libzip/regress/nonrandomopentest.c new file mode 100644 index 0000000000000000000000000000000000000000..e4585a478825e3d09586a9c363f0d2760ca5f0ed --- /dev/null +++ b/3rdparty/libzip/regress/nonrandomopentest.c @@ -0,0 +1,57 @@ +/* + nonrandomopentest.c -- test nonrandomopen.so + Copyright (C) 2017-2021 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 <ckmame@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The name of the author may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <stdio.h> +#include <stdlib.h> + +int +main(int argc, const char *argv[]) { + zip_uint8_t buf[1024]; + int i; + +#ifdef HAVE_CRYPTO + if (!zip_secure_random(buf, sizeof(buf))) { + fprintf(stderr, "zip_secure_random returned false\n"); + exit(1); + } + for (i = 0; i < sizeof(buf); i++) { + if (buf[i] != 0) { + fprintf(stderr, "non-zero byte found\n"); + exit(1); + } + } +#endif + exit(0); +} diff --git a/3rdparty/libzip/regress/open_cons_extrabytes.test b/3rdparty/libzip/regress/open_cons_extrabytes.test new file mode 100644 index 0000000000000000000000000000000000000000..ab6b01872c9b9a04ddcc55a77bfa04eeab0eaa7d --- /dev/null +++ b/3rdparty/libzip/regress/open_cons_extrabytes.test @@ -0,0 +1,7 @@ +# zip_open: file has extra bytes at end of archive +program tryopen +file testextrabytes.zzip testextrabytes.zip testextrabytes.zip +args -c testextrabytes.zzip +return 1 +stdout opening 'testextrabytes.zzip' returned error 21/2 +stderr 1 errors diff --git a/3rdparty/libzip/regress/open_empty.test b/3rdparty/libzip/regress/open_empty.test new file mode 100644 index 0000000000000000000000000000000000000000..8f05d2921de9b8946389a213b53f2e634d747718 --- /dev/null +++ b/3rdparty/libzip/regress/open_empty.test @@ -0,0 +1,6 @@ +# zip_open: file contains no entry, but is valid +program tryopen +file testempty.zip testempty.zip testempty.zip +args testempty.zip +return 0 +stdout opening 'testempty.zip' succeeded, 0 entries diff --git a/3rdparty/libzip/regress/open_empty_2.test b/3rdparty/libzip/regress/open_empty_2.test new file mode 100644 index 0000000000000000000000000000000000000000..bb35bc62f92a85a60298f912e2d725fa89813491 --- /dev/null +++ b/3rdparty/libzip/regress/open_empty_2.test @@ -0,0 +1,7 @@ +# zip_open: 0 size file is recognized as empty zip +program tryopen +file testfile.txt testfile.txt testfile.txt +args testfile.txt +return 1 +stdout opening 'testfile.txt' returned error 19 +stderr 1 errors diff --git a/3rdparty/libzip/regress/open_extrabytes.test b/3rdparty/libzip/regress/open_extrabytes.test new file mode 100644 index 0000000000000000000000000000000000000000..1cfce246cdeee367f557663949d5cda4dd2fa2d4 --- /dev/null +++ b/3rdparty/libzip/regress/open_extrabytes.test @@ -0,0 +1,6 @@ +# zip_open: file has extra bytes at end of archive +program tryopen +file testextrabytes.zzip testextrabytes.zip testextrabytes.zip +args testextrabytes.zzip +return 0 +stdout opening 'testextrabytes.zzip' succeeded, 1 entries diff --git a/3rdparty/libzip/regress/open_file_count.test b/3rdparty/libzip/regress/open_file_count.test new file mode 100644 index 0000000000000000000000000000000000000000..1f18deb97cfec68f80b4a89efb85909879f96be3 --- /dev/null +++ b/3rdparty/libzip/regress/open_file_count.test @@ -0,0 +1,12 @@ +# zip_open: various inconsistent files +setenv LANG C +program tryopen +file incons-file-count-high.zzip incons-file-count-high.zip incons-file-count-high.zip +file incons-file-count-low.zzip incons-file-count-low.zip incons-file-count-low.zip +file incons-file-count-overflow.zzip incons-file-count-overflow.zip incons-file-count-overflow.zip +args incons-file-count-high.zzip incons-file-count-low.zzip incons-file-count-overflow.zzip +return 1 +stdout opening 'incons-file-count-high.zzip' returned error 21/5 +stdout opening 'incons-file-count-low.zzip' returned error 21/5 +stdout opening 'incons-file-count-overflow.zzip' returned error 21/11 +stderr 3 errors diff --git a/3rdparty/libzip/regress/open_filename_duplicate.test b/3rdparty/libzip/regress/open_filename_duplicate.test new file mode 100644 index 0000000000000000000000000000000000000000..5204db6e50b7cae761f6ce9083f2eb3e840f65b1 --- /dev/null +++ b/3rdparty/libzip/regress/open_filename_duplicate.test @@ -0,0 +1,6 @@ +# zip_open: file opens fine even though same file name appears twice +program tryopen +args filename_duplicate.zzip +return 0 +file filename_duplicate.zzip filename_duplicate.zip filename_duplicate.zip +stdout opening 'filename_duplicate.zzip' succeeded, 2 entries diff --git a/3rdparty/libzip/regress/open_filename_duplicate_consistency.test b/3rdparty/libzip/regress/open_filename_duplicate_consistency.test new file mode 100644 index 0000000000000000000000000000000000000000..e82cf751b29384f97c53d9c42c528ec78c625a3d --- /dev/null +++ b/3rdparty/libzip/regress/open_filename_duplicate_consistency.test @@ -0,0 +1,7 @@ +# zip_open: file opens fine even though same file name appears twice +program tryopen +args -c filename_duplicate.zzip +return 1 +file filename_duplicate.zzip filename_duplicate.zip filename_duplicate.zip +stdout opening 'filename_duplicate.zzip' returned error 10 +stderr 1 errors diff --git a/3rdparty/libzip/regress/open_filename_duplicate_empty.test b/3rdparty/libzip/regress/open_filename_duplicate_empty.test new file mode 100644 index 0000000000000000000000000000000000000000..ea143b609a7aa6320f3ea99381dd28ce046c6193 --- /dev/null +++ b/3rdparty/libzip/regress/open_filename_duplicate_empty.test @@ -0,0 +1,6 @@ +# zip_open: file opens fine even though same file name (empty file name) appears twice +program tryopen +args filename_duplicate_empty.zzip +return 0 +file filename_duplicate_empty.zzip filename_duplicate_empty.zip filename_duplicate_empty.zip +stdout opening 'filename_duplicate_empty.zzip' succeeded, 2 entries diff --git a/3rdparty/libzip/regress/open_filename_duplicate_empty_consistency.test b/3rdparty/libzip/regress/open_filename_duplicate_empty_consistency.test new file mode 100644 index 0000000000000000000000000000000000000000..657019563136dff880a834c889e46721cfdf5bad --- /dev/null +++ b/3rdparty/libzip/regress/open_filename_duplicate_empty_consistency.test @@ -0,0 +1,7 @@ +# zip_open: file opens fine even though same file name (empty file name) appears twice +program tryopen +args -c filename_duplicate_empty.zzip +return 1 +file filename_duplicate_empty.zzip filename_duplicate_empty.zip filename_duplicate_empty.zip +stdout opening 'filename_duplicate_empty.zzip' returned error 10 +stderr 1 errors diff --git a/3rdparty/libzip/regress/open_filename_empty.test b/3rdparty/libzip/regress/open_filename_empty.test new file mode 100644 index 0000000000000000000000000000000000000000..96f3efc0d4966ff73417c59f86fb32a7349a5427 --- /dev/null +++ b/3rdparty/libzip/regress/open_filename_empty.test @@ -0,0 +1,6 @@ +# zip_open: file opens fine even though file name has length 0 +program tryopen +args filename_empty.zip +return 0 +file filename_empty.zip filename_empty.zip filename_empty.zip +stdout opening 'filename_empty.zip' succeeded, 1 entries diff --git a/3rdparty/libzip/regress/open_incons.test b/3rdparty/libzip/regress/open_incons.test new file mode 100644 index 0000000000000000000000000000000000000000..c0e63a080bcdd6e07a781728e4472a609aac2650 --- /dev/null +++ b/3rdparty/libzip/regress/open_incons.test @@ -0,0 +1,74 @@ +# zip_open: various inconsistent files +setenv LANG C +program tryopen +file incons-archive-comment-longer.zzip incons-archive-comment-longer.zip incons-archive-comment-longer.zip +file incons-archive-comment-shorter.zzip incons-archive-comment-shorter.zip incons-archive-comment-shorter.zip +file incons-cdoffset.zzip incons-cdoffset.zip incons-cdoffset.zip +file incons-central-compression-method.zzip incons-central-compression-method.zip incons-central-compression-method.zip +file incons-central-compsize-larger.zzip incons-central-compsize-larger.zip incons-central-compsize-larger.zip +file incons-central-compsize-larger-toolarge.zzip incons-central-compsize-larger-toolarge.zip incons-central-compsize-larger-toolarge.zip +file incons-central-compsize-smaller.zzip incons-central-compsize-smaller.zip incons-central-compsize-smaller.zip +file incons-central-crc.zzip incons-central-crc.zip incons-central-crc.zip +file incons-central-date.zzip incons-central-date.zip incons-central-date.zip +file incons-central-file-comment-longer.zzip incons-central-file-comment-longer.zip incons-central-file-comment-longer.zip +file incons-central-file-comment-shorter.zzip incons-central-file-comment-shorter.zip incons-central-file-comment-shorter.zip +file incons-central-magic-bad.zzip incons-central-magic-bad.zip incons-central-magic-bad.zip +file incons-central-magic-bad2.zzip incons-central-magic-bad2.zip incons-central-magic-bad2.zip +file incons-central-size-larger.zzip incons-central-size-larger.zip incons-central-size-larger.zip +file incons-data.zzip incons-data.zip incons-data.zip +file incons-ef-central-size-wrong.zzip incons-ef-central-size-wrong.zip incons-ef-central-size-wrong.zip +file incons-ef-local-id-size.zzip incons-ef-local-id-size.zip incons-ef-local-id-size.zip +file incons-ef-local-id.zzip incons-ef-local-id.zip incons-ef-local-id.zip +file incons-ef-local-size.zzip incons-ef-local-size.zip incons-ef-local-size.zip +file incons-eocd-magic-bad.zzip incons-eocd-magic-bad.zip incons-eocd-magic-bad.zip +file incons-file-count-high.zzip incons-file-count-high.zip incons-file-count-high.zip +file incons-file-count-low.zzip incons-file-count-low.zip incons-file-count-low.zip +file incons-file-count-overflow.zzip incons-file-count-overflow.zip incons-file-count-overflow.zip +file incons-local-compression-method.zzip incons-local-compression-method.zip incons-local-compression-method.zip +file incons-local-compsize-larger.zzip incons-local-compsize-larger.zip incons-local-compsize-larger.zip +file incons-local-compsize-smaller.zzip incons-local-compsize-smaller.zip incons-local-compsize-smaller.zip +file incons-local-crc.zzip incons-local-crc.zip incons-local-crc.zip +file incons-local-filename-long.zzip incons-local-filename-long.zip incons-local-filename-long.zip +file incons-local-filename-missing.zzip incons-local-filename-missing.zip incons-local-filename-missing.zip +file incons-local-filename-short.zzip incons-local-filename-short.zip incons-local-filename-short.zip +file incons-local-filename.zzip incons-local-filename.zip incons-local-filename.zip +file incons-local-magic-bad.zzip incons-local-magic-bad.zip incons-local-magic-bad.zip +file incons-local-size-larger.zzip incons-local-size-larger.zip incons-local-size-larger.zip +args -c incons-archive-comment-longer.zzip incons-archive-comment-shorter.zzip incons-cdoffset.zzip incons-central-compression-method.zzip incons-central-compsize-larger-toolarge.zzip incons-central-compsize-larger.zzip incons-central-compsize-smaller.zzip incons-central-crc.zzip incons-central-date.zzip incons-central-file-comment-longer.zzip incons-central-file-comment-shorter.zzip incons-central-magic-bad.zzip incons-central-magic-bad2.zzip incons-central-size-larger.zzip incons-data.zzip incons-ef-central-size-wrong.zzip incons-ef-local-id-size.zzip incons-ef-local-id.zzip incons-ef-local-size.zzip incons-eocd-magic-bad.zzip incons-file-count-high.zzip incons-file-count-low.zzip incons-file-count-overflow.zzip incons-local-compression-method.zzip incons-local-compsize-larger.zzip incons-local-compsize-smaller.zzip incons-local-crc.zzip incons-local-filename-long.zzip incons-local-filename-missing.zzip incons-local-filename-short.zzip incons-local-filename.zzip incons-local-magic-bad.zzip incons-local-size-larger.zzip +return 1 +stdout opening 'incons-archive-comment-longer.zzip' returned error 21/2 +stdout opening 'incons-archive-comment-shorter.zzip' returned error 21/2 +stdout opening 'incons-cdoffset.zzip' returned error 21/1 +stdout opening 'incons-central-compression-method.zzip' returned error 21/6 +stdout opening 'incons-central-compsize-larger-toolarge.zzip' returned error 19 +stdout opening 'incons-central-compsize-larger.zzip' returned error 21/6 +stdout opening 'incons-central-compsize-smaller.zzip' returned error 21/6 +stdout opening 'incons-central-crc.zzip' returned error 21/6 +stdout opening 'incons-central-date.zzip' returned error 21/6 +stdout opening 'incons-central-file-comment-longer.zzip' returned error 21/12 +stdout opening 'incons-central-file-comment-shorter.zzip' returned error 21/260 +stdout opening 'incons-central-magic-bad.zzip' returned error 19 +stdout opening 'incons-central-magic-bad2.zzip' returned error 19 +stdout opening 'incons-central-size-larger.zzip' returned error 21/6 +# tryopen does not test checksums, so this is fine. +stdout opening 'incons-data.zzip' succeeded, 1 entries +stdout opening 'incons-ef-central-size-wrong.zzip' returned error 21/16 +stdout opening 'incons-ef-local-id-size.zzip' returned error 21/16 +# different extra fields local vs. central is fine +stdout opening 'incons-ef-local-id.zzip' succeeded, 1 entries +stdout opening 'incons-ef-local-size.zzip' returned error 21/16 +stdout opening 'incons-eocd-magic-bad.zzip' returned error 19 +stdout opening 'incons-file-count-high.zzip' returned error 21/5 +stdout opening 'incons-file-count-low.zzip' returned error 21/5 +stdout opening 'incons-file-count-overflow.zzip' returned error 21/11 +stdout opening 'incons-local-compression-method.zzip' returned error 21/6 +stdout opening 'incons-local-compsize-larger.zzip' returned error 21/6 +stdout opening 'incons-local-compsize-smaller.zzip' returned error 21/6 +stdout opening 'incons-local-crc.zzip' returned error 21/6 +stdout opening 'incons-local-filename-long.zzip' returned error 17 +stdout opening 'incons-local-filename-missing.zzip' returned error 21/6 +stdout opening 'incons-local-filename-short.zzip' returned error 21/16 +stdout opening 'incons-local-filename.zzip' returned error 21/6 +stdout opening 'incons-local-magic-bad.zzip' returned error 19 +stdout opening 'incons-local-size-larger.zzip' returned error 21/6 +stderr 31 errors diff --git a/3rdparty/libzip/regress/open_many_fail.test b/3rdparty/libzip/regress/open_many_fail.test new file mode 100644 index 0000000000000000000000000000000000000000..2b57e15443b4bc49bccb06ad87b479ef2904a107 --- /dev/null +++ b/3rdparty/libzip/regress/open_many_fail.test @@ -0,0 +1,11 @@ +# zip_open: files with >65k that have issues +program tryopen +args manyfiles-zip64-modulo.zzip manyfiles-fewer.zzip manyfiles-more.zzip +return 1 +file manyfiles-zip64-modulo.zzip manyfiles-zip64-modulo.zip manyfiles-zip64-modulo.zip +file manyfiles-fewer.zzip manyfiles-fewer.zip manyfiles-fewer.zip +file manyfiles-more.zzip manyfiles-more.zip manyfiles-more.zip +stdout opening 'manyfiles-zip64-modulo.zzip' returned error 21/5 +stdout opening 'manyfiles-fewer.zzip' returned error 21/5 +stdout opening 'manyfiles-more.zzip' returned error 21/5 +stderr 3 errors diff --git a/3rdparty/libzip/regress/open_many_ok.test b/3rdparty/libzip/regress/open_many_ok.test new file mode 100644 index 0000000000000000000000000000000000000000..248868d909aa4d6277c9c8475285cd38f325b816 --- /dev/null +++ b/3rdparty/libzip/regress/open_many_ok.test @@ -0,0 +1,12 @@ +# zip_open: files open fine, have > 65k entries +program tryopen +args manyfiles.zip manyfiles-zip64.zip manyfiles-133000.zip manyfiles-65536.zip +return 0 +file manyfiles.zip manyfiles.zip manyfiles.zip +file manyfiles-zip64.zip manyfiles-zip64.zip manyfiles-zip64.zip +file manyfiles-133000.zip manyfiles-133000.zip manyfiles-133000.zip +file manyfiles-65536.zip manyfiles-65536.zip manyfiles-65536.zip +stdout opening 'manyfiles.zip' succeeded, 70000 entries +stdout opening 'manyfiles-zip64.zip' succeeded, 70000 entries +stdout opening 'manyfiles-133000.zip' succeeded, 133000 entries +stdout opening 'manyfiles-65536.zip' succeeded, 65536 entries diff --git a/3rdparty/libzip/regress/open_multidisk.test b/3rdparty/libzip/regress/open_multidisk.test new file mode 100644 index 0000000000000000000000000000000000000000..1da4a5ca6b5f57a7f0dc411b84bc451d2c4ca665 --- /dev/null +++ b/3rdparty/libzip/regress/open_multidisk.test @@ -0,0 +1,7 @@ +# zip_open: file is part of a multi-disk zip archive +program tryopen +args test.piz +return 1 +file test.piz multidisk.zip multidisk.zip +stdout opening 'test.piz' returned error 1 +stderr 1 errors diff --git a/3rdparty/libzip/regress/open_new_but_exists.test b/3rdparty/libzip/regress/open_new_but_exists.test new file mode 100644 index 0000000000000000000000000000000000000000..002ccb4a0a82eeb6149ade13136704b7f8b77d0e --- /dev/null +++ b/3rdparty/libzip/regress/open_new_but_exists.test @@ -0,0 +1,7 @@ +# zip_open: file shall be created but already exists +program tryopen +args -e test.zip +return 1 +file test.zip test.zip test.zip +stdout opening 'test.zip' returned error 10 +stderr 1 errors diff --git a/3rdparty/libzip/regress/open_new_ok.test b/3rdparty/libzip/regress/open_new_ok.test new file mode 100644 index 0000000000000000000000000000000000000000..b1452c7c54b67868a55028fd843cfa9f6adffaeb --- /dev/null +++ b/3rdparty/libzip/regress/open_new_ok.test @@ -0,0 +1,5 @@ +# zip_open: create new archive +program tryopen +args -n new.zip +return 0 +stdout opening 'new.zip' succeeded, 0 entries diff --git a/3rdparty/libzip/regress/open_nonarchive.test b/3rdparty/libzip/regress/open_nonarchive.test new file mode 100644 index 0000000000000000000000000000000000000000..44c48367b8c8360672c518886d0d1c6f05c77de9 --- /dev/null +++ b/3rdparty/libzip/regress/open_nonarchive.test @@ -0,0 +1,7 @@ +# zip_open: file is not a zip archive +program tryopen +file CMakeLists.txt CMakeLists.txt CMakeLists.txt +args CMakeLists.txt +return 1 +stdout opening 'CMakeLists.txt' returned error 19 +stderr 1 errors diff --git a/3rdparty/libzip/regress/open_nosuchfile.test b/3rdparty/libzip/regress/open_nosuchfile.test new file mode 100644 index 0000000000000000000000000000000000000000..69321640745a05d499d5fafcb7bba8ffcb471ecc --- /dev/null +++ b/3rdparty/libzip/regress/open_nosuchfile.test @@ -0,0 +1,6 @@ +# zip_open: file doesn't exist +program tryopen +args nosuchfile +return 1 +stdout opening 'nosuchfile' returned error 9 +stderr 1 errors diff --git a/3rdparty/libzip/regress/open_ok.test b/3rdparty/libzip/regress/open_ok.test new file mode 100644 index 0000000000000000000000000000000000000000..dd1f38e0e30446575e7a6ca72d8fc60488e6d00f --- /dev/null +++ b/3rdparty/libzip/regress/open_ok.test @@ -0,0 +1,6 @@ +# zip_open: file opens fine +program tryopen +args test.zip +return 0 +file test.zip test.zip test.zip +stdout opening 'test.zip' succeeded, 3 entries diff --git a/3rdparty/libzip/regress/open_too_short.test b/3rdparty/libzip/regress/open_too_short.test new file mode 100644 index 0000000000000000000000000000000000000000..b7434bacaa7592e93475aea327d67a54ba2fe3f4 --- /dev/null +++ b/3rdparty/libzip/regress/open_too_short.test @@ -0,0 +1,7 @@ +# zip_open: file is too short for even a central directory entry +program tryopen +args test.piz +return 1 +file test.piz bogus.zip bogus.zip +stdout opening 'test.piz' returned error 19 +stderr 1 errors diff --git a/3rdparty/libzip/regress/open_truncate.test b/3rdparty/libzip/regress/open_truncate.test new file mode 100644 index 0000000000000000000000000000000000000000..7ef753729d0075fb0d6e3ade431b6647dce799dd --- /dev/null +++ b/3rdparty/libzip/regress/open_truncate.test @@ -0,0 +1,6 @@ +# zip_open: file opens fine and gets truncated +program tryopen +args -t test.zip +return 0 +file-del test.zip test.zip +stdout opening 'test.zip' succeeded, 0 entries diff --git a/3rdparty/libzip/regress/open_zip64_3mf.test b/3rdparty/libzip/regress/open_zip64_3mf.test new file mode 100644 index 0000000000000000000000000000000000000000..4a571549e73d82225d2d98866208d962c63c27a5 --- /dev/null +++ b/3rdparty/libzip/regress/open_zip64_3mf.test @@ -0,0 +1,6 @@ +# zip_open: ZIP64 file opens fine even when most eocd entries are 0xff (3MF format) +program tryopen +args test.zip +return 0 +file test.zip zip64-3mf.zip zip64-3mf.zip +stdout opening 'test.zip' succeeded, 1 entries diff --git a/3rdparty/libzip/regress/open_zip64_ok.test b/3rdparty/libzip/regress/open_zip64_ok.test new file mode 100644 index 0000000000000000000000000000000000000000..ac33f9a47b65237eb1cf54e658faba5e118687f8 --- /dev/null +++ b/3rdparty/libzip/regress/open_zip64_ok.test @@ -0,0 +1,6 @@ +# zip_open: ZIP64 file opens fine +program tryopen +args test.zip +return 0 +file test.zip zip64.zip zip64.zip +stdout opening 'test.zip' succeeded, 1 entries diff --git a/3rdparty/libzip/regress/ossfuzz.sh b/3rdparty/libzip/regress/ossfuzz.sh new file mode 100755 index 0000000000000000000000000000000000000000..01e41708c6dd237c47fa3f59972cf9d58f53ee55 --- /dev/null +++ b/3rdparty/libzip/regress/ossfuzz.sh @@ -0,0 +1,35 @@ +#!/bin/bash -eu +# Copyright 2019 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +# This script is meant to be run by +# https://github.com/google/oss-fuzz/blob/master/projects/libzip/Dockerfile + +mkdir build +cd build +cmake -DBUILD_SHARED_LIBS=OFF -DENABLE_GNUTLS=OFF -DENABLE_MBEDTLS=OFF -DENABLE_OPENSSL=OFF -DBUILD_TOOLS=OFF -DENABLE_LZMA=OFF .. +make -j$(nproc) + +$CXX $CXXFLAGS -std=c++11 -I. -I../lib \ + $SRC/libzip/regress/zip_read_fuzzer.cc \ + -o $OUT/zip_read_fuzzer \ + $LIB_FUZZING_ENGINE $SRC/libzip/build/lib/libzip.a -lz + +find $SRC/libzip/regress -name "*.zip" | \ + xargs zip $OUT/zip_read_fuzzer_seed_corpus.zip + +cp $SRC/libzip/regress/zip_read_fuzzer.dict $OUT/ + diff --git a/3rdparty/libzip/regress/preload.test b/3rdparty/libzip/regress/preload.test new file mode 100644 index 0000000000000000000000000000000000000000..5a62114c144ef3cd6b17892cd9d43a5551a581a7 --- /dev/null +++ b/3rdparty/libzip/regress/preload.test @@ -0,0 +1,4 @@ +description test if preload works +program nonrandomopentest +return 0 +preload nonrandomopen.so diff --git a/3rdparty/libzip/regress/progress.test b/3rdparty/libzip/regress/progress.test new file mode 100644 index 0000000000000000000000000000000000000000..8604db2f079304eb1331e21327b994b775640f01 --- /dev/null +++ b/3rdparty/libzip/regress/progress.test @@ -0,0 +1,10 @@ +# test default compression stores if smaller; print progress +return 0 +args -n test.zip print_progress add compressable aaaaaaaaaaaaaa add uncompressable uncompressable add_nul large-compressable 8200 add_file large-uncompressable large-uncompressable 0 -1 +file-new test.zip cm-default.zip +file large-uncompressable large-uncompressable large-uncompressable +stdout 0.0% done +stdout 25.0% done +stdout 50.0% done +stdout 75.0% done +stdout 100.0% done diff --git a/3rdparty/libzip/regress/rename_ascii.test b/3rdparty/libzip/regress/rename_ascii.test new file mode 100644 index 0000000000000000000000000000000000000000..0010ca41f3b81373ae1b1b51ffe19277588be84b --- /dev/null +++ b/3rdparty/libzip/regress/rename_ascii.test @@ -0,0 +1,4 @@ +# rename file to ASCII name in zip archive +return 0 +args testfile rename 0 testfile.txt +file testfile testfile-UTF8.zip testfile.zip diff --git a/3rdparty/libzip/regress/rename_cp437.test b/3rdparty/libzip/regress/rename_cp437.test new file mode 100644 index 0000000000000000000000000000000000000000..5a01250406d89292a3fab45da3f3de78cdcecedc --- /dev/null +++ b/3rdparty/libzip/regress/rename_cp437.test @@ -0,0 +1,4 @@ +# rename file to CP437 name in zip archive (fails) +return 0 +args testfile.zip rename 0 ‚ƒ„…†‡ˆ‰Š‹ŒŽ +file testfile.zip testfile.zip testfile-cp437.zip diff --git a/3rdparty/libzip/regress/rename_deleted.test b/3rdparty/libzip/regress/rename_deleted.test new file mode 100644 index 0000000000000000000000000000000000000000..9dcc7c36c36ba92ddf49707a6209fc8e17c7dfc3 --- /dev/null +++ b/3rdparty/libzip/regress/rename_deleted.test @@ -0,0 +1,5 @@ +# rename deleted entry in zip archive (fails) +return 1 +args testfile.zip delete 1 delete 3 rename 1 othername +file testfile.zip testcomment.zip testcomment13.zip +stderr can't rename file at index '1' to 'othername': Entry has been deleted diff --git a/3rdparty/libzip/regress/rename_fail.test b/3rdparty/libzip/regress/rename_fail.test new file mode 100644 index 0000000000000000000000000000000000000000..185f4e2197069d757e6ca6dcae686aea7d8914bd --- /dev/null +++ b/3rdparty/libzip/regress/rename_fail.test @@ -0,0 +1,5 @@ +# rename file inside zip archive, but file name already exists +return 1 +args rename.zip rename 0 file4 +file rename.zip testcomment.zip testcomment.zip +stderr can't rename file at index '0' to 'file4': File already exists diff --git a/3rdparty/libzip/regress/rename_ok.test b/3rdparty/libzip/regress/rename_ok.test new file mode 100644 index 0000000000000000000000000000000000000000..b76df9c6606f70d510d0a8e2dc053c2a1228e8d0 --- /dev/null +++ b/3rdparty/libzip/regress/rename_ok.test @@ -0,0 +1,4 @@ +# rename file inside zip archive +return 0 +args rename.zip rename 1 notfile2 +file rename.zip testcomment.zip rename_ok.zip diff --git a/3rdparty/libzip/regress/rename_ok.zip b/3rdparty/libzip/regress/rename_ok.zip new file mode 100644 index 0000000000000000000000000000000000000000..ad073060c75447df53e4872d172ce8b8018c7491 Binary files /dev/null and b/3rdparty/libzip/regress/rename_ok.zip differ diff --git a/3rdparty/libzip/regress/rename_utf8.test b/3rdparty/libzip/regress/rename_utf8.test new file mode 100644 index 0000000000000000000000000000000000000000..391ebeb26d3afddfe3f17ebd5feb229b0d5753f9 --- /dev/null +++ b/3rdparty/libzip/regress/rename_utf8.test @@ -0,0 +1,4 @@ +# rename file to UTF-8 name in zip archive +return 0 +args testfile rename 0 ÄÖÜßäöü +file testfile testfile.zip testfile-UTF8.zip diff --git a/3rdparty/libzip/regress/rename_utf8_encmismatch.test b/3rdparty/libzip/regress/rename_utf8_encmismatch.test new file mode 100644 index 0000000000000000000000000000000000000000..075bca1894f588533a469b5605d8ea7a3bcfc710 --- /dev/null +++ b/3rdparty/libzip/regress/rename_utf8_encmismatch.test @@ -0,0 +1,4 @@ +# rename file to UTF-8 name in zip archive with CP437 comment (sets InfoZIP UTF-8 Name Extension) +return 0 +args testfile rename 0 ÄÖÜßäöü +file testfile test-cp437-fc.zip test-cp437-fc-utf-8-filename.zip diff --git a/3rdparty/libzip/regress/runtest.in b/3rdparty/libzip/regress/runtest.in new file mode 100644 index 0000000000000000000000000000000000000000..a6eb1407a667b3141706c25f9f0d21a44fb2a8c9 --- /dev/null +++ b/3rdparty/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 <ckmame@nih.at> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. The names of the authors may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (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/3rdparty/libzip/regress/set_comment_all.test b/3rdparty/libzip/regress/set_comment_all.test new file mode 100644 index 0000000000000000000000000000000000000000..5902f98b31f430f26d7eeadc4b3920b8d49ff27c --- /dev/null +++ b/3rdparty/libzip/regress/set_comment_all.test @@ -0,0 +1,4 @@ +# change local and global comments in a zip archive +return 0 +args testcomment.zip set_archive_comment "This is the new,\r\nmultiline archive comment.\r\nAin't it nice?" set_file_comment 0 "File comment no 0" set_file_comment 1 "File comment no 1" set_file_comment 2 "File comment no 2" set_file_comment 3 "File comment no 3" +file testcomment.zip testcomment.zip testchanged.zip diff --git a/3rdparty/libzip/regress/set_comment_localonly.test b/3rdparty/libzip/regress/set_comment_localonly.test new file mode 100644 index 0000000000000000000000000000000000000000..08f7b8e5db03855b972e26bac32664899a4138f5 --- /dev/null +++ b/3rdparty/libzip/regress/set_comment_localonly.test @@ -0,0 +1,4 @@ +# change file comments in a zip archive +return 0 +args testcomment.zip set_file_comment 0 "File comment no 0" set_file_comment 1 "File comment no 1" set_file_comment 3 "File comment no 3" set_file_comment 2 "" +file testcomment.zip testcomment.zip testchangedlocal.zip diff --git a/3rdparty/libzip/regress/set_comment_removeglobal.test b/3rdparty/libzip/regress/set_comment_removeglobal.test new file mode 100644 index 0000000000000000000000000000000000000000..b469b37f431942eb89f76dee189a7e57160a09c1 --- /dev/null +++ b/3rdparty/libzip/regress/set_comment_removeglobal.test @@ -0,0 +1,4 @@ +# remove archive comment +return 0 +args testcomment.zip set_archive_comment "" +file testcomment.zip testcomment.zip testcommentremoved.zip diff --git a/3rdparty/libzip/regress/set_comment_revert.test b/3rdparty/libzip/regress/set_comment_revert.test new file mode 100644 index 0000000000000000000000000000000000000000..da61c37e4dd644f104bf3af11a4d93160dc46389 --- /dev/null +++ b/3rdparty/libzip/regress/set_comment_revert.test @@ -0,0 +1,4 @@ +# start changing local and global comments, but revert before closing +return 0 +args testcomment.zip set_archive_comment "some long string, a bit longer than this at least" set_file_comment 0 "File comment no 0" set_file_comment 1 "File comment no 1" set_file_comment 3 "File comment no 3" set_file_comment 2 "" unchange_all +file testcomment.zip testcomment.zip testcomment.zip diff --git a/3rdparty/libzip/regress/set_compression_bzip2_to_deflate.test b/3rdparty/libzip/regress/set_compression_bzip2_to_deflate.test new file mode 100644 index 0000000000000000000000000000000000000000..bdfacb56c0eb750a30c04ce84048db7e69271fe3 --- /dev/null +++ b/3rdparty/libzip/regress/set_compression_bzip2_to_deflate.test @@ -0,0 +1,5 @@ +# change method from bzip2 to deflated +features LIBBZ2 +return 0 +args test.zip set_file_compression 0 deflate 0 +file test.zip testbzip2.zip testdeflated.zip diff --git a/3rdparty/libzip/regress/set_compression_deflate_to_bzip2.test b/3rdparty/libzip/regress/set_compression_deflate_to_bzip2.test new file mode 100644 index 0000000000000000000000000000000000000000..197b43547eed259260d242a18a26bff60122ea35 --- /dev/null +++ b/3rdparty/libzip/regress/set_compression_deflate_to_bzip2.test @@ -0,0 +1,5 @@ +# change method from deflated to bzip2 +features LIBBZ2 +return 0 +args test.zip set_file_compression 0 bzip2 0 +file test.zip testdeflated.zip testbzip2.zip diff --git a/3rdparty/libzip/regress/set_compression_deflate_to_deflate.test b/3rdparty/libzip/regress/set_compression_deflate_to_deflate.test new file mode 100644 index 0000000000000000000000000000000000000000..e0b31218aeafa9a1b8e135257734517681631539 --- /dev/null +++ b/3rdparty/libzip/regress/set_compression_deflate_to_deflate.test @@ -0,0 +1,4 @@ +# change method from deflated to deflated (no change) +return 0 +args test.zip set_file_compression 0 deflate 0 +file test.zip testdeflated.zip testdeflated.zip diff --git a/3rdparty/libzip/regress/set_compression_deflate_to_store.test b/3rdparty/libzip/regress/set_compression_deflate_to_store.test new file mode 100644 index 0000000000000000000000000000000000000000..1678b9c32e49830b8c0298438bfa8449e6b34c36 --- /dev/null +++ b/3rdparty/libzip/regress/set_compression_deflate_to_store.test @@ -0,0 +1,4 @@ +# change method from deflated to stored +return 0 +args test.zip set_file_compression 0 store 0 +file test.zip testdeflated.zip teststored.zip diff --git a/3rdparty/libzip/regress/set_compression_lzma_no_eos_to_store.test b/3rdparty/libzip/regress/set_compression_lzma_no_eos_to_store.test new file mode 100644 index 0000000000000000000000000000000000000000..793b8438780bd2d2e268cbeae6e3ae01aabf83c0 --- /dev/null +++ b/3rdparty/libzip/regress/set_compression_lzma_no_eos_to_store.test @@ -0,0 +1,5 @@ +# change method from lzma-compressed (id 14) without EOS/EOPM marker to stored +features LIBLZMA +return 0 +args test.zip set_file_compression 0 store 0 +file test.zip lzma-no-eos.zip stored-no-eos.zip diff --git a/3rdparty/libzip/regress/set_compression_lzma_to_store.test b/3rdparty/libzip/regress/set_compression_lzma_to_store.test new file mode 100644 index 0000000000000000000000000000000000000000..67fc2907fa39918041a597845b0dc34aef5da8af --- /dev/null +++ b/3rdparty/libzip/regress/set_compression_lzma_to_store.test @@ -0,0 +1,5 @@ +# change method from lzma-compressed (id 14) to stored +features LIBLZMA +return 0 +args test.zip set_file_compression 0 store 0 +file test.zip testfile-lzma.zip testfile-stored-dos.zip diff --git a/3rdparty/libzip/regress/set_compression_store_to_bzip2.test b/3rdparty/libzip/regress/set_compression_store_to_bzip2.test new file mode 100644 index 0000000000000000000000000000000000000000..28bddd7a2531ef93d60d0068e8eb4b709e244e20 --- /dev/null +++ b/3rdparty/libzip/regress/set_compression_store_to_bzip2.test @@ -0,0 +1,5 @@ +# change method from stored to bzip2 +features LIBBZ2 +return 0 +args test.zip set_file_compression 0 bzip2 0 +file test.zip teststored.zip testbzip2.zip diff --git a/3rdparty/libzip/regress/set_compression_store_to_deflate.test b/3rdparty/libzip/regress/set_compression_store_to_deflate.test new file mode 100644 index 0000000000000000000000000000000000000000..1f83492839a47b6b3219a2a81008cbd577a51912 --- /dev/null +++ b/3rdparty/libzip/regress/set_compression_store_to_deflate.test @@ -0,0 +1,4 @@ +# change method from stored to deflated +return 0 +args test.zip set_file_compression 0 deflate 0 +file test.zip teststored.zip testdeflated.zip diff --git a/3rdparty/libzip/regress/set_compression_store_to_lzma.test b/3rdparty/libzip/regress/set_compression_store_to_lzma.test new file mode 100644 index 0000000000000000000000000000000000000000..f5ff530ca55efa9838c6106ec064588a45d8d52c --- /dev/null +++ b/3rdparty/libzip/regress/set_compression_store_to_lzma.test @@ -0,0 +1,5 @@ +# change method from stored to lzma-compressed (Id 14) +features LIBLZMA +return 0 +args test.zip set_file_compression 0 lzma 0 +file test.zip testfile-stored-dos.zip testfile-lzma.zip diff --git a/3rdparty/libzip/regress/set_compression_store_to_store.test b/3rdparty/libzip/regress/set_compression_store_to_store.test new file mode 100644 index 0000000000000000000000000000000000000000..66cf3ddc34852dc4b109b8d7a1c96e9e20a00567 --- /dev/null +++ b/3rdparty/libzip/regress/set_compression_store_to_store.test @@ -0,0 +1,4 @@ +# change method from stored to stored (no change) +return 0 +args test.zip set_file_compression 0 store 0 +file test.zip teststored.zip teststored.zip diff --git a/3rdparty/libzip/regress/set_compression_store_to_xz.test b/3rdparty/libzip/regress/set_compression_store_to_xz.test new file mode 100644 index 0000000000000000000000000000000000000000..fe6d8db23b38a1dd0b35a236e66da4bd872546ed --- /dev/null +++ b/3rdparty/libzip/regress/set_compression_store_to_xz.test @@ -0,0 +1,5 @@ +# change method from stored to xz-compressed +features LIBLZMA +return 0 +args test.zip set_file_compression 0 xz 0 +file test.zip testfile-stored-dos.zip testfile-xz.zip diff --git a/3rdparty/libzip/regress/set_compression_store_to_zstd.test b/3rdparty/libzip/regress/set_compression_store_to_zstd.test new file mode 100644 index 0000000000000000000000000000000000000000..898a3d8546dc6b9213c6b128a6bdba7a945ea8fe --- /dev/null +++ b/3rdparty/libzip/regress/set_compression_store_to_zstd.test @@ -0,0 +1,5 @@ +# change method from stored to zstd-compressed +features LIBZSTD +return 0 +args test.zip set_file_compression 0 zstd 0 +file test.zip testfile-stored-dos.zip testfile-zstd.zip diff --git a/3rdparty/libzip/regress/set_compression_unknown.test b/3rdparty/libzip/regress/set_compression_unknown.test new file mode 100644 index 0000000000000000000000000000000000000000..9ebf688b1604c2dedbf7670e2053d6d53e70c7a3 --- /dev/null +++ b/3rdparty/libzip/regress/set_compression_unknown.test @@ -0,0 +1,5 @@ +# change method to unknown +return 1 +args test.zip set_file_compression 0 unknown 0 +file test.zip teststored.zip teststored.zip +stderr can't set file compression method at index '0' to 'unknown', flags '0': Compression method not supported diff --git a/3rdparty/libzip/regress/set_compression_xz_to_store.test b/3rdparty/libzip/regress/set_compression_xz_to_store.test new file mode 100644 index 0000000000000000000000000000000000000000..6294ba26adfdf24625318f6c95eb778ab8c58de6 --- /dev/null +++ b/3rdparty/libzip/regress/set_compression_xz_to_store.test @@ -0,0 +1,5 @@ +# change method from xz-compressed to stored +features LIBLZMA +return 0 +args test.zip set_file_compression 0 store 0 +file test.zip testfile-xz.zip testfile-stored-dos.zip diff --git a/3rdparty/libzip/regress/set_compression_zstd_to_store.test b/3rdparty/libzip/regress/set_compression_zstd_to_store.test new file mode 100644 index 0000000000000000000000000000000000000000..6f8cd7e221f20b3f2fc85866aea8486c79c918b5 --- /dev/null +++ b/3rdparty/libzip/regress/set_compression_zstd_to_store.test @@ -0,0 +1,5 @@ +# change method from zstd-compressed to stored +features LIBZSTD +return 0 +args test.zip set_file_compression 0 store 0 +file test.zip testfile-zstd.zip testfile-stored-dos.zip diff --git a/3rdparty/libzip/regress/set_file_dostime.test b/3rdparty/libzip/regress/set_file_dostime.test new file mode 100644 index 0000000000000000000000000000000000000000..bd1af879b3b1f0f9e9bb27e2ed9675e9250c64cd --- /dev/null +++ b/3rdparty/libzip/regress/set_file_dostime.test @@ -0,0 +1,4 @@ +# change dostime in a zip archive (use torrentzip default time) +return 0 +args testfile set_file_dostime 0 48128 8600 +file testfile testfile.zip testfile0.zip diff --git a/3rdparty/libzip/regress/set_file_mtime.test b/3rdparty/libzip/regress/set_file_mtime.test new file mode 100644 index 0000000000000000000000000000000000000000..477fd06a5f291013832bb900db3ddee88f7ca62e --- /dev/null +++ b/3rdparty/libzip/regress/set_file_mtime.test @@ -0,0 +1,4 @@ +# change mtime in a zip archive +return 0 +args testfile set_file_mtime 0 1407272201 +file testfile testfile.zip testfile2014.zip diff --git a/3rdparty/libzip/regress/source_hole.c b/3rdparty/libzip/regress/source_hole.c new file mode 100644 index 0000000000000000000000000000000000000000..03521141a01a36a80b783396a38bdfa969f0123c --- /dev/null +++ b/3rdparty/libzip/regress/source_hole.c @@ -0,0 +1,577 @@ +/* + source_hole.c -- source for handling huge files that are mostly NULs + Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "zip.h" + +/* public API */ + +zip_source_t *source_hole_create(const char *, int flags, zip_error_t *); + + +#ifndef EFTYPE +#define EFTYPE EINVAL +#endif + + +#define MY_MIN(a, b) ((a) < (b) ? (a) : (b)) + +#define FRAGMENT_SIZE (8 * 1024) + +#define MARK_BEGIN "NiH0" +#define MARK_DATA "NiH1" +#define MARK_NUL "NiH2" + + +typedef struct buffer { + zip_uint64_t fragment_size; + zip_uint8_t **fragment; + zip_uint64_t nfragments; + zip_uint64_t size; + zip_uint64_t offset; +} buffer_t; + +static void buffer_free(buffer_t *buffer); +static buffer_t *buffer_from_file(const char *fname, int flags, zip_error_t *error); +static buffer_t *buffer_new(void); +static zip_int64_t buffer_read(buffer_t *buffer, zip_uint8_t *data, zip_uint64_t length, zip_error_t *error); +static int buffer_read_file(buffer_t *buffer, FILE *f, zip_error_t *error); +static zip_int64_t buffer_seek(buffer_t *buffer, void *data, zip_uint64_t length, zip_error_t *error); +static int buffer_to_file(buffer_t *buffer, const char *fname, 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 *error); +static zip_uint64_t get_u64(const zip_uint8_t *b); +static int only_nul(const zip_uint8_t *data, zip_uint64_t length); +static int write_nuls(zip_uint64_t n, FILE *f); +static int write_u64(zip_uint64_t u64, FILE *f); + + +typedef struct hole { + zip_error_t error; + char *fname; + buffer_t *in; + buffer_t *out; +} hole_t; + +static hole_t *hole_new(const char *fname, int flags, zip_error_t *error); +static zip_int64_t source_hole_cb(void *ud, void *data, zip_uint64_t length, zip_source_cmd_t command); + + +zip_source_t * +source_hole_create(const char *fname, int flags, zip_error_t *error) { + hole_t *ud = hole_new(fname, flags, error); + + if (ud == NULL) { + return NULL; + } + return zip_source_function_create(source_hole_cb, ud, error); +} + + +static void +buffer_free(buffer_t *buffer) { + zip_uint64_t i; + + if (buffer == NULL) { + return; + } + + if (buffer->fragment) { + for (i = 0; i < buffer->nfragments; i++) { + free(buffer->fragment[i]); + } + free(buffer->fragment); + } + free(buffer); +} + + +static buffer_t * +buffer_from_file(const char *fname, int flags, zip_error_t *error) { + buffer_t *buffer; + FILE *f; + + if ((buffer = buffer_new()) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if ((flags & ZIP_TRUNCATE) == 0) { + if ((f = fopen(fname, "rb")) == NULL) { + if (!(errno == ENOENT && (flags & ZIP_CREATE))) { + buffer_free(buffer); + return NULL; + } + } + else { + if (buffer_read_file(buffer, f, error) < 0) { + buffer_free(buffer); + fclose(f); + return NULL; + } + fclose(f); + } + } + + return buffer; +} + + +static buffer_t * +buffer_new(void) { + buffer_t *buffer; + + if ((buffer = (buffer_t *)malloc(sizeof(*buffer))) == NULL) { + return NULL; + } + + buffer->fragment = NULL; + buffer->nfragments = 0; + buffer->fragment_size = FRAGMENT_SIZE; + buffer->size = 0; + buffer->offset = 0; + + return buffer; +} + + +static zip_int64_t +buffer_read(buffer_t *buffer, zip_uint8_t *data, zip_uint64_t length, zip_error_t *error) { + zip_uint64_t n, i, fragment_offset; + + length = MY_MIN(length, buffer->size - buffer->offset); + + if (length == 0) { + return 0; + } + if (length > ZIP_INT64_MAX) { + return -1; + } + + i = buffer->offset / buffer->fragment_size; + fragment_offset = buffer->offset % buffer->fragment_size; + n = 0; + while (n < length) { + zip_uint64_t left = MY_MIN(length - n, buffer->fragment_size - fragment_offset); + + if (buffer->fragment[i]) { + memcpy(data + n, buffer->fragment[i] + fragment_offset, left); + } + else { + memset(data + n, 0, left); + } + + n += left; + i++; + fragment_offset = 0; + } + + buffer->offset += n; + return (zip_int64_t)n; +} + + +static int +buffer_read_file(buffer_t *buffer, FILE *f, zip_error_t *error) { + zip_uint8_t b[20]; + zip_uint64_t i; + + if (fread(b, 20, 1, f) != 1) { + zip_error_set(error, ZIP_ER_READ, errno); + return -1; + } + + if (memcmp(b, MARK_BEGIN, 4) != 0) { + zip_error_set(error, ZIP_ER_READ, EFTYPE); + return -1; + } + + buffer->fragment_size = get_u64(b + 4); + buffer->size = get_u64(b + 12); + + if (buffer->fragment_size == 0) { + zip_error_set(error, ZIP_ER_INCONS, 0); + return -1; + } + + buffer->nfragments = buffer->size / buffer->fragment_size; + if (buffer->size % buffer->fragment_size != 0) { + buffer->nfragments += 1; + } + + if ((buffer->nfragments > SIZE_MAX / sizeof(buffer->fragment[0])) || ((buffer->fragment = (zip_uint8_t **)malloc(sizeof(buffer->fragment[0]) * buffer->nfragments)) == NULL)) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return -1; + } + + for (i = 0; i < buffer->nfragments; i++) { + buffer->fragment[i] = NULL; + } + + i = 0; + while (i < buffer->nfragments) { + if (fread(b, 4, 1, f) != 1) { + zip_error_set(error, ZIP_ER_READ, errno); + return -1; + } + + if (memcmp(b, MARK_DATA, 4) == 0) { + if (buffer->fragment_size > SIZE_MAX) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return -1; + } + if ((buffer->fragment[i] = (zip_uint8_t *)malloc(buffer->fragment_size)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return -1; + } + if (fread(buffer->fragment[i], buffer->fragment_size, 1, f) != 1) { + zip_error_set(error, ZIP_ER_READ, errno); + return -1; + } + i++; + } + else if (memcmp(b, MARK_NUL, 4) == 0) { + if (fread(b, 8, 1, f) != 1) { + zip_error_set(error, ZIP_ER_READ, errno); + return -1; + } + i += get_u64(b); + } + else { + zip_error_set(error, ZIP_ER_READ, EFTYPE); + return -1; + } + } + + return 0; +} + +static zip_int64_t +buffer_seek(buffer_t *buffer, void *data, zip_uint64_t length, zip_error_t *error) { + zip_int64_t new_offset = zip_source_seek_compute_offset(buffer->offset, buffer->size, data, length, error); + + if (new_offset < 0) { + return -1; + } + + buffer->offset = (zip_uint64_t)new_offset; + return 0; +} + + +static int +buffer_to_file(buffer_t *buffer, const char *fname, zip_error_t *error) { + FILE *f = fopen(fname, "wb"); + zip_uint64_t i; + zip_uint64_t nul_run; + + if (f == NULL) { + zip_error_set(error, ZIP_ER_OPEN, errno); + return -1; + } + + fwrite(MARK_BEGIN, 4, 1, f); + write_u64(buffer->fragment_size, f); + write_u64(buffer->size, f); + + nul_run = 0; + for (i = 0; i * buffer->fragment_size < buffer->size; i++) { + if (buffer->fragment[i] == NULL || only_nul(buffer->fragment[i], buffer->fragment_size)) { + nul_run++; + } + else { + if (nul_run > 0) { + write_nuls(nul_run, f); + nul_run = 0; + } + fwrite(MARK_DATA, 4, 1, f); + + fwrite(buffer->fragment[i], 1, buffer->fragment_size, f); + } + } + + if (nul_run > 0) { + write_nuls(nul_run, f); + } + + if (fclose(f) != 0) { + zip_error_set(error, ZIP_ER_WRITE, errno); + return -1; + } + + 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_uint8_t **fragment; + if (buffer->offset + length > buffer->nfragments * buffer->fragment_size) { + zip_uint64_t needed_fragments = (buffer->offset + length + buffer->fragment_size - 1) / buffer->fragment_size; + zip_uint64_t new_capacity = buffer->nfragments; + zip_uint64_t i; + + if (new_capacity == 0) { + new_capacity = 4; + } + while (new_capacity < needed_fragments) { + new_capacity *= 2; + } + + fragment = realloc(buffer->fragment, new_capacity * sizeof(*fragment)); + + if (fragment == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return -1; + } + + for (i = buffer->nfragments; i < new_capacity; i++) { + fragment[i] = NULL; + } + + buffer->fragment = fragment; + buffer->nfragments = new_capacity; + } + + if (!only_nul(data, length)) { + zip_uint64_t idx, n, fragment_offset; + + idx = buffer->offset / buffer->fragment_size; + fragment_offset = buffer->offset % buffer->fragment_size; + n = 0; + + while (n < length) { + zip_uint64_t left = MY_MIN(length - n, buffer->fragment_size - fragment_offset); + + if (buffer->fragment[idx] == NULL) { + if ((buffer->fragment[idx] = (zip_uint8_t *)malloc(buffer->fragment_size)) == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return -1; + } + memset(buffer->fragment[idx], 0, buffer->fragment_size); + } + memcpy(buffer->fragment[idx] + fragment_offset, data + n, left); + + n += left; + idx++; + fragment_offset = 0; + } + } + + buffer->offset += length; + if (buffer->offset > buffer->size) { + buffer->size = buffer->offset; + } + + return (zip_int64_t)length; +} + + +static zip_uint64_t +get_u64(const zip_uint8_t *b) { + zip_uint64_t i; + + i = (zip_uint64_t)b[0] << 56 | (zip_uint64_t)b[1] << 48 | (zip_uint64_t)b[2] << 40 | (zip_uint64_t)b[3] << 32 | (zip_uint64_t)b[4] << 24 | (zip_uint64_t)b[5] << 16 | (zip_uint64_t)b[6] << 8 | (zip_uint64_t)b[7]; + + return i; +} + + +static int +only_nul(const zip_uint8_t *data, zip_uint64_t length) { + zip_uint64_t i; + + for (i = 0; i < length; i++) { + if (data[i] != '\0') { + return 0; + } + } + + return 1; +} + + +static int +write_nuls(zip_uint64_t n, FILE *f) { + if (fwrite(MARK_NUL, 4, 1, f) != 1) { + return -1; + } + return write_u64(n, f); +} + + +static int +write_u64(zip_uint64_t u64, FILE *f) { + zip_uint8_t b[8]; + + b[0] = (zip_uint8_t)((u64 >> 56) & 0xff); + b[1] = (zip_uint8_t)((u64 >> 48) & 0xff); + b[2] = (zip_uint8_t)((u64 >> 40) & 0xff); + b[3] = (zip_uint8_t)((u64 >> 32) & 0xff); + b[4] = (zip_uint8_t)((u64 >> 24) & 0xff); + b[5] = (zip_uint8_t)((u64 >> 16) & 0xff); + b[6] = (zip_uint8_t)((u64 >> 8) & 0xff); + b[7] = (zip_uint8_t)(u64 & 0xff); + + return fwrite(b, 8, 1, f) == 1 ? 0 : -1; +} + + +static void +hole_free(hole_t *hole) { + if (hole == NULL) { + return; + } + zip_error_fini(&hole->error); + buffer_free(hole->in); + buffer_free(hole->out); + free(hole->fname); + free(hole); +} + + +static hole_t * +hole_new(const char *fname, int flags, zip_error_t *error) { + hole_t *ctx = (hole_t *)malloc(sizeof(*ctx)); + + if (ctx == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if ((ctx->fname = strdup(fname)) == NULL) { + free(ctx); + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if ((ctx->in = buffer_from_file(fname, flags, error)) == NULL) { + free(ctx); + return NULL; + } + + zip_error_init(&ctx->error); + ctx->out = NULL; + + return ctx; +} + + +static zip_int64_t +source_hole_cb(void *ud, void *data, zip_uint64_t length, zip_source_cmd_t command) { + hole_t *ctx = (hole_t *)ud; + + switch (command) { + case ZIP_SOURCE_BEGIN_WRITE: + ctx->out = buffer_new(); + return 0; + + case ZIP_SOURCE_CLOSE: + return 0; + + case ZIP_SOURCE_COMMIT_WRITE: + if (buffer_to_file(ctx->out, ctx->fname, &ctx->error) < 0) { + return -1; + } + 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, length); + + case ZIP_SOURCE_FREE: + hole_free(ctx); + return 0; + + case ZIP_SOURCE_OPEN: + ctx->in->offset = 0; + return 0; + + case ZIP_SOURCE_READ: + return buffer_read(ctx->in, data, length, &ctx->error); + + case ZIP_SOURCE_REMOVE: + buffer_free(ctx->in); + ctx->in = buffer_new(); + buffer_free(ctx->out); + ctx->out = NULL; + (void)remove(ctx->fname); + 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, length, &ctx->error); + + case ZIP_SOURCE_SEEK_WRITE: + return buffer_seek(ctx->out, data, length, &ctx->error); + + case ZIP_SOURCE_STAT: { + zip_stat_t *st = ZIP_SOURCE_GET_ARGS(zip_stat_t, data, length, &ctx->error); + + if (st == NULL) { + return -1; + } + + /* TODO: return ENOENT if fname doesn't exist */ + + st->valid |= ZIP_STAT_SIZE; + st->size = ctx->in->size; + return 0; + } + + case ZIP_SOURCE_TELL: + return (zip_int64_t)ctx->in->offset; + + case ZIP_SOURCE_TELL_WRITE: + return (zip_int64_t)ctx->out->offset; + + case ZIP_SOURCE_WRITE: + return buffer_write(ctx->out, data, length, &ctx->error); + + case ZIP_SOURCE_SUPPORTS: + return zip_source_make_command_bitmap(ZIP_SOURCE_BEGIN_WRITE, ZIP_SOURCE_COMMIT_WRITE, ZIP_SOURCE_CLOSE, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_REMOVE, ZIP_SOURCE_ROLLBACK_WRITE, ZIP_SOURCE_SEEK, ZIP_SOURCE_SEEK_WRITE, ZIP_SOURCE_STAT, ZIP_SOURCE_TELL, ZIP_SOURCE_TELL_WRITE, ZIP_SOURCE_WRITE, -1); + + default: + zip_error_set(&ctx->error, ZIP_ER_OPNOTSUPP, 0); + return -1; + } +} diff --git a/3rdparty/libzip/regress/stat_index_cp437_guess.test b/3rdparty/libzip/regress/stat_index_cp437_guess.test new file mode 100644 index 0000000000000000000000000000000000000000..f1abd1ad056fc715dfff13235f09ea04939513d7 --- /dev/null +++ b/3rdparty/libzip/regress/stat_index_cp437_guess.test @@ -0,0 +1,148 @@ +# guess CP437 file names and autoconvert them +args test-cp437.zip stat 0 stat 1 stat 2 stat 3 stat 4 stat 5 stat 6 stat 7 stat 8 stat 9 stat 10 stat 11 stat 12 stat 13 stat 14 stat 15 +return 0 +file test-cp437.zip test-cp437.zip test-cp437.zip +stdout name: '☺☻♥♦♣♠•○◘◙♂♀♪♫☼►' +stdout index: '0' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:51:50' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '◄↕‼¶§▬↨↑↓→â†âˆŸâ†”▲▼ ' +stdout index: '1' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:51:54' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '!"#$%&'()*+,-./0' +stdout index: '2' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:51:58' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '123456789:;<=>?@' +stdout index: '3' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:04' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'ABCDEFGHIJKLMNOP' +stdout index: '4' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:08' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'QRSTUVWXYZ[\]^_`' +stdout index: '5' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:12' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'abcdefghijklmnop' +stdout index: '6' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:18' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'qrstuvwxyz{|}~~Ç' +stdout index: '7' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:22' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'üéâäà åçêëèïîìÄÅÉ' +stdout index: '8' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:26' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'æÆôöòûùÿÖÜ¢£¥₧ƒá' +stdout index: '9' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:30' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'ÃóúñѪº¿âŒÂ¬Â½Â¼Â¡Â«Â»â–‘' +stdout index: '10' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:36' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '▒▓│┤╡╢╖╕╣║╗â•â•œâ•›â”â””' +stdout index: '11' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:40' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '┴┬├─┼╞╟╚╔╩╦╠â•â•¬â•§â•¨' +stdout index: '12' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:44' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '╤╥╙╘╒╓╫╪┘┌█▄▌â–▀α' +stdout index: '13' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:50' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'ßΓπΣσµτΦΘΩδ∞φε∩≡' +stdout index: '14' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:54' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '±≥≤⌠⌡÷≈°∙·√â¿Â²â–   ' +stdout index: '15' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:53:02' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout diff --git a/3rdparty/libzip/regress/stat_index_cp437_raw.test b/3rdparty/libzip/regress/stat_index_cp437_raw.test new file mode 100644 index 0000000000000000000000000000000000000000..79104f0ef64575a2bb10a90751756df5638870eb --- /dev/null +++ b/3rdparty/libzip/regress/stat_index_cp437_raw.test @@ -0,0 +1,149 @@ +# get raw file names them from archive +args -r test-cp437.zip stat 0 stat 1 stat 2 stat 3 stat 4 stat 5 stat 6 stat 7 stat 8 stat 9 stat 10 stat 11 stat 12 stat 13 stat 14 stat 15 +return 0 +file test-cp437.zip test-cp437.zip test-cp437.zip +stdout name: ' +stdout ' +stdout index: '0' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:51:50' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: ' ' +stdout index: '1' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:51:54' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '!"#$%&'()*+,-./0' +stdout index: '2' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:51:58' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '123456789:;<=>?@' +stdout index: '3' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:04' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'ABCDEFGHIJKLMNOP' +stdout index: '4' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:08' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'QRSTUVWXYZ[\]^_`' +stdout index: '5' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:12' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'abcdefghijklmnop' +stdout index: '6' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:18' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'qrstuvwxyz{|}~~€' +stdout index: '7' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:22' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '‚ƒ„…†‡ˆ‰Š‹ŒŽ' +stdout index: '8' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:26' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '‘’“”•–—˜™š›œžŸ ' +stdout index: '9' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:30' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '¡¢£¤¥¦§¨©ª«¬®¯°' +stdout index: '10' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:36' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '±²³´µ¶·¸¹º»¼½¾¿À' +stdout index: '11' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:40' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐ' +stdout index: '12' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:44' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'ÑÒÓÔÕÖ×ØÙÚÛÜÝÞßà' +stdout index: '13' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:50' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'áâãäåæçèéêëìíîïð' +stdout index: '14' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:54' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'ñòóôõö÷øùúûüýþÿÿ' +stdout index: '15' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:53:02' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout diff --git a/3rdparty/libzip/regress/stat_index_cp437_strict.test b/3rdparty/libzip/regress/stat_index_cp437_strict.test new file mode 100644 index 0000000000000000000000000000000000000000..a34a0e6365a15e27b7aad333a384737310819bdf --- /dev/null +++ b/3rdparty/libzip/regress/stat_index_cp437_strict.test @@ -0,0 +1,148 @@ +# strictly follow ZIP spec and expect CP437 file names, and autoconvert them +args -s test-cp437.zip stat 0 stat 1 stat 2 stat 3 stat 4 stat 5 stat 6 stat 7 stat 8 stat 9 stat 10 stat 11 stat 12 stat 13 stat 14 stat 15 +return 0 +file test-cp437.zip test-cp437.zip test-cp437.zip +stdout name: '☺☻♥♦♣♠•○◘◙♂♀♪♫☼►' +stdout index: '0' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:51:50' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '◄↕‼¶§▬↨↑↓→â†âˆŸâ†”▲▼ ' +stdout index: '1' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:51:54' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '!"#$%&'()*+,-./0' +stdout index: '2' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:51:58' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '123456789:;<=>?@' +stdout index: '3' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:04' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'ABCDEFGHIJKLMNOP' +stdout index: '4' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:08' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'QRSTUVWXYZ[\]^_`' +stdout index: '5' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:12' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'abcdefghijklmnop' +stdout index: '6' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:18' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'qrstuvwxyz{|}~~Ç' +stdout index: '7' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:22' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'üéâäà åçêëèïîìÄÅÉ' +stdout index: '8' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:26' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'æÆôöòûùÿÖÜ¢£¥₧ƒá' +stdout index: '9' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:30' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'ÃóúñѪº¿âŒÂ¬Â½Â¼Â¡Â«Â»â–‘' +stdout index: '10' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:36' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '▒▓│┤╡╢╖╕╣║╗â•â•œâ•›â”â””' +stdout index: '11' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:40' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '┴┬├─┼╞╟╚╔╩╦╠â•â•¬â•§â•¨' +stdout index: '12' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:44' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '╤╥╙╘╒╓╫╪┘┌█▄▌â–▀α' +stdout index: '13' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:50' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'ßΓπΣσµτΦΘΩδ∞φε∩≡' +stdout index: '14' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:52:54' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: '±≥≤⌠⌡÷≈°∙·√â¿Â²â–   ' +stdout index: '15' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Feb 17 2012 20:53:02' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout diff --git a/3rdparty/libzip/regress/stat_index_fileorder.test b/3rdparty/libzip/regress/stat_index_fileorder.test new file mode 100644 index 0000000000000000000000000000000000000000..24b02b44e2417fed95407527234117d988125250 --- /dev/null +++ b/3rdparty/libzip/regress/stat_index_fileorder.test @@ -0,0 +1,22 @@ +# zip_open: entries ordered by central directory order +args fileorder.zzip stat 0 stat 1 +return 0 +file fileorder.zzip fileorder.zip fileorder.zip +stdout name: 'file1' +stdout index: '0' +stdout size: '5' +stdout compressed size: '5' +stdout mtime: 'Fri Apr 27 2012 23:21:42' +stdout crc: '9ee760e5' +stdout compression method: '0' +stdout encryption method: '0' +stdout +stdout name: 'file2' +stdout index: '1' +stdout size: '5' +stdout compressed size: '5' +stdout mtime: 'Fri Apr 27 2012 23:21:44' +stdout crc: '7ee315f' +stdout compression method: '0' +stdout encryption method: '0' +stdout diff --git a/3rdparty/libzip/regress/stat_index_streamed.test b/3rdparty/libzip/regress/stat_index_streamed.test new file mode 100644 index 0000000000000000000000000000000000000000..a2b3048adbc70d93befa815ce4f5c152418a9a7e --- /dev/null +++ b/3rdparty/libzip/regress/stat_index_streamed.test @@ -0,0 +1,13 @@ +# stat file in streamed zip file +args streamed stat 0 +file streamed streamed.zip streamed.zip +return 0 +stdout name: '-' +stdout index: '0' +stdout size: '2' +stdout compressed size: '4' +stdout mtime: 'Wed Apr 25 2012 10:20:38' +stdout crc: 'ddeaa107' +stdout compression method: '8' +stdout encryption method: '0' +stdout diff --git a/3rdparty/libzip/regress/stat_index_streamed_zip64.test b/3rdparty/libzip/regress/stat_index_streamed_zip64.test new file mode 100644 index 0000000000000000000000000000000000000000..18a8694b02978f6086cf342622ff29845f277cbc --- /dev/null +++ b/3rdparty/libzip/regress/stat_index_streamed_zip64.test @@ -0,0 +1,13 @@ +# stat file in streamed zip file +args streamed stat 0 +file streamed streamed-zip64.zip streamed-zip64.zip +return 0 +stdout name: '-' +stdout index: '0' +stdout size: '2' +stdout compressed size: '4' +stdout mtime: 'Wed Apr 25 2012 10:20:38' +stdout crc: 'ddeaa107' +stdout compression method: '8' +stdout encryption method: '0' +stdout diff --git a/3rdparty/libzip/regress/stat_index_utf8_guess.test b/3rdparty/libzip/regress/stat_index_utf8_guess.test new file mode 100644 index 0000000000000000000000000000000000000000..898db2dcd1482f44acab6e6dfa1ccb347785a9a2 --- /dev/null +++ b/3rdparty/libzip/regress/stat_index_utf8_guess.test @@ -0,0 +1,13 @@ +# guess UTF-8 file names +args test-utf8.zip stat 0 +return 0 +file test-utf8.zip test-utf8.zip test-utf8.zip +stdout name: 'ÄÖÜäöüßćçĉéèêëē' +stdout index: '0' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Sat Feb 18 2012 00:15:08' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout diff --git a/3rdparty/libzip/regress/stat_index_utf8_raw.test b/3rdparty/libzip/regress/stat_index_utf8_raw.test new file mode 100644 index 0000000000000000000000000000000000000000..881a18b74085e526ea342c07084de59d4f3cd136 --- /dev/null +++ b/3rdparty/libzip/regress/stat_index_utf8_raw.test @@ -0,0 +1,13 @@ +# print UTF-8 file names +args -r test-utf8.zip stat 0 +return 0 +file test-utf8.zip test-utf8.zip test-utf8.zip +stdout name: 'ÄÖÜäöüßćçĉéèêëē' +stdout index: '0' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Sat Feb 18 2012 00:15:08' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout diff --git a/3rdparty/libzip/regress/stat_index_utf8_strict.test b/3rdparty/libzip/regress/stat_index_utf8_strict.test new file mode 100644 index 0000000000000000000000000000000000000000..af1bb818b605ab3b0263d93bc054c329500c54be --- /dev/null +++ b/3rdparty/libzip/regress/stat_index_utf8_strict.test @@ -0,0 +1,14 @@ +# follow strict rules and convert UTF-8 as if it was CP437, but not +# if the files are marked as having UTF-8 names +args -s test-utf8.zip stat 0 +return 0 +file test-utf8.zip test-utf8.zip test-utf8.zip +stdout name: 'ÄÖÜäöüßćçĉéèêëē' +stdout index: '0' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Sat Feb 18 2012 00:15:08' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout diff --git a/3rdparty/libzip/regress/stat_index_utf8_unmarked_strict.test b/3rdparty/libzip/regress/stat_index_utf8_unmarked_strict.test new file mode 100644 index 0000000000000000000000000000000000000000..07954dd24e6ad28bc1689de4b12929a2481c9de8 --- /dev/null +++ b/3rdparty/libzip/regress/stat_index_utf8_unmarked_strict.test @@ -0,0 +1,14 @@ +# follow strict rules and convert UTF-8 as if it was CP437, +# if not marked otherwise (in this case: not marked) +args -s test-utf8-unmarked.zip stat 0 +return 0 +file test-utf8-unmarked.zip test-utf8-unmarked.zip test-utf8-unmarked.zip +stdout name: '├ä├û├£├ñ├╢├â•â”œÆ’─ç├º─ë├âŒâ”œÂ¿â”œÂ¬â”œÂ½â”€Ã´' +stdout index: '0' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Sat Feb 18 2012 00:15:08' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout diff --git a/3rdparty/libzip/regress/stat_index_zip64.test b/3rdparty/libzip/regress/stat_index_zip64.test new file mode 100644 index 0000000000000000000000000000000000000000..c3f420c9fa8fda6ccbda2ff34cb1b9be13df3ada --- /dev/null +++ b/3rdparty/libzip/regress/stat_index_zip64.test @@ -0,0 +1,13 @@ +# stat file in zip64 zip file +args bigzero stat 0 +file bigzero bigzero.zip bigzero.zip +return 0 +stdout name: 'bigzero' +stdout index: '0' +stdout size: '4294967296' +stdout compressed size: '4168157' +stdout mtime: 'Thu Mar 15 2012 14:54:06' +stdout crc: 'd202ef8d' +stdout compression method: '8' +stdout encryption method: '0' +stdout diff --git a/3rdparty/libzip/regress/stored-no-eos.zip b/3rdparty/libzip/regress/stored-no-eos.zip new file mode 100644 index 0000000000000000000000000000000000000000..4a7745f73cda20294873712f5664f92d491b03e4 Binary files /dev/null and b/3rdparty/libzip/regress/stored-no-eos.zip differ diff --git a/3rdparty/libzip/regress/streamed-zip64.zip b/3rdparty/libzip/regress/streamed-zip64.zip new file mode 100644 index 0000000000000000000000000000000000000000..85886190bef6d6408c2a0f2efbe8418c7f54a61b Binary files /dev/null and b/3rdparty/libzip/regress/streamed-zip64.zip differ diff --git a/3rdparty/libzip/regress/streamed.zip b/3rdparty/libzip/regress/streamed.zip new file mode 100644 index 0000000000000000000000000000000000000000..737d56f31b3dbf55589c53ce41411c69d2a3cd52 Binary files /dev/null and b/3rdparty/libzip/regress/streamed.zip differ diff --git a/3rdparty/libzip/regress/test-cp437-comment-utf-8.zip b/3rdparty/libzip/regress/test-cp437-comment-utf-8.zip new file mode 100644 index 0000000000000000000000000000000000000000..04fbaac95fd8360af4fc71d98c06ca9b3a7e5f11 Binary files /dev/null and b/3rdparty/libzip/regress/test-cp437-comment-utf-8.zip differ diff --git a/3rdparty/libzip/regress/test-cp437-fc-utf-8-filename.zip b/3rdparty/libzip/regress/test-cp437-fc-utf-8-filename.zip new file mode 100644 index 0000000000000000000000000000000000000000..7aeb8096b35588c0b4f54d83b7cca8033067704b Binary files /dev/null and b/3rdparty/libzip/regress/test-cp437-fc-utf-8-filename.zip differ diff --git a/3rdparty/libzip/regress/test-cp437-fc.zip b/3rdparty/libzip/regress/test-cp437-fc.zip new file mode 100644 index 0000000000000000000000000000000000000000..0c4f04d53139f06a6fc4eb89eecb755ea37aca46 Binary files /dev/null and b/3rdparty/libzip/regress/test-cp437-fc.zip differ diff --git a/3rdparty/libzip/regress/test-cp437.zip b/3rdparty/libzip/regress/test-cp437.zip new file mode 100644 index 0000000000000000000000000000000000000000..066531efb10cd09d803f455b1ae7c5e47ec764b9 Binary files /dev/null and b/3rdparty/libzip/regress/test-cp437.zip differ diff --git a/3rdparty/libzip/regress/test-utf8-unmarked.zip b/3rdparty/libzip/regress/test-utf8-unmarked.zip new file mode 100644 index 0000000000000000000000000000000000000000..1bcb7035ff928b664d3fe5502a256f45f5f12d75 Binary files /dev/null and b/3rdparty/libzip/regress/test-utf8-unmarked.zip differ diff --git a/3rdparty/libzip/regress/test-utf8.zip b/3rdparty/libzip/regress/test-utf8.zip new file mode 100644 index 0000000000000000000000000000000000000000..3045e20b86ae42e8e5529af7803dc62f38278037 Binary files /dev/null and b/3rdparty/libzip/regress/test-utf8.zip differ diff --git a/3rdparty/libzip/regress/test.zip b/3rdparty/libzip/regress/test.zip new file mode 100644 index 0000000000000000000000000000000000000000..e4efd716b64801cd7445a7baaa8d460a661534ca Binary files /dev/null and b/3rdparty/libzip/regress/test.zip differ diff --git a/3rdparty/libzip/regress/test2.zip b/3rdparty/libzip/regress/test2.zip new file mode 100644 index 0000000000000000000000000000000000000000..ed2f60f50e320d2968637f673d0ac50355594b21 Binary files /dev/null and b/3rdparty/libzip/regress/test2.zip differ diff --git a/3rdparty/libzip/regress/testbuffer.zip b/3rdparty/libzip/regress/testbuffer.zip new file mode 100644 index 0000000000000000000000000000000000000000..91e7d8a8b84dbd7faaef9afc2a873216a37b6bb4 Binary files /dev/null and b/3rdparty/libzip/regress/testbuffer.zip differ diff --git a/3rdparty/libzip/regress/testbzip2.zip b/3rdparty/libzip/regress/testbzip2.zip new file mode 100644 index 0000000000000000000000000000000000000000..7c9a9e72b90f5166169f761cf052de78e473b05a Binary files /dev/null and b/3rdparty/libzip/regress/testbzip2.zip differ diff --git a/3rdparty/libzip/regress/testchanged.zip b/3rdparty/libzip/regress/testchanged.zip new file mode 100644 index 0000000000000000000000000000000000000000..d5169c96edbda1b0e796e0a466feba7a013c1d36 Binary files /dev/null and b/3rdparty/libzip/regress/testchanged.zip differ diff --git a/3rdparty/libzip/regress/testchangedlocal.zip b/3rdparty/libzip/regress/testchangedlocal.zip new file mode 100644 index 0000000000000000000000000000000000000000..1c8b301414483864e522f2d440c53027942d63d8 Binary files /dev/null and b/3rdparty/libzip/regress/testchangedlocal.zip differ diff --git a/3rdparty/libzip/regress/testcomment.zip b/3rdparty/libzip/regress/testcomment.zip new file mode 100644 index 0000000000000000000000000000000000000000..45dc18d1423248071fd02b8a68e9bed36dd3f623 Binary files /dev/null and b/3rdparty/libzip/regress/testcomment.zip differ diff --git a/3rdparty/libzip/regress/testcomment13.zip b/3rdparty/libzip/regress/testcomment13.zip new file mode 100644 index 0000000000000000000000000000000000000000..bd6e1c3277cfc2551406338d2c5f92db0401bb35 Binary files /dev/null and b/3rdparty/libzip/regress/testcomment13.zip differ diff --git a/3rdparty/libzip/regress/testcommentremoved.zip b/3rdparty/libzip/regress/testcommentremoved.zip new file mode 100644 index 0000000000000000000000000000000000000000..b2e4d05dc5bd3d8b4e6d2a4f16215b5c37dc50ff Binary files /dev/null and b/3rdparty/libzip/regress/testcommentremoved.zip differ diff --git a/3rdparty/libzip/regress/testdeflated.zip b/3rdparty/libzip/regress/testdeflated.zip new file mode 100644 index 0000000000000000000000000000000000000000..7f6ab1cf579a37e2f0a0b9284de8844e7f9c671b Binary files /dev/null and b/3rdparty/libzip/regress/testdeflated.zip differ diff --git a/3rdparty/libzip/regress/testdeflated2.zip b/3rdparty/libzip/regress/testdeflated2.zip new file mode 100644 index 0000000000000000000000000000000000000000..b5ded7d6d3fc7c8a3b59a03ca7b6c3ec5cbfaa1d Binary files /dev/null and b/3rdparty/libzip/regress/testdeflated2.zip differ diff --git a/3rdparty/libzip/regress/testdir.zip b/3rdparty/libzip/regress/testdir.zip new file mode 100644 index 0000000000000000000000000000000000000000..b1e13e184314636058d86e3d0ad1320805a77fe1 Binary files /dev/null and b/3rdparty/libzip/regress/testdir.zip differ diff --git a/3rdparty/libzip/regress/testempty.zip b/3rdparty/libzip/regress/testempty.zip new file mode 100644 index 0000000000000000000000000000000000000000..15cb0ecb3e219d1701294bfdf0fe3f5cb5d208e7 Binary files /dev/null and b/3rdparty/libzip/regress/testempty.zip differ diff --git a/3rdparty/libzip/regress/testextrabytes.zip b/3rdparty/libzip/regress/testextrabytes.zip new file mode 100644 index 0000000000000000000000000000000000000000..f2a3fb2a6d34871facb252d2ef086db496932682 Binary files /dev/null and b/3rdparty/libzip/regress/testextrabytes.zip differ diff --git a/3rdparty/libzip/regress/testfile-UTF8.zip b/3rdparty/libzip/regress/testfile-UTF8.zip new file mode 100644 index 0000000000000000000000000000000000000000..727961545ca745df1f286593bc818d3fb59b996c Binary files /dev/null and b/3rdparty/libzip/regress/testfile-UTF8.zip differ diff --git a/3rdparty/libzip/regress/testfile-cp437.zip b/3rdparty/libzip/regress/testfile-cp437.zip new file mode 100644 index 0000000000000000000000000000000000000000..169a90311aa235010b5e29c9479bf3dc81477b76 Binary files /dev/null and b/3rdparty/libzip/regress/testfile-cp437.zip differ diff --git a/3rdparty/libzip/regress/testfile-lzma.zip b/3rdparty/libzip/regress/testfile-lzma.zip new file mode 100644 index 0000000000000000000000000000000000000000..f855b2ac69af8cf6b6094d443cc3ec5779b01f7b Binary files /dev/null and b/3rdparty/libzip/regress/testfile-lzma.zip differ diff --git a/3rdparty/libzip/regress/testfile-plus-extra.zip b/3rdparty/libzip/regress/testfile-plus-extra.zip new file mode 100644 index 0000000000000000000000000000000000000000..09a6c039c3d6132c11bd266c68479addcccda42b Binary files /dev/null and b/3rdparty/libzip/regress/testfile-plus-extra.zip differ diff --git a/3rdparty/libzip/regress/testfile-stored-dos.zip b/3rdparty/libzip/regress/testfile-stored-dos.zip new file mode 100644 index 0000000000000000000000000000000000000000..1adf55403f420636cae422300f03ebecbe35616f Binary files /dev/null and b/3rdparty/libzip/regress/testfile-stored-dos.zip differ diff --git a/3rdparty/libzip/regress/testfile-xz.zip b/3rdparty/libzip/regress/testfile-xz.zip new file mode 100644 index 0000000000000000000000000000000000000000..6be8f9c137882d2dffa709544f84d6b8c0f3f71b Binary files /dev/null and b/3rdparty/libzip/regress/testfile-xz.zip differ diff --git a/3rdparty/libzip/regress/testfile-zstd.zip b/3rdparty/libzip/regress/testfile-zstd.zip new file mode 100755 index 0000000000000000000000000000000000000000..bf42d3e08bce22cd560e0204ab0235b8865d1bf5 Binary files /dev/null and b/3rdparty/libzip/regress/testfile-zstd.zip differ diff --git a/3rdparty/libzip/regress/testfile.txt b/3rdparty/libzip/regress/testfile.txt new file mode 100755 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/3rdparty/libzip/regress/testfile.zip b/3rdparty/libzip/regress/testfile.zip new file mode 100644 index 0000000000000000000000000000000000000000..2fa5ba0859f6d7022ecc42226a48f806a2d6e785 Binary files /dev/null and b/3rdparty/libzip/regress/testfile.zip differ diff --git a/3rdparty/libzip/regress/testfile0.zip b/3rdparty/libzip/regress/testfile0.zip new file mode 100644 index 0000000000000000000000000000000000000000..5e565d14fb89415fa40dacb55f7fc389795ec33b Binary files /dev/null and b/3rdparty/libzip/regress/testfile0.zip differ diff --git a/3rdparty/libzip/regress/testfile2014.zip b/3rdparty/libzip/regress/testfile2014.zip new file mode 100644 index 0000000000000000000000000000000000000000..1d75d46ecc76e534e984b36e723b64e094390ca3 Binary files /dev/null and b/3rdparty/libzip/regress/testfile2014.zip differ diff --git a/3rdparty/libzip/regress/teststdin.zip b/3rdparty/libzip/regress/teststdin.zip new file mode 100644 index 0000000000000000000000000000000000000000..e1a40a869fa29ffbe742866eabf0c514ea84545e Binary files /dev/null and b/3rdparty/libzip/regress/teststdin.zip differ diff --git a/3rdparty/libzip/regress/teststored.zip b/3rdparty/libzip/regress/teststored.zip new file mode 100644 index 0000000000000000000000000000000000000000..138c6adda3bb6a7bf4c63ba589094dc3381cc516 Binary files /dev/null and b/3rdparty/libzip/regress/teststored.zip differ diff --git a/3rdparty/libzip/regress/tryopen.c b/3rdparty/libzip/regress/tryopen.c new file mode 100644 index 0000000000000000000000000000000000000000..54058f23c8cd7e2a9c0680e15ce2a68d4e33b0bc --- /dev/null +++ b/3rdparty/libzip/regress/tryopen.c @@ -0,0 +1,113 @@ +/* + tryopen.c -- tool for tests that try opening zip archives + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <errno.h> +#include <stdio.h> + +#ifndef HAVE_GETOPT +#include "getopt.h" +#endif + +#include "zip.h" +#define TRYOPEN_USAGE \ + "usage: %s [-cent] file\n\n" \ + "\t-c\tcheck consistency\n" \ + "\t-e\texclusively open archive\n" \ + "\t-n\tcreate new file\n" \ + "\t-t\ttruncate file to size 0\n" + + +int +main(int argc, char *argv[]) { + const char *fname; + zip_t *z; + int c, flags, ze; + zip_int64_t count; + int error; + + flags = 0; + + while ((c = getopt(argc, argv, "cent")) != -1) { + switch (c) { + case 'c': + flags |= ZIP_CHECKCONS; + break; + case 'e': + flags |= ZIP_EXCL; + break; + case 'n': + flags |= ZIP_CREATE; + break; + case 't': + flags |= ZIP_TRUNCATE; + break; + + default: + fprintf(stderr, TRYOPEN_USAGE, argv[0]); + return 1; + } + } + + error = 0; + for (; optind < argc; optind++) { + fname = argv[optind]; + errno = 0; + + if ((z = zip_open(fname, flags, &ze)) != NULL) { + count = zip_get_num_entries(z, 0); + printf("opening '%s' succeeded, %" PRIu64 " entries\n", fname, count); + zip_close(z); + continue; + } + + printf("opening '%s' returned error %d", fname, ze); + switch (zip_error_get_sys_type(ze)) { + case ZIP_ET_SYS: + case ZIP_ET_LIBZIP: + printf("/%d", errno); + break; + + default: + break; + } + printf("\n"); + error++; + } + + if (error > 0) + fprintf(stderr, "%d errors\n", error); + + return error ? 1 : 0; +} diff --git a/3rdparty/libzip/regress/utf-8-standardization-input.zip b/3rdparty/libzip/regress/utf-8-standardization-input.zip new file mode 100644 index 0000000000000000000000000000000000000000..67e3acf3ce999f23c1694ee994f332976b0df32f Binary files /dev/null and b/3rdparty/libzip/regress/utf-8-standardization-input.zip differ diff --git a/3rdparty/libzip/regress/utf-8-standardization-output.zip b/3rdparty/libzip/regress/utf-8-standardization-output.zip new file mode 100644 index 0000000000000000000000000000000000000000..266027ff64b93c5261b6acd0bdaf29492bee2ed2 Binary files /dev/null and b/3rdparty/libzip/regress/utf-8-standardization-output.zip differ diff --git a/3rdparty/libzip/regress/utf-8-standardization.test b/3rdparty/libzip/regress/utf-8-standardization.test new file mode 100644 index 0000000000000000000000000000000000000000..35d4808a8cc18dfe0f1f803a62b4f234def83de5 --- /dev/null +++ b/3rdparty/libzip/regress/utf-8-standardization.test @@ -0,0 +1,4 @@ +# replace file contents and make UTF-8 name +return 0 +args testfile.zzip replace_file_contents 0 "Some new content for the file." set_file_mtime 0 1406885162 +file testfile.zzip utf-8-standardization-input.zip utf-8-standardization-output.zip diff --git a/3rdparty/libzip/regress/zip-in-archive-comment.test b/3rdparty/libzip/regress/zip-in-archive-comment.test new file mode 100644 index 0000000000000000000000000000000000000000..4838a8fb1a82ba27237b7c1ffbd9664e0f86e187 --- /dev/null +++ b/3rdparty/libzip/regress/zip-in-archive-comment.test @@ -0,0 +1,13 @@ +# stat file in zip that contains archive comment to find out if it detected the right one of the two +args zip-in-archive-comment.zip stat 0 +file zip-in-archive-comment.zip zip-in-archive-comment.zip zip-in-archive-comment.zip +return 0 +stdout name: 'testfile.txt' +stdout index: '0' +stdout size: '0' +stdout compressed size: '0' +stdout mtime: 'Fri Jul 15 2005 16:37:14' +stdout crc: '0' +stdout compression method: '0' +stdout encryption method: '0' +stdout diff --git a/3rdparty/libzip/regress/zip-in-archive-comment.zip b/3rdparty/libzip/regress/zip-in-archive-comment.zip new file mode 100644 index 0000000000000000000000000000000000000000..20a412bd105ac8a663d0f3aeacf3a5dd213da7d2 Binary files /dev/null and b/3rdparty/libzip/regress/zip-in-archive-comment.zip differ diff --git a/3rdparty/libzip/regress/zip64-3mf.zip b/3rdparty/libzip/regress/zip64-3mf.zip new file mode 100644 index 0000000000000000000000000000000000000000..a2ccf240866c41ec492ed1e58439aeab76ca74ca Binary files /dev/null and b/3rdparty/libzip/regress/zip64-3mf.zip differ diff --git a/3rdparty/libzip/regress/zip64.zip b/3rdparty/libzip/regress/zip64.zip new file mode 100644 index 0000000000000000000000000000000000000000..c1ba76b7e76183b17d7b058a61ffcea94b3f3e35 Binary files /dev/null and b/3rdparty/libzip/regress/zip64.zip differ diff --git a/3rdparty/libzip/regress/zip64_creation.test b/3rdparty/libzip/regress/zip64_creation.test new file mode 100644 index 0000000000000000000000000000000000000000..f21608867af7fd851eab25dcce7306d2657b74d1 --- /dev/null +++ b/3rdparty/libzip/regress/zip64_creation.test @@ -0,0 +1,4 @@ +# create big zip64 zip file from scratch +args bigzero.zip add_nul bigzero 4294967296 +file-new bigzero.zip bigzero.zip +return 0 diff --git a/3rdparty/libzip/regress/zip64_stored_creation.test b/3rdparty/libzip/regress/zip64_stored_creation.test new file mode 100644 index 0000000000000000000000000000000000000000..92ee02c142a465787beb20493d5e8d9277352ce1 --- /dev/null +++ b/3rdparty/libzip/regress/zip64_stored_creation.test @@ -0,0 +1,4 @@ +# create big zip64 zip file from scratch +args -H bigstored.zh add_nul bigzero 4294967296 set_file_compression 0 0 0 set_file_mtime 0 0 add_nul smallzero 16384 set_file_compression 1 0 0 set_file_mtime 1 0 +file-new bigstored.zh bigstored.zh +return 0 diff --git a/3rdparty/libzip/regress/zip_read_fuzzer.cc b/3rdparty/libzip/regress/zip_read_fuzzer.cc new file mode 100644 index 0000000000000000000000000000000000000000..6813807b4e4255ec8c089c36f7dd4ef5355b2274 --- /dev/null +++ b/3rdparty/libzip/regress/zip_read_fuzzer.cc @@ -0,0 +1,48 @@ +#include <zip.h> + +#ifdef __cplusplus +extern "C" +#endif +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + zip_source_t *src; + zip_t *za; + zip_error_t error; + char buf[32768]; + zip_int64_t i, n; + zip_file_t *f; + + zip_error_init(&error); + + if ((src = zip_source_buffer_create(data, size, 0, &error)) == NULL) { + zip_error_fini(&error); + return 0; + } + + if ((za = zip_open_from_source(src, 0, &error)) == NULL) { + zip_source_free(src); + zip_error_fini(&error); + return 0; + } + + zip_error_fini(&error); + + n = zip_get_num_entries(za, 0); + + for (i = 0; i < n; i++) { + f = zip_fopen_index(za, i, 0); + if (f == NULL) { + continue; + } + + while (zip_fread(f, buf, sizeof(buf)) > 0) { + ; + } + + zip_fclose(f); + } + + zip_close(za); + + return 0; +} diff --git a/3rdparty/libzip/regress/zip_read_fuzzer.dict b/3rdparty/libzip/regress/zip_read_fuzzer.dict new file mode 100644 index 0000000000000000000000000000000000000000..b54ac52359345975def9a984683321c773f7bbd0 --- /dev/null +++ b/3rdparty/libzip/regress/zip_read_fuzzer.dict @@ -0,0 +1,3 @@ +header_lfh="\x50\x4b\x03\x04" +header_cd="\x50\x4b\x01\x02" +header_eocd="\x50\x4b\x05\x06" diff --git a/3rdparty/libzip/regress/zipcmp_zip_dir.test b/3rdparty/libzip/regress/zipcmp_zip_dir.test new file mode 100644 index 0000000000000000000000000000000000000000..c44d83b982be2c075a560a0fa95936f096907bb4 --- /dev/null +++ b/3rdparty/libzip/regress/zipcmp_zip_dir.test @@ -0,0 +1,15 @@ +# compare zip with directory +features FTS_H +program zipcmp +mkdir 0777 a +mkdir 0777 a/dir-with-file +mkdir 0777 a/empty-dir-in-dir +args zipcmp_zip_dir.zip a +file zipcmp_zip_dir.zip zipcmp_zip_dir.zip zipcmp_zip_dir.zip +return 1 +stdout --- zipcmp_zip_dir.zip +stdout +++ a +stdout - directory '00-empty-dir/' +stdout - file 'dir-with-file/a', size 1, crc e8b7be43 +stdout + directory 'empty-dir-in-dir/' +stdout - directory 'empty-dir/' diff --git a/3rdparty/libzip/regress/zipcmp_zip_dir.zip b/3rdparty/libzip/regress/zipcmp_zip_dir.zip new file mode 100644 index 0000000000000000000000000000000000000000..8f47f21bdf3b8a59450799502bfb13f1e608f62a Binary files /dev/null and b/3rdparty/libzip/regress/zipcmp_zip_dir.zip differ diff --git a/3rdparty/libzip/regress/ziptool_regress.c b/3rdparty/libzip/regress/ziptool_regress.c new file mode 100644 index 0000000000000000000000000000000000000000..ee440d2385723262d85d5ead74b0395205a95187 --- /dev/null +++ b/3rdparty/libzip/regress/ziptool_regress.c @@ -0,0 +1,445 @@ +#include "zip.h" + +#include <sys/stat.h> + +#define ZIP_MIN(a, b) ((a) < (b) ? (a) : (b)) + +#define FOR_REGRESS + +typedef enum { SOURCE_TYPE_NONE, SOURCE_TYPE_IN_MEMORY, SOURCE_TYPE_HOLE } source_type_t; + +source_type_t source_type = SOURCE_TYPE_NONE; +zip_uint64_t fragment_size = 0; + +static int add_nul(int argc, char *argv[]); +static int cancel(int argc, char *argv[]); +static int unchange_one(int argc, char *argv[]); +static int unchange_all(int argc, char *argv[]); +static int zin_close(int argc, char *argv[]); + +#define OPTIONS_REGRESS "F:Hm" + +#define USAGE_REGRESS " [-Hm] [-F fragment-size]" + +#define GETOPT_REGRESS \ + case 'H': \ + source_type = SOURCE_TYPE_HOLE; \ + break; \ + case 'm': \ + source_type = SOURCE_TYPE_IN_MEMORY; \ + break; \ + case 'F': \ + fragment_size = strtoull(optarg, NULL, 10); \ + break; + +/* clang-format off */ + +#define DISPATCH_REGRESS \ + {"add_nul", 2, "name length", "add NUL bytes", add_nul}, \ + {"cancel", 1, "limit", "cancel writing archive when limit% have been written (calls print_progress)", cancel}, \ + {"unchange", 1, "index", "revert changes for entry", unchange_one}, \ + {"unchange_all", 0, "", "revert all changes", unchange_all}, \ + { "zin_close", 1, "index", "close input zip_source (for internal tests)", zin_close } + +/* clang-format on */ + + +zip_t *ziptool_open(const char *archive, int flags, zip_error_t *error, zip_uint64_t offset, zip_uint64_t len); + + +#include "ziptool.c" + + +zip_source_t *memory_src = NULL; + +zip_source_t *source_hole_create(const char *, int flags, zip_error_t *); + +static zip_t *read_to_memory(const char *archive, int flags, zip_error_t *error, zip_source_t **srcp); +static zip_source_t *source_nul(zip_t *za, zip_uint64_t length); + + +static int +add_nul(int argc, char *argv[]) { + zip_source_t *zs; + zip_uint64_t length = strtoull(argv[1], NULL, 10); + + if ((zs = source_nul(za, length)) == NULL) { + fprintf(stderr, "can't create zip_source for length: %s\n", zip_strerror(za)); + return -1; + } + + if (zip_add(za, argv[0], zs) == -1) { + zip_source_free(zs); + fprintf(stderr, "can't add file '%s': %s\n", argv[0], zip_strerror(za)); + return -1; + } + return 0; +} + +static int +unchange_all(int argc, char *argv[]) { + if (zip_unchange_all(za) < 0) { + fprintf(stderr, "can't revert changes to archive: %s\n", zip_strerror(za)); + return -1; + } + return 0; +} + + +static int +unchange_one(int argc, char *argv[]) { + zip_uint64_t idx; + + idx = strtoull(argv[0], NULL, 10); + + if (zip_unchange(za, idx) < 0) { + fprintf(stderr, "can't revert changes for entry %" PRIu64 ": %s", idx, zip_strerror(za)); + return -1; + } + + return 0; +} + + +static int +cancel_callback(zip_t *archive, void *ud) { + if (progress_userdata.percentage >= progress_userdata.limit) { + return -1; + } + return 0; +} + +static int +cancel(int argc, char *argv[]) { + zip_int64_t percent; + percent = strtoll(argv[0], NULL, 10); + if (percent > 100 || percent < 0) { + fprintf(stderr, "invalid percentage '%" PRId64 "' for cancel (valid: 0 <= x <= 100)\n", percent); + return -1; + } + progress_userdata.limit = ((double)percent) / 100; + + zip_register_cancel_callback_with_state(za, cancel_callback, NULL, NULL); + + /* needs the percentage updates from print_progress */ + print_progress(argc, argv); + return 0; +} + +static int +zin_close(int argc, char *argv[]) { + zip_uint64_t idx; + + idx = strtoull(argv[0], NULL, 10); + if (idx >= z_in_count) { + fprintf(stderr, "invalid argument '%" PRIu64 "', only %u zip sources open\n", idx, z_in_count); + return -1; + } + if (zip_close(z_in[idx]) < 0) { + fprintf(stderr, "can't close source archive: %s\n", zip_strerror(z_in[idx])); + return -1; + } + z_in[idx] = z_in[z_in_count]; + z_in_count--; + + return 0; +} + + +static zip_t * +read_hole(const char *archive, int flags, zip_error_t *error) { + zip_source_t *src = NULL; + zip_t *zs = NULL; + + if (strcmp(archive, "/dev/stdin") == 0) { + zip_error_set(error, ZIP_ER_OPNOTSUPP, 0); + return NULL; + } + + if ((src = source_hole_create(archive, flags, error)) == NULL || (zs = zip_open_from_source(src, flags, error)) == NULL) { + zip_source_free(src); + } + + return zs; +} + + +static zip_t * +read_to_memory(const char *archive, int flags, zip_error_t *error, zip_source_t **srcp) { + zip_source_t *src; + zip_t *zb; + FILE *fp; + + if (strcmp(archive, "/dev/stdin") == 0) { + zip_error_set(error, ZIP_ER_OPNOTSUPP, 0); + return NULL; + } + + if ((fp = fopen(archive, "rb")) == NULL) { + if (errno == ENOENT) { + src = zip_source_buffer_create(NULL, 0, 0, error); + } + else { + zip_error_set(error, ZIP_ER_OPEN, errno); + return NULL; + } + } + else { + struct stat st; + + if (fstat(fileno(fp), &st) < 0) { + fclose(fp); + zip_error_set(error, ZIP_ER_OPEN, errno); + return NULL; + } + if (fragment_size == 0) { + char *buf; + if ((buf = malloc((size_t)st.st_size)) == NULL) { + fclose(fp); + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + if (fread(buf, (size_t)st.st_size, 1, fp) < 1) { + free(buf); + fclose(fp); + zip_error_set(error, ZIP_ER_READ, errno); + return NULL; + } + src = zip_source_buffer_create(buf, (zip_uint64_t)st.st_size, 1, error); + if (src == NULL) { + free(buf); + } + } + else { + zip_uint64_t nfragments, i, left; + zip_buffer_fragment_t *fragments; + + nfragments = ((size_t)st.st_size + fragment_size - 1) / fragment_size; + if ((fragments = malloc(sizeof(fragments[0]) * nfragments)) == NULL) { + fclose(fp); + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + for (i = 0; i < nfragments; i++) { + left = ZIP_MIN(fragment_size, (size_t)st.st_size - i * fragment_size); + if ((fragments[i].data = malloc(left)) == NULL) { +#ifndef __clang_analyzer__ + /* fragments is initialized up to i - 1*/ + while (--i > 0) { + free(fragments[i].data); + } +#endif + free(fragments); + fclose(fp); + zip_error_set(error, ZIP_ER_MEMORY, 0); + return NULL; + } + fragments[i].length = left; + if (fread(fragments[i].data, left, 1, fp) < 1) { +#ifndef __clang_analyzer__ + /* fragments is initialized up to i - 1*/ + while (--i > 0) { + free(fragments[i].data); + } +#endif + free(fragments); + fclose(fp); + zip_error_set(error, ZIP_ER_READ, errno); + return NULL; + } + } + src = zip_source_buffer_fragment_create(fragments, nfragments, 1, error); + if (src == NULL) { + for (i = 0; i < nfragments; i++) { + free(fragments[i].data); + } + free(fragments); + fclose(fp); + return NULL; + } + free(fragments); + } + fclose(fp); + } + if (src == NULL) { + return NULL; + } + zb = zip_open_from_source(src, flags, error); + if (zb == NULL) { + zip_source_free(src); + return NULL; + } + zip_source_keep(src); + *srcp = src; + return zb; +} + + +typedef struct source_nul { + zip_error_t error; + zip_uint64_t length; + zip_uint64_t offset; +} source_nul_t; + +static zip_int64_t +source_nul_cb(void *ud, void *data, zip_uint64_t length, zip_source_cmd_t command) { + source_nul_t *ctx = (source_nul_t *)ud; + + switch (command) { + case ZIP_SOURCE_CLOSE: + return 0; + + case ZIP_SOURCE_ERROR: + return zip_error_to_data(&ctx->error, data, length); + + case ZIP_SOURCE_FREE: + free(ctx); + return 0; + + case ZIP_SOURCE_OPEN: + ctx->offset = 0; + return 0; + + case ZIP_SOURCE_READ: + if (length > ZIP_INT64_MAX) { + zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (length > ctx->length - ctx->offset) { + length = ctx->length - ctx->offset; + } + + memset(data, 0, length); + ctx->offset += length; + return (zip_int64_t)length; + + case ZIP_SOURCE_STAT: { + zip_stat_t *st = ZIP_SOURCE_GET_ARGS(zip_stat_t, data, length, &ctx->error); + + if (st == NULL) { + return -1; + } + + st->valid |= ZIP_STAT_SIZE; + st->size = ctx->length; + + return 0; + } + + case ZIP_SOURCE_SUPPORTS: + return zip_source_make_command_bitmap(ZIP_SOURCE_CLOSE, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_STAT, -1); + + default: + zip_error_set(&ctx->error, ZIP_ER_OPNOTSUPP, 0); + return -1; + } +} + +static zip_source_t * +source_nul(zip_t *zs, zip_uint64_t length) { + source_nul_t *ctx; + zip_source_t *src; + + if ((ctx = (source_nul_t *)malloc(sizeof(*ctx))) == NULL) { + zip_error_set(zip_get_error(zs), ZIP_ER_MEMORY, 0); + return NULL; + } + + zip_error_init(&ctx->error); + ctx->length = length; + ctx->offset = 0; + + if ((src = zip_source_function(zs, source_nul_cb, ctx)) == NULL) { + free(ctx); + return NULL; + } + + return src; +} + + +static int +write_memory_src_to_file(const char *archive, zip_source_t *src) { + zip_stat_t zst; + char *buf; + FILE *fp; + + if (zip_source_stat(src, &zst) < 0) { + fprintf(stderr, "zip_source_stat on buffer failed: %s\n", zip_error_strerror(zip_source_error(src))); + return -1; + } + if (zip_source_open(src) < 0) { + if (zip_error_code_zip(zip_source_error(src)) == ZIP_ER_DELETED) { + if (unlink(archive) < 0 && errno != ENOENT) { + fprintf(stderr, "unlink failed: %s\n", strerror(errno)); + return -1; + } + return 0; + } + fprintf(stderr, "zip_source_open on buffer failed: %s\n", zip_error_strerror(zip_source_error(src))); + return -1; + } + if ((buf = malloc(zst.size)) == NULL) { + fprintf(stderr, "malloc failed: %s\n", strerror(errno)); + zip_source_close(src); + return -1; + } + if (zip_source_read(src, buf, zst.size) < (zip_int64_t)zst.size) { + fprintf(stderr, "zip_source_read on buffer failed: %s\n", zip_error_strerror(zip_source_error(src))); + zip_source_close(src); + free(buf); + return -1; + } + zip_source_close(src); + if ((fp = fopen(archive, "wb")) == NULL) { + fprintf(stderr, "fopen failed: %s\n", strerror(errno)); + free(buf); + return -1; + } + if (fwrite(buf, zst.size, 1, fp) < 1) { + fprintf(stderr, "fwrite failed: %s\n", strerror(errno)); + free(buf); + fclose(fp); + return -1; + } + free(buf); + if (fclose(fp) != 0) { + fprintf(stderr, "fclose failed: %s\n", strerror(errno)); + return -1; + } + return 0; +} + + +zip_t * +ziptool_open(const char *archive, int flags, zip_error_t *error, zip_uint64_t offset, zip_uint64_t len) { + switch (source_type) { + case SOURCE_TYPE_NONE: + za = read_from_file(archive, flags, error, offset, len); + break; + + case SOURCE_TYPE_IN_MEMORY: + za = read_to_memory(archive, flags, error, &memory_src); + break; + + case SOURCE_TYPE_HOLE: + za = read_hole(archive, flags, error); + break; + } + + return za; +} + + +int +ziptool_post_close(const char *archive) { + if (source_type == SOURCE_TYPE_IN_MEMORY) { + if (write_memory_src_to_file(archive, memory_src) < 0) { + return -1; + } + zip_source_free(memory_src); + } + + return 0; +} diff --git a/3rdparty/libzip/src/CMakeLists.txt b/3rdparty/libzip/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d75b8a0cf02370ec0318c0fb5293249fd361e66 --- /dev/null +++ b/3rdparty/libzip/src/CMakeLists.txt @@ -0,0 +1,14 @@ +check_function_exists(getopt HAVE_GETOPT) +foreach(PROGRAM zipcmp zipmerge ziptool) + add_executable(${PROGRAM} ${PROGRAM}.c) + target_link_libraries(${PROGRAM} zip) + target_include_directories(${PROGRAM} PRIVATE BEFORE ${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}) + if(LIBZIP_DO_INSTALL) + install(TARGETS ${PROGRAM} EXPORT ${PROJECT_NAME}-targets RUNTIME DESTINATION bin) + endif() + if(NOT HAVE_GETOPT) + target_sources(${PROGRAM} PRIVATE getopt.c) + endif(NOT HAVE_GETOPT) +endforeach() +target_sources(zipcmp PRIVATE diff_output.c) +target_link_libraries(zipcmp ${FTS_LIB} ZLIB::ZLIB) diff --git a/3rdparty/libzip/src/diff_output.c b/3rdparty/libzip/src/diff_output.c new file mode 100644 index 0000000000000000000000000000000000000000..2a53f037f98bf8557c63f166b7d92d33a2e0db5f --- /dev/null +++ b/3rdparty/libzip/src/diff_output.c @@ -0,0 +1,106 @@ +#include "diff_output.h" + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "compat.h" + +static void ensure_header(diff_output_t *output) { + if (output->archive_names[0] != NULL) { + printf("--- %s\n", output->archive_names[0]); + printf("+++ %s\n", output->archive_names[1]); + output->archive_names[0] = NULL; + output->archive_names[1] = NULL; + } +} + +void diff_output_init(diff_output_t *output, int verbose, char *const archive_names[]) { + output->archive_names[0] = archive_names[0]; + output->archive_names[1] = archive_names[1]; + output->verbose = verbose; + output->file_name = NULL; + output->file_size = 0; + output->file_crc = 0; +} + +void diff_output_start_file(diff_output_t *output, const char *name, zip_uint64_t size, zip_uint32_t crc) { + output->file_name = name; + output->file_size = size; + output->file_crc = crc; +} + +void diff_output_end_file(diff_output_t *output) { + output->file_name = NULL; +} + +void diff_output(diff_output_t *output, int side, const char *fmt, ...) { + va_list ap; + + if (!output->verbose) { + return; + } + + ensure_header(output); + + if (output->file_name != NULL) { + diff_output_file(output, ' ', output->file_name, output->file_size, output->file_crc); + output->file_name = NULL; + } + + printf("%c ", side); + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + printf("\n"); +} + +void diff_output_file(diff_output_t *output, char side, const char *name, zip_uint64_t size, zip_uint32_t crc) { + if (!output->verbose) { + return; + } + + ensure_header(output); + + if (size == 0 && crc == 0 && name[0] != '\0' && name[strlen(name) - 1] == '/') { + printf("%c directory '%s'\n", side, name); + } + else { + printf("%c file '%s', size %" PRIu64 ", crc %08x\n", side, name, size, crc); + } +} + +#define MAX_BYTES 64 +void diff_output_data(diff_output_t *output, int side, const zip_uint8_t *data, zip_uint64_t data_length, const char *fmt, ...) { + char prefix[1024]; + char hexdata[MAX_BYTES * 3 + 6]; + size_t i, offset; + va_list ap; + + if (!output->verbose) { + return; + } + + offset = 0; + for (i = 0; i < data_length; i++) { + hexdata[offset++] = (i == 0 ? '<' : ' '); + + if (i >= MAX_BYTES) { + sprintf(hexdata + offset, "..."); + break; + } + sprintf(hexdata + offset, "%02x", data[i]); + offset += 2; + } + + hexdata[offset++] = '>'; + hexdata[offset] = '\0'; + + va_start(ap, fmt); + vsnprintf(prefix, sizeof(prefix), fmt, ap); + va_end(ap); + prefix[sizeof(prefix) - 1] = '\0'; + + diff_output(output, side, "%s, length %" PRIu64 ", data %s", prefix, data_length, hexdata); +} diff --git a/3rdparty/libzip/src/diff_output.h b/3rdparty/libzip/src/diff_output.h new file mode 100644 index 0000000000000000000000000000000000000000..8ac12b8bba5628d40955f40617e166bd3c35d1db --- /dev/null +++ b/3rdparty/libzip/src/diff_output.h @@ -0,0 +1,28 @@ +#ifndef HAD_DIFF_OUTPUT_H +#define HAD_DIFF_OUTPUT_H + +#include <zip.h> + +typedef struct { + const char *archive_names[2]; + const char *file_name; + zip_uint64_t file_size; + zip_uint32_t file_crc; + int verbose; +} diff_output_t; + +#if defined(__GNUC__) && __GNUC__ >= 4 +#define PRINTF_LIKE(n, m) __attribute__((__format__(__printf__, n, m))) +#else +#define PRINTF_LIKE(n, m) +#endif + +void diff_output_init(diff_output_t *output, int verbose, char *const archive_names[]); +void diff_output_start_file(diff_output_t *output, const char *name, zip_uint64_t size, zip_uint32_t crc); +void diff_output_end_file(diff_output_t *output); + +void diff_output(diff_output_t *output, int side, const char *fmt, ...) PRINTF_LIKE(3, 4); +void diff_output_data(diff_output_t *output, int side, const zip_uint8_t *data, zip_uint64_t data_length, const char *fmt, ...) PRINTF_LIKE(5, 6); +void diff_output_file(diff_output_t *output, char side, const char *name, zip_uint64_t size, zip_uint32_t crc); + +#endif /* HAD_DIFF_OUTPUT_H */ diff --git a/3rdparty/libzip/src/getopt.c b/3rdparty/libzip/src/getopt.c new file mode 100644 index 0000000000000000000000000000000000000000..a9879c4bc3fe36e5d5082d92670685974a55c811 --- /dev/null +++ b/3rdparty/libzip/src/getopt.c @@ -0,0 +1,110 @@ +/* + * getopt.c -- + * + * Standard UNIX getopt function. Code is from BSD. + * + * Copyright (c) 1987-2002 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: + * + * A. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * B. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * C. Neither the names of the copyright holders 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 COPYRIGHT HOLDERS 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. + */ + +/* #if !defined(lint) + * static char sccsid[] = "@(#)getopt.c 8.2 (Berkeley) 4/2/94"; + * #endif + */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "getopt.h" + +int opterr = 1, /* if error message should be printed */ + optind = 1, /* index into parent argv vector */ + optopt, /* character checked for validity */ + optreset; /* reset getopt */ +char *optarg; /* argument associated with option */ + +#define BADCH (int)'?' +#define BADARG (int)':' +#define EMSG "" + +/* + * getopt -- + * Parse argc/argv argument vector. + */ +int +getopt(int nargc, char *const *nargv, const char *ostr) { + static char *place = EMSG; /* option letter processing */ + char *oli; /* option letter list index */ + + if (optreset || !*place) { /* update scanning pointer */ + optreset = 0; + if (optind >= nargc || *(place = nargv[optind]) != '-') { + place = EMSG; + return (EOF); + } + if (place[1] && *++place == '-') { /* found "--" */ + ++optind; + place = EMSG; + return (EOF); + } + } /* option letter okay? */ + if ((optopt = (int)*place++) == (int)':' || !(oli = (char *)strchr(ostr, optopt))) { + /* + * if the user didn't specify '-' as an option, + * assume it means EOF. + */ + if (optopt == (int)'-') + return (EOF); + if (!*place) + ++optind; + if (opterr && *ostr != ':') + (void)fprintf(stderr, "illegal option -- %c\n", optopt); + return (BADCH); + } + if (*++oli != ':') { /* don't need argument */ + optarg = NULL; + if (!*place) + ++optind; + } + else { /* need an argument */ + if (*place) /* no white space */ + optarg = place; + else if (nargc <= ++optind) { /* no arg */ + place = EMSG; + if (*ostr == ':') + return (BADARG); + if (opterr) + (void)fprintf(stderr, "option requires an argument -- %c\n", optopt); + return (BADCH); + } + else /* white space */ + optarg = nargv[optind]; + place = EMSG; + ++optind; + } + return (optopt); /* dump back option letter */ +} diff --git a/3rdparty/libzip/src/getopt.h b/3rdparty/libzip/src/getopt.h new file mode 100644 index 0000000000000000000000000000000000000000..bb09497e229ffb697b8a174ecfd26d98f80cdc38 --- /dev/null +++ b/3rdparty/libzip/src/getopt.h @@ -0,0 +1,51 @@ +#ifndef _HAD_GETOPT_H +#define _HAD_GETOPT_H + +/* + getopt.h -- header for getopt() replacement function + Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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" { +#endif + +extern char *optarg; +extern int optind; +extern int opterr; + +extern int getopt(int, char *const *, const char *); + +#ifdef __cplusplus +} +#endif + +#endif /* _HAD_GETOPT_H */ diff --git a/3rdparty/libzip/src/zipcmp.c b/3rdparty/libzip/src/zipcmp.c new file mode 100644 index 0000000000000000000000000000000000000000..6a1e7414fec502ef1a407ec751db370dc2bdeb25 --- /dev/null +++ b/3rdparty/libzip/src/zipcmp.c @@ -0,0 +1,866 @@ +/* + zipcmp.c -- compare zip files + Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/stat.h> +#ifdef HAVE_STRINGS_H +#include <strings.h> +#endif +#ifdef HAVE_FTS_H +#include <fts.h> +#endif +#include <zlib.h> + +#ifndef HAVE_GETOPT +#include "getopt.h" +#endif + +#include "zip.h" + +#include "compat.h" + +#include "diff_output.h" + +struct archive { + const char *name; + zip_t *za; + zip_uint64_t nentry; + struct entry *entry; + const char *comment; + size_t comment_length; +}; + +struct ef { + const char *name; + zip_uint16_t flags; + zip_uint16_t id; + zip_uint16_t size; + const zip_uint8_t *data; +}; + +struct entry { + char *name; + zip_uint64_t size; + zip_uint32_t crc; + zip_uint32_t comp_method; + struct ef *extra_fields; + zip_uint16_t n_extra_fields; + const char *comment; + zip_uint32_t comment_length; +}; + + +typedef struct { + uint32_t value; + const char * const name; +} enum_map_t; + +const enum_map_t comp_methods[] = { + { 0, "Stored (no compression)" }, + { 1, "Shrunk" }, + { 2, "Reduced with compression factor 1" }, + { 3, "Reduced with compression factor 2" }, + { 4, "Reduced with compression factor 3" }, + { 5, "Reduced with compression factor 4" }, + { 6, "Imploded" }, + { 7, "Reserved for Tokenizing compression algorithm" }, + { 8, "Deflated" }, + { 9, "Enhanced Deflating using Deflate64(tm)" }, + { 10, "PKWARE Data Compression Library Imploding (old IBM TERSE)" }, + { 11, "11 (Reserved by PKWARE)" }, + { 12, "BZIP2" }, + { 13, "13 (Reserved by PKWARE)" }, + { 14, "LZMA (EFS)" }, + { 15, "15 (Reserved by PKWARE)" }, + { 16, "16 (Reserved by PKWARE)" }, + { 17, "17 (Reserved by PKWARE)" }, + { 18, "IBM TERSE (new)" }, + { 19, "IBM LZ77 z Architecture (PFS)" }, + { 20, "Zstandard compressed data (obsolete)" }, + { 93, "Zstandard compressed data" }, + { 95, "XZ compressed data" }, + { 97, "WavPack compressed data" }, + { 98, "PPMd version I, Rev 1" }, + { 99, "WinZIP AES Encryption" }, + { UINT32_MAX, NULL } +}; + +const enum_map_t extra_fields[] = { + /* PKWARE defined */ + { 0x0001, "Zip64 extended information" }, + { 0x0007, "AV Info" }, + { 0x0008, "Reserved for extended language encoding data (PFS)" }, + { 0x0009, "OS/2" }, + { 0x000a, "NTFS" }, + { 0x000c, "OpenVMS" }, + { 0x000d, "UNIX" }, + { 0x000e, "Reserved for file stream and fork descriptors" }, + { 0x000f, "Patch Descriptor" }, + { 0x0014, "PKCS#7 Store for X.509 Certificates" }, + { 0x0015, "X.509 Certificate ID and Signature for individual file" }, + { 0x0016, "X.509 Certificate ID for Central Directory" }, + { 0x0017, "Strong Encryption Header" }, + { 0x0018, "Record Management Controls" }, + { 0x0019, "PKCS#7 Encryption Recipient Certificate List" }, + { 0x0065, "IBM S/390 (Z390), AS/400 (I400) attributes - uncompressed" }, + { 0x0066, "Reserved for IBM S/390 (Z390), AS/400 (I400) attributes - compressed" }, + { 0x4690, "POSZIP 4690 (reserved)" }, + + /* Third-Party defined; see InfoZIP unzip sources proginfo/extrafld.txt */ + { 0x07c8, "Info-ZIP Macintosh (old)" }, + { 0x2605, "ZipIt Macintosh (first version)" }, + { 0x2705, "ZipIt Macintosh 1.3.5+ (w/o full filename)" }, + { 0x2805, "ZipIt Macintosh 1.3.5+" }, + { 0x334d, "Info-ZIP Macintosh (new)" }, + { 0x4154, "Tandem NSK" }, + { 0x4341, "Acorn/SparkFS" }, + { 0x4453, "Windows NT security descriptor" }, + { 0x4704, "VM/CMS" }, + { 0x470f, "MVS" }, + { 0x4854, "Theos, old inofficial port" }, + { 0x4b46, "FWKCS MD5" }, + { 0x4c41, "OS/2 access control list (text ACL)" }, + { 0x4d49, "Info-ZIP OpenVMS (obsolete)" }, + { 0x4d63, "Macintosh SmartZIP" }, + { 0x4f4c, "Xceed original location extra field" }, + { 0x5356, "AOS/VS (ACL)" }, + { 0x5455, "extended timestamp" }, + { 0x554e, "Xceed unicode extra field" }, + { 0x5855, "Info-ZIP UNIX (original)" }, + { 0x6375, "Info-ZIP UTF-8 comment field" }, + { 0x6542, "BeOS (BeBox, PowerMac, etc.)" }, + { 0x6854, "Theos" }, + { 0x7075, "Info-ZIP UTF-8 name field" }, + { 0x7441, "AtheOS (AtheOS/Syllable attributes)" }, + { 0x756e, "ASi UNIX" }, + { 0x7855, "Info-ZIP UNIX" }, + { 0x7875, "Info-ZIP UNIX 3rd generation" }, + { 0x9901, "WinZIP AES encryption" }, + { 0xa220, "Microsoft Open Packaging Growth Hint" }, + { 0xcafe, "executable Java JAR file" }, + { 0xfb4a, "SMS/QDOS" }, /* per InfoZIP extrafld.txt */ + { 0xfd4a, "SMS/QDOS" }, /* per appnote.txt */ + { UINT32_MAX, NULL } +}; + + +const char *progname; + +#define PROGRAM "zipcmp" + +#define USAGE "usage: %s [-hipqtVv] archive1 archive2\n" + +char help_head[] = PROGRAM " (" PACKAGE ") by Dieter Baron and Thomas Klausner\n\n"; + +char help[] = "\n\ + -h display this help message\n\ + -C check archive consistencies\n\ + -i compare names ignoring case distinctions\n\ + -p compare as many details as possible\n\ + -q be quiet\n\ + -t test zip files (compare file contents to checksum)\n\ + -V display version number\n\ + -v be verbose (print differences, default)\n\ +\n\ +Report bugs to <libzip@nih.at>.\n"; + +char version_string[] = PROGRAM " (" PACKAGE " " VERSION ")\n\ +Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner\n\ +" PACKAGE " comes with ABSOLUTELY NO WARRANTY, to the extent permitted by law.\n"; + +#define OPTIONS "hVCipqtv" + + +#define BOTH_ARE_ZIPS(a) (a[0].za && a[1].za) + +static int comment_compare(const char *c1, size_t l1, const char *c2, size_t l2); +static int compare_list(char *const name[2], const void *list[2], const zip_uint64_t list_length[2], int element_size, int (*cmp)(const void *a, const void *b), int (*ignore)(const void *list, int last, const void *other), int (*check)(char *const name[2], const void *a, const void *b), void (*print)(char side, const void *element), void (*start_file)(const void *element)); +static int compare_zip(char *const zn[]); +static int ef_compare(char *const name[2], const struct entry *e1, const struct entry *e2); +static int ef_order(const void *a, const void *b); +static void ef_print(char side, const void *p); +static int ef_read(zip_t *za, zip_uint64_t idx, struct entry *e); +static int entry_cmp(const void *p1, const void *p2); +static int entry_ignore(const void *p1, int last, const void *o); +static int entry_paranoia_checks(char *const name[2], const void *p1, const void *p2); +static void entry_print(char side, const void *p); +static void entry_start_file(const void *p); +static const char *map_enum(const enum_map_t *map, uint32_t value); + +static int is_directory(const char *name); +#ifdef HAVE_FTS_H +static int list_directory(const char *name, struct archive *a); +#endif +static int list_zip(const char *name, struct archive *a); +static int test_file(zip_t *za, zip_uint64_t idx, const char *zipname, const char *filename, zip_uint64_t size, zip_uint32_t crc); + +int ignore_case, test_files, paranoid, verbose, have_directory, check_consistency; + +diff_output_t output; + + +int +main(int argc, char *const argv[]) { + int c; + + progname = argv[0]; + + ignore_case = 0; + test_files = 0; + check_consistency = 0; + paranoid = 0; + have_directory = 0; + verbose = 1; + + while ((c = getopt(argc, argv, OPTIONS)) != -1) { + switch (c) { + case 'C': + check_consistency = 1; + break; + case 'i': + ignore_case = 1; + break; + case 'p': + paranoid = 1; + break; + case 'q': + verbose = 0; + break; + case 't': + test_files = 1; + break; + case 'v': + verbose = 1; + break; + + case 'h': + fputs(help_head, stdout); + printf(USAGE, progname); + fputs(help, stdout); + exit(0); + case 'V': + fputs(version_string, stdout); + exit(0); + + default: + fprintf(stderr, USAGE, progname); + exit(2); + } + } + + if (argc != optind + 2) { + fprintf(stderr, USAGE, progname); + exit(2); + } + + exit((compare_zip(argv + optind) == 0) ? 0 : 1); +} + + +static int +compare_zip(char *const zn[]) { + struct archive a[2]; + struct entry *e[2]; + zip_uint64_t n[2]; + int i; + int res; + + for (i = 0; i < 2; i++) { + a[i].name = zn[i]; + a[i].entry = NULL; + a[i].nentry = 0; + a[i].za = NULL; + a[i].comment = NULL; + a[i].comment_length = 0; + + if (is_directory(zn[i])) { +#ifndef HAVE_FTS_H + fprintf(stderr, "%s: reading directories not supported\n", progname); + exit(2); +#else + if (list_directory(zn[i], a + i) < 0) + exit(2); + have_directory = 1; + paranoid = 0; /* paranoid checks make no sense for directories, since they compare zip metadata */ +#endif + } + else { + if (list_zip(zn[i], a + i) < 0) + exit(2); + } + if (a[i].nentry > 0) + qsort(a[i].entry, a[i].nentry, sizeof(a[i].entry[0]), entry_cmp); + } + + diff_output_init(&output, verbose, zn); + + e[0] = a[0].entry; + e[1] = a[1].entry; + n[0] = a[0].nentry; + n[1] = a[1].nentry; + res = compare_list(zn, (const void **)e, n, sizeof(e[i][0]), entry_cmp, have_directory ? entry_ignore : NULL, paranoid ? entry_paranoia_checks : NULL, entry_print, entry_start_file); + + if (paranoid) { + if (comment_compare(a[0].comment, a[0].comment_length, a[1].comment, a[1].comment_length) != 0) { + if (a[0].comment_length > 0) { + diff_output_data(&output, '-', (const zip_uint8_t *)a[0].comment, a[0].comment_length, "archive comment"); + } + if (a[1].comment_length > 0) { + diff_output_data(&output, '+', (const zip_uint8_t *)a[1].comment, a[1].comment_length, "archive comment"); + } + res = 1; + } + } + + for (i = 0; i < 2; i++) { + zip_uint64_t j; + + if (a[i].za) { + zip_close(a[i].za); + } + for (j = 0; j < a[i].nentry; j++) { + free(a[i].entry[j].name); + } + free(a[i].entry); + } + + switch (res) { + case 0: + exit(0); + + case 1: + exit(1); + + default: + exit(2); + } +} + +#ifdef HAVE_FTS_H +static zip_int64_t +compute_crc(const char *fname) { + FILE *f; + uLong crc = crc32(0L, Z_NULL, 0); + size_t n; + Bytef buffer[8192]; + + + if ((f = fopen(fname, "rb")) == NULL) { + fprintf(stderr, "%s: can't open %s: %s\n", progname, fname, strerror(errno)); + return -1; + } + + while ((n = fread(buffer, 1, sizeof(buffer), f)) > 0) { + crc = crc32(crc, buffer, (unsigned int)n); + } + + if (ferror(f)) { + fprintf(stderr, "%s: read error on %s: %s\n", progname, fname, strerror(errno)); + fclose(f); + return -1; + } + + fclose(f); + + return (zip_int64_t)crc; +} +#endif + + +static int +is_directory(const char *name) { + struct stat st; + + if (stat(name, &st) < 0) + return 0; + + return S_ISDIR(st.st_mode); +} + + +#ifdef HAVE_FTS_H +static int +list_directory(const char *name, struct archive *a) { + FTS *fts; + FTSENT *ent; + zip_uint64_t nalloc; + size_t prefix_length; + + char *const names[2] = {(char *)name, NULL}; + + + if ((fts = fts_open(names, FTS_NOCHDIR | FTS_LOGICAL, NULL)) == NULL) { + fprintf(stderr, "%s: can't open directory '%s': %s\n", progname, name, strerror(errno)); + return -1; + } + prefix_length = strlen(name) + 1; + + nalloc = 0; + + while ((ent = fts_read(fts))) { + zip_int64_t crc; + + switch (ent->fts_info) { + case FTS_DOT: + case FTS_DP: + case FTS_DEFAULT: + case FTS_SL: + case FTS_NSOK: + break; + + case FTS_DC: + case FTS_DNR: + case FTS_ERR: + case FTS_NS: + case FTS_SLNONE: + /* TODO: error */ + fts_close(fts); + return -1; + + case FTS_D: + case FTS_F: + if (a->nentry >= nalloc) { + nalloc += 16; + if (nalloc > SIZE_MAX / sizeof(a->entry[0])) { + fprintf(stderr, "%s: malloc failure\n", progname); + exit(1); + } + a->entry = realloc(a->entry, sizeof(a->entry[0]) * nalloc); + if (a->entry == NULL) { + fprintf(stderr, "%s: malloc failure\n", progname); + exit(1); + } + } + + if (ent->fts_info == FTS_D) { + char *dir_name; + + if (ent->fts_path[prefix_length - 1] == '\0') { + break; + } + + dir_name = malloc(strlen(ent->fts_path + prefix_length) + 2); + if (dir_name == NULL) { + fprintf(stderr, "%s: malloc failure\n", progname); + exit(1); + } + sprintf(dir_name, "%s/", ent->fts_path + prefix_length); + a->entry[a->nentry].name = dir_name; + a->entry[a->nentry].size = 0; + a->entry[a->nentry].crc = 0; + } + else { + a->entry[a->nentry].name = strdup(ent->fts_path + prefix_length); + a->entry[a->nentry].size = (zip_uint64_t)ent->fts_statp->st_size; + if ((crc = compute_crc(ent->fts_accpath)) < 0) { + fts_close(fts); + return -1; + } + + a->entry[a->nentry].crc = (zip_uint32_t)crc; + } + a->nentry++; + break; + } + } + + if (fts_close(fts)) { + fprintf(stderr, "%s: error closing directory '%s': %s\n", progname, a->name, strerror(errno)); + return -1; + } + + return 0; +} +#endif + + +static int +list_zip(const char *name, struct archive *a) { + zip_t *za; + int err; + struct zip_stat st; + unsigned int i; + + if ((za = zip_open(name, check_consistency ? ZIP_CHECKCONS : 0, &err)) == NULL) { + zip_error_t error; + zip_error_init_with_code(&error, err); + fprintf(stderr, "%s: cannot open zip archive '%s': %s\n", progname, name, zip_error_strerror(&error)); + zip_error_fini(&error); + return -1; + } + + a->za = za; + a->nentry = (zip_uint64_t)zip_get_num_entries(za, 0); + + if (a->nentry == 0) + a->entry = NULL; + else { + if ((a->nentry > SIZE_MAX / sizeof(a->entry[0])) || (a->entry = (struct entry *)malloc(sizeof(a->entry[0]) * a->nentry)) == NULL) { + fprintf(stderr, "%s: malloc failure\n", progname); + exit(1); + } + + for (i = 0; i < a->nentry; i++) { + zip_stat_index(za, i, 0, &st); + a->entry[i].name = strdup(st.name); + a->entry[i].size = st.size; + a->entry[i].crc = st.crc; + if (test_files) + test_file(za, i, name, st.name, st.size, st.crc); + if (paranoid) { + a->entry[i].comp_method = st.comp_method; + ef_read(za, i, a->entry + i); + a->entry[i].comment = zip_file_get_comment(za, i, &a->entry[i].comment_length, 0); + } + else { + a->entry[i].comp_method = 0; + a->entry[i].n_extra_fields = 0; + } + } + + if (paranoid) { + int length; + a->comment = zip_get_archive_comment(za, &length, 0); + a->comment_length = (size_t)length; + } + else { + a->comment = NULL; + a->comment_length = 0; + } + } + + return 0; +} + + +static int +comment_compare(const char *c1, size_t l1, const char *c2, size_t l2) { + if (l1 != l2) + return 1; + + if (l1 == 0) + return 0; + + if (c1 == NULL || c2 == NULL) + return c1 == c2; + + return memcmp(c1, c2, (size_t)l2); +} + + +static int compare_list(char *const name[2], const void *list[2], const zip_uint64_t list_length[2], int element_size, int (*cmp)(const void *a, const void *b), int (*ignore)(const void *list, int last, const void *other), int (*check)(char *const name[2], const void *a, const void *b), void (*print)(char side, const void *element), void (*start_file)(const void *element)) { + unsigned int i[2]; + int j; + int diff; + +#define INC(k) (i[k]++, list[k] = ((const char *)list[k]) + element_size) +#define PRINT(k) \ + do { \ + if (ignore && ignore(list[k], i[k] >= list_length[k] - 1, i[1-k] < list_length[1-k] ? list[1-k] : NULL)) { \ + break; \ + } \ + print((k) ? '+' : '-', list[k]); \ + diff = 1; \ + } while (0) + + i[0] = i[1] = 0; + diff = 0; + while (i[0] < list_length[0] && i[1] < list_length[1]) { + int c = cmp(list[0], list[1]); + + if (c == 0) { + if (check) { + if (start_file) { + start_file(list[0]); + } + diff |= check(name, list[0], list[1]); + if (start_file) { + diff_output_end_file(&output); + } + } + INC(0); + INC(1); + } + else if (c < 0) { + PRINT(0); + INC(0); + } + else { + PRINT(1); + INC(1); + } + } + + for (j = 0; j < 2; j++) { + while (i[j] < list_length[j]) { + PRINT(j); + INC(j); + } + } + + return diff; +} + + +static int +ef_read(zip_t *za, zip_uint64_t idx, struct entry *e) { + zip_int16_t n_local, n_central; + zip_uint16_t i; + + if ((n_local = zip_file_extra_fields_count(za, idx, ZIP_FL_LOCAL)) < 0 || (n_central = zip_file_extra_fields_count(za, idx, ZIP_FL_CENTRAL)) < 0) { + return -1; + } + + e->n_extra_fields = (zip_uint16_t)(n_local + n_central); + + if ((e->extra_fields = (struct ef *)malloc(sizeof(e->extra_fields[0]) * e->n_extra_fields)) == NULL) + return -1; + + for (i = 0; i < n_local; i++) { + e->extra_fields[i].name = e->name; + e->extra_fields[i].data = zip_file_extra_field_get(za, idx, i, &e->extra_fields[i].id, &e->extra_fields[i].size, ZIP_FL_LOCAL); + if (e->extra_fields[i].data == NULL) + return -1; + e->extra_fields[i].flags = ZIP_FL_LOCAL; + } + for (; i < e->n_extra_fields; i++) { + e->extra_fields[i].name = e->name; + e->extra_fields[i].data = zip_file_extra_field_get(za, idx, (zip_uint16_t)(i - n_local), &e->extra_fields[i].id, &e->extra_fields[i].size, ZIP_FL_CENTRAL); + if (e->extra_fields[i].data == NULL) + return -1; + e->extra_fields[i].flags = ZIP_FL_CENTRAL; + } + + qsort(e->extra_fields, e->n_extra_fields, sizeof(e->extra_fields[0]), ef_order); + + return 0; +} + + +static int +ef_compare(char *const name[2], const struct entry *e1, const struct entry *e2) { + struct ef *ef[2]; + zip_uint64_t n[2]; + + ef[0] = e1->extra_fields; + ef[1] = e2->extra_fields; + n[0] = e1->n_extra_fields; + n[1] = e2->n_extra_fields; + + return compare_list(name, (const void **)ef, n, sizeof(struct ef), ef_order, NULL, NULL, ef_print, NULL); +} + + +static int +ef_order(const void *ap, const void *bp) { + const struct ef *a, *b; + + a = (struct ef *)ap; + b = (struct ef *)bp; + + if (a->flags != b->flags) + return a->flags - b->flags; + if (a->id != b->id) + return a->id - b->id; + if (a->size != b->size) + return a->size - b->size; + return memcmp(a->data, b->data, a->size); +} + + +static void +ef_print(char side, const void *p) { + const struct ef *ef = (struct ef *)p; + + diff_output_data(&output, side, ef->data, ef->size, " %s extra field %s", ef->flags == ZIP_FL_LOCAL ? "local" : "central", map_enum(extra_fields, ef->id)); +} + + +static int +entry_cmp(const void *p1, const void *p2) { + const struct entry *e1, *e2; + int c; + + e1 = (struct entry *)p1; + e2 = (struct entry *)p2; + + if ((c = (ignore_case ? strcasecmp : strcmp)(e1->name, e2->name)) != 0) + return c; + if (e1->size != e2->size) { + if (e1->size > e2->size) + return 1; + else + return -1; + } + if (e1->crc != e2->crc) + return (int)e1->crc - (int)e2->crc; + + return 0; +} + + +static int +entry_ignore(const void *p, int last, const void *o) { + const struct entry *e = (const struct entry *)p; + const struct entry *other = (const struct entry *)o; + + size_t length = strlen(e[0].name); + + if (length == 0 || e[0].name[length - 1] != '/') { + /* not a directory */ + return 0; + } + + if (other != NULL && strlen(other->name) > length && strncmp(other->name, e[0].name, length) == 0) { + /* not empty in other archive */ + return 1; + } + + if (last || (strlen(e[1].name) < length || strncmp(e[0].name, e[1].name, length) != 0)) { + /* empty in this archive */ + return 0; + } + + /* not empty in this archive */ + return 1; +} + + +static int +entry_paranoia_checks(char *const name[2], const void *p1, const void *p2) { + const struct entry *e1, *e2; + int ret; + + e1 = (struct entry *)p1; + e2 = (struct entry *)p2; + + ret = 0; + + if (e1->comp_method != e2->comp_method) { + diff_output(&output, '-', " compression method %s", map_enum(comp_methods, e1->comp_method)); + diff_output(&output, '+', " compression method %s", map_enum(comp_methods, e2->comp_method)); + ret = 1; + } + + if (ef_compare(name, e1, e2) != 0) { + ret = 1; + } + + if (comment_compare(e1->comment, e1->comment_length, e2->comment, e2->comment_length) != 0) { + diff_output_data(&output, '-', (const zip_uint8_t *)e1->comment, e1->comment_length, " comment"); + diff_output_data(&output, '+', (const zip_uint8_t *)e2->comment, e2->comment_length, " comment"); + ret = 1; + } + + return ret; +} + + +static void entry_print(char side, const void *p) { + const struct entry *e = (struct entry *)p; + + diff_output_file(&output, side, e->name, e->size, e->crc); +} + + +static void entry_start_file(const void *p) { + const struct entry *e = (struct entry *)p; + + diff_output_start_file(&output, e->name, e->size, e->crc); +} + + +static int +test_file(zip_t *za, zip_uint64_t idx, const char *zipname, const char *filename, zip_uint64_t size, zip_uint32_t crc) { + zip_file_t *zf; + char buf[8192]; + zip_uint64_t nsize; + zip_int64_t n; + zip_uint32_t ncrc; + + if ((zf = zip_fopen_index(za, idx, 0)) == NULL) { + fprintf(stderr, "%s: %s: cannot open file %s (index %" PRIu64 "): %s\n", progname, zipname, filename, idx, zip_strerror(za)); + return -1; + } + + ncrc = (zip_uint32_t)crc32(0, NULL, 0); + nsize = 0; + + while ((n = zip_fread(zf, buf, sizeof(buf))) > 0) { + nsize += (zip_uint64_t)n; + ncrc = (zip_uint32_t)crc32(ncrc, (const Bytef *)buf, (unsigned int)n); + } + + if (n < 0) { + fprintf(stderr, "%s: %s: error reading file %s (index %" PRIu64 "): %s\n", progname, zipname, filename, idx, zip_file_strerror(zf)); + zip_fclose(zf); + return -1; + } + + zip_fclose(zf); + + if (nsize != size) { + fprintf(stderr, "%s: %s: file %s (index %" PRIu64 "): unexpected length %" PRId64 " (should be %" PRId64 ")\n", progname, zipname, filename, idx, nsize, size); + return -2; + } + if (ncrc != crc) { + fprintf(stderr, "%s: %s: file %s (index %" PRIu64 "): unexpected length %x (should be %x)\n", progname, zipname, filename, idx, ncrc, crc); + return -2; + } + + return 0; +} + + +static const char *map_enum(const enum_map_t *map, uint32_t value) { + static char unknown[16]; + size_t i = 0; + + while (map[i].value < UINT32_MAX) { + if (map[i].value == value) { + return map[i].name; + } + i++; + } + + snprintf(unknown, sizeof(unknown), "unknown (%u)", value); + unknown[sizeof(unknown) - 1] = '\0'; + + return unknown; +} diff --git a/3rdparty/libzip/src/zipmerge.c b/3rdparty/libzip/src/zipmerge.c new file mode 100644 index 0000000000000000000000000000000000000000..536132124e738a278502baa0a0d57b725464548f --- /dev/null +++ b/3rdparty/libzip/src/zipmerge.c @@ -0,0 +1,279 @@ +/* + zipmerge.c -- merge zip archives + Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <ctype.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "config.h" + +#ifndef HAVE_GETOPT +#include "getopt.h" +#endif + +#include "zip.h" + +char *progname; + +#define PROGRAM "zipmerge" + +#define USAGE "usage: %s [-DhIiSsV] target-zip zip...\n" + +char help_head[] = PROGRAM " (" PACKAGE ") by Dieter Baron and Thomas Klausner\n\n"; + +char help[] = "\n\ + -h display this help message\n\ + -V display version number\n\ + -D ignore directory component in file names\n\ + -I ignore case in file names\n\ + -i ask before overwriting files\n\ + -S don't overwrite identical files\n\ + -s overwrite identical files without asking\n\ +\n\ +Report bugs to <libzip@nih.at>.\n"; + +char version_string[] = PROGRAM " (" PACKAGE " " VERSION ")\n\ +Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner\n\ +" PACKAGE " comes with ABSOLUTELY NO WARRANTY, to the extent permitted by law.\n"; + +#define OPTIONS "hVDiIsS" + +#define CONFIRM_ALL_YES 0x001 +#define CONFIRM_ALL_NO 0x002 +#define CONFIRM_SAME_YES 0x010 +#define CONFIRM_SAME_NO 0x020 + +int confirm; +zip_flags_t name_flags; + +static int confirm_replace(zip_t *, const char *, zip_uint64_t, zip_t *, const char *, zip_uint64_t); +static zip_t *merge_zip(zip_t *, const char *, const char *); + + +int +main(int argc, char *argv[]) { + zip_t *za; + zip_t **zs; + int c, err; + unsigned int i, n; + char *tname; + + progname = argv[0]; + + confirm = CONFIRM_ALL_YES; + name_flags = 0; + + while ((c = getopt(argc, argv, OPTIONS)) != -1) { + switch (c) { + case 'D': + name_flags |= ZIP_FL_NODIR; + break; + case 'i': + confirm &= ~CONFIRM_ALL_YES; + break; + case 'I': + name_flags |= ZIP_FL_NOCASE; + break; + case 's': + confirm &= ~CONFIRM_SAME_NO; + confirm |= CONFIRM_SAME_YES; + break; + case 'S': + confirm &= ~CONFIRM_SAME_YES; + confirm |= CONFIRM_SAME_NO; + break; + + case 'h': + fputs(help_head, stdout); + printf(USAGE, progname); + fputs(help, stdout); + exit(0); + case 'V': + fputs(version_string, stdout); + exit(0); + + default: + fprintf(stderr, USAGE, progname); + exit(2); + } + } + + if (argc < optind + 2) { + fprintf(stderr, USAGE, progname); + exit(2); + } + + tname = argv[optind++]; + argv += optind; + + n = (unsigned int)(argc - optind); + if ((zs = (zip_t **)malloc(sizeof(zs[0]) * n)) == NULL) { + fprintf(stderr, "%s: out of memory\n", progname); + exit(1); + } + + if ((za = zip_open(tname, ZIP_CREATE, &err)) == NULL) { + zip_error_t error; + zip_error_init_with_code(&error, err); + fprintf(stderr, "%s: can't open zip archive '%s': %s\n", progname, tname, zip_error_strerror(&error)); + zip_error_fini(&error); + exit(1); + } + + for (i = 0; i < n; i++) { + if ((zs[i] = merge_zip(za, tname, argv[i])) == NULL) + exit(1); + } + + if (zip_close(za) < 0) { + fprintf(stderr, "%s: cannot write zip archive '%s': %s\n", progname, tname, zip_strerror(za)); + exit(1); + } + + for (i = 0; i < n; i++) + zip_close(zs[i]); + + exit(0); +} + + +static int +confirm_replace(zip_t *za, const char *tname, zip_uint64_t it, zip_t *zs, const char *sname, zip_uint64_t is) { + char line[1024]; + struct zip_stat st, ss; + + if (confirm & CONFIRM_ALL_YES) + return 1; + else if (confirm & CONFIRM_ALL_NO) + return 0; + + if (zip_stat_index(za, it, ZIP_FL_UNCHANGED, &st) < 0) { + fprintf(stderr, "%s: cannot stat file %" PRIu64 " in '%s': %s\n", progname, it, tname, zip_strerror(za)); + return -1; + } + if (zip_stat_index(zs, is, 0, &ss) < 0) { + fprintf(stderr, "%s: cannot stat file %" PRIu64 " in '%s': %s\n", progname, is, sname, zip_strerror(zs)); + return -1; + } + + if (st.size == ss.size && st.crc == ss.crc) { + if (confirm & CONFIRM_SAME_YES) + return 1; + else if (confirm & CONFIRM_SAME_NO) + return 0; + } + + printf("replace '%s' (%" PRIu64 " / %08x) in `%s'\n" + " with '%s' (%" PRIu64 " / %08x) from `%s'? ", + st.name, st.size, st.crc, tname, ss.name, ss.size, ss.crc, sname); + fflush(stdout); + + if (fgets(line, sizeof(line), stdin) == NULL) { + fprintf(stderr, "%s: read error from stdin: %s\n", progname, strerror(errno)); + return -1; + } + + if (tolower((unsigned char)line[0]) == 'y') + return 1; + + return 0; +} + + +static zip_t * +merge_zip(zip_t *za, const char *tname, const char *sname) { + zip_t *zs; + zip_source_t *source; + zip_int64_t ret, idx; + zip_uint64_t i; + int err; + const char *fname; + + if ((zs = zip_open(sname, 0, &err)) == NULL) { + zip_error_t error; + zip_error_init_with_code(&error, err); + fprintf(stderr, "%s: can't open zip archive '%s': %s\n", progname, sname, zip_error_strerror(&error)); + zip_error_fini(&error); + return NULL; + } + + ret = zip_get_num_entries(zs, 0); + if (ret < 0) { + fprintf(stderr, "%s: cannot get number of entries for '%s': %s\n", progname, sname, zip_strerror(za)); + return NULL; + } + for (i = 0; i < (zip_uint64_t)ret; i++) { + fname = zip_get_name(zs, i, 0); + + if ((idx = zip_name_locate(za, fname, name_flags)) >= 0) { + switch (confirm_replace(za, tname, (zip_uint64_t)idx, zs, sname, i)) { + case 0: + break; + + case 1: + if ((source = zip_source_zip(za, zs, i, 0, 0, 0)) == NULL || zip_replace(za, (zip_uint64_t)idx, source) < 0) { + zip_source_free(source); + fprintf(stderr, "%s: cannot replace '%s' in `%s': %s\n", progname, fname, tname, zip_strerror(za)); + zip_close(zs); + return NULL; + } + break; + + case -1: + zip_close(zs); + return NULL; + + default: + fprintf(stderr, + "%s: internal error: " + "unexpected return code from confirm (%d)\n", + progname, err); + zip_close(zs); + return NULL; + } + } + else { + if ((source = zip_source_zip(za, zs, i, 0, 0, 0)) == NULL || zip_add(za, fname, source) < 0) { + zip_source_free(source); + fprintf(stderr, "%s: cannot add '%s' to `%s': %s\n", progname, fname, tname, zip_strerror(za)); + zip_close(zs); + return NULL; + } + } + } + + return zs; +} diff --git a/3rdparty/libzip/src/ziptool.c b/3rdparty/libzip/src/ziptool.c new file mode 100644 index 0000000000000000000000000000000000000000..149381babedb0fca75c9eee88ecc779d1040777f --- /dev/null +++ b/3rdparty/libzip/src/ziptool.c @@ -0,0 +1,974 @@ +/* + ziptool.c -- tool for modifying zip archive in multiple ways + 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 <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (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 <errno.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#ifdef _WIN32 +/* WIN32 needs <fcntl.h> for _O_BINARY */ +#include <fcntl.h> +#ifndef STDIN_FILENO +#define STDIN_FILENO _fileno(stdin) +#endif +#endif + +#ifndef HAVE_GETOPT +#include "getopt.h" +#endif +extern int optopt; + +#include "zip.h" + +#include "compat.h" + +typedef struct dispatch_table_s { + const char *cmdline_name; + int argument_count; + const char *arg_names; + const char *description; + int (*function)(int argc, char *argv[]); +} dispatch_table_t; + +static zip_flags_t get_flags(const char *arg); +static zip_int32_t get_compression_method(const char *arg); +static zip_uint16_t get_encryption_method(const char *arg); +static void hexdump(const zip_uint8_t *data, zip_uint16_t len); +int ziptool_post_close(const char *archive); + +#ifndef FOR_REGRESS +#define OPTIONS_REGRESS "" +#define USAGE_REGRESS "" +#endif + +zip_t *za, *z_in[16]; +unsigned int z_in_count; +zip_flags_t stat_flags; + +static int +add(int argc, char *argv[]) { + zip_source_t *zs; + + if ((zs = zip_source_buffer(za, argv[1], strlen(argv[1]), 0)) == NULL) { + fprintf(stderr, "can't create zip_source from buffer: %s\n", zip_strerror(za)); + return -1; + } + + if (zip_add(za, argv[0], zs) == -1) { + zip_source_free(zs); + fprintf(stderr, "can't add file '%s': %s\n", argv[0], zip_strerror(za)); + return -1; + } + return 0; +} + +static int +add_dir(int argc, char *argv[]) { + /* add directory */ + if (zip_add_dir(za, argv[0]) < 0) { + fprintf(stderr, "can't add directory '%s': %s\n", argv[0], zip_strerror(za)); + return -1; + } + return 0; +} + +static int +add_file(int argc, char *argv[]) { + zip_source_t *zs; + zip_uint64_t start = strtoull(argv[2], NULL, 10); + zip_int64_t len = strtoll(argv[3], NULL, 10); + + if (strcmp(argv[1], "/dev/stdin") == 0) { + if ((zs = zip_source_filep(za, stdin, start, len)) == NULL) { + fprintf(stderr, "can't create zip_source from stdin: %s\n", zip_strerror(za)); + return -1; + } + } + else { + if ((zs = zip_source_file(za, argv[1], start, len)) == NULL) { + fprintf(stderr, "can't create zip_source from file: %s\n", zip_strerror(za)); + return -1; + } + } + + if (zip_add(za, argv[0], zs) == -1) { + zip_source_free(zs); + fprintf(stderr, "can't add file '%s': %s\n", argv[0], zip_strerror(za)); + return -1; + } + return 0; +} + +static int +add_from_zip(int argc, char *argv[]) { + zip_uint64_t idx, start; + zip_int64_t len; + int err; + zip_source_t *zs; + /* add from another zip file */ + idx = strtoull(argv[2], NULL, 10); + start = strtoull(argv[3], NULL, 10); + len = strtoll(argv[4], NULL, 10); + if ((z_in[z_in_count] = zip_open(argv[1], ZIP_CHECKCONS, &err)) == NULL) { + zip_error_t error; + zip_error_init_with_code(&error, err); + fprintf(stderr, "can't open zip archive '%s': %s\n", argv[1], zip_error_strerror(&error)); + zip_error_fini(&error); + return -1; + } + if ((zs = zip_source_zip(za, z_in[z_in_count], idx, 0, start, len)) == NULL) { + fprintf(stderr, "error creating file source from '%s' index '%" PRIu64 "': %s\n", argv[1], idx, zip_strerror(za)); + zip_close(z_in[z_in_count]); + return -1; + } + if (zip_add(za, argv[0], zs) == -1) { + fprintf(stderr, "can't add file '%s': %s\n", argv[0], zip_strerror(za)); + zip_source_free(zs); + zip_close(z_in[z_in_count]); + return -1; + } + z_in_count++; + return 0; +} + +static int +cat(int argc, char *argv[]) { + /* output file contents to stdout */ + zip_uint64_t idx; + zip_int64_t n; + zip_file_t *zf; + char buf[8192]; + int err; + idx = strtoull(argv[0], NULL, 10); + +#ifdef _WIN32 + /* Need to set stdout to binary mode for Windows */ + setmode(fileno(stdout), _O_BINARY); +#endif + if ((zf = zip_fopen_index(za, idx, 0)) == NULL) { + fprintf(stderr, "can't open file at index '%" PRIu64 "': %s\n", idx, zip_strerror(za)); + return -1; + } + while ((n = zip_fread(zf, buf, sizeof(buf))) > 0) { + if (fwrite(buf, (size_t)n, 1, stdout) != 1) { + zip_fclose(zf); + fprintf(stderr, "can't write file contents to stdout: %s\n", strerror(errno)); + return -1; + } + } + if (n == -1) { + fprintf(stderr, "can't read file at index '%" PRIu64 "': %s\n", idx, zip_file_strerror(zf)); + zip_fclose(zf); + return -1; + } + if ((err = zip_fclose(zf)) != 0) { + zip_error_t error; + + zip_error_init_with_code(&error, err); + fprintf(stderr, "can't close file at index '%" PRIu64 "': %s\n", idx, zip_error_strerror(&error)); + return -1; + } + + return 0; +} + +static int +count_extra(int argc, char *argv[]) { + zip_int16_t count; + zip_uint64_t idx; + zip_flags_t ceflags = 0; + idx = strtoull(argv[0], NULL, 10); + ceflags = get_flags(argv[1]); + if ((count = zip_file_extra_fields_count(za, idx, ceflags)) < 0) { + fprintf(stderr, "can't get extra field count for file at index '%" PRIu64 "': %s\n", idx, zip_strerror(za)); + return -1; + } + else { + printf("Extra field count: %d\n", count); + } + return 0; +} + +static int +count_extra_by_id(int argc, char *argv[]) { + zip_int16_t count; + zip_uint16_t eid; + zip_flags_t ceflags = 0; + zip_uint64_t idx; + idx = strtoull(argv[0], NULL, 10); + eid = (zip_uint16_t)strtoull(argv[1], NULL, 10); + ceflags = get_flags(argv[2]); + if ((count = zip_file_extra_fields_count_by_id(za, idx, eid, ceflags)) < 0) { + fprintf(stderr, "can't get extra field count for file at index '%" PRIu64 "' and for id '%d': %s\n", idx, eid, zip_strerror(za)); + return -1; + } + else { + printf("Extra field count: %d\n", count); + } + return 0; +} + +static int delete (int argc, char *argv[]) { + zip_uint64_t idx; + idx = strtoull(argv[0], NULL, 10); + if (zip_delete(za, idx) < 0) { + fprintf(stderr, "can't delete file at index '%" PRIu64 "': %s\n", idx, zip_strerror(za)); + return -1; + } + return 0; +} + +static int +delete_extra(int argc, char *argv[]) { + zip_flags_t geflags; + zip_uint16_t eid; + zip_uint64_t idx; + idx = strtoull(argv[0], NULL, 10); + eid = (zip_uint16_t)strtoull(argv[1], NULL, 10); + geflags = get_flags(argv[2]); + if ((zip_file_extra_field_delete(za, idx, eid, geflags)) < 0) { + fprintf(stderr, "can't delete extra field data for file at index '%" PRIu64 "', extra field id '%d': %s\n", idx, eid, zip_strerror(za)); + return -1; + } + return 0; +} + +static int +delete_extra_by_id(int argc, char *argv[]) { + zip_flags_t geflags; + zip_uint16_t eid, eidx; + zip_uint64_t idx; + idx = strtoull(argv[0], NULL, 10); + eid = (zip_uint16_t)strtoull(argv[1], NULL, 10); + eidx = (zip_uint16_t)strtoull(argv[2], NULL, 10); + geflags = get_flags(argv[3]); + if ((zip_file_extra_field_delete_by_id(za, idx, eid, eidx, geflags)) < 0) { + fprintf(stderr, "can't delete extra field data for file at index '%" PRIu64 "', extra field id '%d', extra field idx '%d': %s\n", idx, eid, eidx, zip_strerror(za)); + return -1; + } + return 0; +} + +static int +get_archive_comment(int argc, char *argv[]) { + const char *comment; + int len; + /* get archive comment */ + if ((comment = zip_get_archive_comment(za, &len, 0)) == NULL) + printf("No archive comment\n"); + else + printf("Archive comment: %.*s\n", len, comment); + return 0; +} + +static int +get_extra(int argc, char *argv[]) { + zip_flags_t geflags; + zip_uint16_t id, eidx, eflen; + const zip_uint8_t *efdata; + zip_uint64_t idx; + /* get extra field data */ + idx = strtoull(argv[0], NULL, 10); + eidx = (zip_uint16_t)strtoull(argv[1], NULL, 10); + geflags = get_flags(argv[2]); + if ((efdata = zip_file_extra_field_get(za, idx, eidx, &id, &eflen, geflags)) == NULL) { + fprintf(stderr, "can't get extra field data for file at index %" PRIu64 ", extra field %d, flags %u: %s\n", idx, eidx, geflags, zip_strerror(za)); + return -1; + } + printf("Extra field 0x%04x: len %d", id, eflen); + if (eflen > 0) { + printf(", data "); + hexdump(efdata, eflen); + } + printf("\n"); + return 0; +} + +static int +get_extra_by_id(int argc, char *argv[]) { + zip_flags_t geflags; + zip_uint16_t eid, eidx, eflen; + const zip_uint8_t *efdata; + zip_uint64_t idx; + idx = strtoull(argv[0], NULL, 10); + eid = (zip_uint16_t)strtoull(argv[1], NULL, 10); + eidx = (zip_uint16_t)strtoull(argv[2], NULL, 10); + geflags = get_flags(argv[3]); + if ((efdata = zip_file_extra_field_get_by_id(za, idx, eid, eidx, &eflen, geflags)) == NULL) { + fprintf(stderr, "can't get extra field data for file at index %" PRIu64 ", extra field id %d, ef index %d, flags %u: %s\n", idx, eid, eidx, geflags, zip_strerror(za)); + return -1; + } + printf("Extra field 0x%04x: len %d", eid, eflen); + if (eflen > 0) { + printf(", data "); + hexdump(efdata, eflen); + } + printf("\n"); + return 0; +} + +static int +get_file_comment(int argc, char *argv[]) { + const char *comment; + int len; + zip_uint64_t idx; + /* get file comment */ + idx = strtoull(argv[0], NULL, 10); + if ((comment = zip_get_file_comment(za, idx, &len, 0)) == NULL) { + fprintf(stderr, "can't get comment for '%s': %s\n", zip_get_name(za, idx, 0), zip_strerror(za)); + return -1; + } + else if (len == 0) + printf("No comment for '%s'\n", zip_get_name(za, idx, 0)); + else + printf("File comment for '%s': %.*s\n", zip_get_name(za, idx, 0), len, comment); + return 0; +} + +static int +get_num_entries(int argc, char *argv[]) { + zip_int64_t count; + zip_flags_t flags; + /* get number of entries in archive */ + flags = get_flags(argv[0]); + count = zip_get_num_entries(za, flags); + printf("%" PRId64 " entr%s in archive\n", count, count == 1 ? "y" : "ies"); + return 0; +} + +static int +name_locate(int argc, char *argv[]) { + zip_flags_t flags; + zip_int64_t idx; + flags = get_flags(argv[1]); + + if ((idx = zip_name_locate(za, argv[0], flags)) < 0) { + fprintf(stderr, "can't find entry with name '%s' using flags '%s'\n", argv[0], argv[1]); + } + else { + printf("name '%s' using flags '%s' found at index %" PRId64 "\n", argv[0], argv[1], idx); + } + + return 0; +} + +struct progress_userdata_s { + double percentage; + double limit; +}; + +struct progress_userdata_s progress_userdata; + +static void +progress_callback(zip_t *archive, double percentage, void *ud) { + printf("%.1f%% done\n", percentage * 100); + progress_userdata.percentage = percentage; +} + +static int +print_progress(int argc, char *argv[]) { + zip_register_progress_callback_with_state(za, 0.001, progress_callback, NULL, NULL); + return 0; +} + +static int +zrename(int argc, char *argv[]) { + zip_uint64_t idx; + idx = strtoull(argv[0], NULL, 10); + if (zip_rename(za, idx, argv[1]) < 0) { + fprintf(stderr, "can't rename file at index '%" PRIu64 "' to '%s': %s\n", idx, argv[1], zip_strerror(za)); + return -1; + } + return 0; +} + +static int +replace_file_contents(int argc, char *argv[]) { + /* replace file contents with data from command line */ + const char *content; + zip_source_t *s; + zip_uint64_t idx; + idx = strtoull(argv[0], NULL, 10); + content = argv[1]; + if ((s = zip_source_buffer(za, content, strlen(content), 0)) == NULL || zip_file_replace(za, idx, s, 0) < 0) { + zip_source_free(s); + fprintf(stderr, "error replacing file data: %s\n", zip_strerror(za)); + return -1; + } + return 0; +} + +static int +set_extra(int argc, char *argv[]) { + zip_flags_t geflags; + zip_uint16_t eid, eidx; + const zip_uint8_t *efdata; + zip_uint64_t idx; + idx = strtoull(argv[0], NULL, 10); + eid = (zip_uint16_t)strtoull(argv[1], NULL, 10); + eidx = (zip_uint16_t)strtoull(argv[2], NULL, 10); + geflags = get_flags(argv[3]); + efdata = (zip_uint8_t *)argv[4]; + if ((zip_file_extra_field_set(za, idx, eid, eidx, efdata, (zip_uint16_t)strlen((const char *)efdata), geflags)) < 0) { + fprintf(stderr, "can't set extra field data for file at index '%" PRIu64 "', extra field id '%d', index '%d': %s\n", idx, eid, eidx, zip_strerror(za)); + return -1; + } + return 0; +} + +static int +set_archive_comment(int argc, char *argv[]) { + if (zip_set_archive_comment(za, argv[0], (zip_uint16_t)strlen(argv[0])) < 0) { + fprintf(stderr, "can't set archive comment to '%s': %s\n", argv[0], zip_strerror(za)); + return -1; + } + return 0; +} + +static int +set_file_comment(int argc, char *argv[]) { + zip_uint64_t idx; + idx = strtoull(argv[0], NULL, 10); + if (zip_file_set_comment(za, idx, argv[1], (zip_uint16_t)strlen(argv[1]), 0) < 0) { + fprintf(stderr, "can't set file comment at index '%" PRIu64 "' to '%s': %s\n", idx, argv[1], zip_strerror(za)); + return -1; + } + return 0; +} + +static int +set_file_compression(int argc, char *argv[]) { + zip_int32_t method; + zip_uint32_t flags; + zip_uint64_t idx; + idx = strtoull(argv[0], NULL, 10); + method = get_compression_method(argv[1]); + flags = (zip_uint32_t)strtoull(argv[2], NULL, 10); + if (zip_set_file_compression(za, idx, method, flags) < 0) { + fprintf(stderr, "can't set file compression method at index '%" PRIu64 "' to '%s', flags '%" PRIu32 "': %s\n", idx, argv[1], flags, zip_strerror(za)); + return -1; + } + return 0; +} + +static int +set_file_encryption(int argc, char *argv[]) { + zip_uint16_t method; + zip_uint64_t idx; + char *password; + idx = strtoull(argv[0], NULL, 10); + method = get_encryption_method(argv[1]); + password = argv[2]; + if (strlen(password) == 0) { + password = NULL; + } + if (zip_file_set_encryption(za, idx, method, password) < 0) { + fprintf(stderr, "can't set file encryption method at index '%" PRIu64 "' to '%s': %s\n", idx, argv[1], zip_strerror(za)); + return -1; + } + return 0; +} + +static int +set_file_dostime(int argc, char *argv[]) { + /* set file last modification time (mtime) directly */ + zip_uint16_t dostime, dosdate; + zip_uint64_t idx; + idx = strtoull(argv[0], NULL, 10); + dostime = (zip_uint16_t)strtoull(argv[1], NULL, 10); + dosdate = (zip_uint16_t)strtoull(argv[2], NULL, 10); + if (zip_file_set_dostime(za, idx, dostime, dosdate, 0) < 0) { + fprintf(stderr, "can't set file dostime at index '%" PRIu64 "' to '%d'/'%d': %s\n", idx, (int)dostime, (int)dosdate, zip_strerror(za)); + return -1; + } + return 0; +} + +static int +set_file_mtime(int argc, char *argv[]) { + /* set file last modification time (mtime) */ + time_t mtime; + zip_uint64_t idx; + idx = strtoull(argv[0], NULL, 10); + mtime = (time_t)strtoull(argv[1], NULL, 10); + if (zip_file_set_mtime(za, idx, mtime, 0) < 0) { + fprintf(stderr, "can't set file mtime at index '%" PRIu64 "' to '%lld': %s\n", idx, (long long)mtime, zip_strerror(za)); + return -1; + } + return 0; +} + +static int +set_file_mtime_all(int argc, char *argv[]) { + /* set last modification time (mtime) for all files */ + time_t mtime; + zip_int64_t num_entries; + zip_uint64_t idx; + mtime = (time_t)strtoull(argv[0], NULL, 10); + + if ((num_entries = zip_get_num_entries(za, 0)) < 0) { + fprintf(stderr, "can't get number of entries: %s\n", zip_strerror(za)); + return -1; + } + for (idx = 0; idx < (zip_uint64_t)num_entries; idx++) { + if (zip_file_set_mtime(za, idx, mtime, 0) < 0) { + fprintf(stderr, "can't set file mtime at index '%" PRIu64 "' to '%lld': %s\n", idx, (long long)mtime, zip_strerror(za)); + return -1; + } + } + return 0; +} + +static int +set_password(int argc, char *argv[]) { + /* set default password */ + if (zip_set_default_password(za, argv[0]) < 0) { + fprintf(stderr, "can't set default password to '%s'\n", argv[0]); + return -1; + } + return 0; +} + +static int +zstat(int argc, char *argv[]) { + zip_uint64_t idx; + char buf[100]; + struct zip_stat sb; + idx = strtoull(argv[0], NULL, 10); + + if (zip_stat_index(za, idx, stat_flags, &sb) < 0) { + fprintf(stderr, "zip_stat_index failed on '%" PRIu64 "' failed: %s\n", idx, zip_strerror(za)); + return -1; + } + + if (sb.valid & ZIP_STAT_NAME) + printf("name: '%s'\n", sb.name); + if (sb.valid & ZIP_STAT_INDEX) + printf("index: '%" PRIu64 "'\n", sb.index); + if (sb.valid & ZIP_STAT_SIZE) + printf("size: '%" PRIu64 "'\n", sb.size); + if (sb.valid & ZIP_STAT_COMP_SIZE) + printf("compressed size: '%" PRIu64 "'\n", sb.comp_size); + if (sb.valid & ZIP_STAT_MTIME) { + struct tm *tpm; +#ifdef HAVE_LOCALTIME_R + struct tm tm; + tpm = localtime_r(&sb.mtime, &tm); +#else + tpm = localtime(&sb.mtime); +#endif + if (tpm == NULL) { + printf("mtime: <not valid>\n"); + } + else { + strftime(buf, sizeof(buf), "%a %b %d %Y %H:%M:%S", tpm); + printf("mtime: '%s'\n", buf); + } + } + if (sb.valid & ZIP_STAT_CRC) + printf("crc: '%0x'\n", sb.crc); + if (sb.valid & ZIP_STAT_COMP_METHOD) + printf("compression method: '%d'\n", sb.comp_method); + if (sb.valid & ZIP_STAT_ENCRYPTION_METHOD) + printf("encryption method: '%d'\n", sb.encryption_method); + if (sb.valid & ZIP_STAT_FLAGS) + printf("flags: '%ld'\n", (long)sb.flags); + printf("\n"); + + return 0; +} + +static zip_flags_t +get_flags(const char *arg) { + zip_flags_t flags = 0; + if (strchr(arg, 'C') != NULL) + flags |= ZIP_FL_NOCASE; + if (strchr(arg, 'c') != NULL) + flags |= ZIP_FL_CENTRAL; + if (strchr(arg, 'd') != NULL) + flags |= ZIP_FL_NODIR; + if (strchr(arg, 'l') != NULL) + flags |= ZIP_FL_LOCAL; + if (strchr(arg, 'u') != NULL) + flags |= ZIP_FL_UNCHANGED; + return flags; +} + +static zip_int32_t +get_compression_method(const char *arg) { + if (strcasecmp(arg, "default") == 0) + return ZIP_CM_DEFAULT; + else if (strcasecmp(arg, "store") == 0) + return ZIP_CM_STORE; + else if (strcasecmp(arg, "deflate") == 0) + return ZIP_CM_DEFLATE; +#if defined(HAVE_LIBBZ2) + else if (strcasecmp(arg, "bzip2") == 0) + return ZIP_CM_BZIP2; +#endif +#if defined(HAVE_LIBLZMA) + /* Disabled - because 7z isn't able to unpack ZIP+LZMA ZIP+LZMA2 + archives made this way - and vice versa. + + else if (strcasecmp(arg, "lzma2") == 0) + return ZIP_CM_LZMA2; + */ + else if (strcasecmp(arg, "lzma") == 0) + return ZIP_CM_LZMA; + else if (strcasecmp(arg, "xz") == 0) + return ZIP_CM_XZ; +#endif +#if defined(HAVE_LIBZSTD) + else if (strcasecmp(arg, "zstd") == 0) + return ZIP_CM_ZSTD; + +#endif + else if (strcasecmp(arg, "unknown") == 0) + return 100; + return 0; /* TODO: error handling */ +} + +static zip_uint16_t +get_encryption_method(const char *arg) { + if (strcasecmp(arg, "none") == 0) + return ZIP_EM_NONE; + else if (strcasecmp(arg, "PKWARE") == 0) + return ZIP_EM_TRAD_PKWARE; + else if (strcasecmp(arg, "AES-128") == 0) + return ZIP_EM_AES_128; + else if (strcasecmp(arg, "AES-192") == 0) + return ZIP_EM_AES_192; + else if (strcasecmp(arg, "AES-256") == 0) + return ZIP_EM_AES_256; + else if (strcasecmp(arg, "unknown") == 0) + return 100; + return (zip_uint16_t)-1; /* TODO: error handling */ +} + +static void +hexdump(const zip_uint8_t *data, zip_uint16_t len) { + zip_uint16_t i; + + if (len <= 0) + return; + + printf("0x"); + + for (i = 0; i < len; i++) + printf("%02x", data[i]); + + return; +} + + +static zip_t * +read_from_file(const char *archive, int flags, zip_error_t *error, zip_uint64_t offset, zip_uint64_t length) { + zip_t *zaa; + zip_source_t *source; + int err; + + if (offset == 0 && length == 0) { + if (strcmp(archive, "/dev/stdin") == 0) { + zaa = zip_fdopen(STDIN_FILENO, flags & ~ZIP_CREATE, &err); + } + else { + zaa = zip_open(archive, flags, &err); + } + if (zaa == NULL) { + zip_error_set(error, err, errno); + return NULL; + } + } + else { + if (length > ZIP_INT64_MAX) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + if ((source = zip_source_file_create(archive, offset, (zip_int64_t)length, error)) == NULL || (zaa = zip_open_from_source(source, flags, error)) == NULL) { + zip_source_free(source); + return NULL; + } + } + + return zaa; +} + +dispatch_table_t dispatch_table[] = {{"add", 2, "name content", "add file called name using content", add}, + {"add_dir", 1, "name", "add directory", add_dir}, + {"add_file", 4, "name file_to_add offset len", "add file to archive, len bytes starting from offset", add_file}, + {"add_from_zip", 5, "name archivename index offset len", "add file from another archive, len bytes starting from offset", add_from_zip}, + {"cat", 1, "index", "output file contents to stdout", cat}, + {"count_extra", 2, "index flags", "show number of extra fields for archive entry", count_extra}, + {"count_extra_by_id", 3, "index extra_id flags", "show number of extra fields of type extra_id for archive entry", count_extra_by_id}, + {"delete", 1, "index", "remove entry", delete}, + {"delete_extra", 3, "index extra_idx flags", "remove extra field", delete_extra}, + {"delete_extra_by_id", 4, "index extra_id extra_index flags", "remove extra field of type extra_id", delete_extra_by_id}, + {"get_archive_comment", 0, "", "show archive comment", get_archive_comment}, + {"get_extra", 3, "index extra_index flags", "show extra field", get_extra}, + {"get_extra_by_id", 4, "index extra_id extra_index flags", "show extra field of type extra_id", get_extra_by_id}, + {"get_file_comment", 1, "index", "get file comment", get_file_comment}, + {"get_num_entries", 1, "flags", "get number of entries in archive", get_num_entries}, + {"name_locate", 2, "name flags", "find entry in archive", name_locate}, + {"print_progress", 0, "", "print progress during zip_close()", print_progress}, + {"rename", 2, "index name", "rename entry", zrename}, + {"replace_file_contents", 2, "index data", "replace entry with data", replace_file_contents}, + {"set_archive_comment", 1, "comment", "set archive comment", set_archive_comment}, + {"set_extra", 5, "index extra_id extra_index flags value", "set extra field", set_extra}, + {"set_file_comment", 2, "index comment", "set file comment", set_file_comment}, + {"set_file_compression", 3, "index method compression_flags", "set file compression method", set_file_compression}, + {"set_file_dostime", 3, "index time date", "set file modification time and date (DOS format)", set_file_dostime}, + {"set_file_encryption", 3, "index method password", "set file encryption method", set_file_encryption}, + {"set_file_mtime", 2, "index timestamp", "set file modification time", set_file_mtime}, + {"set_file_mtime_all", 1, "timestamp", "set file modification time for all files", set_file_mtime_all}, + {"set_password", 1, "password", "set default password for encryption", set_password}, + {"stat", 1, "index", "print information about entry", zstat} +#ifdef DISPATCH_REGRESS + , + DISPATCH_REGRESS +#endif +}; + +static int +dispatch(int argc, char *argv[]) { + unsigned int i; + for (i = 0; i < sizeof(dispatch_table) / sizeof(dispatch_table_t); i++) { + if (strcmp(dispatch_table[i].cmdline_name, argv[0]) == 0) { + argc--; + argv++; + /* 1 for the command, argument_count for the arguments */ + if (argc < dispatch_table[i].argument_count) { + fprintf(stderr, "not enough arguments for command '%s': %d available, %d needed\n", dispatch_table[i].cmdline_name, argc, dispatch_table[i].argument_count); + return -1; + } + if (dispatch_table[i].function(argc, argv) == 0) + return 1 + dispatch_table[i].argument_count; + return -1; + } + } + + fprintf(stderr, "unknown command '%s'\n", argv[0]); + return -1; +} + + +static void +usage(const char *progname, const char *reason) { + unsigned int i; + FILE *out; + if (reason == NULL) + out = stdout; + else + out = stderr; + fprintf(out, "usage: %s [-ceghnrst]" USAGE_REGRESS " [-l len] [-o offset] archive command1 [args] [command2 [args] ...]\n", progname); + if (reason != NULL) { + fprintf(out, "%s\n", reason); + exit(1); + } + + fprintf(out, "\nSupported options are:\n" + "\t-c\t\tcheck consistency\n" + "\t-e\t\terror if archive already exists (only useful with -n)\n" +#ifdef FOR_REGRESS + "\t-F size\t\tfragment size for in memory archive\n" +#endif + "\t-g\t\tguess file name encoding (for stat)\n" +#ifdef FOR_REGRESS + "\t-H\t\twrite files with holes compactly\n" +#endif + "\t-h\t\tdisplay this usage\n" + "\t-l len\t\tonly use len bytes of file\n" +#ifdef FOR_REGRESS + "\t-m\t\tread archive into memory, and modify there; write out at end\n" +#endif + "\t-n\t\tcreate archive if it doesn't exist\n" + "\t-o offset\tstart reading file at offset\n" + "\t-r\t\tprint raw file name encoding without translation (for stat)\n" + "\t-s\t\tfollow file name convention strictly (for stat)\n" + "\t-t\t\tdisregard current archive contents, if any\n"); + fprintf(out, "\nSupported commands and arguments are:\n"); + for (i = 0; i < sizeof(dispatch_table) / sizeof(dispatch_table_t); i++) { + fprintf(out, "\t%s %s\n\t %s\n\n", dispatch_table[i].cmdline_name, dispatch_table[i].arg_names, dispatch_table[i].description); + } + fprintf(out, "\nSupported flags are:\n" + "\t0\t(no flags)\n" + "\tC\tZIP_FL_NOCASE\n" + "\tc\tZIP_FL_CENTRAL\n" + "\td\tZIP_FL_NODIR\n" + "\tl\tZIP_FL_LOCAL\n" + "\tu\tZIP_FL_UNCHANGED\n"); + fprintf(out, "\nSupported compression methods are:\n" + "\tdefault\n"); + if (zip_compression_method_supported(ZIP_CM_BZIP2, 1)) { + fprintf(out, "\tbzip2\n"); + } + fprintf(out, "\tdeflate\n" + "\tstore\n"); + if (zip_compression_method_supported(ZIP_CM_XZ, 1)) { + fprintf(out, "\txz\n"); + } + if (zip_compression_method_supported(ZIP_CM_ZSTD, 1)) { + fprintf(out, "\tzstd\n"); + } + fprintf(out, "\nSupported encryption methods are:\n" + "\tnone\n"); + if (zip_encryption_method_supported(ZIP_EM_AES_128, 1)) { + fprintf(out, "\tAES-128\n"); + } + if (zip_encryption_method_supported(ZIP_EM_AES_192, 1)) { + fprintf(out, "\tAES-192\n"); + } + if (zip_encryption_method_supported(ZIP_EM_AES_256, 1)) { + fprintf(out, "\tAES-256\n"); + } + fprintf(out, "\tPKWARE\n"); + fprintf(out, "\nThe index is zero-based.\n"); + exit(0); +} + +#ifndef FOR_REGRESS +#define ziptool_open read_from_file +int +ziptool_post_close(const char *archive) { + return 0; +} +#endif + +int +main(int argc, char *argv[]) { + const char *archive; + unsigned int i; + int c, arg, err, flags; + const char *prg; + zip_uint64_t len = 0, offset = 0; + zip_error_t error; + + flags = 0; + prg = argv[0]; + + while ((c = getopt(argc, argv, "ceghl:no:rst" OPTIONS_REGRESS)) != -1) { + switch (c) { + case 'c': + flags |= ZIP_CHECKCONS; + break; + case 'e': + flags |= ZIP_EXCL; + break; + case 'g': + stat_flags = ZIP_FL_ENC_GUESS; + break; + case 'h': + usage(prg, NULL); + break; + case 'l': + len = strtoull(optarg, NULL, 10); + break; + case 'n': + flags |= ZIP_CREATE; + break; + case 'o': + offset = strtoull(optarg, NULL, 10); + break; + case 'r': + stat_flags = ZIP_FL_ENC_RAW; + break; + case 's': + stat_flags = ZIP_FL_ENC_STRICT; + break; + case 't': + flags |= ZIP_TRUNCATE; + break; +#ifdef GETOPT_REGRESS + GETOPT_REGRESS +#endif + + default: { + char reason[128]; + snprintf(reason, sizeof(reason), "invalid option -%c", optopt); + usage(prg, reason); + } + } + } + + if (optind >= argc - 1) + usage(prg, "too few arguments"); + + arg = optind; + + archive = argv[arg++]; + + if (flags == 0) + flags = ZIP_CREATE; + + zip_error_init(&error); + za = ziptool_open(archive, flags, &error, offset, len); + if (za == NULL) { + fprintf(stderr, "can't open zip archive '%s': %s\n", archive, zip_error_strerror(&error)); + zip_error_fini(&error); + return 1; + } + zip_error_fini(&error); + + err = 0; + while (arg < argc) { + int ret; + ret = dispatch(argc - arg, argv + arg); + if (ret > 0) { + arg += ret; + } + else { + err = 1; + break; + } + } + + if (zip_close(za) == -1) { + fprintf(stderr, "can't close zip archive '%s': %s\n", archive, zip_strerror(za)); + return 1; + } + if (ziptool_post_close(archive) < 0) { + err = 1; + } + + for (i = 0; i < z_in_count; i++) { + if (zip_close(z_in[i]) < 0) { + err = 1; + } + } + + return err; +} diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f096702e1a90c309aeba0b5f7e6a00fd316c4e5..2e71e87937b2931aeb650242eb922c6e33e70250 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,6 +92,11 @@ if (ANDROID) include_directories(cellframe-sdk/3rdparty/) endif() +if (BUILD_WITH_ZIP) + if(LINUX) + add_subdirectory(3rdparty/libzip) + endif() +endif() add_subdirectory(dap-sdk) add_subdirectory(3rdparty/monero_crypto)