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..38a54f1a44ad3e3580dab9faae1dd58bdd7aaa30
--- /dev/null
+++ b/3rdparty/libzip/CMakeLists.txt
@@ -0,0 +1,448 @@
+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)
+
+if(LINUX)
+  option(ENABLE_COMMONCRYPTO "Enable use of CommonCrypto" ON)
+endif()
+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>.
+
+[![Github Actions Build Status](https://github.com/nih-at/libzip/workflows/build/badge.svg)](https://github.com/nih-at/libzip/actions?query=workflow%3Abuild)
+[![Appveyor Build status](https://ci.appveyor.com/api/projects/status/f1bqqt9djvf22f5g?svg=true)](https://ci.appveyor.com/project/nih-at/libzip)
+[![Coverity Status](https://scan.coverity.com/projects/127/badge.svg)](https://scan.coverity.com/projects/libzip)
diff --git a/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..d9179571fcc55352c2229fa4dc3ff805742ceb80
--- /dev/null
+++ b/3rdparty/libzip/lib/compat.h
@@ -0,0 +1,196 @@
+#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
+#define SIZEOF_OFF_T == 8
+#define ZIP_OFF_MAX ZIP_INT64_MAX
+#define ZIP_OFF_MIN ZIP_INT64_MIN
+#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 ZIP_OFF_MAX
+#define ZIP_FSEEK_MIN ZIP_OFF_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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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, &amp;ze, &amp;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, &amp;ze, &amp;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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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(&amp;error, ze);
+int i = zip_error_system_type(&amp;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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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(&quot;%s&quot;, buf);
+</pre>
+</div>
+with
+<div class="Bd Pp Bd-indent">
+<pre>
+zip_error_t error;
+zip_error_init_with_code(&amp;error, ze);
+printf(&quot;%s&quot;, zip_error_strerror(&amp;error));
+zip_error_fini(&amp;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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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>
+  &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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[]=&quot;teststring&quot;;
+
+if ((s=zip_source_buffer(archive, buf, sizeof(buf), 0)) == NULL ||
+    zip_file_add(archive, name, s, ZIP_FL_ENC_UTF_8) &lt; 0) {
+    zip_source_free(s);
+    printf(&quot;error adding file: %s\n&quot;, 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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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 &lt;sys/stat.h&gt;
+
+#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 &amp; FA_RDONLY))
+      m |= S_IWUSR | S_IWGRP | S_IWOTH;
+
+   if (attr &amp; FA_DIREC)
+      m = (S_IFDIR | (m &amp; ~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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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>
+  &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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>
+  &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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 &#x201C;$MAJOR.$MINOR.$MICRO$SUFFIX&#x201D;
+  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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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>
+  &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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
+      &quot;major * 10 + minor&quot; 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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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>
+  &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &lt;<a class="In">zip.h</a>&gt;</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &gt;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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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 &gt;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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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> &#x2014;
+<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&#x00A0;0 on success,
+  and&#x00A0;&gt;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 &#x201C;This is a
+  test.\n&#x201D; where &#x201C;\n&#x201D; is replaced with a newline character:
+<div class="Bd Pp Bd-indent">
+<pre>
+ziptool testbuffer.zip add teststring.txt \&quot;This is a test.\n\&quot;
+</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>
+  &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
+  <span class="An">Thomas Klausner</span>
+  &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
+</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..68ffd2081cfc402f095310419f7720f2535ba01f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@ project(cellframe-sdk C)
 cmake_minimum_required(VERSION 3.10)
 
 set(CMAKE_C_STANDARD 11)
-set(CELLFRAME_SDK_NATIVE_VERSION "3.1-0")
+set(CELLFRAME_SDK_NATIVE_VERSION "3.2-0")
 
 add_definitions ("-DCELLFRAME_SDK_VERSION=\"${CELLFRAME_SDK_NATIVE_VERSION}\"")
 
@@ -92,6 +92,10 @@ if (ANDROID)
     include_directories(cellframe-sdk/3rdparty/)
 endif()
 
+if (BUILD_WITH_ZIP)
+    add_subdirectory(3rdparty/libzip)
+    include_directories(3rdparty/libzip/lib)
+endif()
 
 add_subdirectory(dap-sdk)
 add_subdirectory(3rdparty/monero_crypto)
diff --git a/cmake/OS_Detection.cmake b/cmake/OS_Detection.cmake
index 8148074e3a757572b7abc583b6e128ead19cec98..18dc069732fc22e8a3f604911a18994eb7b0eeb2 100644
--- a/cmake/OS_Detection.cmake
+++ b/cmake/OS_Detection.cmake
@@ -92,13 +92,13 @@ if(UNIX)
         endif()
     elseif (DARWIN)
         if(DAP_DEBUG)
-          set(_CCOPT "-L/usr/local/lib -I/usr/local/include -DDAP_DEBUG -Wall  -Wno-address-of-packed-member -Wno-unused-command-line-argument -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-unused-function -Wno-implicit-fallthrough -Wno-unused-variable -Wno-unused-parameter -g3 -ggdb -fno-eliminate-unused-debug-symbols -fno-strict-aliasing  -std=c11")
-          set(_LOPT "-L/usr/local/lib ")
+          set(_CCOPT "-L/usr/local/lib -L/opt/homebrew/lib -I/opt/homebrew/include -I/usr/local/include -DDAP_DEBUG -Wall  -Wno-address-of-packed-member -Wno-unused-command-line-argument -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-unused-function -Wno-implicit-fallthrough -Wno-unused-variable -Wno-unused-parameter -g3 -ggdb -fno-eliminate-unused-debug-symbols -fno-strict-aliasing  -std=c11")
+          set(_LOPT "-L/usr/local/lib -L/opt/homebrew/lib")
           SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
         else()
-          set(_CCOPT "-L /usr/local/lib -I/usr/local/include -Wno-address-of-packed-member -Wno-deprecated-declarations -Wno-unused-command-line-argument -Wno-unused-local-typedefs -Wno-unused-function -Wno-implicit-fallthrough -Wno-unused-variable -Wno-unused-parameter -O3 -fPIC -fno-strict-aliasing -fno-ident -ffast-math -ftree-vectorize -fno-asynchronous-unwind-tables -ffunction-sections -std=c11")
-          set(_LOPT "-L /usr/local/lib")
-          SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -L/usr/local/lib")
+          set(_CCOPT "-L/usr/local/lib -L/opt/homebrew/lib -I/opt/homebrew/include -I/usr/local/include -Wno-address-of-packed-member -Wno-deprecated-declarations -Wno-unused-command-line-argument -Wno-unused-local-typedefs -Wno-unused-function -Wno-implicit-fallthrough -Wno-unused-variable -Wno-unused-parameter -O3 -fPIC -fno-strict-aliasing -fno-ident -ffast-math -ftree-vectorize -fno-asynchronous-unwind-tables -ffunction-sections -std=c11")
+          set(_LOPT "-L/usr/local/lib -L/opt/homebrew/lib")
+          SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -L/opt/homebrew/lib -L/usr/local/lib")
         endif()
     elseif(BSD)
         if(DAP_DEBUG)
diff --git a/dap-sdk/core/CMakeLists.txt b/dap-sdk/core/CMakeLists.txt
index 5956ea55318d1c3e02efe8d27c8ecb2d06c21a83..51f267c717fc6147883b43ae33f3ecb5179fb672 100755
--- a/dap-sdk/core/CMakeLists.txt
+++ b/dap-sdk/core/CMakeLists.txt
@@ -43,27 +43,30 @@ endif()
 
 if(UNIX)
     add_subdirectory(src/unix)
+    set(CORE_LIBRARIES dap_core_unix)
     if(DARWIN)
-        target_link_libraries(${PROJECT_NAME} dap_core_unix)
+        add_subdirectory(src/darwin)
+        set(CORE_LIBRARIES ${CORE_LIBRARIES} dap_core_darwin)
     else()
-        target_link_libraries(${PROJECT_NAME} dap_core_unix rt)
+        set(CORE_LIBRARIES ${CORE_LIBRARIES} rt)
+    endif()
+    if(ANDROID)
+        add_subdirectory(src/android)
+        set(CORE_LIBRARIES ${CORE_LIBRARIES} dap_core_android)
     endif()
 endif()
 
-if(DARWIN)
-    add_subdirectory(src/darwin)
-    target_link_libraries(${PROJECT_NAME} dap_core_darwin)
+if (WIN32)
+    add_subdirectory(src/win32)
+    set(CORE_LIBRARIES dap_core_win32)
 endif()
 
-if(ANDROID)
-    add_subdirectory(src/android)
-    target_link_libraries(${PROJECT_NAME} dap_core_android rt)
+if (BUILD_WITH_ZIP)
+    set(CORE_LIBRARIES ${CORE_LIBRARIES} zip)
+    add_definitions ("-DDAP_BUILD_WITH_ZIP")
 endif()
 
-if (WIN32)
-    add_subdirectory(src/win32)
-    target_link_libraries(${PROJECT_NAME} dap_core_win32)
-endif()
+target_link_libraries(${PROJECT_NAME} ${CORE_LIBRARIES})
 
 if(BUILD_DAP_TESTS)
     enable_testing()
diff --git a/dap-sdk/core/include/dap_common.h b/dap-sdk/core/include/dap_common.h
index 52dddae63dacccfe799028125de9dd42c4e8445a..aea85d7025556ecd154f718ae5ceac428f515586 100755
--- a/dap-sdk/core/include/dap_common.h
+++ b/dap-sdk/core/include/dap_common.h
@@ -51,8 +51,6 @@
 #include <fcntl.h>
 #define pipe(pfds) _pipe(pfds, 4096, _O_BINARY)
 #define strerror_r(arg1, arg2, arg3) strerror_s(arg2, arg3, arg1)
-#define ctime_r(arg1, arg2) ctime_s(arg2, sizeof(arg2), arg1)
-//#define asctime_r(arg1, arg2) asctime_s(arg2, sizeof(arg2), arg1)
 #endif
 #ifdef __MACH__
 #include <dispatch/dispatch.h>
@@ -74,8 +72,6 @@ typedef uint8_t byte_t;
 // Extracts a size_t from a pointer
 #define DAP_POINTER_TO_SIZE(p) ((size_t) (p))
 
-#define DAP_END_OF_DAYS 4102444799
-
 #if defined(__GNUC__) ||defined (__clang__)
   #define DAP_ALIGN_PACKED  __attribute__((aligned(1),packed))
 #else
@@ -209,12 +205,12 @@ DAP_STATIC_INLINE void _dap_aligned_free( void *ptr )
 #define DAP_FORMAT_SOCKET "llu"
 #else
 #define DAP_FORMAT_SOCKET "lu"
-#endif
+#endif // _WIN64
 #define DAP_FORMAT_HANDLE "p"
 #else
 #define DAP_FORMAT_SOCKET "d"
 #define DAP_FORMAT_HANDLE "d"
-#endif
+#endif // DAP_OS_WINDOWS
 
 #ifndef LOWORD
   #define LOWORD( l ) ((uint16_t) (((uintptr_t) (l)) & 0xFFFF))
@@ -470,9 +466,6 @@ void dap_set_appname(const char * a_appname);
 
 char *dap_itoa(int i);
 
-int dap_time_to_str_rfc822(char * out, size_t out_size_max, time_t t);
-int timespec_diff(struct timespec *a_start, struct timespec *a_stop, struct timespec *a_result);
-
 int get_select_breaker(void);
 int send_select_break(void);
 int exec_with_ret(char**, const char*);
@@ -497,18 +490,6 @@ uint64_t dap_lendian_get64(const uint8_t *a_buf);
 void dap_lendian_put64(uint8_t *a_buf, uint64_t a_val);
 
 
-// crossplatform usleep
-#define DAP_USEC_PER_SEC 1000000
-void dap_usleep(time_t a_microseconds);
-
-/**
- * @brief dap_ctime_r This function does the same as ctime_r, but if it returns (null), a line break is added.
- * @param a_time
- * @param a_buf The minimum buffer size is 26 elements.
- * @return
- */
-char* dap_ctime_r(time_t *a_time, char* a_buf);
-
 static inline void * dap_mempcpy(void * a_dest,const void * a_src,size_t n)
 {
     return ((byte_t*) memcpy(a_dest,a_src,n))+n;
diff --git a/dap-sdk/core/include/dap_file_utils.h b/dap-sdk/core/include/dap_file_utils.h
index cd5ba8bfcde9d03f599ccc35111f14cd05947392..948e3e497baed8657d3aac671eb6682cbb168729 100755
--- a/dap-sdk/core/include/dap_file_utils.h
+++ b/dap-sdk/core/include/dap_file_utils.h
@@ -170,6 +170,36 @@ char* dap_canonicalize_filename(const char *filename, const char *relative_to);
  */
 char* dap_get_current_dir(void);
 
+/**
+ * rm_rf
+ *
+ * A fairly naive `rm -rf` implementation
+ */
+void dap_rm_rf(const char *path);
+
+#ifdef DAP_BUILD_WITH_ZIP
+/*
+ * Pack a directory to zip file
+ *
+ * @a_inputdir: input dir
+ * @a_output_filename: output zip file path
+ *
+ * Returns: True, if successfully
+ */
+bool dap_zip_directory(const char *a_inputdir, const char * a_output_filename);
+#endif
+
+/*
+ * Pack a directory to tar file
+ *
+ * @a_inputdir: input dir
+ * @a_output_filename: output tar file path
+ *
+ * Returns: True, if successfully
+ */
+bool dap_tar_directory(const char *a_inputdir, const char *a_output_tar_filename);
+
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/dap-sdk/core/include/dap_list.h b/dap-sdk/core/include/dap_list.h
index aa1bbf0ec4edf2a200c3a81d84f92a8134b62167..5664e6bc75766b4ad83fc144ad8a89a6879a3aa4 100755
--- a/dap-sdk/core/include/dap_list.h
+++ b/dap-sdk/core/include/dap_list.h
@@ -132,12 +132,8 @@ void* dap_list_nth_data(dap_list_t *list, unsigned int n);
 #define dap_list_previous(list)	        ((list) ? (((dap_list_t *)(list))->prev) : NULL)
 #define dap_list_next(list)	        ((list) ? (((dap_list_t *)(list))->next) : NULL)
 
-
-
-
-#endif /* __DAP_LIST_H__ */
-
-
 #ifdef __cplusplus
 }
 #endif
+
+#endif /* __DAP_LIST_H__ */
diff --git a/dap-sdk/core/include/dap_math_ops.h b/dap-sdk/core/include/dap_math_ops.h
index b495d466a42dd48289360bdbfd59379de5e26e30..7054d9d1944515b85417c36f4a56e9c2af835510 100755
--- a/dap-sdk/core/include/dap_math_ops.h
+++ b/dap-sdk/core/include/dap_math_ops.h
@@ -3,7 +3,10 @@
 #include <stdio.h>
 #include "assert.h"
 
+#ifndef __STDC_FORMAT_MACROS
 #define __STDC_FORMAT_MACROS
+#endif
+
 #include <inttypes.h>
 
 #include "dap_common.h"
@@ -434,8 +437,8 @@ static inline int ADD_128_INTO_256(uint128_t a_128_bit,uint256_t* c_256_bit) {
     int overflow_flag=0;
     uint128_t overflow_128 = uint128_0;
     uint128_t temp = uint128_0;
-    temp=c_256_bit->lo;
-    overflow_flag=SUM_128_128(a_128_bit,temp,&c_256_bit->lo);
+    overflow_flag=SUM_128_128(a_128_bit, c_256_bit->lo, &temp);
+    c_256_bit->lo = temp;
 
 #ifdef DAP_GLOBAL_IS_INT128
     overflow_128=overflow_flag;
@@ -443,31 +446,30 @@ static inline int ADD_128_INTO_256(uint128_t a_128_bit,uint256_t* c_256_bit) {
     overflow_128.lo=overflow_flag;
 #endif
 
-    temp=c_256_bit->hi;
-    overflow_flag=SUM_128_128(overflow_128,temp,&c_256_bit->hi);
+    overflow_flag=SUM_128_128(overflow_128, c_256_bit->hi, &temp);
+    c_256_bit->hi = temp;
     return overflow_flag;
 }
 
 static inline int SUM_256_256(uint256_t a_256_bit,uint256_t b_256_bit,uint256_t* c_256_bit)
 {
     int overflow_flag=0;
+    uint128_t intermediate_value = uint128_0;
 #ifdef DAP_GLOBAL_IS_INT128
     int overflow_flag_intermediate;
-    overflow_flag=SUM_128_128(a_256_bit.lo,b_256_bit.lo,&c_256_bit->lo);
+    overflow_flag=SUM_128_128(a_256_bit.lo,b_256_bit.lo,&intermediate_value);
+    c_256_bit->lo = intermediate_value;
     uint128_t carry_in_128=overflow_flag;
-    uint128_t intermediate_value=0;
     overflow_flag=0;
     overflow_flag=SUM_128_128(carry_in_128,a_256_bit.hi,&intermediate_value);
-    overflow_flag_intermediate=SUM_128_128(intermediate_value,b_256_bit.hi,&c_256_bit->hi);
+    overflow_flag_intermediate=SUM_128_128(intermediate_value,b_256_bit.hi,&intermediate_value);
+    c_256_bit->hi = intermediate_value;
     overflow_flag=overflow_flag||overflow_flag_intermediate;
 #else
     overflow_flag=SUM_128_128(a_256_bit.lo,b_256_bit.lo,&c_256_bit->lo);
     uint128_t carry_in_128;
     carry_in_128.hi=0;
     carry_in_128.lo=overflow_flag;
-    uint128_t intermediate_value;
-    intermediate_value.hi=0;
-    intermediate_value.lo=0;
     overflow_flag=0;
     overflow_flag=SUM_128_128(carry_in_128,a_256_bit.hi,&intermediate_value);
     //we store overflow_flag in case there is already overflow
diff --git a/dap-sdk/core/include/dap_time.h b/dap-sdk/core/include/dap_time.h
new file mode 100644
index 0000000000000000000000000000000000000000..d16e8b151e3f4724f9130d320f9eec30dfc4258b
--- /dev/null
+++ b/dap-sdk/core/include/dap_time.h
@@ -0,0 +1,52 @@
+#pragma once
+#include <stdint.h>
+#include <stddef.h>
+#include <time.h>
+
+#define DAP_END_OF_DAYS 4102444799
+// Constant to convert seconds to nanoseconds
+#define DAP_NSEC_PER_SEC 1000000000
+// Constant to convert seconds to microseconds
+#define DAP_USEC_PER_SEC 1000000
+
+
+// time in seconds
+typedef uint64_t dap_time_t;
+// time in nanoseconds
+typedef uint64_t dap_gdb_time_t;
+
+// Create gdb time from second
+dap_gdb_time_t dap_gdb_time_from_sec(uint32_t a_time);
+// Get seconds from gdb time
+long dap_gdb_time_to_sec(dap_gdb_time_t a_time);
+
+/**
+ * @brief dap_chain_time_now Get current time in seconds since January 1, 1970 (UTC)
+ * @return Returns current UTC time in seconds.
+ */
+dap_gdb_time_t dap_time_now(void);
+/**
+ * @brief dap_clock_gettime Get current time in nanoseconds since January 1, 1970 (UTC)
+ * @return Returns current UTC time in nanoseconds.
+ */
+dap_gdb_time_t dap_gdb_time_now(void);
+
+
+// crossplatform usleep
+void dap_usleep(dap_time_t a_microseconds);
+
+/**
+ * @brief dap_ctime_r This function does the same as ctime_r, but if it returns (null), a line break is added.
+ * @param a_time
+ * @param a_buf The minimum buffer size is 26 elements.
+ * @return
+ */
+char* dap_ctime_r(dap_time_t *a_time, char* a_buf);
+char* dap_gdb_ctime_r(dap_gdb_time_t *a_time, char* a_buf);
+
+
+int dap_time_to_str_rfc822(char * out, size_t out_size_max, dap_time_t t);
+int dap_gbd_time_to_str_rfc822(char *a_out, size_t a_out_size_max, dap_gdb_time_t a_chain_time);
+int timespec_diff(struct timespec *a_start, struct timespec *a_stop, struct timespec *a_result);
+
+
diff --git a/dap-sdk/core/libdap.pri b/dap-sdk/core/libdap.pri
index e3b46af7e822cd9c1efc41ccb6776ff96fd5176b..3b73f16fd25bebc2e83ca06bf460d8304ffefd27 100755
--- a/dap-sdk/core/libdap.pri
+++ b/dap-sdk/core/libdap.pri
@@ -68,7 +68,8 @@ HEADERS += $$PWD/include/dap_common.h \
     $$PWD/include/dap_list.h \
     $$PWD/include/dap_module.h \
     $$PWD/include/dap_strfuncs.h \
-    $$PWD/include/dap_string.h
+    $$PWD/include/dap_string.h \
+    $$PWD/include/dap_time.h
 
 SOURCES += $$PWD/src/dap_common.c \
     $$PWD/src/dap_binary_tree.c \
@@ -78,7 +79,8 @@ SOURCES += $$PWD/src/dap_common.c \
     $$PWD/src/dap_list.c \
     $$PWD/src/dap_module.c \
     $$PWD/src/dap_strfuncs.c \
-    $$PWD/src/dap_string.c
+    $$PWD/src/dap_string.c \
+    $$PWD/src/dap_time.c
 
 INCLUDEPATH += $$PWD/include \
     $$PWD/../../3rdparty/uthash/src/
diff --git a/dap-sdk/core/src/core.pri b/dap-sdk/core/src/core.pri
index 81ce43173ef2d3b5b0e8aab7941b9283041f368e..7702cd71f186e42f34d6c980028b5c9fe6b4aad5 100755
--- a/dap-sdk/core/src/core.pri
+++ b/dap-sdk/core/src/core.pri
@@ -18,7 +18,8 @@ HEADERS += $$PWD/dap_common.h \
     $$PWD/dap_list.h \
     $$PWD/dap_module.h \
     $$PWD/dap_strfuncs.h \
-    $$PWD/dap_string.h
+    $$PWD/dap_string.h \
+    $$PWD/dap_time.h
 
 SOURCES += $$PWD/dap_common.c \
     $$PWD/dap_config.c \
@@ -27,6 +28,7 @@ SOURCES += $$PWD/dap_common.c \
     $$PWD/dap_list.c \
     $$PWD/dap_module.c \
     $$PWD/dap_strfuncs.c \
-    $$PWD/dap_string.c
+    $$PWD/dap_string.c \
+    $$PWD/dap_time.c
 
 INCLUDEPATH += $$PWD
diff --git a/dap-sdk/core/src/dap_common.c b/dap-sdk/core/src/dap_common.c
index c9abcfbc4e21157db9836ba860e7d0a81d08c5d9..8b844b71fa36064a1fc563e804bc228a7ad7aa94 100755
--- a/dap-sdk/core/src/dap_common.c
+++ b/dap-sdk/core/src/dap_common.c
@@ -33,7 +33,7 @@
 #include <stdatomic.h>
 
 #include "utlist.h"
-#include <errno.h>
+//#include <errno.h>
 
 #ifdef DAP_OS_ANDROID
   #include <android/log.h>
@@ -443,7 +443,7 @@ char *dap_log_get_item(time_t a_start_time, int a_limit)
 	}
 
     DL_FOREACH_SAFE(s_log_buffer, elem, tmp) {
-		if (!tmp->str) continue;
+        if (!tmp->str[0]) continue;
 		if (a_limit <= 0) break;
 		a_limit -= s_check_and_fill_buffer_log(&s, l_tm_st, tmp->str);
 	}
@@ -498,66 +498,6 @@ char *dap_itoa(int i)
 
 #endif
 
-
-/**
- * @brief time_to_rfc822 Convert time_t to string with RFC822 formatted date and time
- * @param[out] out Output buffer
- * @param[out] out_size_mac Maximum size of output buffer
- * @param[in] t UNIX time
- * @return Length of resulting string if ok or lesser than zero if not
- */
-int dap_time_to_str_rfc822(char * out, size_t out_size_max, time_t t)
-{
-  struct tm *tmp;
-  tmp = localtime( &t );
-
-  if ( tmp == NULL ) {
-    log_it( L_ERROR, "Can't convert data from unix fromat to structured one" );
-    return -2;
-  }
-
-  int ret;
-
-  #ifndef _WIN32
-    ret = strftime( out, out_size_max, "%a, %d %b %y %T %z", tmp );
-  #else
-    ret = strftime( out, out_size_max, "%a, %d %b %y %H:%M:%S", tmp );
-  #endif
-
-  if ( !ret ) {
-    log_it( L_ERROR, "Can't print formatted time in string" );
-    return -1;
-  }
-
-  return ret;
-}
-
-/**
- * @brief Calculate diff of two struct timespec
- * @param[in] a_start - first time
- * @param[in] a_stop - second time
- * @param[out] a_result -  diff time, may be NULL
- * @return diff time in millisecond
- */
-int timespec_diff(struct timespec *a_start, struct timespec *a_stop, struct timespec *a_result)
-{
-    if(!a_start || !a_stop)
-        return 0;
-    if(!a_result) {
-        struct timespec l_time_tmp = { 0 };
-        a_result = &l_time_tmp;
-    }
-    if((a_stop->tv_nsec - a_start->tv_nsec) < 0) {
-        a_result->tv_sec = a_stop->tv_sec - a_start->tv_sec - 1;
-        a_result->tv_nsec = a_stop->tv_nsec - a_start->tv_nsec + 1000000000;
-    } else {
-        a_result->tv_sec = a_stop->tv_sec - a_start->tv_sec;
-        a_result->tv_nsec = a_stop->tv_nsec - a_start->tv_nsec;
-    }
-
-    return (a_result->tv_sec * 1000 + a_result->tv_nsec / 1000000);
-}
-
 #define BREAK_LATENCY   1
 
 static int breaker_set[2] = { -1, -1 };
@@ -1144,45 +1084,6 @@ void dap_lendian_put64(uint8_t *a_buf, uint64_t a_val)
     dap_lendian_put32(a_buf + 4, a_val >> 32);
 }
 
-/**
- * dap_usleep:
- * @a_microseconds: number of microseconds to pause
- *
- * Pauses the current thread for the given number of microseconds.
- */
-void dap_usleep(time_t a_microseconds)
-{
-#ifdef DAP_OS_WINDOWS
-    Sleep (a_microseconds / 1000);
-#else
-    struct timespec l_request, l_remaining;
-    l_request.tv_sec = a_microseconds / DAP_USEC_PER_SEC;
-    l_request.tv_nsec = 1000 * (a_microseconds % DAP_USEC_PER_SEC);
-    while(nanosleep(&l_request, &l_remaining) == -1 && errno == EINTR)
-        l_request = l_remaining;
-#endif
-}
-
-
-char* dap_ctime_r(time_t *a_time, char* a_buf){
-    char *l_fail_ret = "(null)\r\n";
-    if (!a_buf)
-        return l_fail_ret;
-    if(!a_time || *a_time > DAP_END_OF_DAYS) {
-        strcpy(a_buf, l_fail_ret);
-        return l_fail_ret;
-    }
-    struct tm l_time;
-    localtime_r(a_time, &l_time);
-    char *l_str_time = asctime_r(&l_time, a_buf);
-    if (l_str_time)
-        return  l_str_time;
-    else {
-        strcpy(a_buf, l_fail_ret);
-        return l_fail_ret;
-    }
-}
-
 int dap_is_alpha_and_(char e)
 {
     if ((e >= '0' && e <= '9')||(e >= 'a' && e <= 'z')||(e >= 'A' && e <= 'Z')||(e == '_')) return 1;
diff --git a/dap-sdk/core/src/dap_config.c b/dap-sdk/core/src/dap_config.c
index 14b3c857772dd07a7917036e206a25fa575780a0..d7b3a316d87cbf15a0a48411836f8e90d1ba8442 100755
--- a/dap-sdk/core/src/dap_config.c
+++ b/dap-sdk/core/src/dap_config.c
@@ -246,16 +246,16 @@ dap_config_t * dap_config_open(const char * a_name)
                                                     // trim token whitespace
                                                     if (isspace(token[0]))
                                                         token = token + 1;
-                                                    if (isspace(token[strlen(token) - 1])
-                                                            || token[strlen(token) - 1] == ']' /* last item in array */)
-                                                        token[strlen(token) - 1] = 0;
+                                                    char *closer = strchr(token, ']');
+                                                    if (closer) /* last item in array */
+                                                        *closer = 0;
 
                                                     l_item->data_str_array[j] = strdup(token);
 
                                                     token = strtok_r(NULL, ",",&l_tmp);
                                                     j++;
                                                 }
-
+                                                l_item->array_length = j;
                                             } else {
                                                 dap_config_item_t * l_item = DAP_NEW_Z(dap_config_item_t);
 
diff --git a/dap-sdk/core/src/dap_file_utils.c b/dap-sdk/core/src/dap_file_utils.c
index fea3cf97ac8ccdc1aa76f8bb75630e91014c7ea3..f1635cbe175203fb0bcaadf63e0fc32e89b45d18 100755
--- a/dap-sdk/core/src/dap_file_utils.c
+++ b/dap-sdk/core/src/dap_file_utils.c
@@ -31,6 +31,9 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <limits.h>
+#ifdef DAP_BUILD_WITH_ZIP
+#include <zip.h>
+#endif
 #if (OS_TARGET == OS_MACOS)
     #include <stdio.h>
 #else
@@ -1298,3 +1301,409 @@ char* dap_get_current_dir(void)
 
 #endif
 }
+
+static const char* dap_dir_read_name(DIR *dir)
+{
+#ifdef _WIN32_MSVS
+  char *utf8_name;
+  struct _wdirent *wentry;
+#else
+    struct dirent *entry;
+#endif
+
+    dap_return_val_if_fail(dir != NULL, NULL);
+
+#ifdef _WIN32_MSVS
+    while(1)
+    {
+        wentry = _wreaddir(dir->wdirp);
+        while(wentry
+                && (0 == wcscmp(wentry->d_name, L".") ||
+                        0 == wcscmp(wentry->d_name, L"..")))
+            wentry = _wreaddir(dir->wdirp);
+
+        if(wentry == NULL)
+            return NULL;
+
+        utf8_name = dap_utf16_to_utf8(wentry->d_name, -1, NULL, NULL, NULL);
+
+        if(utf8_name == NULL)
+            continue; /* Huh, impossible? Skip it anyway */
+
+        strcpy(dir->utf8_buf, utf8_name);
+        DAP_DELETE(utf8_name);
+
+        return dir->utf8_buf;
+    }
+#else
+    entry = readdir(dir);
+    while(entry
+            && (0 == strcmp(entry->d_name, ".") ||
+                    0 == strcmp(entry->d_name, "..")))
+        entry = readdir(dir);
+
+    if(entry)
+        return entry->d_name;
+    else
+        return NULL;
+#endif
+}
+
+/**
+ * rm_rf
+ *
+ * A fairly naive `rm -rf` implementation
+ */
+void dap_rm_rf(const char *path)
+{
+    DIR *dir = NULL;
+    const char *entry;
+
+    dir = opendir(path);
+    if(dir == NULL)
+    {
+        /* Assume it’s a file. Ignore failure. */
+        remove(path);
+        return;
+    }
+
+    while((entry = dap_dir_read_name(dir)) != NULL)
+    {
+        char *sub_path = dap_build_filename(path, entry, NULL);
+        dap_rm_rf(sub_path);
+        DAP_DELETE(sub_path);
+    }
+
+    closedir(dir);
+
+    rmdir(path);
+}
+
+#ifdef DAP_BUILD_WITH_ZIP
+static bool walk_directory(const char *a_startdir, const char *a_inputdir, zip_t *a_zipper)
+{
+    DIR *l_dir = opendir(a_inputdir);
+    if(l_dir == NULL)
+    {
+        log_it(L_ERROR, "Failed to open input directory ");
+        zip_close(a_zipper);
+        return false;
+    }
+
+    struct dirent *l_dirp;
+    while((l_dirp = readdir(l_dir)) != NULL) {
+        if(strcmp(l_dirp->d_name, ".") && strcmp(l_dirp->d_name, "..")) {
+            char *l_fullname = dap_build_filename(a_inputdir, l_dirp->d_name, NULL);
+            if(dap_dir_test(l_fullname)) {
+
+                if(zip_dir_add(a_zipper, l_fullname + dap_strlen(a_startdir) + 1, ZIP_FL_ENC_UTF_8) < 0) {
+                    log_it(L_ERROR, "Failed to add directory to zip: %s", zip_strerror(a_zipper));
+                    DAP_DELETE(l_fullname);
+                    closedir(l_dir);
+                    return false;
+                }
+                walk_directory(a_startdir, l_fullname, a_zipper);
+            } else {
+                zip_source_t *l_source = zip_source_file(a_zipper, l_fullname, 0, 0);
+                if(l_source == NULL) {
+                    log_it(L_ERROR, "Failed to add file to zip: %s", zip_strerror(a_zipper));
+                    closedir(l_dir);
+                    DAP_DELETE(l_fullname);
+                    return false;
+                }
+                if(zip_file_add(a_zipper, l_fullname + dap_strlen(a_startdir) + 1, l_source, ZIP_FL_ENC_UTF_8) < 0) {
+                    zip_source_free(l_source);
+                    log_it(L_ERROR, "Failed to add file to zip: %s", zip_strerror(a_zipper));
+                    DAP_DELETE(l_fullname);
+                    closedir(l_dir);
+                    return false;
+                }
+            }
+            DAP_DELETE(l_fullname);
+        }
+    }
+    closedir(l_dir);
+    return true;
+}
+
+/*
+ * Pack a directory to zip file
+ *
+ * @a_inputdir: input dir
+ * @a_output_filename: output zip file path
+ *
+ * Returns: True, if successfully
+ */
+bool dap_zip_directory(const char *a_inputdir, const char *a_output_filename)
+{
+    int l_errorp;
+    zip_t *l_zipper = zip_open(a_output_filename, ZIP_CREATE | ZIP_EXCL, &l_errorp);
+    if(l_zipper == NULL) {
+        zip_error_t l_ziperror;
+        zip_error_init_with_code(&l_ziperror, l_errorp);
+        if(l_errorp == ZIP_ER_EXISTS) {
+            if(!remove(a_output_filename))
+                return dap_zip_directory(a_inputdir, a_output_filename);
+        }
+        log_it(L_ERROR, "Failed to open output file %s: %s ", a_output_filename, zip_error_strerror(&l_ziperror));
+        return false;
+    }
+
+    bool l_ret = walk_directory(a_inputdir, a_inputdir, l_zipper);
+
+    zip_close(l_zipper);
+    return l_ret;
+}
+#endif
+
+
+// For TAR
+/* values used in typeflag field */
+#define REGTYPE  '0'            /* regular file */
+#define AREGTYPE '\0'           /* regular file */
+#define LNKTYPE  '1'            /* link */
+#define SYMTYPE  '2'            /* reserved */
+#define CHRTYPE  '3'            /* character special */
+#define BLKTYPE  '4'            /* block special */
+#define DIRTYPE  '5'            /* directory */
+#define FIFOTYPE '6'            /* FIFO special */
+#define CONTTYPE '7'            /* reserved */
+
+#define BLOCKSIZE 512
+/* The checksum field is filled with this while the checksum is computed.  */
+#define CHKBLANKS   "        "  /* 8 blanks, no null */
+
+struct tar_header
+{ /* byte offset */
+    char name[100]; /*   0 */
+    char mode[8]; /* 100 */
+    char uid[8]; /* 108 */
+    char gid[8]; /* 116 */
+    char size[12]; /* 124 */
+    char mtime[12]; /* 136 */
+    char chksum[8]; /* 148 */
+    char typeflag; /* 156 */
+    char linkname[100]; /* 157 */
+    char magic[6]; /* 257 */
+    char version[2]; /* 263 */
+    char uname[32]; /* 265 */
+    char gname[32]; /* 297 */
+    char devmajor[8]; /* 329 */
+    char devminor[8]; /* 337 */
+    char prefix[155]; /* 345 */
+/* 500 */
+};
+
+union tar_buffer {
+    char buffer[BLOCKSIZE];
+    struct tar_header header;
+};
+
+/*
+ * Pack a directory with contents into a TAR archive
+ *
+ * @a_outfile: output file descriptor
+ * @a_fname: file path relative archive start
+ * @a_fpath: full dir path
+ *
+ * Returns: True, if successfully
+ */
+static bool s_tar_dir_add(int a_outfile, const char *a_fname, const char *a_fpath)
+{
+    union tar_buffer l_buffer;
+    if(!a_outfile)
+        return false;
+    char *l_filebuf = NULL;
+    size_t l_filelen = 0;
+    struct stat l_stat_info;
+    int remaining = l_filelen; // how much is left to write
+    // fill header
+    memset(&l_buffer, 0, BLOCKSIZE);
+    // Trim a directory name if it's over 100 bytes
+    size_t l_fname_len = MIN(dap_strlen(a_fname), sizeof(l_buffer.header.name) - 1);
+    strncpy(l_buffer.header.name, a_fname, l_fname_len);
+    l_buffer.header.name[l_fname_len] = '/';
+    sprintf(l_buffer.header.mode, "0000777");
+    sprintf(l_buffer.header.magic, "ustar");
+    l_buffer.header.typeflag = DIRTYPE;
+    sprintf(l_buffer.header.size, "%o", remaining);
+    stat(a_fpath, &l_stat_info);
+    sprintf(l_buffer.header.mtime, "%o", (unsigned int) l_stat_info.st_mtime);
+    // Checksum calculation
+    {
+        memcpy(l_buffer.header.chksum, CHKBLANKS, sizeof l_buffer.header.chksum);
+        int i, unsigned_sum = 0;
+        char *p;
+        p = (char*) &l_buffer;
+        for(i = sizeof l_buffer; i-- != 0;) {
+            unsigned_sum += 0xFF & *p++;
+        }
+        sprintf(l_buffer.header.chksum, "%6o", unsigned_sum);
+    }
+
+    // add header
+    write(a_outfile, &l_buffer, BLOCKSIZE);
+
+    return true;
+}
+
+/*
+ * Pack a file into a TAR archive
+ *
+ * @a_outfile: output file descriptor
+ * @a_fname: file path relative archive start
+ * @a_fpath: full file path
+ *
+ * Returns: True, if successfully
+ */
+static bool s_tar_file_add(int a_outfile, const char *a_fname, const char *a_fpath)
+{
+    union tar_buffer l_buffer;
+    if(!a_outfile)
+        return false;
+    char *l_filebuf = NULL;
+    size_t l_filelen = 0;
+    if(dap_file_get_contents(a_fpath, &l_filebuf, &l_filelen)) {
+        struct stat l_stat_info;
+        int remaining = l_filelen; // how much is left to write
+        // fill header
+        memset(&l_buffer, 0, BLOCKSIZE);
+        // Trim filename if it's over 100 bytes
+        strncpy(l_buffer.header.name, a_fname, MIN(dap_strlen(a_fname), sizeof(l_buffer.header.name) - 1));
+        sprintf(l_buffer.header.mode, "0100644");
+        sprintf(l_buffer.header.magic, "ustar");
+        l_buffer.header.typeflag = REGTYPE;
+        sprintf(l_buffer.header.size, "%o", remaining);
+        stat(a_fpath, &l_stat_info);
+        sprintf(l_buffer.header.mtime, "%o", (unsigned int) l_stat_info.st_mtime);
+        // Checksum calculation
+        {
+            memcpy(l_buffer.header.chksum, CHKBLANKS, sizeof l_buffer.header.chksum);
+            int i, unsigned_sum = 0;
+            char *p;
+            p = (char*) &l_buffer;
+            for(i = sizeof l_buffer; i-- != 0;) {
+                unsigned_sum += 0xFF & *p++;
+            }
+            sprintf(l_buffer.header.chksum, "%6o", unsigned_sum);
+        }
+
+        // add header
+        write(a_outfile, &l_buffer, BLOCKSIZE);
+        // add file body
+        while(remaining)
+        {
+            unsigned int bytes = (remaining > BLOCKSIZE) ? BLOCKSIZE : remaining;
+            memcpy(&l_buffer, l_filebuf + l_filelen - remaining, bytes);
+            write(a_outfile, &l_buffer, bytes);
+            remaining -= bytes;
+            // the file is already written, but not aligned to the BLOCKSIZE boundary
+            if(bytes != BLOCKSIZE && !remaining) {
+                memset(&l_buffer, 0, BLOCKSIZE - bytes);
+                write(a_outfile, &l_buffer, BLOCKSIZE - bytes);
+            }
+        }
+        DAP_DELETE(l_filebuf);
+        return true;
+    };
+    return false;
+}
+
+/*
+ * Pack a file or direcrory to TAR file
+ *
+ * @a_start_path: start path for archive
+ * @a_cur_path: current path for archive
+ * @a_outfile: output file descriptor
+ *
+ * Returns: True, if successfully
+ */
+static bool s_tar_walk_directory(const char *a_start_path, const char *a_cur_path, int a_outfile)
+{
+    //
+    char *l_start_basename = dap_path_get_basename(a_start_path);
+    size_t l_start_name_len = dap_strlen(l_start_basename);
+    size_t l_start_dir_len = dap_strlen(a_start_path);
+
+    // add root dir
+    if(dap_dir_test(a_start_path)) {
+
+        if(!s_tar_dir_add(a_outfile, l_start_basename, a_start_path)) {
+            log_it(L_ERROR, "Failed to add directory to tar");
+            DAP_DELETE(l_start_basename);
+            return false;
+        }
+    }
+    else if(dap_file_test(a_cur_path)) {
+        if(!s_tar_file_add(a_outfile, l_start_basename, a_cur_path)) {
+            log_it(L_ERROR, "Failed to add file to tar");
+            DAP_DELETE(l_start_basename);
+            return false;
+        }
+        // just one file, not a directory, finish walking
+        DAP_DELETE(l_start_basename);
+        return true;
+    }
+    DAP_DELETE(l_start_basename);
+
+    // add root content
+    DIR *l_dir = opendir(a_cur_path);
+    if(l_dir == NULL)
+    {
+        log_it(L_ERROR, "Failed to open input directory");
+        return false;
+    }
+    struct dirent *l_dirp;
+    while((l_dirp = readdir(l_dir)) != NULL) {
+        if(strcmp(l_dirp->d_name, ".") && strcmp(l_dirp->d_name, "..")) {
+            char *l_fullname = dap_build_filename(a_cur_path, l_dirp->d_name, NULL);
+            if(dap_dir_test(l_fullname)) {
+                if(!s_tar_dir_add(a_outfile, l_fullname - l_start_name_len + l_start_dir_len + 0, l_fullname)) {
+                    log_it(L_ERROR, "Failed to add directory to tar");
+                    closedir(l_dir);
+                    DAP_DELETE(l_fullname);
+                    return false;
+                }
+                // Pack subdirectory
+                s_tar_walk_directory(a_start_path, l_fullname, a_outfile);
+            } else {
+                if(!s_tar_file_add(a_outfile, l_fullname - l_start_name_len + l_start_dir_len + 0, l_fullname)) {
+                    log_it(L_ERROR, "Failed to add file to tar");
+                    closedir(l_dir);
+                    DAP_DELETE(l_fullname);
+                    return false;
+                }
+            }
+            DAP_DELETE(l_fullname);
+        }
+    }
+    closedir(l_dir);
+    return true;
+}
+
+/*
+ * Pack a directory to tar file
+ *
+ * @a_inputdir: input dir
+ * @a_output_filename: output tar file path
+ *
+ * Returns: True, if successfully
+ */
+bool dap_tar_directory(const char *a_inputdir, const char *a_output_tar_filename)
+{
+    int l_outfile = open(a_output_tar_filename, O_CREAT | O_WRONLY | O_BINARY, 0644);
+    if(l_outfile < 0) {
+        log_it(L_ERROR, "Failed to open output file");
+        return false;
+    }
+    // Pack all files to l_outfile
+    bool l_ret = s_tar_walk_directory(a_inputdir, a_inputdir, l_outfile);
+
+    // Write two empty blocks to the end
+    union tar_buffer buffer;
+    memset(&buffer, 0, BLOCKSIZE);
+    write(l_outfile, &buffer, BLOCKSIZE);
+    write(l_outfile, &buffer, BLOCKSIZE);
+    close(l_outfile);
+    return l_ret;
+}
diff --git a/dap-sdk/core/src/dap_strfuncs.c b/dap-sdk/core/src/dap_strfuncs.c
index 471998264eb7be7aed31d8dc90d4fa7f818ba60d..f960159e161d38242545a38c5923262a62676c45 100755
--- a/dap-sdk/core/src/dap_strfuncs.c
+++ b/dap-sdk/core/src/dap_strfuncs.c
@@ -284,8 +284,8 @@ char* dap_strdup(const char *a_str)
         size_t l_length = (size_t) (strlen(a_str) + 1);
         if(l_length){
             l_new_str = DAP_NEW_SIZE(char, l_length);
-	    if(l_new_str)
-        	memcpy(l_new_str, a_str, l_length);
+            if (l_new_str)
+                memcpy(l_new_str, a_str, l_length);
         }else
             l_new_str = NULL;
     }
diff --git a/dap-sdk/core/src/dap_time.c b/dap-sdk/core/src/dap_time.c
new file mode 100644
index 0000000000000000000000000000000000000000..393b8a140851f218a0f1bdb633eea23697dc01ca
--- /dev/null
+++ b/dap-sdk/core/src/dap_time.c
@@ -0,0 +1,222 @@
+#ifdef _WIN32
+#include <windows.h>
+#endif
+#include <errno.h>
+#include <string.h>
+#include <time.h>
+
+#include "dap_common.h"
+#include "dap_time.h"
+
+#define LOG_TAG "dap_common"
+
+#ifdef _WIN32
+
+/* Identifier for system-wide realtime clock.  */
+#ifndef CLOCK_REALTIME
+#define CLOCK_REALTIME              0
+
+#ifndef clockid_t
+typedef int clockid_t;
+#endif
+
+struct timespec {
+    uint64_t tv_sec; // seconds
+    uint64_t tv_nsec;// nanoseconds
+};
+
+int clock_gettime(clockid_t clock_id, struct timespec *spec)
+{
+//    __int64 wintime;
+//    GetSystemTimeAsFileTime((FILETIME*) &wintime);
+//    spec->tv_sec = wintime / 10000000i64; //seconds
+//    spec->tv_nsec = wintime % 10000000i64 * 100; //nano-seconds
+//    return 0;
+    uint64_t ft;
+    GetSystemTimeAsFileTime(FILETIME*)&ft); //return the number of 100-nanosecond intervals since January 1, 1601 (UTC)
+    // from 1 jan 1601 to 1 jan 1970
+    ft -= 116444736000000000i64;
+    spec->tv_sec = ft / 10000000i64; //seconds
+    spec->tv_nsec = ft % 10000000i64 * 100; //nano-seconds
+    return 0;
+}
+#endif
+#endif
+
+
+// Create time from second
+dap_gdb_time_t dap_gdb_time_from_sec(uint32_t a_time)
+{
+    return (dap_gdb_time_t)a_time << 32;
+}
+
+// Get seconds from time
+long dap_gdb_time_to_sec(dap_gdb_time_t a_time)
+{
+    return a_time >> 32;
+}
+
+/**
+ * @brief dap_chain_time_now Get current time in seconds since January 1, 1970 (UTC)
+ * @return Returns current UTC time in seconds.
+ */
+dap_gdb_time_t dap_time_now(void)
+{
+    time_t l_time = time(NULL);
+    return l_time;
+}
+
+/**
+ * @brief dap_chain_time_now Get current time in nanoseconds since January 1, 1970 (UTC)
+ * @return Returns current UTC time in nanoseconds.
+ */
+dap_gdb_time_t dap_gdb_time_now(void)
+{
+    dap_gdb_time_t l_time_nsec;
+    struct timespec cur_time;
+    clock_gettime(CLOCK_REALTIME, &cur_time);
+    l_time_nsec = ((dap_gdb_time_t)cur_time.tv_sec << 32) + cur_time.tv_nsec;
+    return l_time_nsec;
+}
+
+/**
+ * dap_usleep:
+ * @a_microseconds: number of microseconds to pause
+ *
+ * Pauses the current thread for the given number of microseconds.
+ */
+void dap_usleep(dap_time_t a_microseconds)
+{
+#ifdef DAP_OS_WINDOWS
+    Sleep (a_microseconds / 1000);
+#else
+    struct timespec l_request, l_remaining;
+    l_request.tv_sec = a_microseconds / DAP_USEC_PER_SEC;
+    l_request.tv_nsec = 1000 * (a_microseconds % DAP_USEC_PER_SEC);
+    while(nanosleep(&l_request, &l_remaining) == -1 && errno == EINTR)
+        l_request = l_remaining;
+#endif
+}
+
+/**
+ * @brief Calculate diff of two struct timespec
+ * @param[in] a_start - first time
+ * @param[in] a_stop - second time
+ * @param[out] a_result -  diff time, may be NULL
+ * @return diff time in millisecond
+ */
+int timespec_diff(struct timespec *a_start, struct timespec *a_stop, struct timespec *a_result)
+{
+    if(!a_start || !a_stop)
+        return 0;
+    if(!a_result) {
+        struct timespec l_time_tmp = { 0 };
+        a_result = &l_time_tmp;
+    }
+    if((a_stop->tv_nsec - a_start->tv_nsec) < 0) {
+        a_result->tv_sec = a_stop->tv_sec - a_start->tv_sec - 1;
+        a_result->tv_nsec = a_stop->tv_nsec - a_start->tv_nsec + 1000000000;
+    } else {
+        a_result->tv_sec = a_stop->tv_sec - a_start->tv_sec;
+        a_result->tv_nsec = a_stop->tv_nsec - a_start->tv_nsec;
+    }
+
+    return (a_result->tv_sec * 1000 + a_result->tv_nsec / 1000000);
+}
+
+/**
+ * @brief time_to_rfc822 Convert time_t to string with RFC822 formatted date and time
+ * @param[out] out Output buffer
+ * @param[out] out_size_mac Maximum size of output buffer
+ * @param[in] t UNIX time
+ * @return Length of resulting string if ok or lesser than zero if not
+ */
+int dap_time_to_str_rfc822(char * a_out, size_t a_out_size_max, dap_time_t a_t)
+{
+  struct tm *l_tmp;
+  time_t l_time = (time_t)a_t;
+  l_tmp = localtime(&l_time);
+
+  if ( l_tmp == NULL ) {
+    log_it( L_ERROR, "Can't convert data from unix fromat to structured one" );
+    return -2;
+  }
+
+  int l_ret;
+  #ifndef _WIN32
+    l_ret = strftime( a_out, a_out_size_max, "%a, %d %b %y %T %z", l_tmp);
+  #else
+    l_ret = strftime( a_out, a_out_size_max, "%a, %d %b %y %H:%M:%S", l_tmp );
+  #endif
+
+  if ( !l_ret ) {
+    log_it( L_ERROR, "Can't print formatted time in string" );
+    return -1;
+  }
+
+  return l_ret;
+}
+
+/**
+ * @brief time_to_rfc822 Convert dap_chain_time_t to string with RFC822 formatted date and time
+ * @param[out] out Output buffer
+ * @param[out] out_size_mac Maximum size of output buffer
+ * @param[in] t UNIX time
+ * @return Length of resulting string if ok or lesser than zero if not
+ */
+int dap_gbd_time_to_str_rfc822(char *a_out, size_t a_out_size_max, dap_gdb_time_t a_chain_time)
+{
+    time_t l_time = dap_gdb_time_to_sec(a_chain_time);
+    return dap_time_to_str_rfc822(a_out, a_out_size_max, l_time);
+}
+
+/**
+ * @brief dap_ctime_r This function does the same as ctime_r, but if it returns (null), a line break is added.
+ * @param a_time
+ * @param a_buf The minimum buffer size is 26 elements.
+ * @return
+ */
+char* dap_ctime_r(dap_time_t *a_time, char* a_buf)
+{
+    char *l_fail_ret = "(null)\r\n";
+    if (!a_buf)
+        return l_fail_ret;
+    if(!a_time || *a_time > DAP_END_OF_DAYS) {
+        strcpy(a_buf, l_fail_ret);
+        return l_fail_ret;
+    }
+    struct tm l_time;
+#ifdef DAP_OS_WINDOWS
+    errno_t l_errno;
+    l_errno = localtime_s(&l_time, (time_t *)a_time);
+    if (!l_errno)
+        l_errno = asctime_s(a_buf, sizeof(l_time), &l_time);
+    if (!l_errno)
+        return a_buf;
+    else {
+        strcpy(a_buf, l_fail_ret);
+        return l_fail_ret;
+    }
+#else
+    localtime_r((time_t*)a_time, &l_time);
+    char *l_str_time = asctime_r(&l_time, a_buf);
+    if (l_str_time)
+        return  l_str_time;
+    else {
+        strcpy(a_buf, l_fail_ret);
+        return l_fail_ret;
+    }
+#endif
+}
+
+/**
+ * @brief dap_chain_ctime_r This function does the same as ctime_r, but if it returns (null), a line break is added.
+ * @param a_time
+ * @param a_buf The minimum buffer size is 26 elements.
+ * @return
+ */
+char* dap_gdb_ctime_r(dap_gdb_time_t *a_chain_time, char* a_buf){
+    dap_time_t l_time = dap_gdb_time_to_sec(*a_chain_time);
+    return dap_ctime_r(&l_time, a_buf);
+}
+
diff --git a/dap-sdk/crypto/include/dap_sign.h b/dap-sdk/crypto/include/dap_sign.h
index 950952148f9bf3ef0f31d90cdf1800f92f261f09..312995386a560f461efedbf2e169175079d4c11e 100755
--- a/dap-sdk/crypto/include/dap_sign.h
+++ b/dap-sdk/crypto/include/dap_sign.h
@@ -133,6 +133,7 @@ bool dap_sign_verify_size(dap_sign_t *a_sign, size_t a_max_key_size);
 dap_enc_key_t *dap_sign_to_enc_key(dap_sign_t * a_chain_sign);
 const char * dap_sign_type_to_str(dap_sign_type_t a_chain_sign_type);
 dap_sign_type_t dap_sign_type_from_str(const char * a_type_str);
+dap_sign_t **dap_sign_get_unique_signs(void *a_data, size_t a_data_size, size_t *a_signs_count);
 
 uint8_t *dap_multi_sign_serialize(dap_multi_sign_t *a_sign, size_t *a_out_len);
 dap_multi_sign_t *dap_multi_sign_deserialize(dap_sign_type_enum_t a_type, uint8_t *a_sign, size_t a_sign_len);
diff --git a/dap-sdk/crypto/src/dap_sign.c b/dap-sdk/crypto/src/dap_sign.c
index 376220b7e7ec0c36bb4cad576c281f97cc011898..318847ceb44433b8c55f0e1ffc96288716935f8a 100755
--- a/dap-sdk/crypto/src/dap_sign.c
+++ b/dap-sdk/crypto/src/dap_sign.c
@@ -33,6 +33,7 @@
 #include "dap_enc_tesla.h"
 #include "dap_enc_picnic.h"
 #include "dap_enc_dilithium.h"
+#include "dap_list.h"
 
 #define LOG_TAG "dap_sign"
 
@@ -468,6 +469,52 @@ size_t dap_sign_get_size(dap_sign_t * a_chain_sign)
 }
 
 
+dap_sign_t **dap_sign_get_unique_signs(void *a_data, size_t a_data_size, size_t *a_signs_count)
+{
+    size_t l_offset = 0;
+    dap_list_t *l_list_signs = NULL;
+    while (l_offset < a_data_size) {
+        dap_sign_t *l_sign = (dap_sign_t *)(a_data+l_offset);
+        size_t l_sign_size = dap_sign_get_size(l_sign);
+        if (!l_sign_size){
+            break;
+        }
+        if (l_sign_size > a_data_size-l_offset ){
+            break;
+        }
+        // Check duplicate signs
+        bool l_sign_duplicate = false;
+        if (l_list_signs) {
+            dap_list_t *l_list = dap_list_first(l_list_signs);
+            while (l_list) {
+                if ( memcmp( ((dap_sign_t *)l_list->data)->pkey_n_sign,
+                            l_sign->pkey_n_sign, l_sign->header.sign_pkey_size ) == 0 ) {
+                    l_sign_duplicate = true;
+                    break;
+                }
+                l_list = l_list->next;
+            }
+        }
+        if (!l_sign_duplicate) {
+            l_list_signs = dap_list_append(l_list_signs, l_sign);
+        }
+        l_offset += l_sign_size;
+    }
+    unsigned int l_list_length = dap_list_length(l_list_signs);
+    *a_signs_count = (size_t)l_list_length;
+    dap_sign_t **l_ret = DAP_NEW_Z_SIZE(dap_sign_t *, sizeof(dap_sign_t *)*l_list_length);
+    unsigned int i = 0;
+    dap_list_t *l_list = dap_list_first(l_list_signs);
+    while(l_list) {
+        l_ret[i] = l_list->data;
+        i++;
+        l_list = l_list->next;
+    }
+    dap_list_free(l_list_signs);
+    return l_ret;
+}
+
+
 /**
  * @brief dap_multi_sign_calc_size Auxiliary function to calculate multi-signature strucrutre size
  * @param a_sign The multi-signature
diff --git a/dap-sdk/net/client/dap_client_http.c b/dap-sdk/net/client/dap_client_http.c
index 7d30903f6abc65f641b265a69423c8664909b8db..7567d228661b189595ef64f91eae1f8a327ffdfc 100644
--- a/dap-sdk/net/client/dap_client_http.c
+++ b/dap-sdk/net/client/dap_client_http.c
@@ -384,7 +384,7 @@ static void s_es_delete(dap_events_socket_t * a_es, void * a_arg)
                l_client_http_internal->response_size, l_client_http_internal->content_length);
             l_client_http_internal->error_callback(-666, l_client_http_internal->obj); // -666 means remote server disconnected before he sends all
         }else if (l_response_size){
-            log_it(L_INFO, "Remote server replied without no content legth but we have the response %zd bytes size",
+            log_it(L_INFO, "Remote server replied without no content length but we have the response %zd bytes size",
                l_response_size);
 
             //l_client_http_internal->error_callback(-10 , l_client_http_internal->obj);
diff --git a/dap-sdk/net/client/dap_client_pvt.c b/dap-sdk/net/client/dap_client_pvt.c
index 9d9fdeddc31e5ae17054ff5de277fea916cdd492..3ac7ef062f71219390f6364798238368d6808a13 100644
--- a/dap-sdk/net/client/dap_client_pvt.c
+++ b/dap-sdk/net/client/dap_client_pvt.c
@@ -627,7 +627,7 @@ static bool s_stage_status_after(dap_client_pvt_t * a_client_pvt)
             //    l_is_last_attempt = true;
             //}
 
-            log_it(L_ERROR, "Error state( %s), doing callback if present", dap_client_error_str(a_client_pvt->last_error));
+            log_it(L_ERROR, "Error state(%s), doing callback if present", dap_client_error_str(a_client_pvt->last_error));
             if(a_client_pvt->stage_status_error_callback)
                 a_client_pvt->stage_status_error_callback(a_client_pvt->client, (void*) l_is_last_attempt);
 
diff --git a/dap-sdk/net/core/dap_events.c b/dap-sdk/net/core/dap_events.c
index d8b32c105bda1a1c3c30d0e52e42e13338bd0362..7dd8ce836354e2585ec944a5ae8ec4f6134c26cb 100644
--- a/dap-sdk/net/core/dap_events.c
+++ b/dap-sdk/net/core/dap_events.c
@@ -95,9 +95,11 @@ typedef cpuset_t cpu_set_t; // Adopt BSD CPU setstructure to POSIX variant
 #include "dap_events.h"
 #include "dap_events_socket.h"
 #include "dap_proc_thread.h"
+#include "dap_config.h"
 
 #define LOG_TAG "dap_events"
 
+bool g_debug_reactor = false;
 static int s_workers_init = 0;
 static uint32_t s_threads_count = 1;
 static dap_worker_t **s_workers = NULL;
@@ -207,6 +209,9 @@ void dap_cpu_assign_thread_on(uint32_t a_cpu_id)
  */
 int dap_events_init( uint32_t a_threads_count, size_t a_conn_timeout )
 {
+
+    g_debug_reactor = g_config ? dap_config_get_item_bool_default(g_config, "general", "debug_reactor", false) : false;
+
     uint32_t l_cpu_count = dap_get_cpu_count();
     if (a_threads_count > l_cpu_count)
         a_threads_count = l_cpu_count;
diff --git a/dap-sdk/net/core/dap_events_socket.c b/dap-sdk/net/core/dap_events_socket.c
index 3ab3b35349d2588206d637671728c732c83503eb..549c451bf92138b7de754ea4b554b9ce09695f80 100644
--- a/dap-sdk/net/core/dap_events_socket.c
+++ b/dap-sdk/net/core/dap_events_socket.c
@@ -104,10 +104,10 @@ struct queue_ptr_input_pvt{
 };
 #define PVT_QUEUE_PTR_INPUT(a) ( (struct queue_ptr_input_pvt*) (a)->_pvt )
 
-static bool s_debug_reactor = false;
 static uint64_t s_delayed_ops_timeout_ms = 5000;
 bool s_remove_and_delete_unsafe_delayed_delete_callback(void * a_arg);
 
+static pthread_attr_t s_attr_detached;                                      /* Thread's creation attribute = DETACHED ! */
 
 
 /**
@@ -116,8 +116,17 @@ bool s_remove_and_delete_unsafe_delayed_delete_callback(void * a_arg);
  */
 int dap_events_socket_init( )
 {
+int l_rc;
+
     log_it(L_NOTICE,"Initialized events socket module");
-    s_debug_reactor = g_config? dap_config_get_item_bool_default(g_config, "general","debug_reactor", false) : false;
+
+    /*
+     * @RRL: #6157
+     * Use this thread's attribute to eliminate resource consuming by terminated threads
+     */
+    assert ( !(l_rc = pthread_attr_init(&s_attr_detached)) );
+    assert ( !(l_rc = pthread_attr_setdetachstate(&s_attr_detached, PTHREAD_CREATE_DETACHED)) );
+
 #if defined (DAP_EVENTS_CAPS_QUEUE_MQUEUE)
 #include <sys/time.h>
 #include <sys/resource.h>
@@ -125,15 +134,15 @@ int dap_events_socket_init( )
     l_mqueue_limit.rlim_cur = RLIM_INFINITY;
     l_mqueue_limit.rlim_max = RLIM_INFINITY;
     setrlimit(RLIMIT_MSGQUEUE,&l_mqueue_limit);
-    char l_cmd[256];
-    snprintf(l_cmd,sizeof (l_cmd),"rm /dev/mqueue/%s-queue_ptr*", dap_get_appname());
+    char l_cmd[256] ={0};
+    snprintf(l_cmd, sizeof (l_cmd) - 1, "rm /dev/mqueue/%s-queue_ptr*", dap_get_appname());
     system(l_cmd);
     FILE *l_mq_msg_max = fopen("/proc/sys/fs/mqueue/msg_max", "w");
     if (l_mq_msg_max) {
         fprintf(l_mq_msg_max, "%d", DAP_QUEUE_MAX_MSGS);
         fclose(l_mq_msg_max);
     } else {
-        log_it(L_ERROR, "Сan't open /proc/sys/fs/mqueue/msg_max file for writing");
+        log_it(L_ERROR, "Сan't open /proc/sys/fs/mqueue/msg_max file for writing, errno=%d", errno);
     }
 #endif
     dap_timerfd_init();
@@ -410,7 +419,7 @@ dap_events_socket_t * dap_events_socket_create(dap_events_desc_type_t a_type, da
         return NULL;
     }
     l_es->type = a_type ;
-    if(s_debug_reactor)
+    if(g_debug_reactor)
         log_it(L_DEBUG,"Created socket %"DAP_FORMAT_SOCKET" type %d", l_sock,l_es->type);
     return l_es;
 }
@@ -892,7 +901,7 @@ int dap_events_socket_queue_proc_input_unsafe(dap_events_socket_t * a_esocket)
             }
 #elif defined DAP_EVENTS_CAPS_KQUEUE
         l_queue_ptr = (void*) a_esocket->kqueue_event_catched_data.data;
-        if(s_debug_reactor)
+        if(g_debug_reactor)
             log_it(L_INFO,"Queue ptr received %p ptr on input", l_queue_ptr);
         if(a_esocket->callbacks.queue_ptr_callback)
             a_esocket->callbacks.queue_ptr_callback (a_esocket, l_queue_ptr);
@@ -909,7 +918,7 @@ int dap_events_socket_queue_proc_input_unsafe(dap_events_socket_t * a_esocket)
 #elif defined (DAP_EVENTS_CAPS_KQUEUE)
         void * l_queue_ptr = a_esocket->kqueue_event_catched_data.data;
         size_t l_queue_ptr_size = a_esocket->kqueue_event_catched_data.size;
-        if(s_debug_reactor)
+        if(g_debug_reactor)
             log_it(L_INFO,"Queue received %z bytes on input", l_queue_ptr_size);
 
         a_esocket->callbacks.queue_callback(a_esocket, l_queue_ptr, l_queue_ptr_size);
@@ -1180,11 +1189,32 @@ static void *dap_events_socket_buf_thread(void *arg)
 
 static void add_ptr_to_buf(dap_events_socket_t * a_es, void* a_arg)
 {
-    dap_events_socket_buf_item_t *l_item = DAP_NEW(dap_events_socket_buf_item_t); if (!l_item) return;
+static atomic_uint_fast64_t l_thd_count;
+int     l_rc;
+pthread_t l_thread;
+dap_events_socket_buf_item_t *l_item;
+
+    atomic_fetch_add(&l_thd_count, 1);                                      /* Count an every call of this routine */
+
+    if ( !(l_item = DAP_NEW(dap_events_socket_buf_item_t)) )                /* Allocate new item - argument for new thread */
+    {
+        log_it (L_ERROR, "[#%"DAP_UINT64_FORMAT_U"] No memory for new item, errno=%d,  drop: a_es: %p, a_arg: %p",
+                atomic_load(&l_thd_count), errno, a_es, a_arg);
+        return;
+    }
+
     l_item->es = a_es;
     l_item->arg = a_arg;
-    pthread_t l_thread;
-    pthread_create(&l_thread, NULL, dap_events_socket_buf_thread, l_item);
+
+    if ( (l_rc = pthread_create(&l_thread, &s_attr_detached /* @RRL: #6157 */, dap_events_socket_buf_thread, l_item)) )
+    {
+        log_it(L_ERROR, "[#%"DAP_UINT64_FORMAT_U"] Cannot start thread, drop a_es: %p, a_arg: %p, rc: %d",
+                 atomic_load(&l_thd_count), a_es, a_arg, l_rc);
+        return;
+    }
+
+    debug_if(g_debug_reactor, L_DEBUG, "[#%"DAP_UINT64_FORMAT_U"] Created thread %"DAP_UINT64_FORMAT_x", a_es: %p, a_arg: %p",
+             atomic_load(&l_thd_count), l_thread, a_es, a_arg);
 }
 
 /**
@@ -1251,7 +1281,7 @@ int dap_events_socket_queue_ptr_send( dap_events_socket_t *a_es, void *a_arg)
 {
     int l_ret = -1024, l_errno;
 
-    if (s_debug_reactor)
+    if (g_debug_reactor)
         log_it(L_DEBUG,"Sent ptr %p to esocket queue %p (%d)", a_arg, a_es, a_es? a_es->fd : -1);
 
 #if defined(DAP_EVENTS_CAPS_QUEUE_PIPE2)
@@ -1328,11 +1358,11 @@ int dap_events_socket_queue_ptr_send( dap_events_socket_t *a_es, void *a_arg)
     int l_n;
     if(a_es->pipe_out){ // If we have pipe out - we send events directly to the pipe out kqueue fd
         if(a_es->pipe_out->worker){
-            if( s_debug_reactor) log_it(L_DEBUG, "Sent kevent() with ptr %p to pipe_out worker on esocket %d",a_arg,a_es);
+            if( g_debug_reactor) log_it(L_DEBUG, "Sent kevent() with ptr %p to pipe_out worker on esocket %d",a_arg,a_es);
             l_n = kevent(a_es->pipe_out->worker->kqueue_fd,&l_event,1,NULL,0,NULL);
         }else if (a_es->pipe_out->proc_thread){
             l_n = kevent(a_es->pipe_out->proc_thread->kqueue_fd,&l_event,1,NULL,0,NULL);
-            if( s_debug_reactor) log_it(L_DEBUG, "Sent kevent() with ptr %p to pipe_out proc_thread on esocket %d",a_arg,a_es);
+            if( g_debug_reactor) log_it(L_DEBUG, "Sent kevent() with ptr %p to pipe_out proc_thread on esocket %d",a_arg,a_es);
         }
         else {
             log_it(L_WARNING,"Trying to send pointer in pipe out queue thats not assigned to any worker or proc thread");
@@ -1341,10 +1371,10 @@ int dap_events_socket_queue_ptr_send( dap_events_socket_t *a_es, void *a_arg)
         }
     }else if(a_es->worker){
         l_n = kevent(a_es->worker->kqueue_fd,&l_event,1,NULL,0,NULL);
-        if( s_debug_reactor) log_it(L_DEBUG, "Sent kevent() with ptr %p to worker on esocket %d",a_arg,a_es);
+        if( g_debug_reactor) log_it(L_DEBUG, "Sent kevent() with ptr %p to worker on esocket %d",a_arg,a_es);
     }else if (a_es->proc_thread){
         l_n = kevent(a_es->proc_thread->kqueue_fd,&l_event,1,NULL,0,NULL);
-        if( s_debug_reactor) log_it(L_DEBUG, "Sent kevent() with ptr %p to proc_thread on esocket %d",a_arg,a_es);
+        if( g_debug_reactor) log_it(L_DEBUG, "Sent kevent() with ptr %p to proc_thread on esocket %d",a_arg,a_es);
     }else {
         log_it(L_WARNING,"Trying to send pointer in queue thats not assigned to any worker or proc thread");
         l_n = 0;
diff --git a/dap-sdk/net/core/dap_net.c b/dap-sdk/net/core/dap_net.c
index b663dedd7ef6c86bdd0a8fd144d8cc05bd3d9526..072388a71a03a61bee31e885f62076a93f395728 100644
--- a/dap-sdk/net/core/dap_net.c
+++ b/dap-sdk/net/core/dap_net.c
@@ -20,11 +20,9 @@ int dap_net_resolve_host(const char *a_host, int ai_family, struct sockaddr *a_a
     l_hints.ai_socktype = SOCK_STREAM;
     l_hints.ai_flags |= AI_CANONNAME;
 
-    int errcode = getaddrinfo(a_host, NULL, &l_hints, &l_res);
-    if(errcode != 0)
-            {
+    if ( getaddrinfo(a_host, NULL, &l_hints, &l_res) )
         return -2;
-    }
+
     while(l_res)
     {
         if(ai_family == l_res->ai_family)
diff --git a/dap-sdk/net/core/dap_proc_queue.c b/dap-sdk/net/core/dap_proc_queue.c
index 1ae6bf1e613279088b23c03ce081e05c54c7ec8a..fc33d2f7dc4a2f269196ed54fb4cd9f7150fed3c 100644
--- a/dap-sdk/net/core/dap_proc_queue.c
+++ b/dap-sdk/net/core/dap_proc_queue.c
@@ -20,7 +20,6 @@
     You should have received a copy of the GNU General Public License
     along with any DAP SDK based project.  If not, see <http://www.gnu.org/licenses/>.
 */
-#include <assert.h>
 #include <errno.h>
 #include "dap_worker.h"
 #include "dap_proc_queue.h"
@@ -93,7 +92,10 @@ static void s_queue_esocket_callback( dap_events_socket_t * a_es, void * a_msg)
     dap_proc_queue_item_t *l_item;
 
     assert ( a_es );
-    assert( (l_queue = (dap_proc_queue_t*) a_es->_inheritor) );
+    if ( !(l_queue = (dap_proc_queue_t*) a_es->_inheritor) ) {
+        log_it(L_CRITICAL, "%s: a_es: %p, l_queue is NULL", __PRETTY_FUNCTION__, a_es);
+        return;
+    }
 
     if ( !(l_msg = (dap_proc_queue_msg_t*) a_msg) ) {
         log_it(L_CRITICAL, "%s: a_es: %p, a_msg is NULL", __PRETTY_FUNCTION__, a_es);
@@ -108,7 +110,7 @@ static void s_queue_esocket_callback( dap_events_socket_t * a_es, void * a_msg)
         return;
     }
 
-    log_it(L_DEBUG, "l_queue: %p, l_msg: %p, callback: %p/%p, pri: %d", l_queue, l_msg, l_msg->callback, l_msg->callback_arg, l_msg->pri);
+    debug_if(g_debug_reactor, L_DEBUG, "l_queue: %p, l_msg: %p, callback: %p/%p, pri: %d", l_queue, l_msg, l_msg->callback, l_msg->callback_arg, l_msg->pri);
 
 
     if ( !(l_item = DAP_NEW_Z(dap_proc_queue_item_t)) ) {
@@ -131,14 +133,14 @@ static void s_queue_esocket_callback( dap_events_socket_t * a_es, void * a_msg)
         l_item->callback = l_msg->callback;
         l_item->callback_arg = l_msg->callback_arg;
 
-    assert ( !pthread_mutex_lock(&l_queue->list[pri].lock) );               /* Protect list from other threads */
+    pthread_mutex_lock(&l_queue->list[pri].lock);                           /* Protect list from other threads */
     l_rc = s_dap_insqtail (&l_queue->list[pri].items, l_item, 1);
-    assert ( !pthread_mutex_unlock(&l_queue->list[pri].lock) );
+    pthread_mutex_unlock(&l_queue->list[pri].lock);
 
     if ( l_rc )
         log_it(L_CRITICAL, "Enqueue failed: %d, drop l_msg:%p, callback: %p/%p, pri: %d", l_rc, l_msg, l_msg->callback, l_msg->callback_arg, l_msg->pri);
     else
-        log_it(L_DEBUG, "Enqueued l_msg:%p, callback: %p/%p, pri: %d", l_msg, l_msg->callback, l_msg->callback_arg, l_msg->pri);
+        debug_if(g_debug_reactor, L_DEBUG, "Enqueued l_msg:%p, callback: %p/%p, pri: %d", l_msg, l_msg->callback, l_msg->callback_arg, l_msg->pri);
 
     dap_events_socket_event_signal(l_queue->proc_thread->proc_event, 1);    /* Add on top so after call this callback will be executed first */
 
diff --git a/dap-sdk/net/core/dap_proc_thread.c b/dap-sdk/net/core/dap_proc_thread.c
index d54d7d078c7b2606bc7e2c4965b9bfacfc2c187c..2d13300d4fee1c040c614c59bf7f91bafe4bb5b0 100644
--- a/dap-sdk/net/core/dap_proc_thread.c
+++ b/dap-sdk/net/core/dap_proc_thread.c
@@ -20,8 +20,6 @@
     You should have received a copy of the GNU General Public License
     along with any DAP SDK based project.  If not, see <http://www.gnu.org/licenses/>.
 */
-
-#include <assert.h>
 #include <errno.h>
 #include <stdatomic.h>
 
@@ -60,7 +58,6 @@ typedef cpuset_t cpu_set_t; // Adopt BSD CPU setstructure to POSIX variant
 #define LOG_TAG "dap_proc_thread"
 
 static size_t s_threads_count = 0;
-static int  s_debug_reactor = 0;
 static dap_proc_thread_t * s_threads = NULL;
 static void *s_proc_thread_function(void * a_arg);
 static void s_event_exit_callback( dap_events_socket_t * a_es, uint64_t a_flags);
@@ -79,12 +76,11 @@ int l_ret = 0;
 
     s_threads_count = a_threads_count ? a_threads_count : dap_get_cpu_count( );
     s_threads = DAP_NEW_Z_SIZE(dap_proc_thread_t, sizeof (dap_proc_thread_t)* s_threads_count);
-    s_debug_reactor = g_config ? dap_config_get_item_bool_default(g_config, "general", "debug_reactor", false) : false;
 
     for (uint32_t i = 0; i < s_threads_count; i++ )
     {
         s_threads[i].cpu_id = i;
-        assert( !pthread_mutex_lock( &s_started_mutex ));
+        pthread_mutex_lock( &s_started_mutex );
 
         if ( (l_ret = pthread_create( &s_threads[i].thread_id,NULL, s_proc_thread_function, &s_threads[i] )) ) {
             log_it(L_CRITICAL, "Create thread failed with code %d", l_ret);
@@ -92,8 +88,8 @@ int l_ret = 0;
             return l_ret;
         }
 
-        assert( !pthread_cond_wait( &s_started_cond, &s_started_mutex ));
-        assert( !pthread_mutex_unlock( &s_started_mutex ));
+        pthread_cond_wait( &s_started_cond, &s_started_mutex);
+        pthread_mutex_unlock( &s_started_mutex);
     }
 
     return l_ret;
@@ -167,7 +163,7 @@ int     l_rc, l_is_anybody_for_repeat, l_is_finished, l_iter_cnt, l_cur_pri;
 size_t  l_size;
 dap_proc_queue_t    *l_queue;
 
-    debug_if (s_debug_reactor, L_DEBUG, "--> Proc event callback start, a_esocket:%p ", a_esocket);
+    debug_if (g_debug_reactor, L_DEBUG, "--> Proc event callback start, a_esocket:%p ", a_esocket);
 
     if ( !(l_thread = (dap_proc_thread_t *) a_esocket->_inheritor) )
         {
@@ -185,31 +181,29 @@ dap_proc_queue_t    *l_queue;
         if ( !l_queue->list[l_cur_pri].items.nr )                           /* A lockless quick check */
             continue;
 
-        assert ( !pthread_mutex_lock(&l_queue->list[l_cur_pri].lock) );     /* Protect list from other threads */
+        pthread_mutex_lock(&l_queue->list[l_cur_pri].lock);                 /* Protect list from other threads */
         l_rc = s_dap_remqhead (&l_queue->list[l_cur_pri].items, (void **) &l_item, &l_size);
-        assert ( !pthread_mutex_unlock(&l_queue->list[l_cur_pri].lock) );
+        pthread_mutex_unlock(&l_queue->list[l_cur_pri].lock);
 
         if  ( l_rc == -ENOENT ) {                                           /* Queue is empty ? */
-            debug_if (s_debug_reactor, L_DEBUG, "a_esocket:%p - nothing to do at prio: %d ", a_esocket, l_cur_pri);
+            debug_if (g_debug_reactor, L_DEBUG, "a_esocket:%p - nothing to do at prio: %d ", a_esocket, l_cur_pri);
             continue;
         }
 
-        debug_if (s_debug_reactor, L_INFO, "Proc event callback: %p/%p, prio=%d, iteration=%d",
+        debug_if (g_debug_reactor, L_INFO, "Proc event callback: %p/%p, prio=%d, iteration=%d",
                        l_item->callback, l_item->callback_arg, l_cur_pri, l_iter_cnt);
 
-        assert(l_item->callback);                                           /* Just for ensuring ... */
-
         l_is_finished = l_item->callback(l_thread, l_item->callback_arg);
         l_is_anybody_for_repeat++;
 
-        debug_if (s_debug_reactor, L_INFO, "Proc event callback: %p/%p, prio=%d, iteration=%d - is %sfinished",
+        debug_if (g_debug_reactor, L_INFO, "Proc event callback: %p/%p, prio=%d, iteration=%d - is %sfinished",
                            l_item->callback, l_item->callback_arg, l_cur_pri, l_iter_cnt, l_is_finished ? "" : "not ");
 
         if ( !(l_is_finished) ) {
                                                                             /* Rearm callback to be executed again */
-            assert ( !pthread_mutex_lock(&l_queue->list[l_cur_pri].lock) );
+            pthread_mutex_lock(&l_queue->list[l_cur_pri].lock);
             l_rc = s_dap_insqtail (&l_queue->list[l_cur_pri].items, l_item, 1);
-            assert ( !pthread_mutex_unlock(&l_queue->list[l_cur_pri].lock) );
+            pthread_mutex_unlock(&l_queue->list[l_cur_pri].lock);
         }
         else    {
                     DAP_DELETE(l_item);
@@ -222,7 +216,7 @@ dap_proc_queue_t    *l_queue;
     if ( l_is_anybody_for_repeat )                                          /* Arm event if we have something to proc again */
         dap_events_socket_event_signal(a_esocket, 1);
 
-    debug_if(s_debug_reactor, L_DEBUG, "<-- Proc event callback end, repeat flag is: %d, iterations: %d", l_is_anybody_for_repeat, l_iter_cnt);
+    debug_if(g_debug_reactor, L_DEBUG, "<-- Proc event callback end, repeat flag is: %d, iterations: %d", l_is_anybody_for_repeat, l_iter_cnt);
 }
 
 
@@ -679,7 +673,7 @@ static void * s_proc_thread_function(void * a_arg)
                 memcpy(&l_cur->kqueue_event_catched_data,l_es_w_data,sizeof(*l_es_w_data));
                 if(l_es_w_data != &l_cur->kqueue_event_catched_data )
                     DAP_DELETE(l_es_w_data);
-                else if (s_debug_reactor)
+                else if (g_debug_reactor)
                     log_it(L_DEBUG,"Own event signal without actual event data");
                 if ( l_cur->pipe_out == NULL){ // If we're not the input for pipe or queue
                                                // we must drop write flag and set read flag
@@ -711,7 +705,7 @@ static void * s_proc_thread_function(void * a_arg)
 #error "Unimplemented fetch esocket after poll"
 #endif
             assert(l_cur);
-            if(s_debug_reactor)
+            if(g_debug_reactor)
                 log_it(L_DEBUG, "Proc thread #%u esocket %p fd=%"DAP_FORMAT_SOCKET" type=%d flags=0x%0X (%s:%s:%s:%s:%s:%s:%s:%s)", l_thread->cpu_id, l_cur, l_cur->socket,
                     l_cur->type, l_cur_events, l_flag_read?"read":"", l_flag_write?"write":"", l_flag_error?"error":"",
                     l_flag_hup?"hup":"", l_flag_rdhup?"rdhup":"", l_flag_msg?"msg":"", l_flag_nval?"nval":"", l_flag_pri?"pri":"");
@@ -957,7 +951,7 @@ static void * s_proc_thread_function(void * a_arg)
 bool dap_proc_thread_assign_on_worker_inter(dap_proc_thread_t * a_thread, dap_worker_t * a_worker, dap_events_socket_t *a_esocket  )
 {
     dap_events_socket_t * l_es_assign_input = a_thread->queue_assign_input[a_worker->id];
-    if(s_debug_reactor)
+    if(g_debug_reactor)
         log_it(L_DEBUG,"Remove esocket %p from proc thread and send it to worker #%u",a_esocket, a_worker->id);
 
     dap_events_socket_assign_on_worker_inter(l_es_assign_input, a_esocket);
@@ -1059,7 +1053,7 @@ static void s_event_exit_callback( dap_events_socket_t * a_es, uint64_t a_flags)
     (void) a_flags;
     dap_proc_thread_t * l_thread = (dap_proc_thread_t *) a_es->_inheritor;
     l_thread->signal_exit = true;
-    if(s_debug_reactor)
+    if(g_debug_reactor)
         log_it(L_DEBUG, "Proc_thread :%u signaled to exit", l_thread->cpu_id);
 }
 
diff --git a/dap-sdk/net/core/dap_timerfd.c b/dap-sdk/net/core/dap_timerfd.c
index 61131a04b4a55b06b5228e12e7360d700c880f14..c38f9e27e3cc6cec551b0244e544237fdee5cca0 100644
--- a/dap-sdk/net/core/dap_timerfd.c
+++ b/dap-sdk/net/core/dap_timerfd.c
@@ -328,6 +328,8 @@ void dap_timerfd_reset(dap_timerfd_t *a_timerfd)
  */
 void dap_timerfd_delete(dap_timerfd_t *a_timerfd)
 {
+    if (!a_timerfd)
+        return;
     #ifdef _WIN32
         DeleteTimerQueueTimer(hTimerQueue, (HANDLE)a_timerfd->th, NULL);
     #endif
diff --git a/dap-sdk/net/core/dap_worker.c b/dap-sdk/net/core/dap_worker.c
index f8c7c2dd4fa06e53b2c9c13557f3d9b2cd49ef08..a5507db49f151bff4d71f742ced894a424a415fe 100644
--- a/dap-sdk/net/core/dap_worker.c
+++ b/dap-sdk/net/core/dap_worker.c
@@ -62,7 +62,6 @@
 #define LOG_TAG "dap_worker"
 
 static time_t s_connection_timeout = 60;    // seconds
-static bool s_debug_reactor=false;
 
 static bool s_socket_all_check_activity( void * a_arg);
 static void s_queue_add_es_callback( dap_events_socket_t * a_es, void * a_arg);
@@ -83,7 +82,6 @@ int dap_worker_init( size_t a_conn_timeout )
     if ( a_conn_timeout )
       s_connection_timeout = a_conn_timeout;
 
-    s_debug_reactor = g_config? dap_config_get_item_bool_default(g_config,"general","debug_reactor",false) : false;
 #ifdef DAP_OS_UNIX
     struct rlimit l_fdlimit;
     if (getrlimit(RLIMIT_NOFILE, &l_fdlimit))
@@ -111,13 +109,17 @@ void *dap_worker_thread(void *arg)
 {
     dap_events_socket_t *l_cur;
     dap_worker_t *l_worker = (dap_worker_t *) arg;
-    //time_t l_next_time_timeout_check = time( NULL) + s_connection_timeout / 2;
     uint32_t l_tn = l_worker->id;
+    int l_errno = 0, l_selected_sockets;
+    socklen_t l_error_len = sizeof(l_errno);
+    char l_error_buf[128] = {0};
+    ssize_t l_bytes_sent = 0, l_bytes_read = 0, l_sockets_max;
+    const struct sched_param l_shed_params = {0};
+
 
     dap_cpu_assign_thread_on(l_worker->id);
     pthread_setspecific(l_worker->events->pth_key_worker, l_worker);
-    struct sched_param l_shed_params;
-    l_shed_params.sched_priority = 0;
+
 #ifdef DAP_OS_WINDOWS
     if (!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL))
         log_it(L_ERROR, "Couldn'r set thread priority, err: %lu", GetLastError());
@@ -130,14 +132,16 @@ void *dap_worker_thread(void *arg)
     log_it(L_INFO, "Worker #%d started with epoll fd %"DAP_FORMAT_HANDLE" and assigned to dedicated CPU unit", l_worker->id, l_worker->epoll_fd);
 #elif defined(DAP_EVENTS_CAPS_KQUEUE)
     l_worker->kqueue_fd = kqueue();
-        if (l_worker->kqueue_fd == -1 ){
-        int l_errno = errno;
-        char l_errbuf[255];
-        strerror_r(l_errno,l_errbuf,sizeof(l_errbuf));
-        log_it (L_CRITICAL,"Can't create kqueue():\"\" code %d",l_errbuf,l_errno);
-            pthread_cond_broadcast(&l_worker->started_cond);
-        return NULL;
+
+    if (l_worker->kqueue_fd == -1 ){
+    int l_errno = errno;
+    char l_errbuf[255];
+    strerror_r(l_errno,l_errbuf,sizeof(l_errbuf));
+    log_it (L_CRITICAL,"Can't create kqueue(): '%s' code %d",l_errbuf,l_errno);
+    pthread_cond_broadcast(&l_worker->started_cond);
+    return NULL;
     }
+
     l_worker->kqueue_events_selected_count_max = 100;
     l_worker->kqueue_events_count_max = DAP_EVENTS_SOCKET_MAX;
     l_worker->kqueue_events_selected = DAP_NEW_Z_SIZE(struct kevent, l_worker->kqueue_events_selected_count_max *sizeof(struct kevent));
@@ -161,14 +165,13 @@ void *dap_worker_thread(void *arg)
     l_worker->queue_es_reassign = dap_events_socket_create_type_queue_ptr_unsafe(l_worker, s_queue_es_reassign_callback );
 
 
-    for( uint32_t n = 0; n < dap_events_worker_get_count(); n++) {
+    for( size_t n = 0; n < dap_events_worker_get_count(); n++) {
         l_worker->queue_es_new_input[n] = dap_events_socket_queue_ptr_create_input(l_worker->queue_es_new);
         l_worker->queue_es_delete_input[n] = dap_events_socket_queue_ptr_create_input(l_worker->queue_es_delete);
         l_worker->queue_es_io_input[n] = dap_events_socket_queue_ptr_create_input(l_worker->queue_es_io);
         l_worker->queue_es_reassign_input[n] = dap_events_socket_queue_ptr_create_input(l_worker->queue_es_reassign);
     }
 
-
     l_worker->queue_callback    = dap_events_socket_create_type_queue_ptr_unsafe(l_worker, s_queue_callback_callback);
     l_worker->event_exit        = dap_events_socket_create_type_event_unsafe(l_worker, s_event_exit_callback);
 
@@ -178,10 +181,8 @@ void *dap_worker_thread(void *arg)
     pthread_mutex_lock(&l_worker->started_mutex);
     pthread_cond_broadcast(&l_worker->started_cond);
     pthread_mutex_unlock(&l_worker->started_mutex);
-    bool s_loop_is_active = true;
-    while(s_loop_is_active) {
-    int l_selected_sockets;
-    size_t l_sockets_max;
+
+    while (1) {
 #ifdef DAP_EVENTS_CAPS_EPOLL
         l_selected_sockets = epoll_wait(l_worker->epoll_fd, l_epoll_events, DAP_EVENTS_SOCKET_MAX, -1);
         l_sockets_max = l_selected_sockets;
@@ -201,10 +202,8 @@ void *dap_worker_thread(void *arg)
 #ifdef DAP_OS_WINDOWS
             log_it(L_ERROR, "Worker thread %d got errno %d", l_worker->id, WSAGetLastError());
 #else
-            int l_errno = errno;
-            char l_errbuf[128];
-            strerror_r(l_errno, l_errbuf, sizeof (l_errbuf));
-            log_it(L_ERROR, "Worker thread %d got errno:\"%s\" (%d)", l_worker->id, l_errbuf, l_errno);
+            strerror_r(l_errno, l_error_buf, sizeof (l_error_buf) - 1);
+            log_it(L_ERROR, "Worker thread %d got errno:\"%s\" (%d)", l_worker->id, l_error_buf, l_errno);
             assert(l_errno);
 #endif
             break;
@@ -213,6 +212,7 @@ void *dap_worker_thread(void *arg)
         time_t l_cur_time = time( NULL);
         for(size_t n = 0; n < l_sockets_max; n++) {
             bool l_flag_hup, l_flag_rdhup, l_flag_read, l_flag_write, l_flag_error, l_flag_nval, l_flag_msg, l_flag_pri;
+
 #ifdef DAP_EVENTS_CAPS_EPOLL
             l_cur = (dap_events_socket_t *) l_epoll_events[n].data.ptr;
             uint32_t l_cur_flags = l_epoll_events[n].events;
@@ -232,6 +232,7 @@ void *dap_worker_thread(void *arg)
 
             if (!l_cur_flags) // No events for this socket
                 continue;
+
             l_flag_hup =  l_cur_flags& POLLHUP;
             l_flag_rdhup = l_cur_flags & POLLRDHUP;
             l_flag_write = (l_cur_flags & POLLOUT) || (l_cur_flags &POLLWRNORM)|| (l_cur_flags &POLLWRBAND ) ;
@@ -247,7 +248,7 @@ void *dap_worker_thread(void *arg)
         struct kevent * l_kevent_selected = &l_worker->kqueue_events_selected[n];
         if ( l_kevent_selected->filter == EVFILT_USER){ // If we have USER event it sends little different pointer
             dap_events_socket_w_data_t * l_es_w_data = (dap_events_socket_w_data_t *) l_kevent_selected->udata;
-            //if(s_debug_reactor)
+            //if(g_debug_reactor)
             //    log_it(L_DEBUG,"EVFILT_USER: udata=%p", l_es_w_data);
 
             l_cur = l_es_w_data->esocket;
@@ -263,7 +264,7 @@ void *dap_worker_thread(void *arg)
             void * l_ptr = &l_cur->kqueue_event_catched_data;
             if(l_es_w_data != l_ptr){
                 DAP_DELETE(l_es_w_data);
-            }else if (s_debug_reactor){
+            }else if (g_debug_reactor){
                 log_it(L_DEBUG,"Own event signal without actual event data");
             }
         }else{
@@ -278,7 +279,13 @@ void *dap_worker_thread(void *arg)
                 l_flag_rdhup = true;
             l_cur = (dap_events_socket_t*) l_kevent_selected->udata;
         }
-        assert(l_cur);
+
+        if( !l_cur) {
+            log_it(L_WARNING, "dap_events_socket was destroyed earlier");
+            continue;
+        }
+
+
         l_cur->kqueue_event_catched = l_kevent_selected;
 #ifndef DAP_OS_DARWIN
             u_int l_cur_flags = l_kevent_selected->flags;
@@ -293,7 +300,7 @@ void *dap_worker_thread(void *arg)
                 log_it(L_WARNING, "dap_events_socket was destroyed earlier");
                 continue;
             }
-            if(s_debug_reactor) {
+            if(g_debug_reactor) {
                 log_it(L_DEBUG, "--Worker #%u esocket %p uuid 0x%016"DAP_UINT64_FORMAT_x" type %d fd=%"DAP_FORMAT_SOCKET" flags=0x%0X (%s:%s:%s:%s:%s:%s:%s:%s)--",
                        l_worker->id, l_cur, l_cur->uuid, l_cur->type, l_cur->socket,
                     l_cur_flags, l_flag_read?"read":"", l_flag_write?"write":"", l_flag_error?"error":"",
@@ -328,7 +335,7 @@ void *dap_worker_thread(void *arg)
                     break;
                 }
                 default:
-                    if(s_debug_reactor)
+                    if(g_debug_reactor)
                         log_it(L_WARNING, "HUP event on esocket %p (%"DAP_FORMAT_SOCKET") type %d", l_cur, l_cur->socket, l_cur->type );
                 }
             }
@@ -388,8 +395,6 @@ void *dap_worker_thread(void *arg)
                     l_cur->buf_in_size = 0;
                 }
 
-                int32_t l_bytes_read = 0;
-                int l_errno=0;
                 bool l_must_read_smth = false;
                 switch (l_cur->type) {
                     case DESCRIPTOR_TYPE_PIPE:
@@ -435,7 +440,7 @@ void *dap_worker_thread(void *arg)
                         l_bytes_read =  wolfSSL_read(l_ssl, (char *) (l_cur->buf_in + l_cur->buf_in_size),
                                                      l_cur->buf_in_size_max - l_cur->buf_in_size);
                         l_errno = wolfSSL_get_error(l_ssl, 0);
-                        if (l_bytes_read > 0 && s_debug_reactor)
+                        if (l_bytes_read > 0 && g_debug_reactor)
                             log_it(L_DEBUG, "SSL read: %s", (char *)(l_cur->buf_in + l_cur->buf_in_size));
 #endif
                     }
@@ -513,8 +518,8 @@ void *dap_worker_thread(void *arg)
                             l_cur->last_time_active = l_cur_time;
                         }
                         l_cur->buf_in_size += l_bytes_read;
-                        if(s_debug_reactor)
-                            log_it(L_DEBUG, "Received %d bytes for fd %d ", l_bytes_read, l_cur->fd);
+                        if(g_debug_reactor)
+                            log_it(L_DEBUG, "Received %zd bytes for fd %d ", l_bytes_read, l_cur->fd);
                         if(l_cur->callbacks.read_callback){
                             l_cur->callbacks.read_callback(l_cur, NULL); // Call callback to process read event. At the end of callback buf_in_size should be zero if everything was read well
                             if (l_cur->worker == NULL ){ // esocket was unassigned in callback, we don't need any ops with it now,
@@ -522,7 +527,7 @@ void *dap_worker_thread(void *arg)
                                 continue;
                             }
                         }else{
-                            log_it(L_WARNING, "We have incomming %d data but no read callback on socket %"DAP_FORMAT_SOCKET", removing from read set",
+                            log_it(L_WARNING, "We have incomming %zd data but no read callback on socket %"DAP_FORMAT_SOCKET", removing from read set",
                                    l_bytes_read, l_cur->socket);
                             dap_events_socket_set_readable_unsafe(l_cur,false);
                         }
@@ -553,7 +558,7 @@ void *dap_worker_thread(void *arg)
                         }
 #endif
                     }
-                    else if (  (! l_flag_rdhup || !l_flag_error ) && (!(l_cur->flags& DAP_SOCK_CONNECTING )) ) {
+                    else if (!l_flag_rdhup && !l_flag_error && !(l_cur->flags & DAP_SOCK_CONNECTING )) {
                         log_it(L_DEBUG, "EPOLLIN triggered but nothing to read");
                         //dap_events_socket_set_readable_unsafe(l_cur,false);
                     }
@@ -574,17 +579,13 @@ void *dap_worker_thread(void *arg)
                     break;
                     default:{}
                 }
-                if(s_debug_reactor)
+                if(g_debug_reactor)
                     log_it(L_DEBUG, "RDHUP event on esocket %p (%"DAP_FORMAT_SOCKET") type %d", l_cur, l_cur->socket, l_cur->type);
             }
 
             // If its outgoing connection
             if ((l_flag_write && !l_cur->server && l_cur->flags & DAP_SOCK_CONNECTING && l_cur->type == DESCRIPTOR_TYPE_SOCKET_CLIENT) ||
                   (l_cur->type == DESCRIPTOR_TYPE_SOCKET_CLIENT_SSL && l_cur->flags & DAP_SOCK_CONNECTING)) {
-                int l_error = 0;
-                socklen_t l_error_len = sizeof(l_error);
-                char l_error_buf[128];
-                l_error_buf[0]='\0';
                 if (l_cur->type == DESCRIPTOR_TYPE_SOCKET_CLIENT_SSL) {
 #ifndef DAP_NET_CLIENT_NO_SSL
                     WOLFSSL *l_ssl = SSL(l_cur);
@@ -599,7 +600,7 @@ void *dap_worker_thread(void *arg)
                                 l_cur->callbacks.error_callback(l_cur, l_error);
                         }
                     } else {
-                        if(s_debug_reactor)
+                        if(g_debug_reactor)
                             log_it(L_NOTICE, "SSL handshake done with %s", l_cur->remote_addr_str ? l_cur->remote_addr_str: "(NULL)");
                         l_cur->flags ^= DAP_SOCK_CONNECTING;
                         if (l_cur->callbacks.connected_callback)
@@ -608,17 +609,19 @@ void *dap_worker_thread(void *arg)
                     }
 #endif
                 } else {
-                    getsockopt(l_cur->socket, SOL_SOCKET, SO_ERROR, (void *)&l_error, &l_error_len);
-                    if(l_error == EINPROGRESS) {
+                    l_error_len = sizeof(l_errno);
+
+                    getsockopt(l_cur->socket, SOL_SOCKET, SO_ERROR, (void *)&l_errno, &l_error_len);
+                    if(l_errno == EINPROGRESS) {
                         log_it(L_DEBUG, "Connecting with %s in progress...", l_cur->remote_addr_str ? l_cur->remote_addr_str: "(NULL)");
-                    }else if (l_error){
-                        strerror_r(l_error, l_error_buf, sizeof (l_error_buf));
+                    }else if (l_errno){
+                        strerror_r(l_errno, l_error_buf, sizeof (l_error_buf));
                         log_it(L_ERROR,"Connecting error with %s: \"%s\" (code %d)", l_cur->remote_addr_str ? l_cur->remote_addr_str: "(NULL)",
-                               l_error_buf, l_error);
+                               l_error_buf, l_errno);
                         if ( l_cur->callbacks.error_callback )
-                            l_cur->callbacks.error_callback(l_cur, l_error);
+                            l_cur->callbacks.error_callback(l_cur, l_errno);
                     }else{
-                        if(s_debug_reactor)
+                        if(g_debug_reactor)
                             log_it(L_NOTICE, "Connected with %s",l_cur->remote_addr_str ? l_cur->remote_addr_str: "(NULL)");
                         l_cur->flags ^= DAP_SOCK_CONNECTING;
                         if (l_cur->callbacks.connected_callback)
@@ -628,149 +631,140 @@ void *dap_worker_thread(void *arg)
                 }
             }
 
-            // Socket is ready to write and not going to close
-            if(   ( l_flag_write&&(l_cur->flags & DAP_SOCK_READY_TO_WRITE) ) ||
-                 (    (l_cur->flags & DAP_SOCK_READY_TO_WRITE) && !(l_cur->flags & DAP_SOCK_SIGNAL_CLOSE) ) ) {
-                if(s_debug_reactor)
-                    log_it(L_DEBUG, "Main loop output: %zu bytes to send", l_cur->buf_out_size);
+            /*
+             * Socket is ready to write and not going to close
+             */
+            if ( !l_cur->buf_out_size )                                     /* Check firstly that output buffer is not empty */
+            {
+                dap_events_socket_set_writable_unsafe(l_cur, false);        /* Clear "enable write flag" */
 
-                if(l_cur->callbacks.write_callback)
-                    l_cur->callbacks.write_callback(l_cur, NULL); // Call callback to process write event
+                if ( l_cur->callbacks.write_finished_callback )             /* Optionaly call I/O completion routine */
+                    l_cur->callbacks.write_finished_callback(l_cur, l_worker, l_errno);
 
-                if ( l_cur->worker ){ // esocket wasn't unassigned in callback, we need some other ops with it
-                    if(l_cur->flags & DAP_SOCK_READY_TO_WRITE) {
+                l_flag_write = 0;                                           /* Clear flag to exclude unecessary processing of output */
+            }
 
-                        static const uint32_t buf_out_zero_count_max = 2;
-                        //l_cur->buf_out[l_cur->buf_out_size] = 0;
+            l_bytes_sent = 0;
 
-                        if(!l_cur->buf_out_size) {
+            if (   ( l_flag_write && (l_cur->flags & DAP_SOCK_READY_TO_WRITE) ) ||
+                 (    (l_cur->flags & DAP_SOCK_READY_TO_WRITE) && !(l_cur->flags & DAP_SOCK_SIGNAL_CLOSE) ) ) {
 
-                            //log_it(L_WARNING, "Output: nothing to send. Why we are in write socket set?");
-                            l_cur->buf_out_zero_count++;
+                debug_if (g_debug_reactor, L_DEBUG, "Main loop output: %zu bytes to send", l_cur->buf_out_size);
 
-                            if(l_cur->buf_out_zero_count > buf_out_zero_count_max) { // How many time buf_out on write event could be empty
-                                //log_it(L_WARNING, "Output: nothing to send %u times, remove socket from the write set",
-                                //        buf_out_zero_count_max);
-                                dap_events_socket_set_writable_unsafe(l_cur, false);
-                            }
-                        }
-                        else
-                            l_cur->buf_out_zero_count = 0;
-                    }
-                    //for(total_sent = 0; total_sent < cur->buf_out_size;) { // If after callback there is smth to send - we do it
-                    ssize_t l_bytes_sent =0;
-                    int l_errno=0;
-
-                    switch (l_cur->type){
-                        case DESCRIPTOR_TYPE_SOCKET_CLIENT: {
-                            l_bytes_sent = send(l_cur->socket, (const char *)l_cur->buf_out,
-                                                l_cur->buf_out_size, MSG_DONTWAIT | MSG_NOSIGNAL);
+                if(l_cur->callbacks.write_callback)
+                    l_cur->callbacks.write_callback(l_cur, NULL);           /* Call callback to process write event */
+
+                if ( l_cur->worker ){ // esocket wasn't unassigned in callback, we need some other ops with it
+                        switch (l_cur->type){
+                            case DESCRIPTOR_TYPE_SOCKET_CLIENT: {
+                                l_bytes_sent = send(l_cur->socket, (const char *)l_cur->buf_out,
+                                                    l_cur->buf_out_size, MSG_DONTWAIT | MSG_NOSIGNAL);
 #ifdef DAP_OS_WINDOWS
-                            //dap_events_socket_set_writable_unsafe(l_cur,false); // enabling this will break windows server replies
-                            l_errno = WSAGetLastError();
+                                //dap_events_socket_set_writable_unsafe(l_cur,false); // enabling this will break windows server replies
+                                l_errno = WSAGetLastError();
 #else
-                            l_errno = errno;
+                                l_errno = errno;
 #endif
-                        }
-                        break;
-                        case DESCRIPTOR_TYPE_SOCKET_UDP:
-                            l_bytes_sent = sendto(l_cur->socket, (const char *)l_cur->buf_out,
-                                                  l_cur->buf_out_size, MSG_DONTWAIT | MSG_NOSIGNAL,
-                                                  (struct sockaddr *)&l_cur->remote_addr, sizeof(l_cur->remote_addr));
+                            }
+                            break;
+                            case DESCRIPTOR_TYPE_SOCKET_UDP:
+                                l_bytes_sent = sendto(l_cur->socket, (const char *)l_cur->buf_out,
+                                                      l_cur->buf_out_size, MSG_DONTWAIT | MSG_NOSIGNAL,
+                                                      (struct sockaddr *)&l_cur->remote_addr, sizeof(l_cur->remote_addr));
 #ifdef DAP_OS_WINDOWS
-                            dap_events_socket_set_writable_unsafe(l_cur,false);
-                            l_errno = WSAGetLastError();
+                                dap_events_socket_set_writable_unsafe(l_cur,false);
+                                l_errno = WSAGetLastError();
 #else
-                            l_errno = errno;
+                                l_errno = errno;
 #endif
-                        break;
-                        case DESCRIPTOR_TYPE_SOCKET_CLIENT_SSL: {
+                            break;
+                            case DESCRIPTOR_TYPE_SOCKET_CLIENT_SSL: {
 #ifndef DAP_NET_CLIENT_NO_SSL
-                            WOLFSSL *l_ssl = SSL(l_cur);
-                            l_bytes_sent = wolfSSL_write(l_ssl, (char *)(l_cur->buf_out), l_cur->buf_out_size);
-                            if (l_bytes_sent > 0)
-                                log_it(L_DEBUG, "SSL write: %s", (char *)(l_cur->buf_out));
-                            l_errno = wolfSSL_get_error(l_ssl, 0);
+                                WOLFSSL *l_ssl = SSL(l_cur);
+                                l_bytes_sent = wolfSSL_write(l_ssl, (char *)(l_cur->buf_out), l_cur->buf_out_size);
+                                if (l_bytes_sent > 0)
+                                    log_it(L_DEBUG, "SSL write: %s", (char *)(l_cur->buf_out));
+                                l_errno = wolfSSL_get_error(l_ssl, 0);
 #endif
-                        }
-                        case DESCRIPTOR_TYPE_QUEUE:
-                             if (l_cur->flags & DAP_SOCK_QUEUE_PTR && l_cur->buf_out_size>= sizeof (void*)){
+                            }
+                            case DESCRIPTOR_TYPE_QUEUE:
+                                 if (l_cur->flags & DAP_SOCK_QUEUE_PTR && l_cur->buf_out_size>= sizeof (void*)){
 #if defined(DAP_EVENTS_CAPS_QUEUE_PIPE2)
-                                l_bytes_sent = write(l_cur->socket, l_cur->buf_out, sizeof (void *) ); // We send pointer by pointer
+                                    l_bytes_sent = write(l_cur->socket, l_cur->buf_out, sizeof (void *) ); // We send pointer by pointer
 #elif defined (DAP_EVENTS_CAPS_QUEUE_POSIX)
-                                l_bytes_sent = mq_send(a_es->mqd, (const char *)&a_arg,sizeof (a_arg),0);
+                                    l_bytes_sent = mq_send(a_es->mqd, (const char *)&a_arg,sizeof (a_arg),0);
 #elif defined DAP_EVENTS_CAPS_MSMQ
-                                 DWORD l_mp_id = 0;
-                                 MQMSGPROPS    l_mps;
-                                 MQPROPVARIANT l_mpvar[1];
-                                 MSGPROPID     l_p_id[1];
-                                 HRESULT       l_mstatus[1];
-
-                                 l_p_id[l_mp_id] = PROPID_M_BODY;
-                                 l_mpvar[l_mp_id].vt = VT_VECTOR | VT_UI1;
-                                 l_mpvar[l_mp_id].caub.pElems = l_cur->buf_out;
-                                 l_mpvar[l_mp_id].caub.cElems = (u_long)sizeof(void*);
-                                 l_mp_id++;
-
-                                 l_mps.cProp = l_mp_id;
-                                 l_mps.aPropID = l_p_id;
-                                 l_mps.aPropVar = l_mpvar;
-                                 l_mps.aStatus = l_mstatus;
-                                 HRESULT hr = MQSendMessage(l_cur->mqh, &l_mps, MQ_NO_TRANSACTION);
-
-                                 if (hr != MQ_OK) {
-                                     l_errno = hr;
-                                     log_it(L_ERROR, "An error occured on sending message to queue, errno: %ld", hr);
-                                     break;
-                                 } else {
-                                     l_errno = WSAGetLastError();
-
-                                     if(dap_sendto(l_cur->socket, l_cur->port, NULL, 0) == SOCKET_ERROR) {
-                                         log_it(L_ERROR, "Write to socket error: %d", WSAGetLastError());
-                                     }
-                                     l_bytes_sent = sizeof(void*);
-                                     dap_events_socket_set_writable_unsafe(l_cur,false);
+                                     DWORD l_mp_id = 0;
+                                     MQMSGPROPS    l_mps;
+                                     MQPROPVARIANT l_mpvar[1];
+                                     MSGPROPID     l_p_id[1];
+                                     HRESULT       l_mstatus[1];
+
+                                     l_p_id[l_mp_id] = PROPID_M_BODY;
+                                     l_mpvar[l_mp_id].vt = VT_VECTOR | VT_UI1;
+                                     l_mpvar[l_mp_id].caub.pElems = l_cur->buf_out;
+                                     l_mpvar[l_mp_id].caub.cElems = (u_long)sizeof(void*);
+                                     l_mp_id++;
+
+                                     l_mps.cProp = l_mp_id;
+                                     l_mps.aPropID = l_p_id;
+                                     l_mps.aPropVar = l_mpvar;
+                                     l_mps.aStatus = l_mstatus;
+                                     HRESULT hr = MQSendMessage(l_cur->mqh, &l_mps, MQ_NO_TRANSACTION);
+
+                                     if (hr != MQ_OK) {
+                                         l_errno = hr;
+                                         log_it(L_ERROR, "An error occured on sending message to queue, errno: %ld", hr);
+                                         break;
+                                     } else {
+                                         l_errno = WSAGetLastError();
+
+                                         if(dap_sendto(l_cur->socket, l_cur->port, NULL, 0) == SOCKET_ERROR) {
+                                             log_it(L_ERROR, "Write to socket error: %d", WSAGetLastError());
+                                         }
+                                         l_bytes_sent = sizeof(void*);
+                                         dap_events_socket_set_writable_unsafe(l_cur,false);
 
-                                 }
+                                     }
 #elif defined (DAP_EVENTS_CAPS_QUEUE_MQUEUE)
-                                l_bytes_sent = mq_send(l_cur->mqd , (const char *)l_cur->buf_out,sizeof (void*),0);
-                                if(l_bytes_sent == 0)
-                                    l_bytes_sent = sizeof (void*);
-                                l_errno = errno;
-                                if (l_bytes_sent == -1 && l_errno == EINVAL) // To make compatible with other
-                                    l_errno = EAGAIN;                        // non-blocking sockets
-#elif defined (DAP_EVENTS_CAPS_KQUEUE)
-                                struct kevent* l_event=&l_cur->kqueue_event;
-                                dap_events_socket_w_data_t * l_es_w_data = DAP_NEW_Z(dap_events_socket_w_data_t);
-                                l_es_w_data->esocket = l_cur;
-                                memcpy(&l_es_w_data->ptr, l_cur->buf_out,sizeof(l_cur));
-                                EV_SET(l_event,l_cur->socket, l_cur->kqueue_base_filter,l_cur->kqueue_base_flags, l_cur->kqueue_base_fflags,l_cur->kqueue_data, l_es_w_data);
-                                int l_n = kevent(l_worker->kqueue_fd,l_event,1,NULL,0,NULL);
-                                if (l_n == 1){
-                                    l_bytes_sent = sizeof(l_cur);
-                                }else{
+                                    l_bytes_sent = mq_send(l_cur->mqd , (const char *)l_cur->buf_out,sizeof (void*),0);
+                                    if(l_bytes_sent == 0)
+                                        l_bytes_sent = sizeof (void*);
                                     l_errno = errno;
-                                    log_it(L_WARNING,"queue ptr send error: kevent %p errno: %d", l_es_w_data, l_errno);
-                                    DAP_DELETE(l_es_w_data);
-                                }
+                                    if (l_bytes_sent == -1 && l_errno == EINVAL) // To make compatible with other
+                                        l_errno = EAGAIN;                        // non-blocking sockets
+#elif defined (DAP_EVENTS_CAPS_KQUEUE)
+                                    struct kevent* l_event=&l_cur->kqueue_event;
+                                    dap_events_socket_w_data_t * l_es_w_data = DAP_NEW_Z(dap_events_socket_w_data_t);
+                                    l_es_w_data->esocket = l_cur;
+                                    memcpy(&l_es_w_data->ptr, l_cur->buf_out,sizeof(l_cur));
+                                    EV_SET(l_event,l_cur->socket, l_cur->kqueue_base_filter,l_cur->kqueue_base_flags, l_cur->kqueue_base_fflags,l_cur->kqueue_data, l_es_w_data);
+                                    int l_n = kevent(l_worker->kqueue_fd,l_event,1,NULL,0,NULL);
+                                    if (l_n == 1){
+                                        l_bytes_sent = sizeof(l_cur);
+                                    }else{
+                                        l_errno = errno;
+                                        log_it(L_WARNING,"queue ptr send error: kevent %p errno: %d", l_es_w_data, l_errno);
+                                        DAP_DELETE(l_es_w_data);
+                                    }
 
 #else
 #error "Not implemented dap_events_socket_queue_ptr_send() for this platform"
 #endif
-                            }else{
-                                 assert("Not implemented non-ptr queue send from outgoing buffer");
-                                 // TODO Implement non-ptr queue output
-                             }
-                        break;
-                        case DESCRIPTOR_TYPE_PIPE:
-                        case DESCRIPTOR_TYPE_FILE:
-                            l_bytes_sent = write(l_cur->fd, (char *) (l_cur->buf_out), l_cur->buf_out_size );
-                            l_errno = errno;
-                        break;
-                        default:
-                            log_it(L_WARNING, "Socket %"DAP_FORMAT_SOCKET" is not SOCKET, PIPE or FILE but has WRITE state on. Switching it off", l_cur->socket);
-                            dap_events_socket_set_writable_unsafe(l_cur,false);
-                    }
+                                }else{
+                                     assert("Not implemented non-ptr queue send from outgoing buffer");
+                                     // TODO Implement non-ptr queue output
+                                 }
+                            break;
+                            case DESCRIPTOR_TYPE_PIPE:
+                            case DESCRIPTOR_TYPE_FILE:
+                                l_bytes_sent = write(l_cur->fd, (char *) (l_cur->buf_out), l_cur->buf_out_size );
+                                l_errno = errno;
+                            break;
+                            default:
+                                log_it(L_WARNING, "Socket %"DAP_FORMAT_SOCKET" is not SOCKET, PIPE or FILE but has WRITE state on. Switching it off", l_cur->socket);
+                                dap_events_socket_set_writable_unsafe(l_cur,false);
+                        }
 
                     if(l_bytes_sent < 0) {
 #ifdef DAP_OS_WINDOWS
@@ -798,6 +792,9 @@ void *dap_worker_thread(void *arg)
                     }else{
                         //log_it(L_DEBUG, "Output: %u from %u bytes are sent ", l_bytes_sent,l_cur->buf_out_size);
                         if (l_bytes_sent) {
+                            if (l_cur->type == DESCRIPTOR_TYPE_SOCKET_CLIENT  || l_cur->type == DESCRIPTOR_TYPE_SOCKET_UDP) {
+                                l_cur->last_time_active = l_cur_time;
+                            }
                             if ( l_bytes_sent <= (ssize_t) l_cur->buf_out_size ){
                                 l_cur->buf_out_size -= l_bytes_sent;
                                 if (l_cur->buf_out_size ) {
@@ -810,15 +807,25 @@ void *dap_worker_thread(void *arg)
                         }
                     }
                 }
+
+                /*
+                 * If whole buffer has been sent (or it was clrered) - clear "write flag" for socket/file descriptor to prevent
+                 * generation of unexpected I/O events like POLLOUT and consuming CPU by this.
+                 */
+                if ( (l_cur->buf_out_size ) || (l_bytes_sent == l_cur->buf_out_size) )
+                {
+                    dap_events_socket_set_writable_unsafe(l_cur, false);/* Clear "enable write flag" */
+
+                    if ( l_cur->callbacks.write_finished_callback )     /* Optionaly call I/O completion routine */
+                        l_cur->callbacks.write_finished_callback(l_cur, l_worker, l_errno);
+                }
             }
-            if (l_cur->buf_out_size) {
-                dap_events_socket_set_writable_unsafe(l_cur,true);
-            }
+
 
             if (l_cur->flags & DAP_SOCK_SIGNAL_CLOSE)
             {
                 if (l_cur->buf_out_size == 0) {
-                    if(s_debug_reactor)
+                    if(g_debug_reactor)
                         log_it(L_INFO, "Process signal to close %s sock %"DAP_FORMAT_SOCKET" (ptr 0x%p uuid 0x%016"DAP_UINT64_FORMAT_x") type %d [thread %u]",
                            l_cur->remote_addr_str ? l_cur->remote_addr_str : "", l_cur->socket, l_cur, l_cur->uuid,
                                l_cur->type, l_tn);
@@ -843,7 +850,7 @@ void *dap_worker_thread(void *arg)
                         if(l_es_selected == NULL || l_es_selected == l_cur ){
                             if(l_es_selected == NULL)
                                 log_it(L_CRITICAL,"NULL esocket found when cleaning selected list");
-                            else if(s_debug_reactor)
+                            else if(g_debug_reactor)
                                 log_it(L_INFO,"Duplicate esockets removed from selected event list");
                             n=nn; // TODO here we need to make smth like poll() array compressing.
                                   // Here we expect thats event duplicates goes together in it. If not - we lose some events between.
@@ -855,7 +862,7 @@ void *dap_worker_thread(void *arg)
                     l_worker->kqueue_events_count--;
 #endif
                 } else if (l_cur->buf_out_size ) {
-                    if(s_debug_reactor)
+                    if(g_debug_reactor)
                         log_it(L_INFO, "Got signal to close %s sock %"DAP_FORMAT_SOCKET" [thread %u] type %d but buffer is not empty(%zu)",
                            l_cur->remote_addr_str ? l_cur->remote_addr_str : "", l_cur->socket, l_cur->type, l_tn,
                            l_cur->buf_out_size);
@@ -913,7 +920,7 @@ static void s_queue_add_es_callback( dap_events_socket_t * a_es, void * a_arg)
         return;
     }
 
-    if(s_debug_reactor)
+    if(g_debug_reactor)
         log_it(L_NOTICE, "Received event socket %p (ident %"DAP_FORMAT_SOCKET" type %d) to add on worker", l_es_new, l_es_new->socket, l_es_new->type);
 
     switch( l_es_new->type){
@@ -1049,7 +1056,7 @@ static void s_event_exit_callback( dap_events_socket_t * a_es, uint64_t a_flags)
 {
     (void) a_flags;
     a_es->worker->signal_exit = true;
-    if(s_debug_reactor)
+    if(g_debug_reactor)
         log_it(L_DEBUG, "Worker :%u signaled to exit", a_es->worker->id);
 }
 
@@ -1110,7 +1117,7 @@ static bool s_socket_all_check_activity( void * a_arg)
     dap_events_socket_t *l_es = NULL, *tmp = NULL;
     char l_curtimebuf[64];
     time_t l_curtime= time(NULL);
-    dap_ctime_r(&l_curtime, l_curtimebuf);
+    //dap_ctime_r(&l_curtime, l_curtimebuf);
     //log_it(L_DEBUG,"Check sockets activity on worker #%u at %s", l_worker->id, l_curtimebuf);
     pthread_rwlock_rdlock(&l_worker->esocket_rwlock);
     HASH_ITER(hh_worker, l_worker->esockets, l_es, tmp ) {
@@ -1146,7 +1153,7 @@ void dap_worker_add_events_socket(dap_events_socket_t * a_events_socket, dap_wor
         a_events_socket->worker = NULL;
 
 #else*/
-    if(s_debug_reactor)
+    if(g_debug_reactor)
         log_it(L_DEBUG,"Worker add esocket %"DAP_FORMAT_SOCKET, a_events_socket->socket);
     int l_ret = dap_events_socket_queue_ptr_send( a_worker->queue_es_new, a_events_socket );
     if(l_ret != 0 ){
@@ -1181,7 +1188,7 @@ void dap_worker_add_events_socket_inter(dap_events_socket_t * a_es_input, dap_ev
  */
 int dap_worker_add_events_socket_unsafe( dap_events_socket_t * a_esocket, dap_worker_t * a_worker )
 {
-    if(s_debug_reactor){
+    if(g_debug_reactor){
         log_it(L_DEBUG,"Add event socket %p (socket %"DAP_FORMAT_SOCKET")", a_esocket, a_esocket->socket);
     }
 #ifdef DAP_EVENTS_CAPS_EPOLL
@@ -1243,7 +1250,7 @@ int dap_worker_add_events_socket_unsafe( dap_events_socket_t * a_esocket, dap_wo
             if( kevent( l_kqueue_fd,&l_event,1,NULL,0,NULL) != 0 ){
                 l_is_error = true;
                 l_errno = errno;
-            }else if (s_debug_reactor){
+            }else if (g_debug_reactor){
                 log_it(L_DEBUG, "kevent set custom filter %d on fd %d",l_filter, a_esocket->socket);
             }
         }else{
@@ -1252,7 +1259,7 @@ int dap_worker_add_events_socket_unsafe( dap_events_socket_t * a_esocket, dap_wo
                 if( kevent( l_kqueue_fd,&l_event,1,NULL,0,NULL) != 0 ){
                     l_is_error = true;
                     l_errno = errno;
-                }else if (s_debug_reactor){
+                }else if (g_debug_reactor){
                     log_it(L_DEBUG, "kevent set EVFILT_READ on fd %d", a_esocket->socket);
                 }
 
@@ -1263,7 +1270,7 @@ int dap_worker_add_events_socket_unsafe( dap_events_socket_t * a_esocket, dap_wo
                     if(kevent( l_kqueue_fd,&l_event,1,NULL,0,NULL) != 0){
                         l_is_error = true;
                         l_errno = errno;
-                    }else if (s_debug_reactor){
+                    }else if (g_debug_reactor){
                         log_it(L_DEBUG, "kevent set EVFILT_WRITE on fd %d", a_esocket->socket);
                     }
                 }
diff --git a/dap-sdk/net/core/include/dap_events.h b/dap-sdk/net/core/include/dap_events.h
index 52c38815e5f828b37423ae9cfa07335e74c0c66b..c1071d5aac1a3efa8d5002ed6ccdf0f8fe14c1bd 100644
--- a/dap-sdk/net/core/include/dap_events.h
+++ b/dap-sdk/net/core/include/dap_events.h
@@ -47,6 +47,8 @@ typedef struct dap_events {
 extern "C" {
 #endif
 
+extern bool g_debug_reactor;
+
 int dap_events_init( uint32_t a_threads_count, size_t a_conn_timeout ); // Init server module
 void dap_events_deinit( ); // Deinit server module
 
diff --git a/dap-sdk/net/core/include/dap_events_socket.h b/dap-sdk/net/core/include/dap_events_socket.h
index af6733c2beefa4b9a93051977974fa3c24b5f8e8..7df579ff05e84863b5658c5d1200601250c46752 100644
--- a/dap-sdk/net/core/include/dap_events_socket.h
+++ b/dap-sdk/net/core/include/dap_events_socket.h
@@ -101,11 +101,12 @@ typedef int SOCKET;
 #endif
 
 #define BIT( x ) ( 1 << x )
-#define DAP_SOCK_READY_TO_READ     BIT( 0 )
-#define DAP_SOCK_READY_TO_WRITE    BIT( 1 )
-#define DAP_SOCK_SIGNAL_CLOSE      BIT( 2 )
-#define DAP_SOCK_CONNECTING         BIT( 3 ) // When connection happens this flag is armed for outgoing connections until its establish the connection
-#define DAP_SOCK_REASSIGN_ONCE     BIT( 4 )   // This usable for FlowControl to prevent multiple reassigment
+#define DAP_SOCK_READY_TO_READ      BIT( 0 )
+#define DAP_SOCK_READY_TO_WRITE     BIT( 1 )
+#define DAP_SOCK_SIGNAL_CLOSE       BIT( 2 )
+#define DAP_SOCK_CONNECTING         BIT( 3 )    // When connection happens this flag is armed for outgoing connections until its establish the connection
+#define DAP_SOCK_REASSIGN_ONCE      BIT( 4 )    // This usable for FlowControl to prevent multiple reassigment
+//#define DAP_SOCK_DROP_WRITE_IF_ZERO BIT( 5 )    // Drop down WRITE flag from socket if reach zero bytes in output buffer
 
 // If set - queue limited to sizeof(void*) size of data transmitted
 #define DAP_SOCK_QUEUE_PTR         BIT( 8 )
@@ -127,29 +128,35 @@ typedef void (*dap_events_socket_callback_accept_t) (dap_events_socket_t * , SOC
 typedef void (*dap_events_socket_callback_connected_t) (dap_events_socket_t * ); // Callback for connected client connection
 typedef void (*dap_events_socket_worker_callback_t) (dap_events_socket_t *,dap_worker_t * ); // Callback for specific client operations
 
+
+                                                                            /* A callback routine is supposed to be called on completion I/O */
+typedef void (*dap_events_socket_worker_complete_io_t) (dap_events_socket_t *, dap_worker_t *, int a_errno);
+
 typedef struct dap_events_socket_callbacks {
     union{ // Specific callbacks
-        dap_events_socket_callback_connected_t connected_callback; // Connected callback for client socket
-        dap_events_socket_callback_accept_t accept_callback; // Accept callback for listening socket
-        dap_events_socket_callback_event_t event_callback; // Event callback for listening socket
-        dap_events_socket_callback_queue_t queue_callback; // Queue callback for listening socket
-        dap_events_socket_callback_queue_ptr_t queue_ptr_callback; // queue_ptr callback for listening socket
+        dap_events_socket_callback_connected_t connected_callback;          /* Connected callback for client socket */
+        dap_events_socket_callback_accept_t accept_callback;                /* Accept callback for listening socket */
+        dap_events_socket_callback_event_t event_callback;                  /* Event callback for listening socket */
+        dap_events_socket_callback_queue_t queue_callback;                  /* Queue callback for listening socket */
+        dap_events_socket_callback_queue_ptr_t queue_ptr_callback;          /* queue_ptr callback for listening socket */
     };
 
-    dap_events_socket_callback_timer_t timer_callback; // Timer callback for listening socket
-    dap_events_socket_callback_t new_callback; // Create new client callback
-    dap_events_socket_callback_t delete_callback; // Delete client callback
-    dap_events_socket_callback_t read_callback; // Read function
-    dap_events_socket_callback_t write_callback; // Write function
-    dap_events_socket_callback_error_t error_callback; // Error processing function
+    dap_events_socket_callback_timer_t timer_callback;                      /* Timer callback for listening socket */
+    dap_events_socket_callback_t new_callback;                              /* Create new client callback */
+    dap_events_socket_callback_t delete_callback;                           /* Delete client callback */
+    dap_events_socket_callback_t read_callback;                             /* Read function */
+    dap_events_socket_callback_t write_callback;                            /* Write function */
+    dap_events_socket_worker_complete_io_t write_finished_callback;         /* Called on completion Write operation */
+    dap_events_socket_callback_error_t error_callback;                      /* Error processing function */
 
-    dap_events_socket_worker_callback_t worker_assign_callback; // After successful worker assign
-    dap_events_socket_worker_callback_t worker_unassign_callback; // After successful worker unassign
+    dap_events_socket_worker_callback_t worker_assign_callback;             /* After successful worker assign */
+    dap_events_socket_worker_callback_t worker_unassign_callback;           /* After successful worker unassign */
 
 } dap_events_socket_callbacks_t;
 
-#define DAP_EVENTS_SOCKET_BUF       100000
-#define DAP_EVENTS_SOCKET_BUF_LIMIT 500000
+#define DAP_STREAM_PKT_SIZE_MAX     (1 * 1024 * 1024)
+#define DAP_EVENTS_SOCKET_BUF       DAP_STREAM_PKT_SIZE_MAX
+#define DAP_EVENTS_SOCKET_BUF_LIMIT (DAP_STREAM_PKT_SIZE_MAX * 4)
 #define DAP_QUEUE_MAX_MSGS          8
 
 typedef enum {
@@ -215,31 +222,23 @@ typedef struct dap_events_socket {
     uint32_t buf_out_zero_count;
 
     // Input section
-        //uint8_t buf_in[DAP_EVENTS_SOCKET_BUF+1]; // Internal buffer for input data
-        //char buf_in_str[DAP_EVENTS_SOCKET_BUF+1];
     byte_t  *buf_in;
     size_t buf_in_size_max; //  size of alloced buffer
         //char    *buf_in_str;
     size_t buf_in_size; // size of data that is in the input buffer
 
     // Output section
-
-    //byte_t buf_out[DAP_EVENTS_SOCKET_BUF+1]; // Internal buffer for output data
     byte_t *buf_out;
     size_t buf_out_size; // size of data that is in the output buffer
     size_t buf_out_size_max; // max size of data
     dap_events_socket_t * pipe_out; // Pipe socket with data for output
 
     // Stored string representation
-    //char hostaddr[1024]; // Address
-    //char service[128];
     char *hostaddr;
     char *service;
 
     // Remote address, port and others
     struct sockaddr_in remote_addr;
-    //char remote_addr_str[INET_ADDRSTRLEN];
-    //char remote_addr_str6[INET6_ADDRSTRLEN];
     char *remote_addr_str;
     char *remote_addr_str6;
     short remote_port;
diff --git a/dap-sdk/net/core/include/dap_proc_thread.h b/dap-sdk/net/core/include/dap_proc_thread.h
index 6e87433c02165152a7ce0f3a22b877c85f6e2ca8..f891b879e8c47cd62dcb79b645b45b6e0f0b7485 100644
--- a/dap-sdk/net/core/include/dap_proc_thread.h
+++ b/dap-sdk/net/core/include/dap_proc_thread.h
@@ -24,9 +24,9 @@
 #pragma once
 
 #include <pthread.h>
-#include "dap_common.h"
 #include "dap_proc_queue.h"
 #include "dap_worker.h"
+#include "dap_common.h"
 
 typedef struct dap_proc_thread{
     uint32_t    cpu_id;
diff --git a/dap-sdk/net/core/include/dap_worker.h b/dap-sdk/net/core/include/dap_worker.h
index 3aba8d78c3b0242e925c410962fce02409d30278..e21a94fb9afc50cb8e9fe8374441f32630b1f54c 100644
--- a/dap-sdk/net/core/include/dap_worker.h
+++ b/dap-sdk/net/core/include/dap_worker.h
@@ -22,10 +22,11 @@
 */
 #pragma once
 
+#include <pthread.h>
 #include "dap_events_socket.h"
 #include "dap_proc_queue.h"
-#include <pthread.h>
 #include "dap_common.h"
+#include "dap_events.h"
 
 //typedef struct dap_proc_queue dap_proc_queue_t;
 typedef struct dap_timerfd dap_timerfd_t;
diff --git a/dap-sdk/net/server/http_server/http_client/dap_http_client.c b/dap-sdk/net/server/http_server/http_client/dap_http_client.c
index 87b9f0a39f4dfface18591294713b9f06acf88ed..0081fdb83ec06cc6b213d4dc1cf028473b149380 100644
--- a/dap-sdk/net/server/http_server/http_client/dap_http_client.c
+++ b/dap-sdk/net/server/http_server/http_client/dap_http_client.c
@@ -39,6 +39,7 @@
 #include "dap_config.h"
 #include "dap_events_socket.h"
 
+#include "dap_time.h"
 #include "dap_http.h"
 #include "http_status_code.h"
 
@@ -371,25 +372,25 @@ void dap_http_client_read( dap_events_socket_t *a_esocket, void *a_arg )
                     break;
                 }
 
-                char *l_query_string;
-                if( (l_query_string = strchr(l_http_client->url_path, '?')) != NULL ) {
-                    size_t len_after = MIN(strlen( l_query_string + 1 ), sizeof (l_http_client->url_path)-1);
+                char *l_query_string = strchr(l_http_client->url_path, '?');
+                if (l_query_string++) {
+                    size_t len_after = MIN(strlen(l_query_string), sizeof(l_http_client->url_path) - 1);
 
                     if ( len_after ) {
                         if( len_after > (sizeof(l_http_client->in_query_string) - 1) ){
                             len_after = sizeof(l_http_client->in_query_string) - 1;
                         }
-
-                        if ( strstr(l_query_string, "HTTP/1.1") ){
-                            strncpy( l_http_client->in_query_string, l_query_string + 1, len_after - 8 );
-                        }else{
-                            strncpy( l_http_client->in_query_string,l_query_string + 1, len_after );
-                        }
-
-                        if ( l_http_client->in_query_string[strlen(l_http_client->in_query_string) - 1] == ' ' ){
-                            l_http_client->in_query_string[strlen(l_http_client->in_query_string) - 1] = 0;
+                        char *l_pos = strstr(l_query_string, "HTTP/1.1");
+                        //Search for the first occurrence.
+                        if (l_pos-- && *l_pos == ' ')
+                            strncpy(l_http_client->in_query_string, l_query_string, len_after - (l_pos - l_query_string));
+                        else
+                            strncpy( l_http_client->in_query_string, l_query_string, len_after);
+                        size_t l_in_query_len = strlen(l_http_client->in_query_string);
+                        if (l_in_query_len && l_http_client->in_query_string[l_in_query_len - 1] == ' ' ){
+                            l_http_client->in_query_string[l_in_query_len - 1] = 0;
                         }
-                        l_query_string[0] = 0;
+                        *(l_query_string - 1) = 0;
                     }
                 }
 
diff --git a/dap-sdk/net/server/notify_server/include/dap_notify_srv.h b/dap-sdk/net/server/notify_server/include/dap_notify_srv.h
index b6ace1bd8e0f9f58eb488cf51897016e07540626..dadd0220f205ac60b533c0da67d7e9dace32f6ae 100644
--- a/dap-sdk/net/server/notify_server/include/dap_notify_srv.h
+++ b/dap-sdk/net/server/notify_server/include/dap_notify_srv.h
@@ -26,4 +26,5 @@
 int dap_notify_server_init();
 void dap_notify_server_deinit();
 int dap_notify_server_send_f_inter(uint32_t a_worker_id, const char * a_format,...);
+int dap_notify_server_send_mt(const char * a_data);
 int dap_notify_server_send_f_mt(const char * a_format,...);
diff --git a/dap-sdk/net/server/notify_server/src/dap_notify_srv.c b/dap-sdk/net/server/notify_server/src/dap_notify_srv.c
index b728fd1c1eab299de207b90e83cb9e35b98b3e7f..9b79bd6e7b296707299baba0b2930843223ffa11 100644
--- a/dap-sdk/net/server/notify_server/src/dap_notify_srv.c
+++ b/dap-sdk/net/server/notify_server/src/dap_notify_srv.c
@@ -132,6 +132,19 @@ int dap_notify_server_send_f_inter(uint32_t a_worker_id, const char * a_format,.
     return dap_events_socket_queue_ptr_send_to_input(l_input,l_str);
 }
 
+/**
+ * @brief dap_notify_server_send_fmt_mt
+ * @param a_format
+ * @return
+ */
+int dap_notify_server_send_mt(const char *a_data)
+{
+    if(!s_notify_server_queue) // If not initialized - nothing to notify
+        return 0;
+    return dap_events_socket_queue_ptr_send(s_notify_server_queue, dap_strdup(a_data));
+}
+
+
 /**
  * @brief dap_notify_server_send_fmt_mt
  * @param a_format
diff --git a/dap-sdk/net/stream/ch/dap_stream_ch.c b/dap-sdk/net/stream/ch/dap_stream_ch.c
index 89064cc99942358e735db9273396506f5faf8583..9743a669d5f39688de8e484646a7cf29ca3c95f8 100644
--- a/dap-sdk/net/stream/ch/dap_stream_ch.c
+++ b/dap-sdk/net/stream/ch/dap_stream_ch.c
@@ -36,6 +36,7 @@
 #include <pthread.h>
 
 #include "dap_common.h"
+#include "dap_events.h"
 #include "dap_events_socket.h"
 #include "dap_http_client.h"
 #include "dap_uuid.h"
@@ -197,3 +198,27 @@ void dap_stream_ch_set_ready_to_write_unsafe(dap_stream_ch_t * ch,bool is_ready)
     }
 }
 
+static void s_print_workers_channels()
+{
+    uint32_t l_worker_count = dap_events_worker_get_count();
+    dap_stream_ch_t* l_msg_ch = NULL;
+    dap_stream_ch_t* l_msg_ch_tmp = NULL;
+    //print all worker connections
+    dap_events_worker_print_all();
+    for (uint32_t i = 0; i < l_worker_count; i++){
+        uint32_t l_channel_count = 0;
+        dap_worker_t* l_worker = dap_events_worker_get(i);
+        if (!l_worker) {
+            log_it(L_CRITICAL, "Can't get stream worker - worker thread don't exist");
+            continue;
+        }
+        dap_stream_worker_t* l_stream_worker = DAP_STREAM_WORKER(l_worker);
+        if (l_stream_worker->channels)
+            HASH_ITER(hh_worker, l_stream_worker->channels, l_msg_ch, l_msg_ch_tmp) {
+                //log_it(L_DEBUG, "Worker id = %d, channel uuid = 0x%llx", l_worker->id, l_msg_ch->uuid);
+                l_channel_count += 1;
+        }
+        log_it(L_DEBUG, "Active workers l_channel_count = %d on worker %d", l_channel_count, l_stream_worker->worker->id);
+    }
+    return;
+}
diff --git a/dap-sdk/net/stream/stream/dap_stream.c b/dap-sdk/net/stream/stream/dap_stream.c
index 144a4ad6c88e92784ba4e12023247da0fec1a933..359d81b5348b175d8c0aa853388aa0b3ea153682 100644
--- a/dap-sdk/net/stream/stream/dap_stream.c
+++ b/dap-sdk/net/stream/stream/dap_stream.c
@@ -693,7 +693,7 @@ size_t dap_stream_data_proc_read (dap_stream_t *a_stream)
      //   log_it(DEBUG,"No prefill or defrag buffer, process directly buf_in");
     // Now lets see how many packets we have in buffer now
     while ( (pkt = dap_stream_pkt_detect( proc_data , bytes_left_to_read)) ){
-        if(pkt->hdr.size > STREAM_PKT_SIZE_MAX ){
+        if(pkt->hdr.size > DAP_STREAM_PKT_SIZE_MAX ){
             //log_it(L_ERROR, "stream_pkt_detect() Too big packet size %u",
             //       pkt->hdr.size);
             bytes_left_to_read=0;
diff --git a/dap-sdk/net/stream/stream/dap_stream_pkt.c b/dap-sdk/net/stream/stream/dap_stream_pkt.c
index 5031551bd08450b3ad17b6a3c5db7a5c22b3af91..022fc64dbe1e1ea546a23ebafbd766cacd90b52c 100644
--- a/dap-sdk/net/stream/stream/dap_stream_pkt.c
+++ b/dap-sdk/net/stream/stream/dap_stream_pkt.c
@@ -52,44 +52,44 @@
 #include "dap_stream_ch.h"
 #include "dap_stream_ch_pkt.h"
 #include "dap_stream_ch_proc.h"
+#include "dap_stream_pkt.h"
+
 
 #include "dap_enc_iaes.h"
 
 #define LOG_TAG "stream_pkt"
 
-
-
-static const size_t s_dap_hdr_size=8+2+1+1+4;
-const uint8_t c_dap_stream_sig[8]={0xa0,0x95,0x96,0xa9,0x9e,0x5c,0xfb,0xfa};
+const uint8_t c_dap_stream_sig [STREAM_PKT_SIG_SIZE] = {0xa0,0x95,0x96,0xa9,0x9e,0x5c,0xfb,0xfa};
 
 dap_stream_pkt_t * dap_stream_pkt_detect(void * a_data, size_t data_size)
 {
     uint8_t * sig_start=(uint8_t*) a_data;
-    dap_stream_pkt_t * ret=NULL;
+    dap_stream_pkt_t * hpkt = NULL;
+    size_t length_left = data_size;
 
-    size_t length_left=data_size;
-
-    while( (sig_start=memchr(sig_start, c_dap_stream_sig[0],length_left)) != NULL ){
+    while ( (sig_start = memchr(sig_start, c_dap_stream_sig[0], length_left)) ) {
         length_left = data_size - (size_t)(sig_start - (uint8_t *)a_data);
         if(length_left < sizeof(c_dap_stream_sig) )
             break;
-        if(memcmp(sig_start,c_dap_stream_sig,sizeof(c_dap_stream_sig))==0){
-            ret = (dap_stream_pkt_t *)sig_start;
+
+        if ( !memcmp(sig_start, c_dap_stream_sig, sizeof(c_dap_stream_sig)) ) {
+            hpkt = (dap_stream_pkt_t *)sig_start;
             if (length_left < sizeof(dap_stream_ch_pkt_hdr_t)) {
                 //log_it(L_ERROR, "Too small packet size %zu", length_left); // it's not an error, just random case
-                ret = NULL;
+                hpkt = NULL;
                 break;
             }
-            if(ret->hdr.size > STREAM_PKT_SIZE_MAX ){
-                log_it(L_ERROR, "Too big packet size %u",ret->hdr.size);
-                ret = NULL;
+            if(hpkt->hdr.size > DAP_STREAM_PKT_SIZE_MAX ){
+                log_it(L_ERROR, "Too big packet size %u (%#x), type:%d(%#x)",
+                       hpkt->hdr.size, hpkt->hdr.size, hpkt->hdr.type, hpkt->hdr.type);
+                hpkt = NULL;
             }
             break;
         } else
             sig_start++;
     }
 
-    return ret;
+    return hpkt;
 }
 
 /**
@@ -145,7 +145,7 @@ size_t dap_stream_pkt_write_unsafe(dap_stream_t * a_stream, const void * a_data,
     uint8_t * l_buf_allocated = NULL;
     uint8_t * l_buf_selected = a_stream->buf;
     size_t  l_buf_size_required = a_data_size + DAP_STREAM_CH_PKT_ENCRYPTION_OVERHEAD;
-    
+
     if(l_buf_size_required > sizeof(a_stream->buf) ){
         l_buf_allocated = DAP_NEW_SIZE(uint8_t, l_buf_size_required);
         l_buf_selected = l_buf_allocated;
diff --git a/dap-sdk/net/stream/stream/include/dap_stream.h b/dap-sdk/net/stream/stream/include/dap_stream.h
index a26e14cfc4406a7612ee6bf6506e0d8f91e551f0..639b9b7d834e7b991c2bd4e1bf7529e9eea1b898 100644
--- a/dap-sdk/net/stream/stream/include/dap_stream.h
+++ b/dap-sdk/net/stream/stream/include/dap_stream.h
@@ -44,7 +44,7 @@ typedef struct dap_http dap_http_t;
 typedef struct dap_stream dap_stream_t;
 typedef struct dap_stream_pkt dap_stream_pkt_t;
 typedef struct dap_events_socket dap_events_socket_t;
-#define STREAM_BUF_SIZE_MAX 500000
+#define STREAM_BUF_SIZE_MAX DAP_STREAM_PKT_SIZE_MAX * 4
 #define STREAM_KEEPALIVE_TIMEOUT 3   // How  often send keeplive messages (seconds)
 
 typedef void (*dap_stream_callback)( dap_stream_t *,void*);
diff --git a/dap-sdk/net/stream/stream/include/dap_stream_pkt.h b/dap-sdk/net/stream/stream/include/dap_stream_pkt.h
index e07932d46b834dcd16e88eb27ed5ce649290ec20..cfd5c3d435df34afea5e5fc1234fffc124bc6392 100644
--- a/dap-sdk/net/stream/stream/include/dap_stream_pkt.h
+++ b/dap-sdk/net/stream/stream/include/dap_stream_pkt.h
@@ -23,16 +23,16 @@
 #include <stddef.h>
 #include "dap_enc_key.h"
 #include "dap_events_socket.h"
-#define STREAM_PKT_SIZE_MAX 100000
 typedef struct dap_stream dap_stream_t;
 typedef struct dap_stream_session dap_stream_session_t;
 #define STREAM_PKT_TYPE_DATA_PACKET 0x00
 #define STREAM_PKT_TYPE_SERVICE_PACKET 0xff
 #define STREAM_PKT_TYPE_KEEPALIVE   0x11
 #define STREAM_PKT_TYPE_ALIVE       0x12
+#define STREAM_PKT_SIG_SIZE         8
 
 typedef struct dap_stream_pkt_hdr{
-    uint8_t sig[8];  // Signature to find out beginning of the frame
+    uint8_t sig[STREAM_PKT_SIG_SIZE];  // Signature to find out beginning of the frame
     uint32_t size;
     uint64_t timestamp;
     uint8_t type;      // Packet type
diff --git a/modules/chain/dap_chain.c b/modules/chain/dap_chain.c
index aea89e9ff74f8f66319aadfb94c3de6a91b29cf1..7e263c83dbd4d291c402cb979439fa92f691f8ba 100644
--- a/modules/chain/dap_chain.c
+++ b/modules/chain/dap_chain.c
@@ -21,7 +21,6 @@
     You should have received a copy of the GNU General Public License
     along with any DAP based project.  If not, see <http://www.gnu.org/licenses/>.
 */
-#include <dap_chain_ledger.h>
 #include <sys/types.h>
 #include <dirent.h>
 #ifdef DAP_OS_LINUX
@@ -37,6 +36,7 @@
 #include "dap_chain.h"
 #include "dap_chain_ledger.h"
 #include "dap_cert.h"
+#include "dap_chain_ledger.h"
 #include "dap_chain_cs.h"
 #include "dap_chain_vf.h"
 #include <uthash.h>
@@ -348,7 +348,6 @@ dap_chain_t * dap_chain_load_from_cfg(dap_ledger_t* a_ledger, const char * a_cha
             }
             l_chain_id.uint64 = l_chain_id_u;
 
-
             if (l_chain_id_str ) {
                 log_it (L_NOTICE, "Chain id 0x%016"DAP_UINT64_FORMAT_x"  ( \"%s\" )",l_chain_id.uint64 , l_chain_id_str) ;
             }else {
diff --git a/modules/chain/dap_chain_ledger.c b/modules/chain/dap_chain_ledger.c
index c7718e7b6094dee682fe8ebc268f4e1e2b737efb..37445ee986112238ec14e1457f44374348e1eca7 100644
--- a/modules/chain/dap_chain_ledger.c
+++ b/modules/chain/dap_chain_ledger.c
@@ -57,6 +57,9 @@
 #include "dap_chain_global_db.h"
 #include "dap_chain_ledger.h"
 #include "dap_chain_pvt.h"
+#include "json-c/json.h"
+#include "json-c/json_object.h"
+#include "dap_notify_srv.h"
 
 #define LOG_TAG "dap_chain_ledger"
 
@@ -112,7 +115,7 @@ typedef struct dap_chain_ledger_tx_item {
     dap_chain_hash_fast_t tx_hash_fast;
     dap_chain_datum_tx_t *tx;
     struct {
-        time_t ts_created;
+        dap_time_t ts_created;
         int n_outs;
         int n_outs_used;
         char token_ticker[DAP_CHAIN_TICKER_SIZE_MAX];
@@ -224,6 +227,9 @@ static size_t s_threshold_emissions_max = 1000;
 static size_t s_threshold_txs_max = 10000;
 static bool s_debug_more = false;
 
+struct json_object *wallet_info_json_collect(dap_ledger_t *a_ledger, dap_ledger_wallet_balance_t* a_bal);
+static void wallet_info_notify();
+
 /**
  * @brief dap_chain_ledger_init
  * current function version set s_debug_more parameter, if it define in config, and returns 0
@@ -296,6 +302,32 @@ void dap_chain_ledger_load_end(dap_ledger_t *a_ledger)
 }
 
 
+struct json_object *wallet_info_json_collect(dap_ledger_t *a_ledger, dap_ledger_wallet_balance_t *a_bal) {
+    struct json_object *l_json = json_object_new_object();
+    json_object_object_add(l_json, "class", json_object_new_string("Wallet"));
+    struct json_object *l_network = json_object_new_object();
+    json_object_object_add(l_network, "name", json_object_new_string(a_ledger->net_name));
+    char *pos = strrchr(a_bal->key, ' ');
+    if (pos) {
+        char *l_addr_str = DAP_NEW_S_SIZE(char, pos - a_bal->key + 1);
+        memcpy(l_addr_str, a_bal->key, pos - a_bal->key);
+        json_object_object_add(l_network, "address", json_object_new_string(l_addr_str));
+    } else {
+        json_object_object_add(l_network, "address", json_object_new_string("Unknown"));
+    }
+    struct json_object *l_token = json_object_new_object();
+    json_object_object_add(l_token, "name", json_object_new_string(a_bal->token_ticker));
+    char *l_balance_coins = dap_chain_balance_to_coins(a_bal->balance);
+    char *l_balance_datoshi = dap_chain_balance_print(a_bal->balance);
+    json_object_object_add(l_token, "full_balance", json_object_new_string(l_balance_coins));
+    json_object_object_add(l_token, "datoshi", json_object_new_string(l_balance_datoshi));
+    DAP_DELETE(l_balance_coins);
+    DAP_DELETE(l_balance_datoshi);
+    json_object_object_add(l_network, "tokens", l_token);
+    json_object_object_add(l_json, "networks", l_network);
+    return l_json;
+}
+
 /**
  * @brief dap_chain_ledger_token_check
  * @param a_ledger
@@ -962,7 +994,7 @@ dap_string_t *dap_chain_ledger_threshold_info(dap_ledger_t *a_ledger)
        //log_it(L_DEBUG,"Ledger thresholded datum_token_emission_hash %s, emission_item_size: %lld", l_emission_hash_str, l_emission_item->datum_token_emission_size);
         dap_string_append(l_str_ret, "Ledger thresholded datum_token_emission_hash: ");
         dap_string_append(l_str_ret, l_emission_hash_str);
-        sprintf(l_item_size, ", tx_item_size: %zu\n", l_emission_item->datum_token_emission_size);
+        dap_sprintf(l_item_size, ", tx_item_size: %zu\n", l_emission_item->datum_token_emission_size);
         dap_string_append(l_str_ret, l_item_size);
         l_counter +=1;
     }
@@ -1225,7 +1257,8 @@ void dap_chain_ledger_load_cache(dap_ledger_t *a_ledger)
     for (size_t i = 0; i < l_objs_count; i++) {
         dap_chain_ledger_tx_spent_item_t *l_tx_spent_item = DAP_NEW_Z(dap_chain_ledger_tx_spent_item_t);
         dap_chain_hash_fast_from_str(l_objs[i].key, &l_tx_spent_item->tx_hash_fast);
-        strncpy(l_tx_spent_item->token_ticker, (char *)l_objs[i].value, DAP_CHAIN_TICKER_SIZE_MAX - 1);
+        strncpy(l_tx_spent_item->token_ticker, (char *)l_objs[i].value,
+                min(l_objs[i].value_len, DAP_CHAIN_TICKER_SIZE_MAX - 1));
         HASH_ADD(hh, l_ledger_pvt->spent_items, tx_hash_fast, sizeof(dap_chain_hash_fast_t), l_tx_spent_item);
     }
     dap_chain_global_db_objs_delete(l_objs, l_objs_count);
@@ -1245,6 +1278,10 @@ void dap_chain_ledger_load_cache(dap_ledger_t *a_ledger)
         l_balance_item->balance = *(uint256_t *)l_objs[i].value;
         HASH_ADD_KEYPTR(hh, l_ledger_pvt->balance_accounts, l_balance_item->key,
                         strlen(l_balance_item->key), l_balance_item);
+        /* Notify the world */
+        /*struct json_object *l_json = wallet_info_json_collect(a_ledger, l_balance_item);
+        dap_notify_server_send_mt(json_object_get_string(l_json));
+        json_object_put(l_json);*/ // TODO: unstable and spammy
     }
     dap_chain_global_db_objs_delete(l_objs, l_objs_count);
     DAP_DELETE(l_gdb_group);
@@ -1407,6 +1444,55 @@ int dap_chain_ledger_token_emission_add_check(dap_ledger_t *a_ledger, byte_t *a_
     return l_ret;
 }
 
+bool s_chain_ledger_token_address_check(dap_chain_addr_t * l_addrs, dap_chain_datum_token_emission_t *a_token_emission, size_t l_addrs_count)
+{
+    // if l_addrs is empty - nothing to check
+    if (!l_addrs)
+        return true;
+
+    for(size_t n=0; n<l_addrs_count;n++ ){
+        if (memcmp(&l_addrs[n],&a_token_emission->hdr.address,sizeof(dap_chain_addr_t))==0)
+            return true;
+    }
+
+    return false; 
+}
+
+bool s_chain_ledger_token_tsd_check(dap_chain_ledger_token_item_t * a_token_item, dap_chain_datum_token_emission_t *a_token_emission)
+{
+    if (!a_token_item){
+        log_it(L_WARNING, "Token object is null. Probably, you set unknown token ticker in -token parameter");
+        return false;
+    }
+
+    // tsd section was parsed in s_token_tsd_parse
+    if (!s_chain_ledger_token_address_check(a_token_item->tx_recv_allow, a_token_emission, a_token_item->tx_recv_allow_size)){
+        log_it(L_WARNING, "Address %s is not in tx_recv_allow for emission for token %s",
+                dap_chain_addr_to_str(&a_token_emission->hdr.address), a_token_item->ticker);
+        return false;
+    }
+
+    if (!s_chain_ledger_token_address_check(a_token_item->tx_recv_block, a_token_emission, a_token_item->tx_recv_block_size)){
+        log_it(L_WARNING, "Address %s is not in tx_recv_block for emission for token %s",
+                dap_chain_addr_to_str(&a_token_emission->hdr.address), a_token_item->ticker);
+        return false;
+    }
+
+    if (!s_chain_ledger_token_address_check(a_token_item->tx_send_allow, a_token_emission, a_token_item->tx_send_allow_size)){
+        log_it(L_WARNING, "Address %s is not in tx_send_allow for emission for token %s",
+                dap_chain_addr_to_str(&a_token_emission->hdr.address), a_token_item->ticker);
+        return false;
+    }
+
+    if (!s_chain_ledger_token_address_check(a_token_item->tx_send_block, a_token_emission, a_token_item->tx_send_block_size)){
+        log_it(L_WARNING, "Address %s is not in tx_send_block for emission for token %s",
+                dap_chain_addr_to_str(&a_token_emission->hdr.address), a_token_item->ticker);
+        return false;
+    }
+
+    return true;
+}
+
 /**
  * @brief dap_chain_ledger_token_emission_add
  * @param a_token_emission
@@ -1450,8 +1536,8 @@ int dap_chain_ledger_token_emission_add(dap_ledger_t *a_ledger, byte_t *a_token_
                     (l_token_item->type == DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_UPDATE) ||
                     (l_token_item->type == DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_DECL) ||
                     (l_token_item->type == DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_UPDATE)) {
-                //s_ledger_permissions_check(l_token_item)
-                //    return -114;
+                    if (!s_chain_ledger_token_tsd_check(l_token_item, (dap_chain_datum_token_emission_t *)a_token_emission))
+                        return -114;
             }
             //Update value in ledger memory object
             if (!IS_ZERO_256(l_token_item->total_supply)) {
@@ -2456,6 +2542,10 @@ static int s_balance_cache_update(dap_ledger_t *a_ledger, dap_ledger_wallet_bala
     }
 
     DAP_DELETE(l_gdb_group);
+    /* Notify the world*/
+    struct json_object *l_json = wallet_info_json_collect(a_ledger, a_balance);
+    dap_notify_server_send_mt(json_object_get_string(l_json));
+    json_object_put(l_json);
     return 0;
 }
 
@@ -2816,7 +2906,7 @@ int dap_chain_ledger_tx_add(dap_ledger_t *a_ledger, dap_chain_datum_tx_t *a_tx,
     memcpy(&l_tx_item->tx_hash_fast, a_tx_hash, sizeof(dap_chain_hash_fast_t));
     size_t l_tx_size = dap_chain_datum_tx_get_size(a_tx);
     l_tx_item->tx = DAP_DUP_SIZE(a_tx, l_tx_size);
-    l_tx_item->cache_data.ts_created = time(NULL); // Time of transasction added to ledger
+    l_tx_item->cache_data.ts_created = dap_time_now(); // Time of transasction added to ledger
     dap_list_t *l_tist_tmp = dap_chain_datum_tx_items_get(a_tx, TX_ITEM_TYPE_OUT_ALL, &l_tx_item->cache_data.n_outs);
     // If debug mode dump the UTXO
     if (dap_log_level_get() == L_DEBUG && s_debug_more) {
@@ -3114,7 +3204,7 @@ unsigned dap_chain_ledger_count(dap_ledger_t *a_ledger)
  * @param a_ts_to
  * @return
  */
-uint64_t dap_chain_ledger_count_from_to(dap_ledger_t * a_ledger, time_t a_ts_from, time_t a_ts_to )
+uint64_t dap_chain_ledger_count_from_to(dap_ledger_t * a_ledger, dap_time_t a_ts_from, dap_time_t a_ts_to)
 {
     uint64_t l_ret = 0;
     dap_ledger_private_t *l_ledger_priv = PVT(a_ledger);
diff --git a/modules/chain/include/dap_chain_ledger.h b/modules/chain/include/dap_chain_ledger.h
index 332621bb902d90a0a1e50f1a47d68644f5e171c7..58de1e208f5a630c60e821c291275435cca9452a 100644
--- a/modules/chain/include/dap_chain_ledger.h
+++ b/modules/chain/include/dap_chain_ledger.h
@@ -176,7 +176,7 @@ void dap_chain_ledger_load_end(dap_ledger_t *a_ledger);
  */
 unsigned dap_chain_ledger_count(dap_ledger_t *a_ledger);
 
-uint64_t dap_chain_ledger_count_from_to(dap_ledger_t * a_ledger, time_t a_ts_from, time_t a_ts_to );
+uint64_t dap_chain_ledger_count_from_to(dap_ledger_t * a_ledger, dap_time_t a_ts_from, dap_time_t a_ts_to);
 size_t dap_chain_ledger_count_tps(dap_ledger_t *a_ledger, struct timespec *a_ts_from, struct timespec *a_ts_to);
 
 /**
diff --git a/modules/channel/chain-voting/dap_stream_ch_chain_voting.c b/modules/channel/chain-voting/dap_stream_ch_chain_voting.c
index 7706212c6ca73acb7df882497cce5be358a9e4b6..9490047c3d14fe9937ecd5e58ddbbcb16391de0c 100644
--- a/modules/channel/chain-voting/dap_stream_ch_chain_voting.c
+++ b/modules/channel/chain-voting/dap_stream_ch_chain_voting.c
@@ -53,8 +53,8 @@ static voting_node_client_list_t *s_node_client_list = NULL;
 
 static void s_callback_send_all_loopback(dap_chain_node_addr_t *a_remote_node_addr);
 static void s_callback_send_all_unsafe(dap_client_t *a_client, void *a_arg);
-static void s_callback_channel_pkt_free_unsafe(uint64_t node_addr_uint64);
-// static void s_callback_channel_go_stage(dap_worker_t * a_worker,void * a_arg);
+static void s_callback_channel_pkt_free_unsafe(uint64_t a_node_addr_uint64);
+static void s_callback_channel_pkt_buf_limit(uint64_t a_node_addr_uint64);
 
 static void s_stream_ch_new(dap_stream_ch_t* a_ch, void* a_arg);
 static void s_stream_ch_delete(dap_stream_ch_t* a_ch, void* a_arg);
@@ -130,30 +130,64 @@ void dap_stream_ch_chain_voting_message_write(dap_chain_net_t * a_net, dap_list_
 }
 
 
-static void s_callback_channel_pkt_free_unsafe(uint64_t node_addr_uint64) {
+static void s_callback_channel_pkt_free_unsafe(uint64_t a_node_addr_uint64) {
 	if ( dap_list_length(s_pkt_items->pkts_out) == 0 )
 		return;
 
-    dap_list_t* l_first_list = dap_list_first(s_pkt_items->pkts_out);
-    
-    while( l_first_list ) {
-    	dap_list_t *l_next_list = l_first_list->next;
-		voting_pkt_addr_t * l_pkt_addr = l_first_list->data;
-		if ( l_pkt_addr->node_addr.uint64 == node_addr_uint64) {
+    dap_list_t *l_list = dap_list_first(s_pkt_items->pkts_out);
+    while( l_list ) {
+    	// dap_list_t *l_next_list = l_list->next;
+		voting_pkt_addr_t *l_pkt_addr = l_list->data;
+		if ( l_pkt_addr->node_addr.uint64 == a_node_addr_uint64) {
 			DAP_DELETE(l_pkt_addr->voting_pkt);
 			DAP_DELETE(l_pkt_addr);
-			s_pkt_items->pkts_out = dap_list_remove_link(s_pkt_items->pkts_out, l_first_list);
+			dap_list_t *l_tmp = l_list->next;
+			s_pkt_items->pkts_out = dap_list_delete_link(s_pkt_items->pkts_out, l_list);
+			// dap_list_t *l_list = dap_list_first(s_pkt_items->pkts_out);
+			l_list = l_tmp;
+    	} else {
+    		l_list = l_list->next;
     	}
-    	l_first_list = l_next_list;
     }
 }
 
 
-void dap_stream_ch_chain_voting_pkt_broadcast(dap_chain_net_t * a_net, dap_list_t *a_sendto_nodes) {
+// remove overflow in outbuf
+static void s_callback_channel_pkt_buf_limit(uint64_t a_node_addr_uint64) {
+	if ( dap_list_length(s_pkt_items->pkts_out) == 0 )
+		return;
+    unsigned int l_limit = 10; // max messages per one addr
+	dap_list_t *l_list = dap_list_first(s_pkt_items->pkts_out);
+	unsigned int l_count = 0;
+	while (l_list) {
+		voting_pkt_addr_t *l_pkt_addr = (voting_pkt_addr_t *)l_list->data;
+		if ( l_pkt_addr->node_addr.uint64 == a_node_addr_uint64)
+			l_count++;
+		l_list = l_list->next;
+	}
+	if ( l_count > l_limit) {
+		unsigned int l_over = l_count-l_limit;
+		dap_list_t *l_list = dap_list_first(s_pkt_items->pkts_out);
+		while (l_list && l_over) {
+			voting_pkt_addr_t *l_pkt_addr = (voting_pkt_addr_t *)l_list->data;
+			if ( l_pkt_addr->node_addr.uint64 == a_node_addr_uint64 ) {
+				DAP_DELETE(l_pkt_addr->voting_pkt);
+				DAP_DELETE(l_pkt_addr);
+				s_pkt_items->pkts_out = dap_list_remove_link(s_pkt_items->pkts_out, l_list);
+				l_over--;
+			}
+			l_list = l_list->next;
+		}
+	}
+
+
+}
+
+void dap_stream_ch_chain_voting_pkt_broadcast(dap_chain_net_t *a_net, dap_list_t *a_sendto_nodes) {
     //if (dap_chain_net_get_state(a_net) == NET_STATE_ONLINE) {
         pthread_rwlock_rdlock(&s_pkt_items->rwlock_out);        
 
-		dap_list_t* l_nodes_list_temp = dap_list_first(a_sendto_nodes);
+		dap_list_t *l_nodes_list_temp = dap_list_first(a_sendto_nodes);
 		while(l_nodes_list_temp) {
 			dap_list_t *l_nodes_list = l_nodes_list_temp;
 			l_nodes_list_temp = l_nodes_list_temp->next;
@@ -193,12 +227,16 @@ void dap_stream_ch_chain_voting_pkt_broadcast(dap_chain_net_t * a_net, dap_list_
 	           		HASH_ADD(hh, s_node_client_list, node_addr, sizeof(dap_chain_node_addr_t), l_node_client_item);
 	           		l_node_item = l_node_client_item;
 			    }
+	        	if ( !l_node_item || !l_node_item->node_client ) {
+	        		continue;
+	        	}
 	            dap_client_pvt_t * l_client_pvt = dap_client_pvt_find(l_node_item->node_client->client->pvt_uuid);
 	            if (NULL == l_client_pvt) {
 	                continue;
 	            }
 	        }
 
+            //s_callback_channel_pkt_free_unsafe(l_remote_node_addr->uint64);
 			dap_list_t* l_pkts_list_temp = dap_list_first(s_pkt_items->pkts_out);
 			while(l_pkts_list_temp) {
 				dap_list_t *l_pkts_list = l_pkts_list_temp;
@@ -214,11 +252,15 @@ void dap_stream_ch_chain_voting_pkt_broadcast(dap_chain_net_t * a_net, dap_list_
 					memcpy(&l_pkt_addr_new->voting_pkt->hdr.recipient_node_addr,
 								l_remote_node_addr, sizeof(dap_chain_node_addr_t));
 					s_pkt_items->pkts_out = dap_list_append(s_pkt_items->pkts_out, l_pkt_addr_new);
+					// s_callback_channel_pkt_buf_limit(l_remote_node_addr->uint64);
             	}
             }
 
 			if ( l_remote_node_addr->uint64 != dap_chain_net_get_cur_addr_int(a_net) ) {
-	            dap_client_go_stage(l_node_item->node_client->client, STAGE_STREAM_STREAMING, s_callback_send_all_unsafe);
+                if (dap_client_get_stage(l_node_item->node_client->client) != STAGE_STREAM_STREAMING)
+                    dap_client_go_stage(l_node_item->node_client->client, STAGE_STREAM_STREAMING, s_callback_send_all_unsafe);
+                else
+                    s_callback_send_all_unsafe(l_node_item->node_client->client, NULL);
 	        } else {
 	        	s_callback_send_all_loopback(l_remote_node_addr);
 	        }
@@ -244,7 +286,7 @@ static void s_callback_send_all_loopback(dap_chain_node_addr_t *a_remote_node_ad
 		}
 		l_pkts_list = l_pkts_list_next;
 	}
-	s_callback_channel_pkt_free_unsafe(a_remote_node_addr->uint64);
+    s_callback_channel_pkt_free_unsafe(a_remote_node_addr->uint64);
 	pthread_rwlock_unlock(&s_pkt_items->rwlock_out);
 }
 
@@ -254,24 +296,26 @@ static void s_callback_send_all_unsafe(dap_client_t *a_client, void *a_arg){
     dap_chain_node_client_t *l_node_client = DAP_CHAIN_NODE_CLIENT(a_client);
     if (l_node_client) {
 	    dap_stream_ch_t * l_ch_chain = dap_client_get_stream_ch_unsafe(a_client, dap_stream_ch_chain_voting_get_id() );
-	    dap_list_t* l_pkts_list = dap_list_first(s_pkt_items->pkts_out);
-		while(l_pkts_list) {
-			dap_list_t *l_pkts_list_next = l_pkts_list->next;
-			voting_pkt_addr_t *l_pkt_addr = (voting_pkt_addr_t *)l_pkts_list->data;
-			dap_stream_ch_chain_voting_pkt_t * l_voting_pkt = l_pkt_addr->voting_pkt;
-		    size_t l_voting_pkt_size = sizeof(l_voting_pkt->hdr) + l_voting_pkt->hdr.data_size;
-			if ( l_pkt_addr->node_addr.uint64 == l_node_client->remote_node_addr.uint64 ) {
-				if (l_ch_chain) {
-		    		dap_stream_ch_pkt_write_unsafe(l_ch_chain, 
-		    						l_voting_pkt->hdr.pkt_type, l_voting_pkt, l_voting_pkt_size);
+	    if (l_ch_chain) {
+		    dap_list_t* l_pkts_list = dap_list_first(s_pkt_items->pkts_out);
+			while(l_pkts_list) {
+				dap_list_t *l_pkts_list_next = l_pkts_list->next;
+				voting_pkt_addr_t *l_pkt_addr = (voting_pkt_addr_t *)l_pkts_list->data;
+				dap_stream_ch_chain_voting_pkt_t * l_voting_pkt = l_pkt_addr->voting_pkt;
+			    size_t l_voting_pkt_size = sizeof(l_voting_pkt->hdr) + l_voting_pkt->hdr.data_size;
+				if ( l_pkt_addr->node_addr.uint64 == l_node_client->remote_node_addr.uint64 ) {
+					if (l_ch_chain) {
+			    		dap_stream_ch_pkt_write_unsafe(l_ch_chain, 
+			    						l_voting_pkt->hdr.pkt_type, l_voting_pkt, l_voting_pkt_size);
+			    	}
+			    	else {
+						//printf("---!!! s_callback_send_all_unsafe() l_ch_chain in null \n");
+			    	}
 		    	}
-		    	else {
-					//printf("---!!! s_callback_send_all_unsafe() l_ch_chain in null \n");
-		    	}
-	    	}
-	    	l_pkts_list = l_pkts_list_next;
+		    	l_pkts_list = l_pkts_list_next;
+		    }
+	        s_callback_channel_pkt_free_unsafe(l_node_client->remote_node_addr.uint64);
 	    }
-		s_callback_channel_pkt_free_unsafe(l_node_client->remote_node_addr.uint64);
 	}
     pthread_rwlock_unlock(&s_pkt_items->rwlock_out);
 }
@@ -301,12 +345,11 @@ static void s_stream_ch_delete(dap_stream_ch_t* a_ch, void* a_arg) {
 static bool s_packet_in_callback_handler(void *a_arg)
 {
     UNUSED(a_arg);
+	pthread_rwlock_rdlock(&s_pkt_items->rwlock_in);
 	if (dap_list_length(s_pkt_items->pkts_in)) {
-		pthread_rwlock_rdlock(&s_pkt_items->rwlock_in);
 		dap_list_t* l_list_pkts = dap_list_copy(s_pkt_items->pkts_in);
 	    dap_list_free(s_pkt_items->pkts_in);
 	    s_pkt_items->pkts_in = NULL;
-		pthread_rwlock_unlock(&s_pkt_items->rwlock_in);
 
 		dap_list_t* l_list_temp = dap_list_first(l_list_pkts);
 		while(l_list_temp) {
@@ -335,6 +378,7 @@ static bool s_packet_in_callback_handler(void *a_arg)
 		}
 		dap_list_free(l_list_pkts);
 	}
+	pthread_rwlock_unlock(&s_pkt_items->rwlock_in);
 	return true;
 }
 
diff --git a/modules/channel/chain/dap_stream_ch_chain.c b/modules/channel/chain/dap_stream_ch_chain.c
index 4a6ccc132e0d01197c87c5ba07cb72ef3d8ad9e6..5a3c322d414484a420f4fa1451837f2fc793668a 100644
--- a/modules/channel/chain/dap_stream_ch_chain.c
+++ b/modules/channel/chain/dap_stream_ch_chain.c
@@ -25,7 +25,6 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#include <time.h>
 #include <stdlib.h>
 #include <stddef.h>
 #include <stdint.h>
@@ -44,6 +43,7 @@
 #include "dap_list.h"
 #include "dap_config.h"
 #include "dap_hash.h"
+#include "dap_time.h"
 #include "utlist.h"
 
 #include "dap_worker.h"
@@ -92,6 +92,9 @@ struct sync_request
     };
 };
 
+static void s_ch_chain_go_idle(dap_stream_ch_chain_t *a_ch_chain);
+static bool s_ch_chain_get_idle(dap_stream_ch_chain_t *a_ch_chain);
+
 static void s_stream_ch_new(dap_stream_ch_t* a_ch, void* a_arg);
 static void s_stream_ch_delete(dap_stream_ch_t* a_ch, void* a_arg);
 static void s_stream_ch_packet_in(dap_stream_ch_t* a_ch, void* a_arg);
@@ -153,28 +156,7 @@ void s_stream_ch_new(dap_stream_ch_t* a_ch, void* a_arg)
     a_ch->internal = DAP_NEW_Z(dap_stream_ch_chain_t);
     dap_stream_ch_chain_t * l_ch_chain = DAP_STREAM_CH_CHAIN(a_ch);
     l_ch_chain->_inheritor = a_ch;
-}
-
-/**
- * @brief s_stream_ch_chain_delete
- * @param a_ch_chain
- */
-static void s_sync_request_delete(struct sync_request * a_sync_request)
-{
-    if (!a_sync_request) {
-        //already NULL'ed
-        return;
-    }
-    if (a_sync_request->pkt.pkt_data) {
-        DAP_DEL_Z(a_sync_request->pkt.pkt_data);
-    }
-
-    if (a_sync_request->gdb.db_iter) {
-        a_sync_request->gdb.db_iter = dap_list_first( a_sync_request->gdb.db_iter);
-        dap_list_free_full( a_sync_request->gdb.db_iter, free);
-        a_sync_request->gdb.db_iter = NULL;
-    }
-    DAP_DEL_Z(a_sync_request);
+    pthread_rwlock_init(&l_ch_chain->idle_lock, NULL);
 }
 
 /**
@@ -190,9 +172,10 @@ static bool s_stream_ch_delete_in_proc(dap_proc_thread_t * a_thread, void * a_ar
     if (l_ch_chain->callback_notify_packet_out)
         l_ch_chain->callback_notify_packet_out(l_ch_chain, DAP_STREAM_CH_CHAIN_PKT_TYPE_DELETE, NULL, 0,
                                                l_ch_chain->callback_notify_arg);
-    dap_stream_ch_chain_go_idle(l_ch_chain);
+    s_ch_chain_go_idle(l_ch_chain);
     s_free_log_list_gdb(l_ch_chain);
-    DAP_DELETE(a_arg);
+    pthread_rwlock_destroy(&l_ch_chain->idle_lock);
+    DAP_DELETE(l_ch_chain);
     return true;
 }
 
@@ -208,6 +191,28 @@ static void s_stream_ch_delete(dap_stream_ch_t* a_ch, void* a_arg)
     a_ch->internal = NULL; // To prevent its cleaning in worker
 }
 
+/**
+ * @brief s_stream_ch_chain_delete
+ * @param a_ch_chain
+ */
+static void s_sync_request_delete(struct sync_request * a_sync_request)
+{
+    if (!a_sync_request) {
+        //already NULL'ed
+        return;
+    }
+    if (a_sync_request->pkt.pkt_data) {
+        DAP_DEL_Z(a_sync_request->pkt.pkt_data);
+    }
+
+    if (a_sync_request->gdb.db_iter) {
+        a_sync_request->gdb.db_iter = dap_list_first( a_sync_request->gdb.db_iter);
+        dap_list_free_full( a_sync_request->gdb.db_iter, free);
+        a_sync_request->gdb.db_iter = NULL;
+    }
+    DAP_DEL_Z(a_sync_request);
+}
+
 /**
  * @brief s_sync_out_chains_worker_callback
  * @param a_worker
@@ -266,13 +271,7 @@ static void s_sync_out_chains_last_worker_callback(dap_worker_t *a_worker, void
     dap_stream_ch_chain_pkt_write_unsafe(l_ch, DAP_STREAM_CH_CHAIN_PKT_TYPE_SYNCED_CHAINS,
             l_sync_request->request_hdr.net_id.uint64, l_sync_request->request_hdr.chain_id.uint64,
             l_sync_request->request_hdr.cell_id.uint64, &l_request, sizeof(l_request));
-    if (l_ch_chain->request_atom_iter)
-    {
-        l_ch_chain->request_atom_iter->chain->callback_atom_iter_delete(l_ch_chain->request_atom_iter);
-        l_ch_chain->request_atom_iter = NULL;
-    }
-
-    l_ch_chain->state = CHAIN_STATE_IDLE;
+    s_ch_chain_go_idle(l_ch_chain);
     if (l_ch_chain->callback_notify_packet_out)
         l_ch_chain->callback_notify_packet_out(l_ch_chain, DAP_STREAM_CH_CHAIN_PKT_TYPE_SYNCED_CHAINS,
                                                 NULL, 0, l_ch_chain->callback_notify_arg);
@@ -373,7 +372,7 @@ static void s_sync_out_gdb_last_worker_callback(dap_worker_t *a_worker, void *a_
     dap_stream_ch_chain_pkt_write_unsafe(DAP_STREAM_CH(l_ch_chain), DAP_STREAM_CH_CHAIN_PKT_TYPE_SYNCED_GLOBAL_DB,
                                          l_ch_chain->request_hdr.net_id.uint64, l_ch_chain->request_hdr.chain_id.uint64,
                                          l_ch_chain->request_hdr.cell_id.uint64, NULL, 0);
-    l_ch_chain->state = CHAIN_STATE_IDLE;
+    s_ch_chain_go_idle(l_ch_chain);
     if(l_ch_chain->callback_notify_packet_out)
         l_ch_chain->callback_notify_packet_out(l_ch_chain, DAP_STREAM_CH_CHAIN_PKT_TYPE_SYNCED_GLOBAL_DB,
                                                 NULL, 0, l_ch_chain->callback_notify_arg);
@@ -445,12 +444,18 @@ static bool s_sync_update_gdb_proc_callback(dap_proc_thread_t *a_thread, void *a
     struct sync_request *l_sync_request = (struct sync_request *)a_arg;
     log_it(L_DEBUG, "Prepare request to gdb sync from %s", l_sync_request->request.id_start ? "last sync" : "zero");
     dap_chain_net_t *l_net = dap_chain_net_by_id(l_sync_request->request_hdr.net_id);
+    if (!l_net) {
+        log_it(L_ERROR, "Network ID 0x%016"DAP_UINT64_FORMAT_x" not found", l_sync_request->request_hdr.net_id.uint64);
+        DAP_DELETE(l_sync_request);
+        return true;
+    }
     dap_stream_ch_t *l_ch = dap_stream_ch_find_by_uuid_unsafe(DAP_STREAM_WORKER(l_sync_request->worker), l_sync_request->ch_uuid);
     if (!l_ch) {
         log_it(L_INFO, "Client disconnected before we sent the reply");
         DAP_DELETE(l_sync_request);
         return true;
     }
+    dap_chain_net_add_downlink(l_net, l_ch->stream_worker, l_ch->uuid);
     dap_stream_ch_chain_t *l_ch_chain = DAP_STREAM_CH_CHAIN(l_ch);
     int l_flags = 0;
     if (dap_chain_net_get_add_gdb_group(l_net, l_sync_request->request.node_addr))
@@ -501,11 +506,11 @@ static bool s_sync_in_chains_callback(dap_proc_thread_t *a_thread, void *a_arg)
     uint64_t l_atom_copy_size = l_pkt_item->pkt_data_size;
     dap_hash_fast(l_atom_copy, l_atom_copy_size, &l_atom_hash);
     dap_chain_atom_verify_res_t l_atom_add_res = l_chain->callback_atom_add(l_chain, l_atom_copy, l_atom_copy_size);
+    char l_atom_hash_str[DAP_CHAIN_HASH_FAST_STR_SIZE] = {[0]='\0'};
+    dap_chain_hash_fast_to_str(&l_atom_hash,l_atom_hash_str,sizeof (l_atom_hash_str));
     switch (l_atom_add_res) {
     case ATOM_PASS:
         if (s_debug_more){
-            char l_atom_hash_str[72]={[0]='\0'};
-            dap_chain_hash_fast_to_str(&l_atom_hash,l_atom_hash_str,sizeof (l_atom_hash_str)-1 );
             log_it(L_WARNING, "Atom with hash %s for %s:%s not accepted (code ATOM_PASS, already present)",  l_atom_hash_str, l_chain->net_name, l_chain->name);
         }
         dap_db_set_last_hash_remote(l_sync_request->request.node_addr.uint64, l_chain, &l_atom_hash);
@@ -513,21 +518,15 @@ static bool s_sync_in_chains_callback(dap_proc_thread_t *a_thread, void *a_arg)
         break;
     case ATOM_MOVE_TO_THRESHOLD:
         if (s_debug_more) {
-            char l_atom_hash_str[72] = {'\0'};
-            dap_chain_hash_fast_to_str(&l_atom_hash, l_atom_hash_str, sizeof(l_atom_hash_str) - 1);
             log_it(L_INFO, "Thresholded atom with hash %s for %s:%s", l_atom_hash_str, l_chain->net_name, l_chain->name);
         }
         break;
     case ATOM_ACCEPT:
         if (s_debug_more) {
-            char l_atom_hash_str[72]={'\0'};
-            dap_chain_hash_fast_to_str(&l_atom_hash,l_atom_hash_str,sizeof (l_atom_hash_str)-1 );
             log_it(L_INFO,"Accepted atom with hash %s for %s:%s", l_atom_hash_str, l_chain->net_name, l_chain->name);
         }
         int l_res = dap_chain_atom_save(l_chain, l_atom_copy, l_atom_copy_size, l_sync_request->request_hdr.cell_id);
         if(l_res < 0) {
-            char l_atom_hash_str[72]={'\0'};
-            dap_chain_hash_fast_to_str(&l_atom_hash,l_atom_hash_str,sizeof (l_atom_hash_str)-1 );
             log_it(L_ERROR, "Can't save atom %s to the file", l_atom_hash_str);
         } else {
             dap_db_set_last_hash_remote(l_sync_request->request.node_addr.uint64, l_chain, &l_atom_hash);
@@ -548,10 +547,10 @@ static bool s_sync_in_chains_callback(dap_proc_thread_t *a_thread, void *a_arg)
                         if (l_atom_treshold) {
                             dap_chain_cell_id_t l_cell_id = (l_cur_chain == l_chain) ? l_sync_request->request_hdr.cell_id
                                                                                      : l_cur_chain->cells->id;
-                            int l_res = dap_chain_atom_save(l_cur_chain, l_atom_copy, l_atom_copy_size, l_cell_id);
+                            int l_res = dap_chain_atom_save(l_cur_chain, l_atom_treshold, l_atom_treshold_size, l_cell_id);
                             log_it(L_INFO, "Added atom from treshold");
                             if (l_res < 0) {
-                                char l_atom_hash_str[72] = {'\0'};
+                                dap_hash_fast(l_atom_treshold, l_atom_treshold_size, &l_atom_hash);
                                 dap_chain_hash_fast_to_str(&l_atom_hash,l_atom_hash_str, sizeof(l_atom_hash_str) - 1);
                                 log_it(L_ERROR, "Can't save atom %s from treshold to file", l_atom_hash_str);
                             } else if (l_cur_chain == l_chain) {
@@ -680,9 +679,7 @@ static bool s_gdb_in_pkt_proc_callback(dap_proc_thread_t *a_thread, void *a_arg)
         if(l_pkt_item->pkt_data_size != l_obj_pkt_size) {
             log_it(L_WARNING, "In: s_gdb_in_pkt_proc_callback: received size=%zu is not equal to obj_pkt_size=%zu",
                     l_pkt_item->pkt_data_size, l_obj_pkt_size);
-            if(l_pkt_item->pkt_data) {
-                DAP_DELETE(l_pkt_item->pkt_data);
-            }
+            DAP_DEL_Z(l_pkt_item->pkt_data);
             DAP_DELETE(l_sync_request);
             return true;
         }
@@ -690,6 +687,12 @@ static bool s_gdb_in_pkt_proc_callback(dap_proc_thread_t *a_thread, void *a_arg)
         size_t l_data_obj_count = 0;
         // deserialize data & Parse data from dap_db_log_pack()
         dap_store_obj_t *l_store_obj = dap_store_unpacket_multiple(l_obj_pkt, &l_data_obj_count);
+        if (!l_store_obj) {
+            debug_if(s_debug_more, L_ERROR, "Invalid synchronization packet format");
+            DAP_DEL_Z(l_pkt_item->pkt_data);
+            DAP_DELETE(l_sync_request);
+            return true;
+        }
         if (s_debug_more){
             if (l_data_obj_count)
                 log_it(L_INFO, "In: GLOBAL_DB parse: pkt_data_size=%"DAP_UINT64_FORMAT_U", l_data_obj_count = %zu",l_pkt_item->pkt_data_size, l_data_obj_count );
@@ -698,18 +701,18 @@ static bool s_gdb_in_pkt_proc_callback(dap_proc_thread_t *a_thread, void *a_arg)
             }else
                  log_it(L_WARNING, "In: GLOBAL_DB parse: packet in list with NULL data(pkt_data_size:%"DAP_UINT64_FORMAT_U")", l_pkt_item->pkt_data_size);
         }
-
         uint64_t l_last_id = l_store_obj->id;
         const char *l_last_group = l_store_obj->group;
         uint32_t l_last_type = l_store_obj->type;
         bool l_group_changed = false;
-        uint32_t l_time_store_lim = dap_config_get_item_uint32_default(g_config, "resources", "dap_global_db_time_store_limit", 72);
-        uint64_t l_limit_time = l_time_store_lim ? (uint64_t)time(NULL) - l_time_store_lim * 3600 : 0;
-
+        uint32_t l_time_store_lim_hours = dap_config_get_item_uint32_default(g_config, "resources", "dap_global_db_time_store_limit", 72);
+        dap_gdb_time_t l_time_now = dap_gdb_time_now();
+        uint64_t l_limit_time = l_time_store_lim_hours ? l_time_now - dap_gdb_time_from_sec(l_time_store_lim_hours * 3600) : 0;
         for (size_t i = 0; i < l_data_obj_count; i++) {
             // obj to add
             dap_store_obj_t *l_obj = l_store_obj + i;
-
+            if (l_obj->timestamp >> 32 == 0 || l_obj->timestamp > l_time_now || l_obj->group == NULL)
+                continue;       // the object is broken
             if (s_list_white_groups) {
                 int l_ret = -1;
                 for (int i = 0; i < s_size_white_groups; i++) {
@@ -746,22 +749,22 @@ static bool s_gdb_in_pkt_proc_callback(dap_proc_thread_t *a_thread, void *a_arg)
             //check whether to apply the received data into the database
             bool l_apply = false;
             // timestamp for exist obj
-            time_t l_timestamp_cur = 0;
+            dap_gdb_time_t l_timestamp_cur = 0;
             // Record is pinned or not
             bool l_is_pinned_cur = false;
             if (dap_chain_global_db_driver_is(l_obj->group, l_obj->key)) {
                 dap_store_obj_t *l_read_obj = dap_chain_global_db_driver_read(l_obj->group, l_obj->key, NULL);
                 if (l_read_obj) {
                     l_timestamp_cur = l_read_obj->timestamp;
-                    l_is_pinned_cur = l_read_obj->flags | RECORD_PINNED;
-                    dap_store_obj_free(l_read_obj, 1);
+                    l_is_pinned_cur = l_read_obj->flags & RECORD_PINNED;
+                    dap_store_obj_free_one(l_read_obj);
                 }
             }
             // Do not overwrite pinned records
-            if(l_is_pinned_cur){
+            if(l_is_pinned_cur) {
                 continue;
             }
-            time_t l_timestamp_del = global_db_gr_del_get_timestamp(l_obj->group, l_obj->key);
+            dap_gdb_time_t l_timestamp_del = global_db_gr_del_get_timestamp(l_obj->group, l_obj->key);
             // check the applied object newer that we have stored or erased
             if (l_obj->timestamp > (uint64_t)l_timestamp_del &&
                     l_obj->timestamp > (uint64_t)l_timestamp_cur &&
@@ -770,19 +773,21 @@ static bool s_gdb_in_pkt_proc_callback(dap_proc_thread_t *a_thread, void *a_arg)
             }
             if (s_debug_more){
                 char l_ts_str[50];
-                dap_time_to_str_rfc822(l_ts_str, sizeof(l_ts_str), l_store_obj[i].timestamp);
+                dap_time_to_str_rfc822(l_ts_str, sizeof(l_ts_str), dap_gdb_time_to_sec(l_store_obj[i].timestamp));
                 log_it(L_DEBUG, "Unpacked log history: type='%c' (0x%02hhX) group=\"%s\" key=\"%s\""
                         " timestamp=\"%s\" value_len=%zu",
-                        (char )l_store_obj[i].type, l_store_obj[i].type, l_store_obj[i].group,
+                        (char )l_store_obj[i].type, (char)l_store_obj[i].type, l_store_obj[i].group,
                         l_store_obj[i].key, l_ts_str, l_store_obj[i].value_len);
             }
             if (!l_apply) {
-                if (l_obj->timestamp <= (uint64_t)l_timestamp_cur)
-                    log_it(L_WARNING, "New data not applied, because newly object exists");
-                if (l_obj->timestamp <= (uint64_t)l_timestamp_del)
-                    log_it(L_WARNING, "New data not applied, because newly object is deleted");
-                if ((l_obj->type == DAP_DB$K_OPTYPE_DEL && l_obj->timestamp <= l_limit_time))
-                    log_it(L_WARNING, "New data not applied, because object is too old");
+                if (s_debug_more) {
+                    if (l_obj->timestamp <= (uint64_t)l_timestamp_cur)
+                        log_it(L_WARNING, "New data not applied, because newly object exists");
+                    if (l_obj->timestamp <= (uint64_t)l_timestamp_del)
+                        log_it(L_WARNING, "New data not applied, because newly object is deleted");
+                    if ((l_obj->type == DAP_DB$K_OPTYPE_DEL && l_obj->timestamp <= l_limit_time))
+                        log_it(L_WARNING, "New data not applied, because object is too old");
+                }
                 continue;
             }
 
@@ -839,7 +844,7 @@ struct sync_request *dap_stream_ch_chain_create_sync_request(dap_stream_ch_chain
 static void s_stream_ch_write_error_unsafe(dap_stream_ch_t *a_ch, uint64_t a_net_id, uint64_t a_chain_id, uint64_t a_cell_id, const char * a_err_string)
 {
     dap_stream_ch_chain_t *l_ch_chain = DAP_STREAM_CH_CHAIN(a_ch);
-    dap_stream_ch_chain_go_idle(l_ch_chain);
+    s_ch_chain_go_idle(l_ch_chain);
     dap_stream_ch_chain_pkt_write_error_unsafe(a_ch, a_net_id, a_chain_id, a_cell_id, a_err_string);
 }
 
@@ -853,8 +858,8 @@ static bool s_chain_timer_callback(void *a_arg)
     }
     dap_stream_ch_chain_t *l_ch_chain = DAP_STREAM_CH_CHAIN(l_ch);
     if (l_ch_chain->timer_shots++ >= 3) {
-        if (l_ch_chain->state != CHAIN_STATE_IDLE) {
-            dap_stream_ch_chain_go_idle(l_ch_chain);
+        if (!s_ch_chain_get_idle(l_ch_chain)) {
+            s_ch_chain_go_idle(l_ch_chain);
             if (l_ch_chain->callback_notify_packet_out)
                 l_ch_chain->callback_notify_packet_out(l_ch_chain, DAP_STREAM_CH_CHAIN_PKT_TYPE_TIMEOUT, NULL, 0,
                                                       l_ch_chain->callback_notify_arg);
@@ -884,16 +889,21 @@ static bool s_chain_timer_callback(void *a_arg)
 
 static void s_chain_timer_reset(dap_stream_ch_chain_t *a_ch_chain)
 {
-    if (a_ch_chain->state == CHAIN_STATE_IDLE)
+    if (s_ch_chain_get_idle(a_ch_chain))
         return;
     if (!a_ch_chain->activity_timer) {
-        dap_stream_ch_uuid_t *l_uuid = DAP_DUP(&DAP_STREAM_CH(a_ch_chain)->uuid);
-        a_ch_chain->activity_timer = dap_timerfd_start_on_worker(DAP_STREAM_CH(a_ch_chain)->stream_worker->worker,
-                                                                 3000, s_chain_timer_callback, (void *)l_uuid);
+        dap_stream_ch_chain_timer_start(a_ch_chain);
     }
     a_ch_chain->timer_shots = 0;
 }
 
+void dap_stream_ch_chain_timer_start(dap_stream_ch_chain_t *a_ch_chain)
+{
+    dap_stream_ch_uuid_t *l_uuid = DAP_DUP(&DAP_STREAM_CH(a_ch_chain)->uuid);
+    a_ch_chain->activity_timer = dap_timerfd_start_on_worker(DAP_STREAM_CH(a_ch_chain)->stream_worker->worker,
+                                                             3000, s_chain_timer_callback, (void *)l_uuid);
+}
+
 /**
  * @brief s_stream_ch_packet_in
  * @param a_ch
@@ -1459,7 +1469,7 @@ void s_stream_ch_packet_in(dap_stream_ch_t* a_ch, void* a_arg)
 
 
 /**
- * @brief dap_stream_ch_chain_go_idle_and_free_log_list
+ * @brief s_ch_chain_go_idle_and_free_log_list
  * @param a_ch_chain
  */
 static void s_free_log_list_gdb ( dap_stream_ch_chain_t * a_ch_chain)
@@ -1473,22 +1483,22 @@ static void s_free_log_list_gdb ( dap_stream_ch_chain_t * a_ch_chain)
         HASH_DEL(a_ch_chain->remote_gdbs, l_hash_item);
         DAP_DELETE(l_hash_item);
     }
-#if 0
-    HASH_ITER(hh, a_ch_chain->remote_atoms, l_hash_item, l_tmp) {
-        HASH_DEL(a_ch_chain->remote_atoms, l_hash_item);
-        DAP_DELETE(l_hash_item);
-    }
-    a_ch_chain->remote_atoms = a_ch_chain->remote_gdbs = NULL;
-#endif
     a_ch_chain->remote_gdbs = NULL;
 }
 /**
- * @brief dap_stream_ch_chain_go_idle
+ * @brief s_ch_chain_go_idle
  * @param a_ch_chain
  */
-void dap_stream_ch_chain_go_idle ( dap_stream_ch_chain_t * a_ch_chain)
+static void s_ch_chain_go_idle(dap_stream_ch_chain_t *a_ch_chain)
 {
+    pthread_rwlock_wrlock(&a_ch_chain->idle_lock);
+    if (a_ch_chain->state == CHAIN_STATE_IDLE) {
+        pthread_rwlock_unlock(&a_ch_chain->idle_lock);
+        return;
+    }
     a_ch_chain->state = CHAIN_STATE_IDLE;
+    pthread_rwlock_unlock(&a_ch_chain->idle_lock);
+
     if(s_debug_more)
         log_it(L_INFO, "Go in CHAIN_STATE_IDLE");
 
@@ -1511,6 +1521,15 @@ void dap_stream_ch_chain_go_idle ( dap_stream_ch_chain_t * a_ch_chain)
     a_ch_chain->remote_atoms = NULL;
 }
 
+static bool s_ch_chain_get_idle(dap_stream_ch_chain_t *a_ch_chain)
+{
+    pthread_rwlock_wrlock(&a_ch_chain->idle_lock);
+    bool ret = a_ch_chain->state == CHAIN_STATE_IDLE;
+    pthread_rwlock_unlock(&a_ch_chain->idle_lock);
+    return ret;
+}
+
+
 /**
  * @brief s_stream_ch_packet_out
  * @param ch
@@ -1524,6 +1543,9 @@ void s_stream_ch_packet_out(dap_stream_ch_t* a_ch, void* a_arg)
         return;
     dap_stream_ch_chain_t *l_ch_chain = DAP_STREAM_CH_CHAIN(a_ch);
 
+    bool l_go_idle = false;
+    bool l_timer_reset = false;
+    pthread_rwlock_rdlock(&l_ch_chain->idle_lock);
     switch (l_ch_chain->state) {
         // Update list of global DB records to remote
         case CHAIN_STATE_UPDATE_GLOBAL_DB: {
@@ -1534,7 +1556,7 @@ void s_stream_ch_packet_out(dap_stream_ch_t* a_ch, void* a_arg)
                 l_obj = dap_db_log_list_get(l_ch_chain->request_db_log);
                 if (!l_obj || DAP_POINTER_TO_INT(l_obj) == 1)
                     break;
-                s_chain_timer_reset(l_ch_chain);
+                l_timer_reset = true;
                 memcpy(&l_data[i].hash, &l_obj->hash, sizeof(dap_chain_hash_fast_t));
                 l_data[i].size = l_obj->pkt->data_size;
             }
@@ -1559,7 +1581,7 @@ void s_stream_ch_packet_out(dap_stream_ch_t* a_ch, void* a_arg)
                                                      &l_ch_chain->request, sizeof(dap_stream_ch_chain_sync_request_t));
                 if (s_debug_more )
                     log_it(L_INFO, "Out: DAP_STREAM_CH_CHAIN_PKT_TYPE_UPDATE_GLOBAL_DB_END");
-                dap_stream_ch_chain_go_idle(l_ch_chain);
+                l_go_idle = true;
             }
         } break;
 
@@ -1603,7 +1625,7 @@ void s_stream_ch_packet_out(dap_stream_ch_t* a_ch, void* a_arg)
                 }
             }
             if (l_pkt_size) {
-                s_chain_timer_reset(l_ch_chain);
+                l_timer_reset = true;
                 // If request was from defined node_addr we update its state
                 if (s_debug_more)
                     log_it(L_INFO, "Send one global_db packet len=%zu (rest=%zu/%zu items)", l_pkt_size,
@@ -1624,7 +1646,7 @@ void s_stream_ch_packet_out(dap_stream_ch_t* a_ch, void* a_arg)
                 dap_stream_ch_chain_pkt_write_unsafe(a_ch, DAP_STREAM_CH_CHAIN_PKT_TYPE_SYNCED_GLOBAL_DB,
                                                      l_ch_chain->request_hdr.net_id.uint64, l_ch_chain->request_hdr.chain_id.uint64,
                                                      l_ch_chain->request_hdr.cell_id.uint64, &l_request, sizeof(l_request));
-                dap_stream_ch_chain_go_idle(l_ch_chain);
+                l_go_idle = true;
                 if (l_ch_chain->callback_notify_packet_out)
                     l_ch_chain->callback_notify_packet_out(l_ch_chain, DAP_STREAM_CH_CHAIN_PKT_TYPE_SYNCED_GLOBAL_DB,
                                                            NULL, 0, l_ch_chain->callback_notify_arg);
@@ -1633,20 +1655,20 @@ void s_stream_ch_packet_out(dap_stream_ch_t* a_ch, void* a_arg)
 
         // Update list of atoms to remote
         case CHAIN_STATE_UPDATE_CHAINS:{
-            s_chain_timer_reset(l_ch_chain);
+            l_timer_reset = true;
             dap_stream_ch_chain_update_element_t *l_data = DAP_NEW_Z_SIZE(dap_stream_ch_chain_update_element_t,
                                                                           sizeof(dap_stream_ch_chain_update_element_t) * s_update_pack_size);
             size_t l_data_size=0;
             for(uint_fast16_t n=0; n<s_update_pack_size && (l_ch_chain->request_atom_iter && l_ch_chain->request_atom_iter->cur);n++){
                 memcpy(&l_data[n].hash, l_ch_chain->request_atom_iter->cur_hash, sizeof (l_data[n].hash));
                 // Shift offset counter
-                l_data_size += sizeof (dap_stream_ch_chain_update_element_t);
+                l_data_size += sizeof(dap_stream_ch_chain_update_element_t);
                 // Then get next atom
                 l_ch_chain->request_atom_iter->chain->callback_atom_iter_get_next(l_ch_chain->request_atom_iter, NULL);
             }
             if (l_data_size){
                 if(s_debug_more)
-                    log_it(L_DEBUG,"Out: UPDATE_CHAINS size %zd sent ",l_data_size);
+                    log_it(L_DEBUG,"Out: UPDATE_CHAINS with %zu hashes sent", l_data_size / sizeof(dap_stream_ch_chain_update_element_t));
                 dap_stream_ch_chain_pkt_write_unsafe(a_ch, DAP_STREAM_CH_CHAIN_PKT_TYPE_UPDATE_CHAINS,
                                                      l_ch_chain->request_hdr.net_id.uint64,
                                                      l_ch_chain->request_hdr.chain_id.uint64,
@@ -1662,7 +1684,7 @@ void s_stream_ch_packet_out(dap_stream_ch_t* a_ch, void* a_arg)
                                                      l_ch_chain->request_hdr.chain_id.uint64,
                                                      l_ch_chain->request_hdr.cell_id.uint64,
                                                      &l_request, sizeof(dap_stream_ch_chain_sync_request_t));
-                dap_stream_ch_chain_go_idle(l_ch_chain);
+                l_go_idle = true;
                 dap_stream_ch_set_ready_to_write_unsafe(a_ch, false);
             }
             DAP_DELETE(l_data);
@@ -1713,7 +1735,7 @@ void s_stream_ch_packet_out(dap_stream_ch_t* a_ch, void* a_arg)
                 if (l_was_sent_smth)
                     break;
                 else
-                    s_chain_timer_reset(l_ch_chain);
+                    l_timer_reset = true;
             }
             if(!l_ch_chain->request_atom_iter || !l_ch_chain->request_atom_iter->cur)  { // All chains synced
                 dap_stream_ch_chain_sync_request_t l_request = {};
@@ -1723,7 +1745,7 @@ void s_stream_ch_packet_out(dap_stream_ch_t* a_ch, void* a_arg)
                                                      l_ch_chain->request_hdr.net_id.uint64, l_ch_chain->request_hdr.chain_id.uint64,
                                                      l_ch_chain->request_hdr.cell_id.uint64, &l_request, sizeof(l_request));
                 log_it( L_INFO,"Synced: %"DAP_UINT64_FORMAT_U" atoms processed", l_ch_chain->stats_request_atoms_processed);
-                dap_stream_ch_chain_go_idle(l_ch_chain);
+                l_go_idle = true;
                 if (l_ch_chain->callback_notify_packet_out)
                     l_ch_chain->callback_notify_packet_out(l_ch_chain, DAP_STREAM_CH_CHAIN_PKT_TYPE_SYNCED_CHAINS, NULL,
                                                            0, l_ch_chain->callback_notify_arg);
@@ -1736,4 +1758,9 @@ void s_stream_ch_packet_out(dap_stream_ch_t* a_ch, void* a_arg)
         } break;
         default: break;
     }
+    pthread_rwlock_unlock(&l_ch_chain->idle_lock);
+    if (l_go_idle)
+        s_ch_chain_go_idle(l_ch_chain);
+    else if (l_timer_reset)
+        s_chain_timer_reset(l_ch_chain);
 }
diff --git a/modules/channel/chain/include/dap_stream_ch_chain.h b/modules/channel/chain/include/dap_stream_ch_chain.h
index 16a38715aba3f8b92dc3d52e1d449ea7d2c42e42..a543463afbbc3fc6a36eaf45bd69805cf59b5a98 100644
--- a/modules/channel/chain/include/dap_stream_ch_chain.h
+++ b/modules/channel/chain/include/dap_stream_ch_chain.h
@@ -77,6 +77,7 @@ typedef struct dap_stream_ch_chain {
 
     int timer_shots;
     dap_timerfd_t *activity_timer;
+    pthread_rwlock_t idle_lock;
 
     dap_stream_ch_chain_callback_packet_t callback_notify_packet_out;
     dap_stream_ch_chain_callback_packet_t callback_notify_packet_in;
@@ -91,6 +92,6 @@ int dap_stream_ch_chain_init(void);
 void dap_stream_ch_chain_deinit(void);
 
 inline static uint8_t dap_stream_ch_chain_get_id(void) { return (uint8_t) 'C'; }
-void dap_stream_ch_chain_go_idle ( dap_stream_ch_chain_t * a_ch_chain);
 dap_chain_t * dap_chain_get_chain_from_group_name(dap_chain_net_id_t a_net_id, const char *a_group_name);
 void dap_stream_ch_chain_create_sync_request_gdb(dap_stream_ch_chain_t * a_ch_chain, dap_chain_net_t * a_net);
+void dap_stream_ch_chain_timer_start(dap_stream_ch_chain_t *a_ch_chain);
diff --git a/modules/common/dap_chain_common.c b/modules/common/dap_chain_common.c
index 41f08c556457194671937b26a4a66bce93164ebc..0d0a695ced70a0862be7a7a456dc22c38be7d1fb 100644
--- a/modules/common/dap_chain_common.c
+++ b/modules/common/dap_chain_common.c
@@ -40,20 +40,12 @@
 /*
  * Forward declarations
  */
-#define DAP_CHAIN$SZ_MAX128DEC 39                                           /* "340282366920938463463374607431768211455" */
-#define DAP_CHAIN$SZ_MAX256DEC (2*39)                                       /* 2 * "340282366920938463463374607431768211455" */
+#define DAP_CHAIN$SZ_MAX128DEC DATOSHI_POW                                           /* "340282366920938463463374607431768211455" */
+#define DAP_CHAIN$SZ_MAX256DEC DATOSHI_POW256                                       /* 2 ^ "340282366920938463463374607431768211455" */
 
 char        *dap_cvt_uint256_to_str (uint256_t a_uint256);
 uint256_t   dap_cvt_str_to_uint256 (const char *a_256bit_num);
 
-dap_chain_time_t dap_chain_time_now()
-{
-    struct timespec ts;
-    clock_gettime(CLOCK_REALTIME, &ts);
-    dap_chain_time_t ret = ts.tv_sec << 32 | ts.tv_nsec;
-    return ret;
-}
-
 /**
  * @brief dap_chain_hash_to_str
  * @param a_hash
@@ -112,7 +104,7 @@ dap_chain_addr_t* dap_chain_addr_from_str(const char *a_str)
     size_t l_ret_size = DAP_ENC_BASE58_DECODE_SIZE(l_str_len);
     dap_chain_addr_t * l_addr = DAP_NEW_Z_SIZE(dap_chain_addr_t, l_ret_size);
     if(dap_enc_base58_decode(a_str, l_addr) == sizeof(dap_chain_addr_t) &&
-            dap_chain_addr_check_sum(l_addr)==1)
+       dap_chain_addr_check_sum(l_addr)==1)
         return l_addr;
     else
         DAP_DELETE(l_addr);
@@ -346,8 +338,8 @@ char *dap_chain_balance_to_coins128(uint128_t a_balance)
 
 char *dap_chain_balance_to_coins256(uint256_t a_balance)
 {
-char *l_buf, *l_cp;
-int l_strlen, l_len;
+    char *l_buf, *l_cp;
+    int l_strlen, l_len;
 
     /* 123000...456 -> "123000...456" */
     if ( !(l_buf = dap_cvt_uint256_to_str(a_balance)) )
@@ -355,20 +347,19 @@ int l_strlen, l_len;
 
     l_strlen = strlen(l_buf);
 
-    if ( 0 < (l_len = (l_strlen - DATOSHI_DEGREE_18)) )
-        {
+    if ( 0 < (l_len = (l_strlen - DATOSHI_DEGREE)) )
+    {
         l_cp = l_buf + l_len;                                               /* Move last 18 symbols to one position right */
-        memmove(l_cp + 1, l_cp, DATOSHI_DEGREE_18);
+        memmove(l_cp + 1, l_cp, DATOSHI_DEGREE);
         *l_cp = '.';                                                        /* Insert '.' separator */
 
         l_strlen++;                                                         /* Adjust string len in the buffer */
     } else {
-        l_len = DATOSHI_DEGREE_18 - l_strlen + 2;                           /* Add leading "0." */
+        l_len = DATOSHI_DEGREE - l_strlen;                           /* Add leading "0." */
         l_cp = l_buf;
-        memmove(l_cp + 2, l_cp, l_len);                                     /* Move last 18 symbols to 2 positions right */
-        *(l_cp++) = '0';
-        *(l_cp++) = '.';
-
+        memmove(l_cp + l_len + 2, l_cp, DATOSHI_DEGREE - l_len);                                     /* Move last 18 symbols to 2 positions right */
+        memset(l_cp, '0', l_len + 2);
+        *(++l_cp) = '.';
         l_strlen += 2;                                                      /* Adjust string len in the buffer */
     }
 
@@ -391,9 +382,9 @@ int l_strlen, l_len;
         l_strlen = l_len;                                                   /* Adjust string len in the buffer */
     }
 
-    for ( l_cp = l_buf + l_strlen -1; *l_cp == '0'; l_cp--)
-        *l_cp = '\0';
-
+    for ( l_cp = l_buf + strlen(l_buf) - 1; *l_cp == '0'; l_cp--)
+        if (*(l_cp - 1) != '.')
+            *l_cp = '\0';
 
     return l_buf;
 }
@@ -402,45 +393,45 @@ const union __c_pow10__ {
     uint64_t u64[2];
     uint32_t u32[4];
 } DAP_ALIGN_PACKED c_pow10[DATOSHI_POW + 1] = {
-    { .u64 = {0,                         1ULL} },                          // 0
-    { .u64 = {0,                         10ULL} },                         // 1
-    { .u64 = {0,                         100ULL} },                        // 2
-    { .u64 = {0,                         1000ULL} },                       // 3
-    { .u64 = {0,                         10000ULL} },                      // 4
-    { .u64 = {0,                         100000ULL} },                     // 5
-    { .u64 = {0,                         1000000ULL} },                    // 6
-    { .u64 = {0,                         10000000ULL} },                   // 7
-    { .u64 = {0,                         100000000ULL} },                  // 8
-    { .u64 = {0,                         1000000000ULL} },                 // 9
-    { .u64 = {0,                         10000000000ULL} },                // 10
-    { .u64 = {0,                         100000000000ULL} },               // 11
-    { .u64 = {0,                         1000000000000ULL} },              // 12
-    { .u64 = {0,                         10000000000000ULL} },             // 13
-    { .u64 = {0,                         100000000000000ULL} },            // 14
-    { .u64 = {0,                         1000000000000000ULL} },           // 15
-    { .u64 = {0,                         10000000000000000ULL} },          // 16
-    { .u64 = {0,                         100000000000000000ULL} },         // 17
-    { .u64 = {0,                         1000000000000000000ULL} },        // 18
-    { .u64 = {0,                         10000000000000000000ULL} },       // 19
-    { .u64 = {5ULL,                      7766279631452241920ULL} },        // 20
-    { .u64 = {54ULL,                     3875820019684212736ULL} },        // 21
-    { .u64 = {542ULL,                    1864712049423024128ULL} },        // 22
-    { .u64 = {5421ULL,                   200376420520689664ULL} },         // 23
-    { .u64 = {54210ULL,                  2003764205206896640ULL} },        // 24
-    { .u64 = {542101ULL,                 1590897978359414784ULL} },        // 25
-    { .u64 = {5421010ULL,                15908979783594147840ULL} },       // 26
-    { .u64 = {54210108ULL,               11515845246265065472ULL} },       // 27
-    { .u64 = {542101086ULL,              4477988020393345024ULL} },        // 28
-    { .u64 = {5421010862ULL,             7886392056514347008ULL} },        // 29
-    { .u64 = {54210108624ULL,            5076944270305263616ULL} },        // 30
-    { .u64 = {542101086242ULL,           13875954555633532928ULL} },       // 31
-    { .u64 = {5421010862427ULL,          9632337040368467968ULL} },        // 32
-    { .u64 = {54210108624275ULL,         4089650035136921600ULL} },        // 33
-    { .u64 = {542101086242752ULL,        4003012203950112768ULL} },        // 34
-    { .u64 = {5421010862427522ULL,       3136633892082024448ULL} },        // 35
-    { .u64 = {54210108624275221ULL,      12919594847110692864ULL} },       // 36
-    { .u64 = {542101086242752217ULL,     68739955140067328ULL} },          // 37
-    { .u64 = {5421010862427522170ULL,    687399551400673280ULL} }          // 38
+        { .u64 = {0,                         1ULL} },                          // 0
+        { .u64 = {0,                         10ULL} },                         // 1
+        { .u64 = {0,                         100ULL} },                        // 2
+        { .u64 = {0,                         1000ULL} },                       // 3
+        { .u64 = {0,                         10000ULL} },                      // 4
+        { .u64 = {0,                         100000ULL} },                     // 5
+        { .u64 = {0,                         1000000ULL} },                    // 6
+        { .u64 = {0,                         10000000ULL} },                   // 7
+        { .u64 = {0,                         100000000ULL} },                  // 8
+        { .u64 = {0,                         1000000000ULL} },                 // 9
+        { .u64 = {0,                         10000000000ULL} },                // 10
+        { .u64 = {0,                         100000000000ULL} },               // 11
+        { .u64 = {0,                         1000000000000ULL} },              // 12
+        { .u64 = {0,                         10000000000000ULL} },             // 13
+        { .u64 = {0,                         100000000000000ULL} },            // 14
+        { .u64 = {0,                         1000000000000000ULL} },           // 15
+        { .u64 = {0,                         10000000000000000ULL} },          // 16
+        { .u64 = {0,                         100000000000000000ULL} },         // 17
+        { .u64 = {0,                         1000000000000000000ULL} },        // 18
+        { .u64 = {0,                         10000000000000000000ULL} },       // 19
+        { .u64 = {5ULL,                      7766279631452241920ULL} },        // 20
+        { .u64 = {54ULL,                     3875820019684212736ULL} },        // 21
+        { .u64 = {542ULL,                    1864712049423024128ULL} },        // 22
+        { .u64 = {5421ULL,                   200376420520689664ULL} },         // 23
+        { .u64 = {54210ULL,                  2003764205206896640ULL} },        // 24
+        { .u64 = {542101ULL,                 1590897978359414784ULL} },        // 25
+        { .u64 = {5421010ULL,                15908979783594147840ULL} },       // 26
+        { .u64 = {54210108ULL,               11515845246265065472ULL} },       // 27
+        { .u64 = {542101086ULL,              4477988020393345024ULL} },        // 28
+        { .u64 = {5421010862ULL,             7886392056514347008ULL} },        // 29
+        { .u64 = {54210108624ULL,            5076944270305263616ULL} },        // 30
+        { .u64 = {542101086242ULL,           13875954555633532928ULL} },       // 31
+        { .u64 = {5421010862427ULL,          9632337040368467968ULL} },        // 32
+        { .u64 = {54210108624275ULL,         4089650035136921600ULL} },        // 33
+        { .u64 = {542101086242752ULL,        4003012203950112768ULL} },        // 34
+        { .u64 = {5421010862427522ULL,       3136633892082024448ULL} },        // 35
+        { .u64 = {54210108624275221ULL,      12919594847110692864ULL} },       // 36
+        { .u64 = {542101086242752217ULL,     68739955140067328ULL} },          // 37
+        { .u64 = {5421010862427522170ULL,    687399551400673280ULL} }          // 38
 };
 
 uint128_t dap_chain_balance_scan128(const char *a_balance)
@@ -504,6 +495,7 @@ uint256_t dap_chain_balance_scan(const char *a_balance)
 {
     return dap_cvt_str_to_uint256 (a_balance);                              /* @RRL */
     //return GET_256_FROM_128(dap_chain_balance_scan128(a_balance));
+
 }
 
 
@@ -570,14 +562,14 @@ uint128_t dap_chain_coins_to_balance128(const char *a_coins)
 
 uint256_t dap_chain_coins_to_balance256(const char *a_coins)
 {
-int l_len, l_pos;
-char    l_buf  [DAP_CHAIN$SZ_MAX256DEC + 8] = {0}, *l_point;
-uint256_t l_nul = {0};
+    int l_len, l_pos;
+    char    l_buf  [DAP_CHAIN$SZ_MAX256DEC + 8] = {0}, *l_point;
+    uint256_t l_nul = {0};
 
     /* "12300000000.0000456" */
     if ( (l_len = strnlen(a_coins, 2*DATOSHI_POW + 2 )) > 2*DATOSHI_POW + 2)/* Check for legal length */
         return  log_it(L_WARNING, "Incorrect balance format of '%s' - too long (%d > %d)", a_coins,
-                l_len, 2*DATOSHI_POW + 2), l_nul;
+                       l_len, 2*DATOSHI_POW + 2), l_nul;
 
     /* Find , check and remove 'precision' dot symbol */
     memcpy (l_buf, a_coins, l_len);                                         /* Make local coy */
@@ -587,7 +579,7 @@ uint256_t l_nul = {0};
 
     l_pos = l_len - (l_point - l_buf);                                      /* Check number of decimals after dot */
     l_pos--;
-    if ( (l_pos ) >  DATOSHI_DEGREE_18 )
+    if ( (l_pos ) >  DATOSHI_DEGREE )
         return  log_it(L_WARNING, "Incorrect balance format of '%s' - too much precision", l_buf), l_nul;
 
     /* "123.456" -> "123456" */
@@ -603,205 +595,119 @@ uint256_t l_nul = {0};
      *           |            |
      *           +-18 digits--+
      */
-    memset(l_point + l_pos, '0', DATOSHI_DEGREE_18 - l_pos);
+    memset(l_point + l_pos, '0', DATOSHI_DEGREE - l_pos);
 
     return dap_cvt_str_to_uint256 (l_buf);
 }
 
 
 
-/*
- *   DESCRIPTION: Convert 256-bit unsigned integer into the decimal text string representation
- *
- *   INPUTS:
- *      a_uint256:  A value to convert
- *
- *   OUTPUTS:
- *      NONE
- *
- *   RETURNS:
- *      an address of the decimal representation text string , shoud be deallocated  by free()
- */
+char *dap_cvt_uint256_to_str(uint256_t a_uint256) {
+    char *l_buf = DAP_NEW_Z_SIZE(char, DATOSHI_POW * 2 + 3);
+    int l_pos = 0;
+    uint256_t l_value = a_uint256;
+    uint256_t uint256_ten = {.hi = 0, .lo = 10};
+    uint256_t rem;
 #ifdef DAP_GLOBAL_IS_INT128
-char *dap_cvt_uint256_to_str (uint256_t a_uint256)
-{
-char *l_buf, *l_cp, *l_cp2, *l_cps, *l_cpe, l_chr;
-int     l_len;
-uint128_t l_nibble;
-
-
-    l_len = (DAP_CHAIN$SZ_MAX256DEC + 8) & (~7);                            /* Align size of the buffer to 8 bytes */
-
-    if ( !(l_buf = DAP_NEW_Z_SIZE(char, l_len)) )
-        return  log_it(L_ERROR, "Cannot allocate %d octets, errno=%d", l_len, errno), NULL;
-
-    l_cp = l_buf;
-
-
-    /* hi = 123, lo = 0...0456 */
-    if ( a_uint256.hi )
-    {
-        /* 123 - > "321" */
-        l_nibble = a_uint256.hi;
-        do { *(l_cp++) = (l_nibble % 10) + '0'; } while (l_nibble /= 10);
-
-        l_len = l_cp - l_buf;                                                   /* Length of the decimal string */
-        l_len = l_len / 2;                                                      /* A number of swaps */
-
-        l_cps = l_buf;                                                          /* Pointer to head */
-        l_cpe = l_cp - 1;                                                       /* -- // -- to tail of the string */
-
-        for (int i = l_len; i--; l_cps++, l_cpe--)                              /* Do swaps ... */
-        {
-            l_chr = *l_cps;
-            *l_cps = *l_cpe;
-            *l_cpe = l_chr;
-        }
-    }
-
-    /* 456 - > "456" */
-    l_cp2 = l_cp;
-    l_nibble = a_uint256.lo;
-
     do {
-        *(l_cp2++) = (l_nibble % 10) + '0';
-    } while (l_nibble /= 10);
-
-
-    l_len = l_cp2 - l_cp;
-    l_len = l_len / 2;
-
-    l_cps = l_cp;
-    l_cpe = l_cp2 - 1;
-
-    for (int i = l_len; i--; l_cps++, l_cpe--)
-    {
-        l_chr = *l_cps;
-        *l_cps = *l_cpe;
-        *l_cpe = l_chr;
-    }
-
-    if (  DAP_CHAIN$SZ_MAX128DEC > (l_len = l_cp2 - l_cp) ) {
-        /* "123456" -> 123000...000456" */
-        memmove(l_cp + ( DAP_CHAIN$SZ_MAX128DEC - l_len), l_cp, l_len);
-        memset(l_cp, '0', ( DAP_CHAIN$SZ_MAX128DEC - l_len));
-    }
-
-    return l_buf;
-}
-
+        divmod_impl_256(l_value, uint256_ten, &l_value, &rem);
+        l_buf[l_pos++] = rem.lo + '0';
+    } while (!IS_ZERO_256(l_value));
 #else
-static const   char l_zero[sizeof(uint256_t)] = {0};
-
-char *dap_cvt_uint256_to_str(uint256_t a_balance)
-{
-int     l_pos, l_len, l_len_hi, l_len_lo;
-char    *l_buf, *l_cp, *l_cp2,  *l_cps, *l_cpe, l_chr;
-static const   char l_zero[sizeof(uint256_t)] = {0};
-uint64_t t, q;
-uint32_t l_tmp[4];
-
-    l_len = (DAP_CHAIN$SZ_MAX256DEC + 8) & (~7);                            /* Align size of the buffer to 8 bytes */
-
-    if ( !(l_buf = DAP_NEW_Z_SIZE(char, l_len)) )
-        return  log_it(L_ERROR, "Cannot allocate %d octets, errno=%d", l_len, errno), NULL;
-
-    l_cp = l_buf;
-
-    if ( memcmp(&a_balance.hi, &l_zero, sizeof(uint128_t)) )
-    {
-        l_tmp [0] = a_balance.__hi.a;
-        l_tmp [1] = a_balance.__hi.b;
-        l_tmp [2] = a_balance.__hi.c;
-        l_tmp [3] = a_balance.__hi.d;
-
-        l_len_hi = 0;
-        l_cps = l_cp;
-
-        do {
-            q = 0;
-            // Byte order is 1, 0, 3, 2 for little endian
-            for (int i = 1; i <= 3; )
-            {
-                t = q << 32 | l_tmp[i];
-                q = t % 10;
-                l_tmp[i] = t / 10;
-
-                if (i == 2) i = 4; // end of cycle
-                if (i == 3) i = 2;
-                if (i == 0) i = 3;
-                if (i == 1) i = 0;
-            }
-
-            *(l_cp++) = q + '0';
-            l_len_hi++;
-
-        } while (l_tmp[2]);
-
-        l_pos = l_len_hi / 2;                                               /* A number of swaps */
-        l_cpe = l_cp - 1;                                                   /* -- // -- to tail of the string */
-
-        for (int i = l_pos; i--; l_cps++, l_cpe--)                          /* Do swaps ... */
-        {
-            l_chr = *l_cps;
-            *l_cps = *l_cpe;
-            *l_cpe = l_chr;
-        }
-    }
-
-    l_tmp [0] = a_balance.__lo.a;
-    l_tmp [1] = a_balance.__lo.b;
-    l_tmp [2] = a_balance.__lo.c;
-    l_tmp [3] = a_balance.__lo.d;
-
-    l_len_lo = 0;
-    l_cps = l_cp2 = l_cp;
-
-    do {
-        q = 0;
-        // Byte order is 1, 0, 3, 2 for little endian
-        for (int i = 1; i <= 3; )
-        {
-            t = q << 32 | l_tmp[i];
-            q = t % 10;
-            l_tmp[i] = t / 10;
-
-            if (i == 2) i = 4; // end of cycle
-            if (i == 3) i = 2;
-            if (i == 0) i = 3;
-            if (i == 1) i = 0;
-        }
-
-        *(l_cp2++) = q + '0';
-        l_len_lo++;
-
-    } while (l_tmp[2]);
-
-
-    l_pos = l_len_lo / 2;                                                   /* A number of swaps */
-    l_cpe = l_cp2 - 1;                                                      /* -- // -- to tail of the string */
-
-    for (int i = l_pos; i--; l_cps++, l_cpe--)                              /* Do swaps ... */
-    {
-        l_chr = *l_cps;
-        *l_cps = *l_cpe;
-        *l_cpe = l_chr;
-    }
-
-    if (  l_len_hi && (DAP_CHAIN$SZ_MAX128DEC > l_len_lo) )                 /* Do we need to add leading zeroes ? */
-    {
-        /* "123456" -> 123000...000456" */
-        memmove(l_cp2 + ( DAP_CHAIN$SZ_MAX128DEC - l_len), l_cp2, l_len_lo);
-        memset(l_cp2, '0', ( DAP_CHAIN$SZ_MAX128DEC - l_len_lo));
+    log_it(L_WARNING, "256 to str not implemented yet for non-native 128-bit");
+#endif
+    int l_strlen = strlen(l_buf) - 1;
+    for (int i = 0; i < (l_strlen + 1) / 2; i++) {
+        char c = l_buf[i];
+        l_buf[i] = l_buf[l_strlen - i];
+        l_buf[l_strlen - i] = c;
     }
-
-    return  l_buf;
+    return l_buf;
 }
-#endif
-
-
 
 
+const union __c_pow10_double__ {
+    uint64_t u64[4];
+    uint32_t u32[8];
+} DAP_ALIGN_PACKED c_pow10_double[DATOSHI_POW * 2 + 1] = {
+        { .u64 = {0,                            0,                           0,                         1ULL} },                          // 0
+        { .u64 = {0,                            0,                           0,                         10ULL} },                         // 1
+        { .u64 = {0,                            0,                           0,                         100ULL} },                        // 2
+        { .u64 = {0,                            0,                           0,                         1000ULL} },                       // 3
+        { .u64 = {0,                            0,                           0,                         10000ULL} },                      // 4
+        { .u64 = {0,                            0,                           0,                         100000ULL} },                     // 5
+        { .u64 = {0,                            0,                           0,                         1000000ULL} },                    // 6
+        { .u64 = {0,                            0,                           0,                         10000000ULL} },                   // 7
+        { .u64 = {0,                            0,                           0,                         100000000ULL} },                  // 8
+        { .u64 = {0,                            0,                           0,                         1000000000ULL} },                 // 9
+        { .u64 = {0,                            0,                           0,                         10000000000ULL} },                // 10
+        { .u64 = {0,                            0,                           0,                         100000000000ULL} },               // 11
+        { .u64 = {0,                            0,                           0,                         1000000000000ULL} },              // 12
+        { .u64 = {0,                            0,                           0,                         10000000000000ULL} },             // 13
+        { .u64 = {0,                            0,                           0,                         100000000000000ULL} },            // 14
+        { .u64 = {0,                            0,                           0,                         1000000000000000ULL} },           // 15
+        { .u64 = {0,                            0,                           0,                         10000000000000000ULL} },          // 16
+        { .u64 = {0,                            0,                           0,                         100000000000000000ULL} },         // 17
+        { .u64 = {0,                            0,                           0,                         1000000000000000000ULL} },        // 18
+        { .u64 = {0,                            0,                           0,                         10000000000000000000ULL} },       // 19
+        { .u64 = {0,                            0,                           5ULL,                      7766279631452241920ULL} },        // 20
+        { .u64 = {0,                            0,                           54ULL,                     3875820019684212736ULL} },        // 21
+        { .u64 = {0,                            0,                           542ULL,                    1864712049423024128ULL} },        // 22
+        { .u64 = {0,                            0,                           5421ULL,                   200376420520689664ULL} },         // 23
+        { .u64 = {0,                            0,                           54210ULL,                  2003764205206896640ULL} },        // 24
+        { .u64 = {0,                            0,                           542101ULL,                 1590897978359414784ULL} },        // 25
+        { .u64 = {0,                            0,                           5421010ULL,                15908979783594147840ULL} },       // 26
+        { .u64 = {0,                            0,                           54210108ULL,               11515845246265065472ULL} },       // 27
+        { .u64 = {0,                            0,                           542101086ULL,              4477988020393345024ULL} },        // 28
+        { .u64 = {0,                            0,                           5421010862ULL,             7886392056514347008ULL} },        // 29
+        { .u64 = {0,                            0,                           54210108624ULL,            5076944270305263616ULL} },        // 30
+        { .u64 = {0,                            0,                           542101086242ULL,           13875954555633532928ULL} },       // 31
+        { .u64 = {0,                            0,                           5421010862427ULL,          9632337040368467968ULL} },        // 32
+        { .u64 = {0,                            0,                           54210108624275ULL,         4089650035136921600ULL} },        // 33
+        { .u64 = {0,                            0,                           542101086242752ULL,        4003012203950112768ULL} },        // 34
+        { .u64 = {0,                            0,                           5421010862427522ULL,       3136633892082024448ULL} },        // 35
+        { .u64 = {0,                            0,                           54210108624275221ULL,      12919594847110692864ULL} },       // 36
+        { .u64 = {0,                            0,                           542101086242752217ULL,     68739955140067328ULL} },          // 37
+        { .u64 = {0,                            0,                           5421010862427522170ULL,    687399551400673280ULL} },         // 38
+        { .u64 = {0,                            2ULL,                        17316620476856118468ULL,   6873995514006732800ULL} },        // 39
+        { .u64 = {0,                            29ULL,                       7145508105175220139ULL,    13399722918938673152ULL} },       // 40
+        { .u64 = {0,                            293ULL,                      16114848830623546549ULL,   4870020673419870208ULL} },        // 41
+        { .u64 = {0,                            2938ULL,                     13574535716559052564ULL,   11806718586779598848ULL} },       // 42
+        { .u64 = {0,                            29387ULL,                    6618148649623664334ULL,    7386721425538678784ULL} },        // 43
+        { .u64 = {0,                            293873ULL,                   10841254275107988496ULL,   80237960548581376ULL} },          // 44
+        { .u64 = {0,                            2938735ULL,                  16178822382532126880ULL,   802379605485813760ULL} },          // 45
+        { .u64 = {0,                            29387358ULL,                 14214271235644855872ULL,   8023796054858137600ULL} },          // 46
+        { .u64 = {0,                            293873587ULL,                13015503840481697412ULL,   6450984253743169536ULL} },          // 47
+        { .u64 = {0,                            2938735877ULL,               1027829888850112811ULL,    9169610316303040512ULL} },          // 48
+        { .u64 = {0,                            29387358770ULL,              10278298888501128114ULL,   17909126868192198656ULL} },          // 49
+        { .u64 = {0,                            293873587705ULL,             10549268516463523069ULL,   13070572018536022016ULL} },          // 50
+        { .u64 = {0,                            2938735877055ULL,            13258964796087472617ULL,   1578511669393358848ULL} },          // 51
+        { .u64 = {0,                            29387358770557ULL,           3462439444907864858ULL,    15785116693933588480ULL} },          // 52
+        { .u64 = {0,                            293873587705571ULL,          16177650375369096972ULL,   10277214349659471872ULL} },          // 53
+        { .u64 = {0,                            2938735877055718ULL,         14202551164014556797ULL,   10538423128046960640ULL} },          // 54
+        { .u64 = {0,                            29387358770557187ULL,        12898303124178706663ULL,   13150510911921848320ULL} },          // 55
+        { .u64 = {0,                            293873587705571876ULL,       18302566799529756941ULL,   2377900603251621888ULL} },          // 56
+        { .u64 = {0,                            2938735877055718769ULL,      17004971331911604867ULL,   5332261958806667264ULL} },          // 57
+        { .u64 = {0,                            10940614696847636083ULL,     4029016655730084128ULL,    16429131440647569408ULL} },          // 58
+        { .u64 = {15ULL,                        17172426599928602752ULL,     3396678409881738056ULL,    16717361816799281152ULL} },          // 59
+        { .u64 = {159ULL,                       5703569335900062977ULL,      15520040025107828953ULL,   1152921504606846976ULL} },          // 60
+        { .u64 = {1593ULL,                      1695461137871974930ULL,      7626447661401876602ULL,    11529215046068469760ULL} },          // 61
+        { .u64 = {15930ULL,                     16954611378719749304ULL,     2477500319180559562ULL,    4611686018427387904ULL} },          // 62
+        { .u64 = {159309ULL,                    3525417123811528497ULL,      6328259118096044006ULL,    9223372036854775808ULL} },          // 63
+        { .u64 = {1593091ULL,                   16807427164405733357ULL,     7942358959831785217ULL,    0ULL} },                            // 64
+        { .u64 = {15930919ULL,                  2053574980671369030ULL,      5636613303479645706ULL,    0ULL} },                            // 65
+        { .u64 = {159309191ULL,                 2089005733004138687ULL,      1025900813667802212ULL,    0ULL} },                            // 66
+        { .u64 = {1593091911ULL,                2443313256331835254ULL,      10259008136678022120ULL,   0ULL} },                            // 67
+        { .u64 = {15930919111ULL,               5986388489608800929ULL,      10356360998232463120ULL,   0ULL} },                            // 68
+        { .u64 = {159309191113ULL,              4523652674959354447ULL,      11329889613776873120ULL,   0ULL} },                            // 69
+        { .u64 = {1593091911132ULL,             8343038602174441244ULL,      2618431695511421504ULL,    0ULL} },                            // 70
+        { .u64 = {15930919111324ULL,            9643409726906205977ULL,      7737572881404663424ULL,    0ULL} },                            // 71
+        { .u64 = {159309191113245ULL,           4200376900514301694ULL,      3588752519208427776ULL,    0ULL} },                            // 72
+        { .u64 = {1593091911132452ULL,          5110280857723913709ULL,      17440781118374726144ULL,   0ULL} },                            // 73
+        { .u64 = {15930919111324522ULL,         14209320429820033867ULL,     8387114520361296896ULL,    0ULL} },                            // 74
+        { .u64 = {159309191113245227ULL,        12965995782233477362ULL,     10084168908774762496ULL,   0ULL} },                            // 75
+        { .u64 = {1593091911132452277ULL,       532749306367912313ULL,       8607968719199866880ULL,    0ULL} },                            // 76
+};
 
 
 /*
@@ -821,27 +727,96 @@ uint32_t l_tmp[4];
 
 uint256_t dap_cvt_str_to_uint256(const char *a_256bit_num)
 {
-int  l_strlen, l_len;
-uint256_t l_ret = {}, l_nul = uint256_0;
-char    l_128bit_num  [DAP_CHAIN$SZ_MAX128DEC + 8];
+    uint256_t l_ret = uint256_0, l_nul = uint256_0;
+    int  l_strlen;
+    char l_256bit_num[DAP_CHAIN$SZ_MAX256DEC];
 
     /* Compute & check length */
     if ( (l_strlen = strnlen(a_256bit_num, DAP_CHAIN$SZ_MAX256DEC + 1) ) > DAP_CHAIN$SZ_MAX256DEC)
         return  log_it(L_ERROR, "Too many digits in `%s` (%d > %d)", a_256bit_num, l_strlen, DAP_CHAIN$SZ_MAX256DEC), l_nul;
 
-    /* Convert firstly low part of the decimal string */
-    l_len = (l_strlen > DAP_CHAIN$SZ_MAX128DEC) ? DAP_CHAIN$SZ_MAX128DEC : l_strlen;
-    l_ret.lo =  dap_chain_balance_scan128(a_256bit_num + (l_strlen - l_len));
+    /* Convert number from xxx.yyyyE+zz to xxxyyyy0000... */
+    char *l_eptr = strchr(a_256bit_num, 'e');
+    if (!l_eptr)
+        l_eptr = strchr(a_256bit_num, 'E');
+    if (l_eptr) {
+        char *l_exp_ptr = l_eptr + 1;
+        if (*l_exp_ptr == '+')
+            l_exp_ptr++;
+        int l_exp = atoi(l_exp_ptr);
+        if (!l_exp)
+            return  log_it(L_ERROR, "Invalid exponent %s", l_eptr), uint256_0;
+        char *l_dot_ptr = strchr(a_256bit_num, '.');
+        if (!l_dot_ptr || l_dot_ptr > l_eptr)
+            return  log_it(L_ERROR, "Invalid number format with exponent %d", l_exp), uint256_0;
+        int l_dot_len = l_dot_ptr - a_256bit_num;
+        if (l_dot_len >= DAP_CHAIN$SZ_MAX256DEC)
+            return log_it(L_ERROR, "Too many digits in '%s'", a_256bit_num), uint256_0;
+        int l_exp_len = l_eptr - a_256bit_num - l_dot_len - 1;
+        if (l_exp_len + l_dot_len + 1 >= DAP_CHAIN$SZ_MAX256DEC)
+            return log_it(L_ERROR, "Too many digits in '%s'", a_256bit_num), uint256_0;
+        if (l_exp < l_exp_len)
+            return  log_it(L_ERROR, "Invalid number format with exponent %d and nuber coun after dot %d", l_exp, l_exp_len), uint256_0;
+        memcpy(l_256bit_num, a_256bit_num, l_dot_len);
+        memcpy(l_256bit_num + l_dot_len, a_256bit_num + l_dot_len + 1, l_exp_len);
+        int l_zero_cnt = l_exp - l_exp_len;
+        size_t l_pos = l_dot_len + l_exp_len;
+        for (int i = l_zero_cnt; i && l_pos < DAP_CHAIN$SZ_MAX256DEC; i--)
+            l_256bit_num[l_pos++] = '0';
+        l_256bit_num[l_pos] = '\0';
+        l_strlen = l_pos;
+    } else {
+        memcpy(l_256bit_num, a_256bit_num, l_strlen);
+        l_256bit_num[l_strlen] = '\0';
+    }
+
+    for (int i = 0; i < l_strlen ; i++) {
+        char c = l_256bit_num[l_strlen - i - 1];
+        if (!isdigit(c)) {
+            log_it(L_WARNING, "Incorrect input number");
+            return l_nul;
+        }
+        uint8_t l_digit = c - '0';
+        if (!l_digit)
+            continue;
+#ifdef DAP_GLOBAL_IS_INT128
+        uint256_t l_tmp;
+        l_tmp.hi = 0;
+        l_tmp.lo = (uint128_t)c_pow10_double[i].u64[3] * (uint128_t) l_digit;
+        SUM_256_256(l_ret, l_tmp, &l_ret);
+        if (l_ret.hi == 0 && l_ret.lo == 0) {
+            return l_nul;
+        }
+        uint128_t l_mul = (uint128_t) c_pow10_double[i].u64[2] * (uint128_t) l_digit;
+        l_tmp.lo = l_mul << 64;
+        l_tmp.hi = l_mul >> 64;
+        SUM_256_256(l_ret, l_tmp, &l_ret);
+
+        if (l_ret.hi == 0 && l_ret.lo == 0) {
+            return l_nul;
+        }
 
+        l_tmp.lo = 0;
+        l_tmp.hi = (uint128_t) c_pow10_double[i].u64[1] * (uint128_t) l_digit;
+        SUM_256_256(l_ret, l_tmp, &l_ret);
+        if (l_ret.hi == 0 && l_ret.lo == 0) {
+            return l_nul;
+        }
 
-    /* Convert a high part of the decimal string is need */
-    if ( 0 < (l_len = (l_strlen -  DAP_CHAIN$SZ_MAX128DEC)) )
-    {
-        memcpy(l_128bit_num, a_256bit_num, l_len);
-        l_128bit_num[l_len] = '\0';
-        l_ret.hi =  dap_chain_balance_scan128(l_128bit_num);
+        l_mul = (uint128_t) c_pow10_double->u64[0] * (uint128_t) l_digit;
+        if (l_mul >> 64) {
+            log_it(L_WARNING, "Input number is too big");
+            return l_nul;
+        }
+        l_tmp.hi = l_mul << 64;
+        SUM_256_256(l_ret, l_tmp, &l_ret);
+        if (l_ret.hi == 0 && l_ret.lo == 0) {
+            return l_nul;
+        }
+#else
+        log_it(L_WARNING, "str to 256 not implemented yet for non-native 128-bit");
+#endif
     }
-
     return l_ret;
 }
 
@@ -867,11 +842,11 @@ char *dap_chain_balance_to_coins(uint256_t a_balance)
 
 char *dap_chain_balance_print333(uint256_t a_balance)
 {
-int     l_pos, l_len, l_len_hi, l_len_lo;
-char    *l_buf, *l_cp, *l_cp2,  *l_cps, *l_cpe, l_chr;
-static const   char l_zero[sizeof(uint256_t)] = {0};
-uint64_t t, q;
-uint32_t l_tmp[4];
+    int     l_pos, l_len, l_len_hi, l_len_lo;
+    char    *l_buf, *l_cp, *l_cp2,  *l_cps, *l_cpe, l_chr;
+    static const   char l_zero[sizeof(uint256_t)] = {0};
+    uint64_t t, q;
+    uint32_t l_tmp[4];
 
     l_len = (DAP_CHAIN$SZ_MAX256DEC + 8) & (~7);                            /* Align size of the buffer to 8 bytes */
 
@@ -976,17 +951,17 @@ uint32_t l_tmp[4];
 
 void    uint256_cvt_test (void)
 {
-extern char *dap_cvt_uint256_to_str(uint256_t a_uint256);
-extern uint256_t dap_cvt_str_to_uint256(const char *a_256bit_num);
-extern char *dap_chain_balance_to_coins256(uint256_t a_balance);
-extern  char *dap_chain_balance_print333(uint256_t a_balance);
-
-char *cp;
-uint128_t uint128 = dap_chain_uint128_from(-1);
-uint256_t uint256;
-uint256.hi = dap_chain_uint128_from(123);
-uint256.lo = dap_chain_uint128_from(374607431768211455);
-const   uint256_t uint256_zero = {0};
+    extern char *dap_cvt_uint256_to_str(uint256_t a_uint256);
+    extern uint256_t dap_cvt_str_to_uint256(const char *a_256bit_num);
+    extern char *dap_chain_balance_to_coins256(uint256_t a_balance);
+    extern  char *dap_chain_balance_print333(uint256_t a_balance);
+
+    char *cp;
+    uint128_t uint128 = dap_chain_uint128_from(-1);
+    uint256_t uint256;
+    uint256.hi = dap_chain_uint128_from(123);
+    uint256.lo = dap_chain_uint128_from(374607431768211455);
+    const   uint256_t uint256_zero = {0};
 
     uint256 = uint256_zero;
     uint256.__lo.c = 1;
diff --git a/modules/common/dap_chain_datum.c b/modules/common/dap_chain_datum.c
index b41554b6383f46a416dc8efad80db7be4a30e243..b01de17951b1fb56e2f71c9e5db7ffe1ede98540 100644
--- a/modules/common/dap_chain_datum.c
+++ b/modules/common/dap_chain_datum.c
@@ -24,6 +24,7 @@
 #include <string.h>
 
 #include "dap_common.h"
+#include "dap_time.h"
 #include "dap_chain_datum.h"
 #include "dap_chain_datum_tx.h"
 #include "dap_chain_datum_tx_items.h"
@@ -197,7 +198,7 @@ bool dap_chain_datum_dump_tx(dap_chain_datum_tx_t *a_datum,
                              const char *a_hash_out_type,
                              dap_hash_fast_t *a_tx_hash)
 {
-    time_t l_ts_create = (time_t)a_datum->header.ts_created;
+    dap_time_t l_ts_create = (dap_time_t)a_datum->header.ts_created;
     bool l_is_first = false;
     dap_chain_tx_in_t *l_in_item = (dap_chain_tx_in_t *)dap_chain_datum_tx_item_get(a_datum, NULL, TX_ITEM_TYPE_IN, NULL);
     if (l_in_item && dap_hash_fast_is_blank(&l_in_item->header.tx_prev_hash))
@@ -310,6 +311,7 @@ bool dap_chain_datum_dump_tx(dap_chain_datum_tx_t *a_datum,
                         ((dap_chain_datum_tx_receipt_t*)item)->receipt_info.value_datoshi);
             char *l_coins_str = dap_chain_balance_to_coins(
                         ((dap_chain_datum_tx_receipt_t*)item)->receipt_info.value_datoshi);
+            serv_unit_enum_t l_unit = ((dap_chain_datum_tx_receipt_t*)item)->receipt_info.units_type.enm;
             dap_string_append_printf(a_str_out, "\t Receipt:\n"
                                                 "\t\t size: %"DAP_UINT64_FORMAT_U"\n"
                                                 "\t\t ext size: %"DAP_UINT64_FORMAT_U"\n"
@@ -322,8 +324,7 @@ bool dap_chain_datum_dump_tx(dap_chain_datum_tx_t *a_datum,
                                      ((dap_chain_datum_tx_receipt_t*)item)->exts_size,
                                      ((dap_chain_datum_tx_receipt_t*)item)->receipt_info.units,
                                      ((dap_chain_datum_tx_receipt_t*)item)->receipt_info.srv_uid.uint64,
-                                     serv_unit_enum_to_str(
-                                         &((dap_chain_datum_tx_receipt_t*)item)->receipt_info.units_type.enm),
+                                     serv_unit_enum_to_str(&l_unit),
                                      l_coins_str,
                                      l_value_str);
             if (((dap_chain_datum_tx_receipt_t*)item)->exts_size == sizeof(dap_sign_t) + sizeof(dap_sign_t)){
@@ -394,7 +395,7 @@ bool dap_chain_datum_dump_tx(dap_chain_datum_tx_t *a_datum,
                                                 "\t\t\t value: %s (%s)\n"
                                                 "\t\t\t subtype: %s\n"
                                                 "\t\t SubType:\n",
-                                     dap_ctime_r((time_t*)((dap_chain_tx_out_cond_t*)item)->header.ts_expires, l_tmp_buf),
+                                     dap_ctime_r((dap_time_t*)((dap_chain_tx_out_cond_t*)item)->header.ts_expires, l_tmp_buf),
                                      l_coins_str,
                                      l_value_str,
                                      dap_chain_tx_out_cond_subtype_to_str(((dap_chain_tx_out_cond_t*)item)->header.subtype));
@@ -590,6 +591,18 @@ void dap_chain_datum_dump(dap_string_t *a_str_out, dap_chain_datum_t *a_datum, c
                     dap_string_append_printf(a_str_out, "  signs_count: %d\n", l_emission->data.type_auth.signs_count);
                     dap_string_append_printf(a_str_out, "  tsd_total_size: %"DAP_UINT64_FORMAT_U"\n",
                                              l_emission->data.type_auth.tsd_total_size);
+
+                    if (  ( (void *) l_emission->tsd_n_signs + l_emission->data.type_auth.tsd_total_size) >
+                          ((void *) l_emission + l_emisssion_size) )
+                    {
+                        log_it(L_ERROR, "Illformed DATUM type %d, TSD section is out-of-buffer (%" DAP_UINT64_FORMAT_U " vs %zu)",
+                            l_emission->hdr.type, l_emission->data.type_auth.tsd_total_size, l_emisssion_size);
+
+                        dap_string_append_printf(a_str_out, "  Skip incorrect or illformed DATUM");
+                        break;
+                    }
+
+
                     dap_chain_datum_token_certs_dump(a_str_out, l_emission->tsd_n_signs + l_emission->data.type_auth.tsd_total_size,
                                                      l_emission->data.type_auth.size - l_emission->data.type_auth.tsd_total_size, a_hash_out_type);
                     break;
diff --git a/modules/common/include/dap_chain_common.h b/modules/common/include/dap_chain_common.h
index 3c45f11e11981ff431335400e21d6aa9e3530c4a..d226b56cc7ed23df1ef292a7c7b5f72b9243e178 100644
--- a/modules/common/include/dap_chain_common.h
+++ b/modules/common/include/dap_chain_common.h
@@ -43,10 +43,10 @@
 #define DAP_CHAIN_TIMESTAMP_SIZE    8
 #define DAP_CHAIN_TICKER_SIZE_MAX   10
 
-#define DATOSHI_LD 1000000000.0L
-#define DATOSHI_DEGREE 9
-#define DATOSHI_DEGREE_18   18
+#define DATOSHI_LD 1000000000.0L    // Deprecated
+#define DATOSHI_DEGREE 18
 #define DATOSHI_POW 38
+#define DATOSHI_POW256 (DATOSHI_POW * 2)
 
 // Chain ID of the whole system
 typedef union dap_chain_id {
@@ -141,9 +141,6 @@ typedef struct dap_chain_addr{
     dap_chain_hash_fast_t checksum;
 }  DAP_ALIGN_PACKED dap_chain_addr_t;
 
-typedef uint64_t dap_chain_time_t;
-dap_chain_time_t dap_chain_time_now();
-
 #define DAP_CHAIN_NET_SRV_UID_SIZE 8
 
 typedef union {
diff --git a/modules/common/include/dap_chain_datum_tx_out_cond.h b/modules/common/include/dap_chain_datum_tx_out_cond.h
index b1f8a23daeec7a8e594832ad2644fbf84d78535d..8a328923bb52b2887183cab84f4dace134d7b96c 100644
--- a/modules/common/include/dap_chain_datum_tx_out_cond.h
+++ b/modules/common/include/dap_chain_datum_tx_out_cond.h
@@ -26,6 +26,7 @@
 
 #include <stdint.h>
 #include "dap_common.h"
+#include "dap_time.h"
 #include "dap_chain_common.h"
 #include "dap_chain_datum_tx.h"
 
@@ -62,7 +63,7 @@ typedef struct dap_chain_tx_out_cond {
         /// Number of Datoshis ( DAP/10^18 ) to be reserved for service
         uint256_t value;
         /// When time expires this output could be used only by transaction owner
-        dap_chain_time_t ts_expires;
+        dap_time_t ts_expires;
         /// Service uid that only could be used for this out
         dap_chain_net_srv_uid_t srv_uid;
 #if DAP_CHAIN_NET_SRV_UID_SIZE == 8
@@ -122,7 +123,7 @@ typedef struct dap_chain_tx_out_cond_old {      // Obsolete
         /// Number of Datoshis ( DAP/10^9 ) to be reserver for service
         uint64_t value;
         /// When time expires this output could be used only by transaction owner
-        dap_chain_time_t ts_expires;
+        dap_time_t ts_expires;
     } header;
     union {
         /// Structure with specific for service pay condition subtype
diff --git a/modules/consensus/block-ton/dap_chain_cs_block_ton.c b/modules/consensus/block-ton/dap_chain_cs_block_ton.c
index 79d7826f0fd781f5f91445eaad99b080ad6a5a96..f1919a86f385e6872c1d8fc3deb8e594c6438328 100644
--- a/modules/consensus/block-ton/dap_chain_cs_block_ton.c
+++ b/modules/consensus/block-ton/dap_chain_cs_block_ton.c
@@ -60,9 +60,12 @@ typedef struct dap_chain_cs_block_ton_pvt
     uint64_t *tokens_hold_value;
     dap_config_t *chain_cfg;
     size_t tokens_hold_size;
-    uint16_t confirmations_minimum;
+    // uint16_t confirmations_minimum;
     dap_chain_callback_new_cfg_t prev_callback_created;
 
+    uint16_t poa_validators_count;
+    bool flag_sign_verify;
+
 	bool debug;
 	bool validators_list_by_stake;
 	uint16_t round_start_sync_timeout;
@@ -119,7 +122,8 @@ static int s_callback_new(dap_chain_t *a_chain, dap_config_t *a_chain_cfg) {
         log_it(L_CRITICAL, "Entries tokens_hold and tokens_hold_value are different size!");
         goto lb_err;
     }
-    l_ton_pvt->confirmations_minimum = dap_config_get_item_uint16_default(a_chain_cfg, "block-ton", "verifications_minimum", 1);
+    //l_ton_pvt->confirmations_minimum = dap_config_get_item_uint16_default(a_chain_cfg, "block-ton", "verifications_minimum", 1);
+    l_ton_pvt->flag_sign_verify = true;
     l_ton_pvt->tokens_hold_size = l_tokens_hold_size;
     l_ton_pvt->tokens_hold = DAP_NEW_Z_SIZE(char *, sizeof(char *) * l_tokens_hold_size);
     l_ton_pvt->tokens_hold_value = DAP_NEW_Z_SIZE(uint64_t, l_tokens_hold_value_size * sizeof(uint64_t));
@@ -159,9 +163,10 @@ static int s_callback_new(dap_chain_t *a_chain, dap_config_t *a_chain_cfg) {
 	
 	    uint16_t l_node_addrs_count;
 	    char **l_addrs = dap_config_get_array_str(a_chain_cfg, "block-ton", "ton_nodes_addrs", &l_node_addrs_count);
+	    l_ton_pvt->poa_validators_count = l_node_addrs_count;
 	    for(size_t i = 0; i < l_node_addrs_count; i++) {
 	        dap_chain_node_addr_t *l_node_addr = DAP_NEW_Z(dap_chain_node_addr_t);
-	        if (sscanf(l_addrs[i],NODE_ADDR_FP_STR, NODE_ADDR_FPS_ARGS(l_node_addr) ) != 4 ){
+            if (dap_sscanf(l_addrs[i],NODE_ADDR_FP_STR, NODE_ADDR_FPS_ARGS(l_node_addr) ) != 4 ){
 	            log_it(L_ERROR,"TON: Wrong address format,  should be like 0123::4567::890AB::CDEF");
 	            DAP_DELETE(l_node_addr);
 	            //DAP_DELETE(l_node_info);
@@ -319,7 +324,7 @@ static int s_callback_created(dap_chain_t *a_chain, dap_config_t *a_chain_net_cf
 	l_session->state = DAP_STREAM_CH_CHAIN_SESSION_STATE_IDLE;
 	l_session->time_proc_lock = false;
 	
-	dap_chain_time_t l_time = (dap_chain_time_t)time(NULL);
+	dap_time_t l_time = dap_time_now();
 	while (true) {
 		l_time++;
 		if ( (l_time % PVT(l_session->ton)->round_start_multiple_of) == 0) {
@@ -331,15 +336,19 @@ static int s_callback_created(dap_chain_t *a_chain, dap_config_t *a_chain_net_cf
 
 	log_it(L_INFO, "TON: init session for net:%s, chain:%s", a_chain->net_name, a_chain->name);
 	DL_APPEND(s_session_items, l_session);
-	if ( s_session_get_validator(l_session, l_session->my_addr, l_session->cur_round.validators_list) ) {
-		if (!s_session_cs_timer) {
-			s_session_cs_timer = dap_timerfd_start(1*1000, 
-	                        (dap_timerfd_callback_t)s_session_timer, 
-	                        NULL);
-			if (PVT(l_session->ton)->debug)
-				log_it(L_MSG, "TON: Consensus main timer is started");
+    dap_chain_node_role_t l_role = dap_chain_net_get_role(l_net);
+    if ( PVT(l_session->ton)->validators_list_by_stake ||
+    				(l_role.enums == NODE_ROLE_ROOT_MASTER || l_role.enums == NODE_ROLE_ROOT) ) {
+		if ( s_session_get_validator(l_session, l_session->my_addr, l_session->cur_round.validators_list) ) {
+			if (!s_session_cs_timer) {
+				s_session_cs_timer = dap_timerfd_start(1*1000, 
+		                        (dap_timerfd_callback_t)s_session_timer, 
+		                        NULL);
+				if (PVT(l_session->ton)->debug)
+					log_it(L_MSG, "TON: Consensus main timer is started");
+			}
+			dap_stream_ch_chain_voting_in_callback_add(l_session, s_session_packet_in);
 		}
-		dap_stream_ch_chain_voting_in_callback_add(l_session, s_session_packet_in);
 	}
 	return 0;
 }
@@ -363,8 +372,32 @@ static void s_session_round_start(dap_chain_cs_block_ton_items_t *a_session) {
 	a_session->cur_round.messages_count = 0;
 	a_session->cur_round.submit = false;
 
-	a_session->ts_round_sync_start = (dap_chain_time_t)time(NULL);
+	a_session->ts_round_sync_start = dap_time_now();
 	a_session->cur_round.id.uint64++;
+
+    size_t l_objs_size = 0;
+    dap_global_db_obj_t *l_objs = dap_chain_global_db_gr_load(a_session->gdb_group_store, &l_objs_size);
+    if (l_objs_size) {
+    	dap_chain_cs_block_ton_store_t *l_store_candidate_ready = NULL;
+    	size_t l_candidate_ready_size = 0;
+        for (size_t i = 0; i < l_objs_size; i++) {
+            if (!l_objs[i].value_len)
+                continue;
+            dap_chain_cs_block_ton_store_t *l_store = 
+										(dap_chain_cs_block_ton_store_t *)l_objs[i].value;
+			if ( l_store->hdr.round_id.uint64 != a_session->cur_round.id.uint64 ) {
+				// dap_chain_global_db_gr_del(dap_strdup(l_objs[i].key), a_session->gdb_group_store);
+				if ( l_store->hdr.sign_collected ) {
+					l_store_candidate_ready = l_store;
+				}
+			}
+        }
+        if (l_store_candidate_ready) {
+        	s_session_candidate_to_chain(a_session, &l_store_candidate_ready->hdr.candidate_hash, 
+        					(dap_chain_block_t*)l_store_candidate_ready->candidate_n_signs, l_store_candidate_ready->hdr.candidate_size);
+        }
+        dap_chain_global_db_objs_delete(l_objs, l_objs_size);
+    }
 }
 
 static bool s_session_send_startsync(dap_chain_cs_block_ton_items_t *a_session){
@@ -401,7 +434,7 @@ static bool s_session_send_votefor(s_session_send_votefor_data_t *a_data){
 }
 
 static bool s_session_timer() {
-	dap_chain_time_t l_time = (dap_chain_time_t)time(NULL);
+	dap_time_t l_time = dap_time_now();
 	dap_chain_cs_block_ton_items_t *l_session = NULL;
 	DL_FOREACH(s_session_items, l_session) {
 		if ( l_session->time_proc_lock ) {
@@ -496,7 +529,7 @@ static bool s_session_timer() {
 					if ( l_my_number != -1 ) {
 						l_my_number++;
 						if ( (l_time-l_session->ts_round_start) >=
-									(dap_chain_time_t)((PVT(l_session->ton)->next_candidate_delay*l_my_number)+PVT(l_session->ton)->first_message_delay) ) {
+									(dap_time_t)((PVT(l_session->ton)->next_candidate_delay*l_my_number)+PVT(l_session->ton)->first_message_delay) ) {
 							l_session->cur_round.submit = true;
 							s_session_candidate_submit(l_session);
 						}
@@ -504,7 +537,7 @@ static bool s_session_timer() {
 				}
 
 				if ( (l_time-l_session->ts_round_start) >=
-							(dap_chain_time_t)(PVT(l_session->ton)->round_attempt_duration*l_session->attempt_current_number) ) {
+							(dap_time_t)(PVT(l_session->ton)->round_attempt_duration*l_session->attempt_current_number) ) {
 
 					l_session->attempt_current_number++;
 					if ( l_session->attempt_current_number > PVT(l_session->ton)->round_attempts_max ) {
@@ -679,39 +712,62 @@ static void s_session_candidate_to_chain(
 		    } break;
 		    case ATOM_PASS: {
 		    	log_it(L_WARNING, "TON: Atom with hash %s not accepted (code ATOM_PASS, already present)", l_candidate_hash_str);
-		    	DAP_DELETE(l_candidate);
+                DAP_DELETE(l_candidate);
 		    } break;
 		    case ATOM_REJECT: {
 		        log_it(L_WARNING,"TON: Atom with hash %s rejected", l_candidate_hash_str);
-		        DAP_DELETE(l_candidate);
+                DAP_DELETE(l_candidate);
 		    } break;
 		    default:
-		        DAP_DELETE(l_candidate);
+                // DAP_DELETE(l_candidate);
 		        // log_it(L_CRITICAL, "TON: Wtf is this ret code? %d", l_candidate_hash_str);
 		        break;
 		}
 		DAP_DELETE(l_candidate_hash_str);
+		dap_chain_hash_fast_t l_my_candidate_hash;
+		dap_hash_fast(a_session->my_candidate, a_session->my_candidate_size, &l_my_candidate_hash);
+		if (memcmp(&l_my_candidate_hash, a_candidate_hash,
+							sizeof(dap_chain_hash_fast_t)) == 0) {
+			s_session_my_candidate_delete(a_session);
+		}
 	}
+    //DAP_DELETE(l_candidate);
 }
 
 static bool s_session_candidate_submit(dap_chain_cs_block_ton_items_t *a_session){
     
-    if (!a_session->my_candidate 
-    		|| a_session->my_candidate_attempts_count 
-    				>= PVT(a_session->ton)->my_candidate_attempts_max) {
-		dap_chain_t *l_chain = a_session->chain;
-    	dap_chain_cs_blocks_t *l_blocks = DAP_CHAIN_CS_BLOCKS(l_chain);
-    	s_session_my_candidate_delete(a_session);
-    	if ( l_blocks->block_new_size && l_blocks->block_new) {
-    		a_session->my_candidate = (dap_chain_block_t *)DAP_DUP_SIZE(l_blocks->block_new, l_blocks->block_new_size);
-    		a_session->my_candidate_size = l_blocks->block_new_size;
-    		s_session_block_new_delete(a_session);
-    	}
-    }
+	// if (!a_session->my_candidate 
+	// 		|| a_session->my_candidate_attempts_count 
+	// 			>= PVT(a_session->ton)->my_candidate_attempts_max) {
+	// 	dap_chain_t *l_chain = a_session->chain;
+	// 	dap_chain_cs_blocks_t *l_blocks = DAP_CHAIN_CS_BLOCKS(l_chain);
+	// 	s_session_my_candidate_delete(a_session);
+	// 	if ( l_blocks->block_new_size && l_blocks->block_new) {
+	// 		a_session->my_candidate = (dap_chain_block_t *)DAP_DUP_SIZE(l_blocks->block_new, l_blocks->block_new_size);
+	// 		a_session->my_candidate_size = l_blocks->block_new_size;
+	// 		s_session_block_new_delete(a_session);
+	// 	}
+	// }
+	
+	dap_chain_t *l_chain = a_session->chain;
+	dap_chain_cs_blocks_t *l_blocks = DAP_CHAIN_CS_BLOCKS(l_chain);
+	s_session_my_candidate_delete(a_session);
+	dap_chain_cs_new_block_add_datums(l_chain); // add new datums from queue
+	if ( l_blocks->block_new_size && l_blocks->block_new) {
+		a_session->my_candidate = (dap_chain_block_t *)DAP_DUP_SIZE(l_blocks->block_new, l_blocks->block_new_size);
+		a_session->my_candidate_size = l_blocks->block_new_size;
+		s_session_block_new_delete(a_session);
+	}
 
 	size_t l_submit_size = a_session->my_candidate ? 
 				sizeof(dap_chain_cs_block_ton_message_submit_t)+a_session->my_candidate_size
-				: sizeof(dap_chain_cs_block_ton_message_submit_t);
+					: sizeof(dap_chain_cs_block_ton_message_submit_t);
+	
+	// dap_chain_cs_new_block_add_datums(dap_chain_t *a_chain);
+	// size_t l_submit_size = l_blocks->block_new ? 
+	// 			sizeof(dap_chain_cs_block_ton_message_submit_t)+a_session->my_candidate_size
+	// 				: sizeof(dap_chain_cs_block_ton_message_submit_t);
+
 	dap_chain_cs_block_ton_message_submit_t *l_submit =
 							DAP_NEW_SIZE(dap_chain_cs_block_ton_message_submit_t, l_submit_size);
 	l_submit->round_id.uint64 = a_session->cur_round.id.uint64;
@@ -758,27 +814,11 @@ static bool s_session_candidate_submit(dap_chain_cs_block_ton_items_t *a_session
 }
 
 static int s_session_atom_validation(dap_chain_cs_blocks_t *a_blocks, dap_chain_block_t *a_block, size_t a_block_size){
-	// size_t l_datums_count = 0;
-	// dap_chain_datum_t **l_datums = dap_chain_block_get_datums(a_block, a_block_size, &l_datums_count);
- //    if (!l_datums || !l_datums_count) {
- //        return -2;
- //    }
- //    int l_ret = -1;
- //    for(size_t i=0; i<l_datums_count; i++){
- //    	dap_chain_datum_t *l_datum = l_datums[i];
- //    	switch (l_datum->header.type_id) {
- //    		case DAP_CHAIN_DATUM_TX: {
- //    			dap_chain_datum_tx_t *l_tx = (dap_chain_datum_tx_t*) l_datum->data;
- //    			int ret = dap_chain_ledger_tx_add_check(a_blocks->chain->ledger, l_tx);
- //    			if (ret == 0) {
- //    				l_ret = 0; // accept block if least one valid tx
- //    			}
- //    		}
- //    	}
- //    }
-
+    dap_chain_cs_block_ton_t *l_ton = DAP_CHAIN_CS_BLOCK_TON(a_blocks);
 	dap_chain_atom_verify_res_t l_res = ATOM_ACCEPT;
+	PVT(l_ton)->flag_sign_verify = false;
 	l_res = a_blocks->chain->callback_atom_verify(a_blocks->chain, a_block, a_block_size);
+	PVT(l_ton)->flag_sign_verify = true;
 	if(l_res == ATOM_ACCEPT){
 		return 0;
 	}
@@ -820,7 +860,7 @@ static bool s_hash_is_null(dap_chain_hash_fast_t *a_hash){
 static bool s_session_round_finish(dap_chain_cs_block_ton_items_t *a_session) {
 
 	a_session->state = DAP_STREAM_CH_CHAIN_SESSION_STATE_IDLE;
-	a_session->ts_round_finish = (dap_chain_time_t)time(NULL);
+	a_session->ts_round_finish = dap_time_now();
 
     size_t l_objs_size = 0;
     dap_global_db_obj_t *l_objs = dap_chain_global_db_gr_load(a_session->gdb_group_store, &l_objs_size);
@@ -849,7 +889,7 @@ static bool s_session_round_finish(dap_chain_cs_block_ton_items_t *a_session) {
 
 					// delete my candidate if it passed consensus or not collected 2/3 approve
 					if ( !l_store->hdr.approve_collected || l_store->hdr.sign_collected ) {
-						s_session_my_candidate_delete(a_session);
+						// s_session_my_candidate_delete(a_session);
 						// DAP_DELETE(a_session->cur_round.my_candidate_hash);
 						// a_session->cur_round.my_candidate_hash=NULL;
 						if (PVT(a_session->ton)->debug) {
@@ -864,10 +904,10 @@ static bool s_session_round_finish(dap_chain_cs_block_ton_items_t *a_session) {
 				}
 			}
         }
-        if (l_store_candidate_ready) {
-        	s_session_candidate_to_chain(a_session, &l_store_candidate_ready->hdr.candidate_hash, 
-        					(dap_chain_block_t*)l_store_candidate_ready->candidate_n_signs, l_store_candidate_ready->hdr.candidate_size);
-        }
+        // if (l_store_candidate_ready) {
+        // 	s_session_candidate_to_chain(a_session, &l_store_candidate_ready->hdr.candidate_hash, 
+        // 					(dap_chain_block_t*)l_store_candidate_ready->candidate_n_signs, l_store_candidate_ready->hdr.candidate_size);
+        // }
         dap_chain_global_db_objs_delete(l_objs, l_objs_size);
     }
 
@@ -1026,7 +1066,7 @@ static void s_session_packet_in(void *a_arg, dap_chain_node_addr_t *a_sender_nod
     	goto handler_finish;
     }
 
-    dap_chain_time_t l_time = (dap_chain_time_t)time(NULL);
+    dap_time_t l_time = dap_time_now();
 	l_message->hdr.is_verified=false;
 
     dap_chain_hash_fast_t l_data_hash;
@@ -1453,6 +1493,12 @@ static void s_session_packet_in(void *a_arg, dap_chain_node_addr_t *a_sender_nod
 			l_reject_count++;
 			if ( ((float)l_reject_count/l_session->cur_round.validators_count) >= ((float)2/3) ) {
 				dap_chain_global_db_gr_del(dap_strdup(l_candidate_hash_str), l_session->gdb_group_store);
+				dap_chain_hash_fast_t l_my_candidate_hash;
+				dap_hash_fast(l_session->my_candidate, l_session->my_candidate_size, &l_my_candidate_hash);
+				if (memcmp(&l_my_candidate_hash, l_candidate_hash,
+									sizeof(dap_chain_hash_fast_t)) == 0) {
+					s_session_my_candidate_delete(l_session);
+				}
 				if (PVT(l_session->ton)->debug)
                     log_it(L_MSG, "TON: net:%s, chain:%s, round:%"DAP_UINT64_FORMAT_U", attempt:%hu Candidate:%s collected rejected more than 2/3 of the validators, so to removed this candidate",
                             l_session->chain->net_name, l_session->chain->name, l_session->cur_round.id.uint64,
@@ -1503,24 +1549,32 @@ static void s_session_packet_in(void *a_arg, dap_chain_node_addr_t *a_sender_nod
 						dap_chain_cs_block_ton_store_t *l_store = 
 												(dap_chain_cs_block_ton_store_t *)dap_chain_global_db_gr_get(
 														l_candidate_hash_str, &l_store_size, l_session->gdb_group_store);
-						if (l_store) {
+						if (l_store && !l_store->hdr.approve_collected) {
+							if (PVT(l_session->ton)->debug)
+								log_it(L_MSG, "TON: APPROVE: candidate found in store:%s & !approve_collected", l_candidate_hash_str);
 							l_store->hdr.approve_collected = true;
 							if (dap_chain_global_db_gr_set(dap_strdup(l_candidate_hash_str), l_store,
-																l_store_size, l_session->gdb_group_store) ) {
-								// event Vote
-								dap_chain_cs_block_ton_message_vote_t *l_vote =
-																	DAP_NEW_Z(dap_chain_cs_block_ton_message_vote_t);
-								l_vote->round_id.uint64 = l_session->cur_round.id.uint64;
-								memcpy(&l_vote->candidate_hash, l_candidate_hash, sizeof(dap_chain_hash_fast_t));
-								l_vote->attempt_number = l_session->attempt_current_number;
-								s_message_send(l_session, DAP_STREAM_CH_CHAIN_MESSAGE_TYPE_VOTE, (uint8_t*)l_vote,
-									sizeof(dap_chain_cs_block_ton_message_vote_t), l_session->cur_round.validators_start);
-								DAP_DELETE(l_vote);
+                                                                l_store_size, l_session->gdb_group_store) ) {
 								if (PVT(l_session->ton)->debug)
-                                    log_it(L_MSG, "TON: net:%s, chain:%s, round:%"DAP_UINT64_FORMAT_U", attempt:%hu This is first attempt, so to sent a VOTE for candidate:%s",
-											l_session->chain->net_name, l_session->chain->name, l_session->cur_round.id.uint64,
-												l_session->attempt_current_number, l_candidate_hash_str );
-							}
+									log_it(L_MSG, "TON: APPROVE: candidate update:%s approve_collected=true", l_candidate_hash_str);
+                            } else
+								if (PVT(l_session->ton)->debug)
+									log_it(L_MSG, "TON: APPROVE: can`t update candidate:%s", l_candidate_hash_str);
+
+							// event Vote
+							dap_chain_cs_block_ton_message_vote_t *l_vote =
+																DAP_NEW_Z(dap_chain_cs_block_ton_message_vote_t);
+							l_vote->round_id.uint64 = l_session->cur_round.id.uint64;
+							memcpy(&l_vote->candidate_hash, l_candidate_hash, sizeof(dap_chain_hash_fast_t));
+							l_vote->attempt_number = l_session->attempt_current_number;
+							s_message_send(l_session, DAP_STREAM_CH_CHAIN_MESSAGE_TYPE_VOTE, (uint8_t*)l_vote,
+								sizeof(dap_chain_cs_block_ton_message_vote_t), l_session->cur_round.validators_start);
+							DAP_DELETE(l_vote);
+							if (PVT(l_session->ton)->debug)
+                                log_it(L_MSG, "TON: net:%s, chain:%s, round:%"DAP_UINT64_FORMAT_U", attempt:%hu This is first attempt, so to sent a VOTE for candidate:%s",
+										l_session->chain->net_name, l_session->chain->name, l_session->cur_round.id.uint64,
+											l_session->attempt_current_number, l_candidate_hash_str );
+
 							DAP_DELETE(l_store);
 						}
 					}
@@ -1767,7 +1821,7 @@ static void s_session_packet_in(void *a_arg, dap_chain_node_addr_t *a_sender_nod
 							DAP_DELETE(l_candidate_sign);
 							
 							l_session->state = DAP_STREAM_CH_CHAIN_SESSION_STATE_WAIT_SIGNS;
-							l_session->ts_round_state_commit = (dap_chain_time_t)time(NULL);
+							l_session->ts_round_state_commit = dap_time_now();
 							
 							if (PVT(l_session->ton)->debug)
                                 log_it(L_MSG, "TON: net:%s, chain:%s, round:%"DAP_UINT64_FORMAT_U" attempt:%hu Candidate:%s collected PRE_COMMIT more than 2/3 of the validators, so to sent a COMMIT_SIGN",
@@ -1903,7 +1957,7 @@ static void s_message_send(dap_chain_cs_block_ton_items_t *a_session, uint8_t a_
 						DAP_NEW_SIZE(dap_chain_cs_block_ton_message_t, l_message_size);
 	l_message->hdr.id.uint64 = (uint64_t)a_session->cur_round.messages_count;
 	l_message->hdr.chain_id.uint64 = a_session->chain->id.uint64;
-	l_message->hdr.ts_created = (dap_chain_time_t)time(NULL);
+	l_message->hdr.ts_created = dap_time_now();
 	l_message->hdr.type = a_message_type;
 	memcpy(&l_message->hdr.sender_node_addr,
 				dap_chain_net_get_cur_addr(l_net), sizeof(dap_chain_node_addr_t));
@@ -1987,8 +2041,8 @@ static size_t s_callback_block_sign(dap_chain_cs_blocks_t *a_blocks, dap_chain_b
 
 static int s_callback_block_verify(dap_chain_cs_blocks_t *a_blocks, dap_chain_block_t *a_block, size_t a_block_size)
 {
-    // dap_chain_cs_block_ton_t *l_ton = DAP_CHAIN_CS_BLOCK_TON(a_blocks);
-    // dap_chain_cs_block_ton_pvt_t *l_ton_pvt = PVT(l_ton);
+    dap_chain_cs_block_ton_t *l_ton = DAP_CHAIN_CS_BLOCK_TON(a_blocks);
+    dap_chain_cs_block_ton_pvt_t *l_ton_pvt = PVT(l_ton);
     if (a_blocks->chain->ledger == NULL) {
         log_it(L_CRITICAL,"Ledger is NULL can't check TON on this chain %s", a_blocks->chain->name);
         return -3;
@@ -1997,9 +2051,54 @@ static int s_callback_block_verify(dap_chain_cs_blocks_t *a_blocks, dap_chain_bl
         log_it(L_WARNING,"Incorrect size with block %p on chain %s", a_block, a_blocks->chain->name);
         return  -7;
     }
-    return 0;
-}
 
+    if ( l_ton_pvt->flag_sign_verify && !l_ton_pvt->validators_list_by_stake ) { // PoA mode		
+		size_t l_offset = dap_chain_block_get_sign_offset(a_block, a_block_size);
+		size_t l_signs_count = 0;
+		dap_sign_t **l_signs = dap_sign_get_unique_signs(a_block->meta_n_datum_n_sign+l_offset,
+												a_block_size-sizeof(a_block->hdr)-l_offset, &l_signs_count);
+		if (!l_signs_count){
+	        log_it(L_ERROR, "No any signatures at all for block");
+	        DAP_DELETE(l_signs);
+	        return -2;
+	    }
+
+	    if ( ((float)l_signs_count/l_ton_pvt->poa_validators_count ) < ((float)2/3) ) {
+            log_it(L_ERROR, "Corrupted block: not enough signs: %zu of %hu", l_signs_count, l_ton_pvt->poa_validators_count);
+	        DAP_DELETE(l_signs);
+	    	return -1;
+	    }
 
+	    // Parse the rest signs
+	    int l_ret = 0;
+	    uint16_t l_signs_verified_count = 0;
+	    size_t l_block_excl_sign_size = dap_chain_block_get_sign_offset(a_block, a_block_size)+sizeof(a_block->hdr);
+	    for (size_t i=0; i<l_signs_count; i++) {
+	    	dap_sign_t *l_sign = (dap_sign_t *)l_signs[i];
+	        if (!dap_sign_verify_size(l_sign, a_block_size)) {
+	            log_it(L_ERROR, "Corrupted block: sign size is bigger than block size");
+	            l_ret = -3;
+	            break;
+	        }
 
+	        // Compare signature with auth_certs
+	        for (uint16_t j = 0; j < l_ton_pvt->auth_certs_count; j++) {
+	            if (dap_cert_compare_with_sign( l_ton_pvt->auth_certs[j], l_sign) == 0
+	            		&& dap_sign_verify(l_sign, a_block, l_block_excl_sign_size) == 1 ){
+	                l_signs_verified_count++;
+	                break;
+	            }
+	        }
+	    }
+		DAP_DELETE(l_signs);
+	    if ( l_ret != 0 ) {
+	    	return l_ret;
+	    }
+	    if ( ((float)l_signs_verified_count/l_ton_pvt->poa_validators_count ) < ((float)2/3) ) {
+	        log_it(L_ERROR, "Corrupted block: not enough signs: %u of %u", l_signs_verified_count, l_ton_pvt->poa_validators_count);
+	    	return -1;
+	    }
+	}
+    return 0;
+}
 
diff --git a/modules/consensus/block-ton/include/dap_chain_cs_block_ton.h b/modules/consensus/block-ton/include/dap_chain_cs_block_ton.h
index e884b112361c85395178a374970c63e0fb18044f..0ad67933ec689625ad411194327e43354f192535 100644
--- a/modules/consensus/block-ton/include/dap_chain_cs_block_ton.h
+++ b/modules/consensus/block-ton/include/dap_chain_cs_block_ton.h
@@ -73,10 +73,10 @@ typedef struct dap_chain_cs_block_ton_items {
 	dap_chain_node_addr_t *attempt_coordinator; // validator-coordinator in current attempt
 	uint16_t attempt_current_number;
 
-	dap_chain_time_t ts_round_sync_start; // time start sync
-	dap_chain_time_t ts_round_start; // time round-start
-	dap_chain_time_t ts_round_state_commit;
-	dap_chain_time_t ts_round_finish;
+	dap_time_t ts_round_sync_start; // time start sync
+	dap_time_t ts_round_start; // time round-start
+	dap_time_t ts_round_state_commit;
+	dap_time_t ts_round_finish;
 
 	char * gdb_group_setup;
 	char * gdb_group_store;
@@ -104,7 +104,7 @@ typedef struct dap_chain_cs_block_ton_message_hdr {
 	size_t sign_size;
 	size_t message_size;
 
-	dap_chain_time_t ts_created;
+	dap_time_t ts_created;
 	//dap_chain_cs_block_ton_round_id_t round_id;
 
 	dap_chain_node_addr_t sender_node_addr;
@@ -124,7 +124,7 @@ typedef struct dap_chain_cs_block_ton_message_item {
     dap_chain_cs_block_ton_message_t *message;
     dap_chain_hash_fast_t message_hash;
     UT_hash_handle hh;
-} DAP_ALIGN_PACKED dap_chain_cs_block_ton_message_item_t;
+} dap_chain_cs_block_ton_message_item_t;
 
 // struct for get info from any messages
 typedef struct dap_chain_cs_block_ton_message_getinfo {
@@ -135,7 +135,7 @@ typedef struct dap_chain_cs_block_ton_message_getinfo {
 
 // technical messages
 typedef struct dap_chain_cs_block_ton_message_startsync {
-	dap_chain_time_t ts;
+	dap_time_t ts;
 	dap_chain_cs_block_ton_round_id_t round_id;
 } DAP_ALIGN_PACKED dap_chain_cs_block_ton_message_startsync_t;
 
@@ -202,7 +202,7 @@ typedef struct dap_chain_cs_block_ton_store_hdr {
 	size_t candidate_size;
 	dap_chain_cs_block_ton_round_id_t round_id;
 	dap_chain_hash_fast_t candidate_hash;
-	dap_chain_time_t ts_candidate_submit;
+	dap_time_t ts_candidate_submit;
 } DAP_ALIGN_PACKED dap_chain_cs_block_ton_store_hdr_t;
 
 typedef struct dap_chain_cs_block_ton_store {
diff --git a/modules/consensus/dag-poa/dap_chain_cs_dag_poa.c b/modules/consensus/dag-poa/dap_chain_cs_dag_poa.c
index 0c9cc8e601d8c72e9f42718d241e2a20b29d6f3a..280795fc482adf9089c425562ed24ecfd857649a 100644
--- a/modules/consensus/dag-poa/dap_chain_cs_dag_poa.c
+++ b/modules/consensus/dag-poa/dap_chain_cs_dag_poa.c
@@ -48,7 +48,7 @@
 #include "dap_chain_cs_dag_poa.h"
 #include "dap_chain_net_srv_stake.h"
 #include "dap_chain_cell.h"
-
+#include "dap_chain_global_db.h"
 #include "dap_cert.h"
 
 #define LOG_TAG "dap_chain_cs_dag_poa"
@@ -70,7 +70,6 @@ typedef struct dap_chain_cs_dag_poa_pvt
     bool auto_confirmation;
     bool auto_round_complete;
     uint32_t wait_sync_before_complete;
-    uint8_t padding[4];
     dap_chain_callback_new_cfg_t prev_callback_created; // global network config init
 } dap_chain_cs_dag_poa_pvt_t;
 
@@ -85,6 +84,7 @@ typedef struct dap_chain_cs_dag_poa_callback_timer_arg {
 static void s_callback_get_round_info(dap_chain_cs_dag_t * a_dag, dap_chain_cs_dag_event_round_info_t * a_event_round_info);
 static void s_callback_delete(dap_chain_cs_dag_t * a_dag);
 static int s_callback_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg);
+static bool s_poa_round_check(dap_chain_t *a_chain);
 static int s_callback_created(dap_chain_t * a_chain, dap_config_t *a_chain_cfg);
 static int s_callback_event_verify(dap_chain_cs_dag_t * a_dag, dap_chain_cs_dag_event_t * a_dag_event, size_t a_dag_event_size);
 static dap_chain_cs_dag_event_t * s_callback_event_create(dap_chain_cs_dag_t * a_dag, dap_chain_datum_t * a_datum,
@@ -103,6 +103,7 @@ static void s_round_event_clean_dup(dap_chain_cs_dag_t * a_dag, const char *a_ev
 static int s_cli_dag_poa(int argc, char ** argv, char **str_reply);
 
 static bool s_seed_mode = false;
+static dap_timerfd_t *s_poa_round_timer = NULL; 
 
 /**
  * @brief
@@ -116,7 +117,7 @@ int dap_chain_cs_dag_poa_init(void)
     dap_chain_cs_add ("dag_poa", s_callback_new );
     s_seed_mode = dap_config_get_item_bool_default(g_config,"general","seed_mode",false);
     dap_chain_node_cli_cmd_item_create ("dag_poa", s_cli_dag_poa, "DAG PoA commands",
-        "dag_poa event sign -net <chain net name> -chain <chain name> -event <event hash> [-H hex|base58(default)]\n"
+        "dag_poa event sign -net <chain net name> -chain <chain name> -event <event hash> [-H {hex | base58(default)}]\n"
             "\tSign event <event hash> in the new round pool with its authorize certificate\n\n");
 
     return 0;
@@ -271,7 +272,7 @@ static int s_cli_dag_poa(int argc, char ** argv, char **a_str_reply)
                     bool l_event_is_ready = s_round_event_ready_minimum_check(l_dag, l_event, l_event_size_new,
                                                                         l_event_new_hash_hex_str, &l_round_item->round_info);
 
-                    if (dap_chain_cs_dag_event_gdb_set(l_event_new_hash_hex_str, l_event,
+                    if (dap_chain_cs_dag_event_gdb_set(l_dag, l_event_new_hash_hex_str, l_event,
                                                     l_event_size_new, l_round_item, l_gdb_group_events)) { //&l_event_round_info) ){
                         // Old event will be cleaned automatically with s_round_event_clean_dup()
                         if(!dap_strcmp(l_hash_out_type, "hex")) {
@@ -342,25 +343,20 @@ static int s_cli_dag_poa(int argc, char ** argv, char **a_str_reply)
 static int s_callback_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg)
 {
     dap_chain_cs_dag_new(a_chain,a_chain_cfg);
-    dap_chain_cs_dag_t * l_dag = DAP_CHAIN_CS_DAG ( a_chain );
-    dap_chain_cs_dag_poa_t * l_poa = DAP_NEW_Z ( dap_chain_cs_dag_poa_t);
+    dap_chain_cs_dag_t *l_dag = DAP_CHAIN_CS_DAG ( a_chain );
+    dap_chain_cs_dag_poa_t *l_poa = DAP_NEW_Z ( dap_chain_cs_dag_poa_t);
     l_dag->_inheritor = l_poa;
     l_dag->callback_delete = s_callback_delete;
     l_dag->callback_cs_verify = s_callback_event_verify;
     l_dag->callback_cs_event_create = s_callback_event_create;
     l_dag->callback_cs_get_round_info = s_callback_get_round_info;
     l_poa->_pvt = DAP_NEW_Z ( dap_chain_cs_dag_poa_pvt_t );
-    dap_chain_cs_dag_poa_pvt_t * l_poa_pvt = PVT ( l_poa );
+    dap_chain_cs_dag_poa_pvt_t *l_poa_pvt = PVT ( l_poa );
     // PoA rounds
     l_poa_pvt->confirmations_timeout = dap_config_get_item_uint32_default(a_chain_cfg,"dag-poa","confirmations_timeout",600);
     l_poa_pvt->auto_confirmation = dap_config_get_item_bool_default(a_chain_cfg,"dag-poa","auto_confirmation",true);
     l_poa_pvt->auto_round_complete = dap_config_get_item_bool_default(a_chain_cfg,"dag-poa","auto_round_complete",true);
     l_poa_pvt->wait_sync_before_complete = dap_config_get_item_uint32_default(a_chain_cfg,"dag-poa","wait_sync_before_complete",180);
-    dap_chain_net_t *l_cur_net = dap_chain_net_by_name(a_chain->net_name);
-    dap_chain_node_role_t l_role = dap_chain_net_get_role(l_cur_net);
-    if (l_role.enums == NODE_ROLE_ROOT_MASTER || l_role.enums == NODE_ROLE_ROOT)
-        l_dag->callback_cs_event_round_sync = s_callback_event_round_sync;
-    // PoA certs
     l_poa_pvt->auth_certs_prefix = dap_strdup(dap_config_get_item_str(a_chain_cfg,"dag-poa","auth_certs_prefix"));
     if (l_poa_pvt->auth_certs_prefix) {
         l_poa_pvt->auth_certs_count = dap_config_get_item_uint16_default(a_chain_cfg,"dag-poa","auth_certs_number",0);
@@ -384,10 +380,22 @@ static int s_callback_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg)
     log_it(L_NOTICE,"Initialized DAG-PoA consensus with %u/%u minimum consensus",l_poa_pvt->auth_certs_count,l_poa_pvt->auth_certs_count_verify);
     l_dag->chain->callback_created = s_callback_created;
 
+    if (!l_dag->is_add_directly && l_poa_pvt->auto_round_complete) {
+        dap_chain_net_t *l_net = dap_chain_net_by_id(l_dag->chain->net_id);
+        dap_chain_node_role_t l_role = dap_chain_net_get_role(l_net);
+        if (l_role.enums == NODE_ROLE_ROOT_MASTER || l_role.enums == NODE_ROLE_ROOT) {
+            if (!s_poa_round_timer) {
+                s_poa_round_timer = dap_timerfd_start(10*1000, 
+                                (dap_timerfd_callback_t)s_poa_round_check, 
+                                a_chain);
+                log_it(L_MSG, "DAG-PoA: Round timer is started");
+            }
+        }
+    }
+
     return 0;
 }
 
-
 typedef struct event_clean_dup_items {
     uint16_t signs_count;
     uint64_t ts_update;
@@ -395,22 +403,50 @@ typedef struct event_clean_dup_items {
     UT_hash_handle hh;
 } event_clean_dup_items_t;
 
+static bool s_poa_round_check(dap_chain_t *a_chain) {
+    dap_chain_cs_dag_t *l_dag = DAP_CHAIN_CS_DAG(a_chain);
+    dap_chain_cs_dag_poa_t *l_poa = DAP_CHAIN_CS_DAG_POA(l_dag);
+    dap_chain_cs_dag_poa_pvt_t *l_poa_pvt = PVT(l_poa);
+
+    char *l_gdb_group_round = l_dag->gdb_group_events_round_new;
+    size_t l_objs_size = 0;
+    dap_global_db_obj_t *l_objs = dap_chain_global_db_gr_load(l_gdb_group_round, &l_objs_size);
+    size_t l_events_count = 0;
+    if (l_objs_size) {
+        for (size_t i = 0; i<l_objs_size; i++) {
+            dap_chain_cs_dag_event_round_item_t *l_event_round_item = (dap_chain_cs_dag_event_round_item_t *)l_objs[i].value;
+            size_t l_event_size = l_event_round_item->event_size;
+            dap_chain_cs_dag_event_t *l_event = (dap_chain_cs_dag_event_t *)l_event_round_item->event_n_signs;
+            if (  (dap_time_now() - l_event_round_item->round_info.ts_update) >   
+                    (l_poa_pvt->confirmations_timeout+l_poa_pvt->wait_sync_before_complete+10)  ) {
+                dap_chain_global_db_gr_del(l_objs[i].key, l_gdb_group_round);
+                log_it(L_MSG, "DAG-PoA: Remove event %s from round by timer.", l_objs[i].key);
+            }
+            else {
+                l_events_count++;
+            }
+        }
+        dap_chain_global_db_objs_delete(l_objs, l_objs_size);
+    }
+
+    if (!l_events_count) {
+        dap_chain_cs_new_event_add_datums(a_chain, false);
+    }
+    return true;
+}
+
+
 static event_clean_dup_items_t *s_event_clean_dup_items = NULL;
 
 static void s_round_event_clean_dup(dap_chain_cs_dag_t * a_dag, const char *a_event_hash_hex_str) {
     char * l_gdb_group_events = a_dag->gdb_group_events_round_new;
-    size_t l_event_size = 0;
     size_t l_round_item_size = 0;
     dap_chain_cs_dag_event_round_item_t * l_round_item = NULL;
-    dap_chain_cs_dag_event_t * l_event;
 
     if ( (l_round_item = (dap_chain_cs_dag_event_round_item_t *)dap_chain_global_db_gr_get(
                                     a_event_hash_hex_str, &l_round_item_size, l_gdb_group_events) ) == NULL ) {
         return;
     }
-    
-    l_event = (dap_chain_cs_dag_event_t *)l_round_item->event_n_signs;
-    l_event_size = l_round_item->event_size;
 
     size_t l_events_round_size = 0;
     dap_store_obj_t *l_events_round = dap_chain_global_db_driver_read(a_dag->gdb_group_events_round_new, NULL, &l_events_round_size);
@@ -418,19 +454,40 @@ static void s_round_event_clean_dup(dap_chain_cs_dag_t * a_dag, const char *a_ev
     //char * l_max_signs_hash;
     for (size_t l_index = 0; l_index<l_events_round_size; l_index++) {
         dap_chain_cs_dag_event_round_item_t *l_event_round_item = (dap_chain_cs_dag_event_round_item_t *)l_events_round[l_index].value;
-        dap_chain_cs_dag_event_t * l_event = (dap_chain_cs_dag_event_t *)l_event_round_item->event_n_signs;
-        if ( memcmp(&l_round_item->round_info.first_event_hash,
-                        &l_event_round_item->round_info.first_event_hash, sizeof(dap_chain_hash_fast_t)) == 0 ) {
-            event_clean_dup_items_t * l_item = DAP_NEW_Z(event_clean_dup_items_t);
-            l_item->signs_count = l_event->header.signs_count;
-            l_item->ts_update = l_events_round[l_index].timestamp;
-            // l_item->ts_update = l_event_round_item->round_info.ts_update;
+        if (!l_event_round_item || !l_events_round[l_index].value_len || !l_event_round_item->event_n_signs) {
+            dap_chain_global_db_gr_del(l_events_round[l_index].key, l_gdb_group_events);
+            continue;
+        }
+        size_t l_event_size = l_event_round_item->event_size;
+        dap_chain_cs_dag_event_t *l_event = (dap_chain_cs_dag_event_t *)l_event_round_item->event_n_signs;
+        if ( memcmp(&l_round_item->round_info.datum_hash,
+                        &l_event_round_item->round_info.datum_hash, sizeof(dap_chain_hash_fast_t)) == 0 ) {
+            event_clean_dup_items_t *l_item = DAP_NEW_Z(event_clean_dup_items_t);
+
+            size_t l_offset_from_beginning = dap_chain_cs_dag_event_calc_size_excl_signs(l_event, l_event_size);
+            if( l_offset_from_beginning >= l_event_size){
+                log_it(L_WARNING,"Incorrect size with event %p: caled size excl signs %zd is bigger or equal then event size %zd",
+                       l_event, l_offset_from_beginning, l_event_size);
+                dap_chain_global_db_gr_del(l_events_round[l_index].key, l_gdb_group_events);
+                continue; // Incorrest size
+            }
+            size_t l_signs_count = 0;
+            dap_sign_t **l_signs = dap_sign_get_unique_signs(((uint8_t*)l_event)+l_offset_from_beginning,
+                                                        l_event_size-l_offset_from_beginning, &l_signs_count);
+            DAP_DELETE(l_signs);
+
+            l_item->signs_count = l_signs_count; //l_event->header.signs_count;
+            //l_item->ts_update = l_events_round[l_index].timestamp;
+            l_item->ts_update = l_event_round_item->round_info.ts_update;
             l_item->hash_str = (char *)l_events_round[l_index].key;
             HASH_ADD_STR(s_event_clean_dup_items, hash_str, l_item);
             if ( l_event->header.signs_count > l_max_signs_count ) {
                 l_max_signs_count = l_event->header.signs_count;
             }
         }
+        else {
+            dap_chain_global_db_gr_del(l_events_round[l_index].key, l_gdb_group_events);
+        }
     }
 
     uint64_t l_max_ts_update = 0;
@@ -469,7 +526,7 @@ static bool s_round_event_ready_minimum_check(dap_chain_cs_dag_t * a_dag, dap_ch
     int l_ret_event_verify = a_dag->callback_cs_verify(a_dag, a_event, a_event_size);
     if ( l_ret_event_verify == 0 ) {
         if (a_event_round_info->ts_confirmations_minimum_completed == (uint64_t)0) {
-            a_event_round_info->ts_confirmations_minimum_completed = (uint64_t)time(NULL);
+            a_event_round_info->ts_confirmations_minimum_completed = dap_time_now();
         }
         return true;
     }
@@ -485,41 +542,21 @@ static void s_round_event_cs_done(dap_chain_cs_dag_t * a_dag, dap_chain_cs_dag_e
     l_callback_arg->dag = a_dag;
     l_callback_arg->l_event_hash_hex_str = dap_strdup(a_event_hash_hex_str);
     memcpy(&l_callback_arg->event_round_info, a_event_round_info, sizeof(dap_chain_cs_dag_event_round_info_t));
-    uint32_t l_timeout = a_event_round_info->confirmations_timeout;
 
     if (a_event_round_info->ts_confirmations_minimum_completed == (uint64_t)0) {
-        a_event_round_info->ts_confirmations_minimum_completed = (uint64_t)time(NULL);
-    }
-
-    if ( a_event->header.signs_count >= PVT(l_poa)->auth_certs_count) {
-        // placement in chain now if max signs
-        if (dap_timerfd_start(PVT(l_poa)->wait_sync_before_complete*1000,
-                            (dap_timerfd_callback_t)s_callback_round_event_to_chain,
-                            l_callback_arg) == NULL) {
-            log_it(L_ERROR,"Can't run timer for Event %s", a_event_hash_hex_str);
-        } else {
-            log_it(L_NOTICE,"Run timer %dsec. for Event %s", PVT(l_poa)->wait_sync_before_complete, a_event_hash_hex_str);
-        }
-    }
-    else if ( l_timeout > ((uint64_t)time(NULL) - a_event_round_info->ts_confirmations_minimum_completed) ) {
-        l_timeout = l_timeout - ((uint64_t)time(NULL) - a_event_round_info->ts_confirmations_minimum_completed);
-        // placement in chain by timer
-        l_timeout += PVT(l_poa)->wait_sync_before_complete;
-        if (dap_timerfd_start(l_timeout*1000,
-                            (dap_timerfd_callback_t)s_callback_round_event_to_chain,
-                            l_callback_arg) == NULL) {
-            log_it(L_ERROR,"Can't run timer for Event %s", a_event_hash_hex_str);
-        } else {
-            log_it(L_NOTICE,"Run timer %dsec. for Event %s", l_timeout, a_event_hash_hex_str);
-        }
-    } else { // placement in chain now if timer out
-        if (dap_timerfd_start(PVT(l_poa)->wait_sync_before_complete*1000,
-                            (dap_timerfd_callback_t)s_callback_round_event_to_chain,
-                            l_callback_arg) == NULL) {
-            log_it(L_ERROR,"Can't run timer for Event %s", a_event_hash_hex_str);
-        } else {
-            log_it(L_NOTICE,"Run timer %dsec. for Event %s", PVT(l_poa)->wait_sync_before_complete, a_event_hash_hex_str);
-        }
+        a_event_round_info->ts_confirmations_minimum_completed = dap_time_now();
+    }
+    int l_timeout = a_event_round_info->ts_confirmations_minimum_completed - dap_time_now() + a_event_round_info->confirmations_timeout;
+    if (a_event->header.signs_count >= PVT(l_poa)->auth_certs_count || l_timeout <= 0)
+        l_timeout = 0;
+    l_timeout += PVT(l_poa)->wait_sync_before_complete;
+    // placement in chain by timer
+    if (dap_timerfd_start(l_timeout * 1000,
+                        (dap_timerfd_callback_t)s_callback_round_event_to_chain,
+                        l_callback_arg) == NULL) {
+        log_it(L_ERROR,"Can't run timer for Event %s", a_event_hash_hex_str);
+    } else {
+        log_it(L_NOTICE,"Run timer %dsec. for Event %s", PVT(l_poa)->wait_sync_before_complete, a_event_hash_hex_str);
     }
 }
 
@@ -534,7 +571,6 @@ static void s_callback_get_round_info(dap_chain_cs_dag_t * a_dag, dap_chain_cs_d
 
 static bool s_callback_round_event_to_chain(dap_chain_cs_dag_poa_callback_timer_arg_t * a_callback_arg) {
     dap_chain_cs_dag_t * l_dag = a_callback_arg->dag;
-    dap_chain_net_t *l_net = dap_chain_net_by_id(l_dag->chain->net_id);
     char * l_gdb_group_events = l_dag->gdb_group_events_round_new;
     dap_chain_cs_dag_event_round_item_t * l_round_item = NULL;
     dap_chain_cs_dag_event_t * l_event;
@@ -545,29 +581,49 @@ static bool s_callback_round_event_to_chain(dap_chain_cs_dag_poa_callback_timer_
                                     a_callback_arg->l_event_hash_hex_str, &l_round_item_size, l_gdb_group_events) ) == NULL ) {
         log_it(L_NOTICE,"Can't find event %s in round.new. The hash may have changed by reason the addition of a new signature.",
                         a_callback_arg->l_event_hash_hex_str);
-    }
-    else {
+    } else {
         l_event = (dap_chain_cs_dag_event_t *)l_round_item->event_n_signs;
         l_event_size = l_round_item->event_size;
 
         dap_chain_atom_ptr_t l_new_atom = (dap_chain_atom_ptr_t)dap_chain_cs_dag_event_copy(l_event, l_event_size);
-        memcpy(l_new_atom, l_event, l_event_size);
-
-        if(l_dag->chain->callback_atom_add(l_dag->chain, l_new_atom, l_event_size) < 0) { // Add new atom in chain
+        dap_chain_atom_verify_res_t l_res = l_dag->chain->callback_atom_add(l_dag->chain, l_new_atom, l_event_size);
+        if (l_res == ATOM_PASS || l_res == ATOM_REJECT) { // Add new atom in chain
             DAP_DELETE(l_new_atom);
             log_it(L_NOTICE, "Event %s not added in chain", a_callback_arg->l_event_hash_hex_str);
-        }
-        else {
-            log_it(L_NOTICE, "Event %s added in chain successfully",
-                    a_callback_arg->l_event_hash_hex_str);
-
-            if (dap_chain_cell_file_update(l_dag->chain->cells) > 0) {
-                // delete events from db
-                dap_chain_global_db_gr_del(a_callback_arg->l_event_hash_hex_str, l_dag->gdb_group_events_round_new);
+        } else {
+            log_it(L_NOTICE, "Event %s added in %s successfully", a_callback_arg->l_event_hash_hex_str,
+                                                                  l_res == ATOM_ACCEPT ? "chain" : "threshold");
+            if (dap_chain_atom_save(l_dag->chain, l_new_atom, l_event_size, l_dag->chain->cells->id) > 0) {
+                // dap_chain_cs_dag_event_broadcast(l_dag, DAP_DB$K_OPTYPE_DEL,
+                //             l_dag->gdb_group_events_round_new, &l_round_item->round_info.first_event_hash,
+                //                 NULL, 0);
             }
-            dap_chain_cell_close(l_dag->chain->cells);
+            dap_chain_net_t *l_net = dap_chain_net_by_id(l_dag->chain->net_id);
+            dap_chain_t *l_cur_chain;
+            bool l_processed;
+            do {
+                l_processed = false;
+                DL_FOREACH(l_net->pub.chains, l_cur_chain) {
+                    if (l_cur_chain->callback_atom_add_from_treshold) {
+                        dap_chain_atom_ptr_t l_atom_treshold;
+                        do {
+                            size_t l_atom_treshold_size;
+                            l_atom_treshold = l_cur_chain->callback_atom_add_from_treshold(l_cur_chain, &l_atom_treshold_size);
+                            if (l_atom_treshold) {
+                                dap_chain_cell_id_t l_cell_id = l_cur_chain->cells->id;
+                                dap_chain_atom_save(l_cur_chain, l_atom_treshold, l_atom_treshold_size, l_cell_id);
+                                log_it(L_INFO, "Added atom from treshold");
+                            }
+                        } while(l_atom_treshold);
+                    }
+                }
+            } while (l_processed);
+            //dap_chain_cell_close(l_dag->chain->cells);
             // dap_chain_net_sync_all(l_net);
         }
+        DAP_DELETE(l_round_item);
+        // delete events from db
+        dap_chain_global_db_gr_del(a_callback_arg->l_event_hash_hex_str, l_dag->gdb_group_events_round_new);
     }
 
     DAP_DELETE(a_callback_arg->l_event_hash_hex_str);
@@ -599,6 +655,21 @@ static int s_callback_created(dap_chain_t * a_chain, dap_config_t *a_chain_net_c
             log_it(L_NOTICE,"Loaded \"%s\" certificate to sign poa event", l_events_sign_cert);
 
     }
+    // Process events from GDB
+    dap_chain_net_t *l_cur_net = dap_chain_net_by_name(a_chain->net_name);
+    dap_chain_node_role_t l_role = dap_chain_net_get_role(l_cur_net);
+    if (l_role.enums == NODE_ROLE_ROOT_MASTER || l_role.enums == NODE_ROLE_ROOT) {
+        l_dag->callback_cs_event_round_sync = s_callback_event_round_sync;
+        size_t l_round_objs_count;
+        dap_global_db_obj_t *l_round_objs = dap_chain_global_db_gr_load(l_dag->gdb_group_events_round_new, &l_round_objs_count);
+        if (l_round_objs) {
+            for (size_t i = 0; i < l_round_objs_count; i++) {
+                s_callback_event_round_sync(l_dag, DAP_DB$K_OPTYPE_ADD, l_dag->gdb_group_events_round_new,
+                                            l_round_objs[i].key, l_round_objs[i].value, l_round_objs[i].value_len);
+            }
+            dap_chain_global_db_objs_delete(l_round_objs, l_round_objs_count);
+        }
+    }
     return 0;
 }
 
@@ -674,11 +745,12 @@ static int s_callback_event_round_sync(dap_chain_cs_dag_t * a_dag, const char a_
 {
     dap_chain_net_t *l_net = dap_chain_net_by_id( a_dag->chain->net_id);
 
-    if ( a_value == NULL || a_op_code != 'a' ) {
+    if ( a_value == NULL || a_op_code != DAP_DB$K_OPTYPE_ADD || !a_value || !a_value_size) {
         return 0;
     }
-
     dap_chain_cs_dag_poa_t * l_poa = DAP_CHAIN_CS_DAG_POA(a_dag);
+    if (!PVT(l_poa)->events_sign_cert)
+        return -1;
 
     if ( !PVT(l_poa)->auto_confirmation ) {
         s_round_event_clean_dup(a_dag, a_key); // Delete dup for manual mode
@@ -690,18 +762,15 @@ static int s_callback_event_round_sync(dap_chain_cs_dag_t * a_dag, const char a_
     //dap_chain_cs_dag_event_t * l_event = (dap_chain_cs_dag_event_t *)l_round_item->event_n_signs;
     dap_chain_cs_dag_event_t * l_event =
                 (dap_chain_cs_dag_event_t *)DAP_DUP_SIZE(l_round_item->event_n_signs, l_event_size);
-    if ( dap_chain_cs_dag_event_sign_exists(l_event, l_event_size,
-                                    l_net, PVT(l_poa)->events_sign_cert->enc_key)
+    if (dap_chain_cs_dag_event_sign_exists(l_event, l_event_size,
+                                           PVT(l_poa)->events_sign_cert->enc_key)
             || dap_chain_cs_dag_event_round_sign_exists(l_round_item,
-                                    l_net, PVT(l_poa)->events_sign_cert->enc_key) ) {
+                                                        PVT(l_poa)->events_sign_cert->enc_key)) {
         // if my sign exists
-        if (PVT(l_poa)->auto_round_complete) {
-            if ( s_round_event_ready_minimum_check(a_dag, l_event, l_event_size,
-                                                            (char *)a_key,  &l_round_item->round_info) ) {
-                // cs done (minimum signs & verify passed)
-                // s_round_event_cs_done(a_dag, l_event, (char *)a_key, &l_round_item->round_info);
-            }
-        }
+        //if (PVT(l_poa)->auto_round_complete && s_round_event_ready_minimum_check(a_dag, l_event, l_event_size,
+        //                                                    (char *)a_key,  &l_round_item->round_info))
+            // cs done (minimum signs & verify passed)
+        //    s_round_event_cs_done(a_dag, l_event, (char *)a_key, &l_round_item->round_info);
         s_round_event_clean_dup(a_dag, a_key);
         DAP_DELETE(l_round_item);
         DAP_DELETE(l_event);
@@ -715,8 +784,7 @@ static int s_callback_event_round_sync(dap_chain_cs_dag_t * a_dag, const char a_
                                 l_event, l_event_size, PVT(l_poa)->callback_pre_sign->arg)) == 0 ) {
         l_event_size_new = dap_chain_cs_dag_event_sign_add(&l_event, l_event_size,
                                                 l_net, PVT(l_poa)->events_sign_cert->enc_key);
-    }
-    else {
+    } else {
         size_t l_round_item_size_new = 0;
         bool l_deleted = false;
         // set sign for reject
@@ -729,7 +797,7 @@ static int s_callback_event_round_sync(dap_chain_cs_dag_t * a_dag, const char a_
             if ( l_round_item->round_info.reject_count // check reject count
                             <= (PVT(l_poa)->auth_certs_count - l_round_item->round_info.confirmations_minimum) ) {
                 // update reject_count
-                dap_chain_cs_dag_event_gdb_set((char *)a_key, l_event, l_event_size,
+                dap_chain_cs_dag_event_gdb_set(a_dag, (char *)a_key, l_event, l_event_size,
                                                         l_round_item, a_group);
             }
             else {
@@ -746,25 +814,36 @@ static int s_callback_event_round_sync(dap_chain_cs_dag_t * a_dag, const char a_
         return 0;
     }
 
+    char *l_event_new_hash_hex_str;
     if ( l_event_size_new ) {
         //char * l_gdb_group_events = a_dag->gdb_group_events_round_new;
         dap_chain_hash_fast_t l_event_new_hash;
         dap_chain_cs_dag_event_calc_hash(l_event, l_event_size_new, &l_event_new_hash);
-        char * l_event_new_hash_hex_str = dap_chain_hash_fast_to_str_new(&l_event_new_hash);
+        l_event_new_hash_hex_str = dap_chain_hash_fast_to_str_new(&l_event_new_hash);
+        if (dap_chain_cs_dag_event_gdb_set(a_dag, l_event_new_hash_hex_str, l_event,
+                                            l_event_size_new, l_round_item, a_group)) {
+            // a_dag->callback_broadcast(a_dag, l_round_item);
+            // dap_chain_global_db_gr_del(a_key, a_group); // Delete old event
+        }
         bool l_event_is_ready = s_round_event_ready_minimum_check(a_dag, l_event, l_event_size_new,
                                                             l_event_new_hash_hex_str,  &l_round_item->round_info);
-
-        if (dap_chain_cs_dag_event_gdb_set(l_event_new_hash_hex_str, l_event,
-                                            l_event_size_new, l_round_item, a_group)) {
-            dap_chain_global_db_gr_del(a_key, a_group); // Delete old event
-            if (l_event_is_ready && PVT(l_poa)->auto_round_complete) { // cs done (minimum signs & verify passed)
-                s_round_event_cs_done(a_dag, l_event, l_event_new_hash_hex_str, &l_round_item->round_info);
-            }
+        if (l_event_is_ready && PVT(l_poa)->auto_round_complete) { // cs done (minimum signs & verify passed)
+            s_round_event_cs_done(a_dag, l_event, l_event_new_hash_hex_str, &l_round_item->round_info);
         }
-        s_round_event_clean_dup(a_dag, l_event_new_hash_hex_str); // Delete dup
-    } else {
-        s_round_event_clean_dup(a_dag, a_key); // Delete dup
     }
+    else {
+        l_event_size_new = l_event_size;
+        l_event_new_hash_hex_str = (char *)a_key;
+    }
+    // bool l_event_is_ready = s_round_event_ready_minimum_check(a_dag, l_event, l_event_size_new,
+    //                                                     l_event_new_hash_hex_str,  &l_round_item->round_info);
+    // if (l_event_is_ready && PVT(l_poa)->auto_round_complete) { // cs done (minimum signs & verify passed)
+    //     s_round_event_cs_done(a_dag, l_event, l_event_new_hash_hex_str, &l_round_item->round_info);
+    // }
+    // Delete dup
+    s_round_event_clean_dup(a_dag, l_event_new_hash_hex_str);
+    if (l_event_new_hash_hex_str != a_key)
+        DAP_DELETE(l_event_new_hash_hex_str);
     DAP_DELETE(l_round_item);
     DAP_DELETE(l_event);
     return 0;
@@ -778,51 +857,78 @@ static int s_callback_event_round_sync(dap_chain_cs_dag_t * a_dag, const char a_
  * @param a_dag_event_size size_t size of event object
  * @return int
  */
-static int s_callback_event_verify(dap_chain_cs_dag_t * a_dag, dap_chain_cs_dag_event_t * a_dag_event, size_t a_dag_event_size)
+static int s_callback_event_verify(dap_chain_cs_dag_t * a_dag, dap_chain_cs_dag_event_t * a_event, size_t a_event_size)
 {
+    
     dap_chain_cs_dag_poa_pvt_t * l_poa_pvt = PVT ( DAP_CHAIN_CS_DAG_POA( a_dag ) );
-    size_t l_offset_from_beginning = dap_chain_cs_dag_event_calc_size_excl_signs(a_dag_event,a_dag_event_size);
-    if( l_offset_from_beginning >= a_dag_event_size){
+    size_t l_offset_from_beginning = dap_chain_cs_dag_event_calc_size_excl_signs(a_event, a_event_size);
+    if( l_offset_from_beginning >= a_event_size){
         log_it(L_WARNING,"Incorrect size with event %p: caled size excl signs %zd is bigger or equal then event size %zd",
-               a_dag_event, l_offset_from_beginning, a_dag_event_size);
+               a_event, l_offset_from_beginning, a_event_size);
         return -7; // Incorrest size
     }
-    uint16_t l_certs_count_verify = a_dag->use_event_round_info ? a_dag->event_round_info.confirmations_minimum
-                                                                : l_poa_pvt->auth_certs_count_verify;
-
+    uint16_t l_certs_count_verify = l_poa_pvt->auth_certs_count_verify;
+    // uint16_t l_certs_count_verify = a_dag->use_event_round_info ? a_dag->event_round_info.confirmations_minimum
+    //                                                             : l_poa_pvt->auth_certs_count_verify;
     a_dag->use_event_round_info = false;
-    if ( a_dag_event->header.signs_count >= l_certs_count_verify ){
-        size_t l_verified = 0;
-        for ( uint16_t i = 0; i < a_dag_event->header.signs_count; i++ ) {
-            if (l_offset_from_beginning == a_dag_event_size)
+    if ( a_event->header.signs_count >= l_certs_count_verify ){
+        size_t l_signs_count = 0;
+        dap_sign_t **l_signs = dap_sign_get_unique_signs(((uint8_t*)a_event)+l_offset_from_beginning,
+                                                a_event_size-l_offset_from_beginning, &l_signs_count);
+
+        if (!l_signs_count){
+            log_it(L_ERROR, "No any signatures at all for event");
+            DAP_DELETE(l_signs);
+            return -2;
+        }
+
+        if ( l_signs_count < l_certs_count_verify ) {
+            log_it(L_ERROR, "Corrupted event: not enough signs: %zu of %hu", l_signs_count, l_certs_count_verify);
+            DAP_DELETE(l_signs);
+            return -1;
+        }
+
+        uint16_t l_signs_verified_count = 0;
+        int l_ret = 0;
+        uint16_t l_event_signs_count = a_event->header.signs_count;
+        for (size_t i=0; i<l_signs_count; i++) {
+            dap_sign_t *l_sign = (dap_sign_t *)l_signs[i];
+            if (!dap_sign_verify_size(l_sign, a_event_size)) {
+                log_it(L_WARNING,"Incorrect size with event %p", a_event);
+                l_ret = -3;
                 break;
-            dap_sign_t * l_sign = dap_chain_cs_dag_event_get_sign(a_dag_event,a_dag_event_size , 0);
-            if ( l_sign == NULL){
-                log_it(L_WARNING, "Event is NOT signed with anything");
-                return -4;
-            }
-            l_offset_from_beginning += dap_sign_get_size( l_sign);
-            if (l_offset_from_beginning > a_dag_event_size){
-                log_it(L_WARNING,"Incorrect size with event %p", a_dag_event);
-                return -7;
             }
+
+            // Compare signature with auth_certs
+            a_event->header.signs_count = i;
             for (uint16_t j = 0; j < l_poa_pvt->auth_certs_count; j++) {
-                if (dap_cert_compare_with_sign ( l_poa_pvt->auth_certs[j], l_sign) == 0)
-                    l_verified++;
+                if (dap_cert_compare_with_sign( l_poa_pvt->auth_certs[j], l_sign) == 0
+                            && dap_sign_verify(l_sign, a_event, l_offset_from_beginning) == 1 ){
+                    l_signs_verified_count++;
+                    break;
+                }
             }
         }
-        return l_verified >= l_certs_count_verify ? 0 : -1;
-    }else if (a_dag_event->header.hash_count == 0){
+        a_event->header.signs_count = l_event_signs_count;
+        DAP_DELETE(l_signs);
+        if ( l_ret != 0 ) {
+            return l_ret;
+        }
+        return l_signs_verified_count >= l_certs_count_verify ? 0 : -1;
+
+    }
+    else if (a_event->header.hash_count == 0){
         dap_chain_hash_fast_t l_event_hash;
-        dap_chain_cs_dag_event_calc_hash(a_dag_event,a_dag_event_size, &l_event_hash);
+        dap_chain_cs_dag_event_calc_hash(a_event,a_event_size, &l_event_hash);
         if ( memcmp( &l_event_hash, &a_dag->static_genesis_event_hash, sizeof(l_event_hash) ) == 0 ){
             return 0;
         }else{
-            log_it(L_WARNING,"Wrong genesis event %p: hash is not equels to what in config", a_dag_event);
+            log_it(L_WARNING,"Wrong genesis event %p: hash is not equels to what in config", a_event);
             return -20; // Wrong signatures number
         }
-    }else{
-        log_it(L_WARNING,"Wrong signatures number with event %p", a_dag_event);
+    }
+    else{
+        log_it(L_WARNING,"Wrong signatures number with event %p", a_event);
         return -2; // Wrong signatures number
     }
 }
diff --git a/modules/global-db/dap_chain_global_db.c b/modules/global-db/dap_chain_global_db.c
index 1bf44fa9988889cbca76b4955b6beb7b26217952..4530e1ada4f02f738f7967dceaa8e73c6c22ff93 100644
--- a/modules/global-db/dap_chain_global_db.c
+++ b/modules/global-db/dap_chain_global_db.c
@@ -26,13 +26,13 @@
 #include <stdint.h>
 #include <pthread.h>
 #include <errno.h>
-#include <time.h>
 #include <assert.h>
-//#include <string.h>
 #include "dap_chain_global_db.h"
 #include "uthash.h"
 #include "dap_strfuncs.h"
+#include "dap_file_utils.h"
 #include "dap_chain_common.h"
+#include "dap_time.h"
 
 #ifdef WIN32
 #include "registry.h"
@@ -207,6 +207,70 @@ size_t i;
     DAP_DELETE(a_objs);                                     /* Finaly kill the the array */
 }
 
+
+static int s_check_db_version(dap_config_t *g_config)
+{
+    int res = 0;
+    // Read current version of database
+    size_t l_gdb_version_len = 0;
+    uint16_t l_gdb_version = 0;
+    uint16_t *l_gdb_version_p = (uint16_t*) dap_chain_global_db_get("gdb_version", &l_gdb_version_len);
+    if(l_gdb_version_p && l_gdb_version_len == sizeof(uint16_t)) {
+        l_gdb_version = *l_gdb_version_p;
+    }
+
+    if(l_gdb_version < GDB_VERSION) {
+        log_it(L_NOTICE, "GlobalDB version %d, but %d required. The current database will be recreated", l_gdb_version, GDB_VERSION);
+        dap_chain_global_db_deinit();
+        // Database path
+        const char *l_storage_path = dap_config_get_item_str(g_config, "resources", "dap_global_db_path");
+        // Delete database
+        if(dap_file_test(l_storage_path) || dap_dir_test(l_storage_path)) {
+            // Backup filename: backup_global_db_ver.X_DATE_TIME.zip
+            char now[255];
+            time_t t = time(NULL);
+            strftime(now, 200, "%y.%m.%d-%H_%M_%S", localtime(&t));
+#ifdef DAP_BUILD_WITH_ZIP
+            char *l_output_file_name = dap_strdup_printf("backup_%s_ver.%d_%s.zip", dap_path_get_basename(l_storage_path), l_gdb_version, now);
+            char *l_output_file_path = dap_build_filename(l_storage_path, "../", l_output_file_name, NULL);
+            // Create backup as ZIP file
+            if(dap_zip_directory(l_storage_path, l_output_file_path)) {
+#else
+            char *l_output_file_name = dap_strdup_printf("backup_%s_ver.%d_%s.tar", dap_path_get_basename(l_storage_path), l_gdb_version, now);
+            char *l_output_file_path = dap_build_filename(l_storage_path, "../", l_output_file_name, NULL);
+            // Create backup as TAR file
+            if(dap_tar_directory(l_storage_path, l_output_file_path)) {
+#endif
+                // Delete database file or directory
+                dap_rm_rf(l_storage_path);
+            }
+            else {
+                log_it(L_ERROR, "Can't backup GlobalDB version %d", l_gdb_version);
+                return -2;
+            }
+            DAP_DELETE(l_output_file_name);
+            DAP_DELETE(l_output_file_path);
+        }
+        // Reinitialize database
+        res = dap_chain_global_db_init(g_config);
+        // Save current db version
+        if(!res) {
+            l_gdb_version = GDB_VERSION;
+            dap_chain_global_db_set("gdb_version", &l_gdb_version, sizeof(uint16_t));
+            log_it(L_NOTICE, "GlobalDB version updated to %d", l_gdb_version);
+        }
+    } else if(l_gdb_version > GDB_VERSION) {
+        log_it(L_ERROR, "GlobalDB version %d is newer than supported version %d", l_gdb_version, GDB_VERSION);
+        res = -1;
+    }
+    else {
+        log_it(L_NOTICE, "GlobalDB version %d", l_gdb_version);
+    }
+    if(l_gdb_version_p)
+        DAP_DELETE(l_gdb_version_p);
+    return res;
+}
+
 /**
  * @brief Initializes a database by g_config structure.
  * @note You should call this function before calling any other functions in this library.
@@ -234,13 +298,20 @@ int dap_chain_global_db_init(dap_config_t * g_config)
 
     if( res != 0 )
         log_it(L_CRITICAL, "Hadn't initialized db driver \"%s\" on path \"%s\"", l_driver_name, l_storage_path);
-    else
-        log_it(L_NOTICE, "GlobalDB initialized");
-
+    else {
+        static bool is_check_version = false;
+        if(!is_check_version){
+            is_check_version = true;
+            res = s_check_db_version(g_config);
+        }
+        if(!res)
+            log_it(L_NOTICE, "GlobalDB initialized");
+        else
+            log_it(L_ERROR, "GlobalDB version changed, please export or remove old version!");
+    }
     return res;
 }
 
-
 static void s_clear_sync_grp(void *a_elm)
 {
     dap_sync_group_item_t *l_item = (dap_sync_group_item_t *)a_elm;
@@ -313,6 +384,36 @@ dap_store_obj_t* dap_chain_global_db_obj_gr_get(const char *a_key, size_t *a_dat
     return l_store_data;
 }
 
+/**
+ * @brief Gets an object value with parameters from database by a_key and a_group.
+ *
+ * @param a_key an object key string
+ * @param a_data_len_out a length of values that were gotten
+ * @param a_flags_out record flags that were gotten
+ * @param a_group a group name string
+ * @return If successful, returns a pointer to the object value.
+ */
+uint8_t* dap_chain_global_db_gr_get_ext(const char *a_key, size_t *a_data_len_out, const char *a_group, uint8_t *a_flags_out)
+{
+    uint8_t *l_ret_value = NULL;
+    // read several items, 0 - no limits
+    size_t l_count_records = 0;
+    dap_store_obj_t *l_store_data = dap_chain_global_db_driver_read(a_group, a_key, &l_count_records);
+    if(!l_store_data || l_count_records < 1) {
+        return NULL;
+    }
+    l_ret_value = l_store_data->value && l_store_data->value_len
+            ? DAP_DUP_SIZE(l_store_data->value, l_store_data->value_len)
+            : NULL;
+    // set length of output buffer
+    if(a_data_len_out)
+        *a_data_len_out = l_store_data->value_len;
+    // set flag of record
+    if(a_flags_out)
+        *a_flags_out = l_store_data->flags;
+    dap_store_obj_free(l_store_data, l_count_records);
+    return l_ret_value;
+}
 
 /**
  * @brief Gets an object value with parameters from database by a_key and a_group.
@@ -377,7 +478,7 @@ uint8_t * dap_chain_global_db_get(const char *a_key, size_t *a_data_len_out)
  * @param a_timestamp an object time stamp
  * @return True if successful, false otherwise.
  */
-static int global_db_gr_del_add(const char *a_key, const char *a_group, time_t a_timestamp)
+static int global_db_gr_del_add(const char *a_key, const char *a_group, uint64_t a_timestamp)
 {
 dap_store_obj_t store_data = {0};
 char	l_group[DAP_DB_K_MAXGRPLEN];
@@ -430,13 +531,13 @@ int	l_res = 0;
  * @param a_key an object key string, looked like "0x8FAFBD00B..."
  * @return If successful, a time stamp, otherwise 0.
  */
-time_t global_db_gr_del_get_timestamp(const char *a_group, const char *a_key)
+uint64_t global_db_gr_del_get_timestamp(const char *a_group, const char *a_key)
 {
-time_t l_timestamp = 0;
-dap_store_obj_t store_data = {0};
-char    l_group [512];
-size_t l_count_out = 0;
-dap_store_obj_t *l_obj;
+    uint64_t l_timestamp = 0;
+    dap_store_obj_t store_data = { 0 };
+    char l_group[512];
+    size_t l_count_out = 0;
+    dap_store_obj_t *l_obj;
 
     if(!a_key)
         return l_timestamp;
@@ -506,34 +607,38 @@ dap_store_obj_t* dap_chain_global_db_cond_load(const char *a_group, uint64_t a_f
 /**
  * @brief Gets all data from a database by a_group.
  * @param a_group a group name string
- * @param a_data_size[in] a poiter to return a number of data
- * @param a_data_size[out] a number of data
+ * @param a_records_count_out[in] a poiter to return a number of data
+ * @param a_records_count_out[out] a number of data
  * @return If successful, a pointer to data; otherwise NULL.
  */
-dap_global_db_obj_t* dap_chain_global_db_gr_load(const char *a_group, size_t *a_data_size_out)
+dap_global_db_obj_t* dap_chain_global_db_gr_load(const char *a_group, size_t *a_records_count_out)
 {
     size_t l_count = 0;
-    if (!a_data_size_out)
-        a_data_size_out = &l_count;
-    dap_store_obj_t *l_store_obj = dap_chain_global_db_driver_read(a_group, NULL, a_data_size_out);
+    dap_store_obj_t *l_store_obj = dap_chain_global_db_driver_read(a_group, NULL, &l_count);
     if(!l_store_obj)
         return NULL;
 
     dap_global_db_obj_t *l_data = DAP_NEW_Z_SIZE(dap_global_db_obj_t,
-                                                 (*a_data_size_out + 1) * sizeof(dap_global_db_obj_t)); // last item in mass must be zero
+                                                 l_count * sizeof(dap_global_db_obj_t));
     if (!l_data) {
-        dap_store_obj_free(l_store_obj, *a_data_size_out);
+        dap_store_obj_free(l_store_obj, l_count);
         return NULL;
     }
 
-    for(size_t i = 0; i < *a_data_size_out; i++) {
+    size_t l_valid = 0;
+    for(size_t i = 0; i < l_count; i++) {
+        if (!l_store_obj[i].key)
+            continue;
         l_data[i] = (dap_global_db_obj_t) {
                 .key = dap_strdup(l_store_obj[i].key),
                 .value_len = l_store_obj[i].value_len,
                 .value = DAP_DUP_SIZE(l_store_obj[i].value, l_store_obj[i].value_len)
         };
+        l_valid++;
     }
-    dap_store_obj_free(l_store_obj, *a_data_size_out);
+    dap_store_obj_free(l_store_obj, l_count);
+    if (a_records_count_out)
+        *a_records_count_out = l_valid;
     return l_data;
 }
 
@@ -582,7 +687,7 @@ void dap_global_db_change_notify(dap_store_obj_t *a_store_data)
  * @details Set one entry to base. IMPORTANT: a_key and a_value should be passed without free after (it will be released by gdb itself)
  * @return True if successful, false otherwise.
  */
-bool dap_chain_global_db_gr_flags_set(const char *a_key, const void *a_value, size_t a_value_len, const char *a_group, uint8_t a_flags)
+bool dap_chain_global_db_gr_set_ext(const char *a_key, const void *a_value, size_t a_value_len, const char *a_group, uint8_t a_flags)
 {
     dap_store_obj_t store_data = { 0 };
 
@@ -591,7 +696,7 @@ bool dap_chain_global_db_gr_flags_set(const char *a_key, const void *a_value, si
     store_data.value_len = (a_value_len == (size_t) -1) ? dap_strlen(a_value) : a_value_len;
     store_data.value = store_data.value_len ? (void *)a_value : NULL;
     store_data.group = (char *)a_group;
-    store_data.timestamp = time(NULL);
+    store_data.timestamp = dap_gdb_time_now();
 
     lock();
     int l_res = dap_chain_global_db_driver_add(&store_data, 1);
@@ -625,13 +730,13 @@ bool dap_chain_global_db_gr_flags_set(const char *a_key, const void *a_value, si
 bool dap_chain_global_db_gr_set(const char *a_key, const void *a_value, size_t a_value_len, const char *a_group)
 {
     uint8_t l_flags = RECORD_COMMON;
-    return dap_chain_global_db_gr_flags_set(a_key, a_value, a_value_len, a_group, l_flags);
+    return dap_chain_global_db_gr_set_ext(a_key, a_value, a_value_len, a_group, l_flags);
 }
 
 bool dap_chain_global_db_gr_pinned_set(const char *a_key, const void *a_value, size_t a_value_len, const char *a_group)
 {
     uint8_t l_flags = RECORD_PINNED;
-    return dap_chain_global_db_gr_flags_set(a_key, a_value, a_value_len, a_group, l_flags);
+    return dap_chain_global_db_gr_set_ext(a_key, a_value, a_value_len, a_group, l_flags);
 }
 
 /**
@@ -653,7 +758,7 @@ bool dap_chain_global_db_set(const char *a_key, const void *a_value, size_t a_va
  */
 bool dap_chain_global_db_gr_del(const char *a_key, const char *a_group)
 {
-dap_store_obj_t store_data = {0};
+    dap_store_obj_t store_data = {0};
 
     store_data.key = a_key;
     store_data.group = (char*)a_group;
@@ -665,7 +770,7 @@ dap_store_obj_t store_data = {0};
     if (a_key) {
         if (l_res >= 0) {
             // add to Del group
-            global_db_gr_del_add(a_key, store_data.group, time(NULL));
+            global_db_gr_del_add(a_key, store_data.group, dap_gdb_time_now());
         }
         // do not add to history if l_res=1 (already deleted)
         if (!l_res) {
@@ -710,7 +815,7 @@ dap_store_obj_t *l_store_obj;
         }
     }
 
-    return l_res;
+    return !(l_res & l_res_del);
 }
 
 /**
@@ -722,9 +827,9 @@ dap_store_obj_t *l_store_obj;
  */
 bool dap_chain_global_db_gr_save(dap_global_db_obj_t* a_objs, size_t a_objs_count, const char *a_group)
 {
-dap_store_obj_t l_store_data[a_objs_count], *store_data_cur;
-dap_global_db_obj_t *l_obj_cur;
-time_t l_timestamp = time(NULL);
+    dap_store_obj_t l_store_data[a_objs_count], *store_data_cur;
+    dap_global_db_obj_t *l_obj_cur;
+    uint64_t l_timestamp = dap_gdb_time_now();
 
     store_data_cur = l_store_data;
     l_obj_cur = a_objs;
diff --git a/modules/global-db/dap_chain_global_db_driver.c b/modules/global-db/dap_chain_global_db_driver.c
index 083ea108b846cad1e30d707ddd33ab21ec4e0b3a..e62052accc1edfa1656d068d2080456b5b150f26 100644
--- a/modules/global-db/dap_chain_global_db_driver.c
+++ b/modules/global-db/dap_chain_global_db_driver.c
@@ -33,7 +33,6 @@
 #include <stdint.h>
 #include <string.h>
 #include <pthread.h>
-#include <assert.h>
 #include <unistd.h>
 
 #include "dap_worker.h"
@@ -200,7 +199,8 @@ dap_store_obj_t *l_store_obj, *l_store_obj_dst, *l_store_obj_src;
  * @param a_store_count a number of objects
  * @return (none)
  */
-void dap_store_obj_free(dap_store_obj_t *a_store_obj, size_t a_store_count){
+void dap_store_obj_free(dap_store_obj_t *a_store_obj, size_t a_store_count)
+{
     if(!a_store_obj)
         return;
 
@@ -262,9 +262,7 @@ dap_store_obj_t *l_store_obj_cur;
         s_drv_callback.transaction_start();
 
     if(s_drv_callback.apply_store_obj)
-        for(int i = a_store_count; (!l_ret) && i--; l_store_obj_cur++) {
-            assert(l_store_obj_cur);                /* Sanity check */
-
+        for(int i = a_store_count; (!l_ret) && (i--); l_store_obj_cur++) {
             if ( 1 == (l_ret = s_drv_callback.apply_store_obj(l_store_obj_cur)) )
                 log_it(L_INFO, "[%p] Item is missing (may be already deleted) %s/%s", a_store_obj, l_store_obj_cur->group, l_store_obj_cur->key);
             else if (l_ret < 0)
@@ -288,17 +286,18 @@ size_t l_store_obj_cnt;
 
     debug_if(s_dap_global_db_debug_more, L_DEBUG, "Entering, %d entries in the queue ...",  s_db_reqs_list.nr);
 
-    assert ( !pthread_mutex_lock(&s_db_reqs_list_lock) );                   /* Get exclusive access to the request list */
+    if ( (l_ret = pthread_mutex_lock(&s_db_reqs_list_lock)) )               /* Get exclusive access to the request list */
+         return log_it(L_ERROR, "Cannot lock request queue, errno=%d",l_ret), 0;
 
     if ( !s_db_reqs_list.nr )                                               /* Nothing to do ?! Just exit */
     {
-        assert ( !pthread_mutex_unlock(&s_db_reqs_list_lock) );
+        pthread_mutex_unlock(&s_db_reqs_list_lock);
         return  1;                                                          /* 1 - Don't call it again */
     }
 
     if ( (l_ret = s_dap_remqhead (&s_db_reqs_list, (void **)  &l_store_obj_cur, &l_store_obj_cnt)) )
     {
-        assert ( !pthread_mutex_unlock(&s_db_reqs_list_lock) );
+        pthread_mutex_unlock(&s_db_reqs_list_lock);
         log_it(L_ERROR, "DB Request list is in incosistence state (code %d)", l_ret);
         return  1;                                                          /* 1 - Don't call it again */
     }
@@ -306,7 +305,7 @@ size_t l_store_obj_cnt;
     /* So at this point we are ready to do work in the DB */
     s_dap_chain_global_db_driver_apply_do(l_store_obj_cur, l_store_obj_cnt);
 
-    assert ( !pthread_mutex_unlock(&s_db_reqs_list_lock) );
+    pthread_mutex_unlock(&s_db_reqs_list_lock);
 
 
     /* Is there a callback  ? */
@@ -351,14 +350,14 @@ dap_worker_t        *l_dap_worker;
     /* Async mode - put request into the list for deffered processing */
     l_ret = -ENOMEM;                                                    /* Preset return code to non-OK  */
 
-    assert ( !pthread_mutex_lock(&s_db_reqs_list_lock) );               /* Get exclusive access to the request list */
+    pthread_mutex_lock(&s_db_reqs_list_lock);                           /* Get exclusive access to the request list */
 
     if ( !(l_store_obj_cur = dap_store_obj_copy(a_store_obj, a_store_count)) )
         l_ret = - ENOMEM, log_it(L_ERROR, "[%p] No memory for DB Request for item %s/%s", a_store_obj, a_store_obj->group, a_store_obj->key);
     else if ( (l_ret = s_dap_insqtail (&s_db_reqs_list, l_store_obj_cur, a_store_count)) )
         log_it(L_ERROR, "[%p] Can't enqueue DB request for item %s/%s (code %d)", a_store_obj, a_store_obj->group, a_store_obj->key, l_ret);
 
-    assert ( !pthread_mutex_unlock(&s_db_reqs_list_lock) );
+    pthread_mutex_unlock(&s_db_reqs_list_lock);
 
     if ( !l_ret )
         {                                                                /* So finaly enqueue an execution routine */
diff --git a/modules/global-db/dap_chain_global_db_driver_cdb.c b/modules/global-db/dap_chain_global_db_driver_cdb.c
index 2405357181586589505a545fceb93d9d5bf61c92..9d19531b0cd96c8d58cf6bc2a68dfc2d779ad2fd 100644
--- a/modules/global-db/dap_chain_global_db_driver_cdb.c
+++ b/modules/global-db/dap_chain_global_db_driver_cdb.c
@@ -59,7 +59,8 @@ typedef struct _cdb_instance {
 } cdb_instance, *pcdb_instance;
 
 /** A path to a CDB file. */
-static char *s_cdb_path = NULL;
+static char s_cdb_path[MAX_PATH];
+
 /** A pointer to a CDB instance. */
 static pcdb_instance s_cdb = NULL;
 /** A mutex for working with a CDB instanse. */
@@ -79,8 +80,7 @@ static pthread_rwlock_t cdb_rwlock = PTHREAD_RWLOCK_INITIALIZER;
  * @param val a serialize string
  */
 static void cdb_serialize_val_to_dap_store_obj(pdap_store_obj_t a_obj, const char *key, const char *val) {
-    if (!key || !val) {
-        a_obj = NULL;
+    if (!key) {
         return;
     }
     int offset = 0;
@@ -91,8 +91,10 @@ static void cdb_serialize_val_to_dap_store_obj(pdap_store_obj_t a_obj, const cha
     offset += sizeof(uint8_t);
     a_obj->value_len = dap_hex_to_uint(val + offset, sizeof(uint64_t));
     offset += sizeof(uint64_t);
-    a_obj->value = DAP_NEW_SIZE(uint8_t, a_obj->value_len);
-    memcpy((byte_t *)a_obj->value, val + offset, a_obj->value_len);
+    if (a_obj->value_len) {
+        a_obj->value = DAP_NEW_SIZE(uint8_t, a_obj->value_len);
+        memcpy((byte_t *)a_obj->value, val + offset, a_obj->value_len);
+    }
     offset += a_obj->value_len;
     a_obj->timestamp = dap_hex_to_uint(val + offset, sizeof(uint64_t));
 }
@@ -175,8 +177,9 @@ bool dap_cdb_get_count_iter_callback(void *arg, const char *key, int ksize, cons
  */
 pcdb_instance dap_cdb_init_group(const char *a_group, int a_flags) {
     pcdb_instance l_cdb_i = NULL;
+    char l_cdb_path[MAX_PATH + 2];
+
     pthread_mutex_lock(&cdb_mutex);
-    char l_cdb_path[strlen(s_cdb_path) + strlen(a_group) + 2];
     HASH_FIND_STR(s_cdb, a_group, l_cdb_i);
     if (a_flags & CDB_TRUNC) {
         if (!l_cdb_i)
@@ -251,21 +254,22 @@ ERR:
  */
 int dap_db_driver_cdb_init(const char *a_cdb_path, dap_db_driver_callbacks_t *a_drv_callback)
 {
-    s_cdb_path = dap_strdup(a_cdb_path);
-    if(s_cdb_path[strlen(s_cdb_path)] == '/') {
-        s_cdb_path[strlen(s_cdb_path)] = '\0';
-    }
+int l_rc;
+struct dirent *d;
+DIR *dir;
+
+    for (l_rc = 0; *a_cdb_path && ((size_t)l_rc < sizeof(s_cdb_path)); )
+         s_cdb_path[l_rc++] = *(a_cdb_path++);                              /* Copy path to CDB root to local storage, calculate length */
+
+    if(s_cdb_path[l_rc - 1] == '/')                                         /* Truncate terminal '/' if need */
+        s_cdb_path[--l_rc] = '\0';
 
     dap_mkdir_with_parents(s_cdb_path);
 
-    struct dirent *d;
-    DIR *dir = opendir(s_cdb_path);
-    if (!dir) {
-        log_it(L_ERROR, "Couldn't open db directory");
-        return -1;
-    }
+    if ( !(dir = opendir(s_cdb_path)) )
+        return log_it(L_ERROR, "Couldn't open db directory '%s', errno=%d", s_cdb_path, errno), -errno;
 
-    for (d = readdir(dir); d; d = readdir(dir)) {
+    while ( (d = readdir(dir))) {
 #ifdef _DIRENT_HAVE_D_TYPE
         if (d->d_type != DT_DIR)
             continue;
@@ -282,9 +286,9 @@ int dap_db_driver_cdb_init(const char *a_cdb_path, dap_db_driver_callbacks_t *a_
             continue;
         }
 #endif
-        if (!dap_strcmp(d->d_name, ".") || !dap_strcmp(d->d_name, "..")) {
+        if ( (d->d_name[0] == '.') || !dap_strcmp(d->d_name, ".."))
             continue;
-        }
+
         pcdb_instance l_cdb_i = dap_cdb_init_group(d->d_name, CDB_PAGEWARMUP);
         if (!l_cdb_i) {
             dap_db_driver_cdb_deinit();
@@ -305,9 +309,6 @@ int dap_db_driver_cdb_init(const char *a_cdb_path, dap_db_driver_callbacks_t *a_
 
     closedir(dir);
 
-
-
-
     return CDB_SUCCESS;
 }
 
@@ -330,7 +331,7 @@ pcdb_instance dap_cdb_get_db_by_group(const char *a_group) {
  * @return 0
  */
 int dap_cdb_add_group(const char *a_group) {
-    char l_cdb_path[strlen(s_cdb_path) + strlen(a_group) + 2];
+    char l_cdb_path[MAX_PATH + 2];
     memset(l_cdb_path, '\0', sizeof(l_cdb_path));
     dap_snprintf(l_cdb_path, sizeof(l_cdb_path), "%s/%s", s_cdb_path, a_group);
 #ifdef _WIN32
@@ -355,7 +356,7 @@ int dap_db_driver_cdb_deinit() {
         DAP_DELETE(cur_cdb);
     }
     pthread_rwlock_unlock(&cdb_rwlock);
-    DAP_DEL_Z(s_cdb_path)
+
     return CDB_SUCCESS;
 }
 
@@ -641,7 +642,7 @@ int dap_db_driver_cdb_apply_store_obj(pdap_store_obj_t a_store_obj) {
         if(a_store_obj->key) {
             if(cdb_del(l_cdb_i->cdb, a_store_obj->key, (int) strlen(a_store_obj->key)) == -3)
                 ret = 1;
-        } else if (dap_cdb_init_group(a_store_obj->group, CDB_TRUNC | CDB_PAGEWARMUP))
+        } else if (!dap_cdb_init_group(a_store_obj->group, CDB_TRUNC | CDB_PAGEWARMUP))
             ret = -1;
     }
     return ret;
diff --git a/modules/global-db/dap_chain_global_db_driver_sqlite.c b/modules/global-db/dap_chain_global_db_driver_sqlite.c
index d111a2221138d95a02fe3b4731dc87ba0901bf3b..551e70421f614a2144dfb913a572871056a1ede6 100644
--- a/modules/global-db/dap_chain_global_db_driver_sqlite.c
+++ b/modules/global-db/dap_chain_global_db_driver_sqlite.c
@@ -34,12 +34,12 @@
 #ifdef DAP_OS_UNIX
 #include <unistd.h>
 #endif
+#include "dap_chain_global_db_driver_sqlite.h"
 #include "dap_common.h"
 #include "dap_hash.h"
 #include "dap_file_utils.h"
 #include "dap_strfuncs.h"
 #include "dap_file_utils.h"
-#include "dap_chain_global_db_driver_sqlite.h"
 
 #define LOG_TAG "db_sqlite"
 
@@ -56,7 +56,7 @@ static struct conn_pool_item *s_trans = NULL;                               /* S
 static pthread_mutex_t s_trans_mtx = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t s_trans_cnd = PTHREAD_COND_INITIALIZER;
 
-
+bool s_debug_db_more = false;
 static char s_filename_db [MAX_PATH];
 
 static pthread_mutex_t s_conn_free_mtx = PTHREAD_MUTEX_INITIALIZER;        /* Lock to coordinate access to the free connections pool */
@@ -95,7 +95,6 @@ typedef struct _sqlite_row_value_
     SQLITE_VALUE *val; // array of field values
 } SQLITE_ROW_VALUE;
 
-
 /**
  * @brief Closes a SQLite database.
  *
@@ -133,8 +132,8 @@ struct timespec tmo = {0};
         return s_trans;                                                     /* DEADLOCK is detected ? Return pointer to current transaction */
     else if ( l_rc )
         return  log_it(L_ERROR, "Cannot get free SQLITE connection, errno=%d", l_rc), NULL;
-    assert ( !pthread_mutex_unlock(&s_db_mtx) );
 
+    pthread_mutex_unlock(&s_db_mtx);
 
     for (int i = DAP_DB$K_RTR4CONN; i--; )
     {
@@ -147,7 +146,8 @@ struct timespec tmo = {0};
                                                                             /* l_rc == 0 - so connection was free, */
                                                                             /* we got free connection, so, release mutex and get out */
                 atomic_fetch_add(&l_conn->usage, 1);
-                log_it(L_DEBUG, "Get l_conn: @%p", l_conn);
+                if (s_debug_db_more)
+                    log_it(L_DEBUG, "Get l_conn: @%p", l_conn);
                 return  l_conn;
                 }
         }
@@ -156,17 +156,17 @@ struct timespec tmo = {0};
 
         /* No free connection at the moment, so, prepare to wait a condition ... */
 
-        assert ( !(l_rc = clock_gettime(CLOCK_REALTIME, &tmo)) );
+        clock_gettime(CLOCK_REALTIME, &tmo);
         tmo.tv_sec += DAP_DB$K_TMO4CONN;
 
-        assert( !pthread_mutex_lock(&s_conn_free_mtx) );
+        pthread_mutex_lock(&s_conn_free_mtx);
         l_rc = pthread_cond_timedwait (&s_conn_free_cnd, &s_conn_free_mtx, &tmo);
-        assert ( !pthread_mutex_unlock(&s_conn_free_mtx) );
+        pthread_mutex_unlock(&s_conn_free_mtx);
 
         log_it(L_DEBUG, "pthread_cond_timedwait()->%d", l_rc);
     }
 
-    assert ( !pthread_mutex_unlock(&s_conn_free_mtx) );
+    pthread_mutex_unlock(&s_conn_free_mtx);
     log_it(L_ERROR, "No free SQLITE connection");
 
     return  NULL;
@@ -176,13 +176,14 @@ static inline int s_sqlite_free_connection(struct conn_pool_item *a_conn)
 {
 int     l_rc;
 
-    log_it(L_DEBUG, "Free l_conn: @%p", a_conn);
+    if (s_debug_db_more)
+        log_it(L_DEBUG, "Free l_conn: @%p", a_conn);
 
-    atomic_flag_clear(&a_conn->busy);                                        /* Clear busy flag */
+    atomic_flag_clear(&a_conn->busy);                                       /* Clear busy flag */
 
-    assert ( !(l_rc = pthread_mutex_lock (&s_conn_free_mtx)) );              /* Send a signal to waiters to wake-up */
-    assert ( !(l_rc = pthread_cond_signal(&s_conn_free_cnd)) );
-    assert ( !(l_rc = pthread_mutex_unlock(&s_conn_free_mtx)) );
+    l_rc = pthread_mutex_lock (&s_conn_free_mtx);                           /* Send a signal to waiters to wake-up */
+    l_rc = pthread_cond_signal(&s_conn_free_cnd);
+    l_rc = pthread_mutex_unlock(&s_conn_free_mtx);
 
     return  0;
 }
@@ -505,12 +506,12 @@ int l_rc;
 
     log_it(L_DEBUG, "Start TX l_conn: @%p", s_trans);
 
-    assert ( !pthread_mutex_lock(&s_db_mtx) );
+    pthread_mutex_lock(&s_db_mtx);
     l_rc = s_dap_db_driver_sqlite_exec(s_trans->conn, "BEGIN", NULL);
-    assert ( !pthread_mutex_unlock(&s_db_mtx) );
+    pthread_mutex_unlock(&s_db_mtx);
 
     if ( l_rc != SQLITE_OK ) {
-        assert ( !pthread_mutex_unlock(&s_trans_mtx) );
+        pthread_mutex_unlock(&s_trans_mtx);
         s_sqlite_free_connection(s_trans);
         s_trans = NULL;
         }
@@ -537,11 +538,11 @@ struct conn_pool_item *l_conn;
 
     log_it(L_DEBUG, "End TX l_conn: @%p", s_trans);
 
-    assert ( !pthread_mutex_unlock(&s_trans_mtx) );                         /* Free TX context to other ... */
+    pthread_mutex_unlock(&s_trans_mtx);                                     /* Free TX context to other ... */
 
-    assert ( !pthread_mutex_lock(&s_db_mtx) );
+    pthread_mutex_lock(&s_db_mtx);
     l_rc = s_dap_db_driver_sqlite_exec(l_conn->conn, "COMMIT", NULL);
-    assert ( ! pthread_mutex_unlock(&s_db_mtx) );
+    pthread_mutex_unlock(&s_db_mtx);
 
     s_sqlite_free_connection(l_conn);
 
diff --git a/modules/global-db/dap_chain_global_db_remote.c b/modules/global-db/dap_chain_global_db_remote.c
index e7586b855aa5750c87172626e594780ad0a777fc..5581e056335d48bed1a5602589dfec1c9021a46c 100644
--- a/modules/global-db/dap_chain_global_db_remote.c
+++ b/modules/global-db/dap_chain_global_db_remote.c
@@ -1,6 +1,5 @@
 #include <string.h>
 #include <stdlib.h>
-#include <time.h>
 
 #include "dap_chain_global_db.h"
 #include "dap_chain_global_db_remote.h"
@@ -8,6 +7,7 @@
 #include "dap_strfuncs.h"
 #include "dap_string.h"
 #include "dap_chain.h"
+#include "dap_time.h"
 
 #define LOG_TAG "dap_chain_global_db_remote"
 
@@ -26,7 +26,7 @@ uint64_t dap_db_log_get_group_last_id(const char *a_group_name)
     dap_store_obj_t *l_last_obj = dap_chain_global_db_get_last(a_group_name);
     if(l_last_obj) {
         result = l_last_obj->id;
-        dap_store_obj_free(l_last_obj, 1);
+        dap_store_obj_free_one(l_last_obj);
     }
     return result;
 }
@@ -40,8 +40,8 @@ uint64_t dap_db_log_get_group_last_id(const char *a_group_name)
 static void *s_list_thread_proc(void *arg)
 {
     dap_db_log_list_t *l_dap_db_log_list = (dap_db_log_list_t *)arg;
-    uint32_t l_time_store_lim = dap_config_get_item_uint32_default(g_config, "resources", "dap_global_db_time_store_limit", 72);
-    uint64_t l_limit_time = l_time_store_lim ? (uint64_t)time(NULL) - l_time_store_lim * 3600 : 0;
+    uint32_t l_time_store_lim_hours = dap_config_get_item_uint32_default(g_config, "resources", "dap_global_db_time_store_limit", 72);
+    uint64_t l_limit_time = l_time_store_lim_hours ? dap_gdb_time_now() - dap_gdb_time_from_sec(l_time_store_lim_hours * 3600) : 0;
     for (dap_list_t *l_groups = l_dap_db_log_list->groups; l_groups; l_groups = dap_list_next(l_groups)) {
         dap_db_log_list_group_t *l_group_cur = (dap_db_log_list_group_t *)l_groups->data;
         char *l_del_group_name_replace = NULL;
@@ -56,6 +56,7 @@ static void *s_list_thread_proc(void *arg)
             l_obj_type = DAP_DB$K_OPTYPE_ADD;
         }
         uint64_t l_item_start = l_group_cur->last_id_synced + 1;
+        dap_gdb_time_t l_time_now = dap_gdb_time_now();
         while (l_group_cur->count && l_dap_db_log_list->is_process) { // Number of records to be synchronized
             size_t l_item_count = min(64, l_group_cur->count);
             dap_store_obj_t *l_objs = dap_chain_global_db_cond_load(l_group_cur->name, l_item_start, &l_item_count);
@@ -70,7 +71,15 @@ static void *s_list_thread_proc(void *arg)
             dap_list_t *l_list = NULL;
             for (size_t i = 0; i < l_item_count; i++) {
                 dap_store_obj_t *l_obj_cur = l_objs + i;
+                if (!l_obj_cur)
+                    continue;
                 l_obj_cur->type = l_obj_type;
+                if (l_obj_cur->timestamp >> 32 == 0 ||
+                        l_obj_cur->timestamp > l_time_now ||
+                        l_obj_cur->group == NULL) {
+                    dap_chain_global_db_driver_delete(l_obj_cur, 1);
+                    continue;       // the object is broken
+                }
                 if (l_obj_type == DAP_DB$K_OPTYPE_DEL) {
                     if (l_limit_time && l_obj_cur->timestamp < l_limit_time) {
                         dap_chain_global_db_driver_delete(l_obj_cur, 1);
@@ -112,6 +121,7 @@ static void *s_list_thread_proc(void *arg)
  * @brief Starts a thread that readding a log list
  * @note instead dap_db_log_get_list()
  *
+ * @param l_net net for sync
  * @param a_addr a pointer to the structure
  * @param a_flags flags
  * @return Returns a pointer to the log list structure if successful, otherwise NULL pointer.
@@ -143,22 +153,23 @@ dap_db_log_list_t* dap_db_log_list_start(dap_chain_net_t *l_net, dap_chain_node_
     }
     dap_list_free(l_groups_masks);
 
-    static uint16_t s_size_ban_list = 0;
+    static int16_t s_size_ban_list = -1;
     static char **s_ban_list = NULL;
 
-    static uint16_t s_size_white_list = 0;
+    static int16_t s_size_white_list = -1;
     static char **s_white_list = NULL;
-
-    static bool l_try_read_ban_list = false;
-    static bool l_try_read_white_list = false;
-
-    if (!l_try_read_ban_list) {
-            s_ban_list = dap_config_get_array_str(g_config, "stream_ch_chain", "ban_list_sync_groups", &s_size_ban_list);
-            l_try_read_ban_list = true;
-    }
-    if (!l_try_read_white_list) {
-            s_white_list = dap_config_get_array_str(g_config, "stream_ch_chain", "white_list_sync_groups", &s_size_white_list);
-            l_try_read_white_list = true;
+    static char **s_white_list_del = NULL;
+
+    if (s_size_ban_list == -1)
+        s_ban_list = dap_config_get_array_str(g_config, "stream_ch_chain", "ban_list_sync_groups", (uint16_t *)&s_size_ban_list);
+    if (s_size_white_list == -1) {
+        s_white_list = dap_config_get_array_str(g_config, "stream_ch_chain", "white_list_sync_groups", (uint16_t *)&s_size_white_list);
+        if (s_size_white_list > 0) {
+            s_white_list_del = DAP_NEW_SIZE(char *, s_size_white_list * sizeof(char *));
+            for (int i = 0; i < s_size_white_list; i++) {
+                s_white_list_del[i] = dap_strdup_printf("%s.del", s_white_list[i]);
+            }
+        }
     }
 
     /* delete if not condition */
@@ -166,17 +177,18 @@ dap_db_log_list_t* dap_db_log_list_start(dap_chain_net_t *l_net, dap_chain_node_
         for (dap_list_t *l_group = l_groups_names; l_group; ) {
             bool l_found = false;
             for (int i = 0; i < s_size_white_list; i++) {
-                if (!dap_fnmatch(s_white_list[i], l_group->data, FNM_NOESCAPE)) {
+                if (!dap_fnmatch(s_white_list[i], l_group->data, FNM_NOESCAPE) ||
+                        !dap_fnmatch(s_white_list_del[i], l_group->data, FNM_NOESCAPE)) {
                     l_found = true;
                     break;
                 }
             }
             if (!l_found) {
-                    dap_list_t *l_tmp = l_group->next;
-                    l_groups_names = dap_list_delete_link(l_dap_db_log_list->groups, l_group);
-                    l_group = l_tmp;
-            }
-            l_group = dap_list_next(l_group);
+                dap_list_t *l_tmp = l_group->next;
+                l_groups_names = dap_list_delete_link(l_groups_names, l_group);
+                l_group = l_tmp;
+            } else
+                l_group = dap_list_next(l_group);
         }
     } else if (s_size_ban_list > 0) {
         for (dap_list_t *l_group = l_groups_names; l_group; ) {
@@ -356,11 +368,11 @@ bool dap_db_set_cur_node_addr(uint64_t a_address, char *a_net_name )
 }
 
 /**
- * @brief Sets an adress of a current node and expire time.
+ * @brief Sets an address of a current node and expire time.
  *
- * @param a_address an adress of a current node
+ * @param a_address an address of a current node
  * @param a_net_name a net name string
- * @return Returns true if siccessful, otherwise false
+ * @return Returns true if successful, otherwise false
  */
 bool dap_db_set_cur_node_addr_exp(uint64_t a_address, char *a_net_name )
 {
@@ -602,11 +614,11 @@ unsigned char *pdata;
  */
 dap_store_obj_t *dap_store_unpacket_multiple(const dap_store_obj_pkt_t *a_pkt, size_t *a_store_obj_count)
 {
-    if(!a_pkt || a_pkt->data_size < 1)
+    if(!a_pkt || a_pkt->data_size < sizeof(dap_store_obj_pkt_t))
         return NULL;
     uint64_t l_offset = 0;
     uint32_t l_count = a_pkt->obj_count, l_cur_count;
-    uint64_t l_size = l_count <= UINT32_MAX ? l_count * sizeof(struct dap_store_obj) : 0;
+    uint64_t l_size = l_count <= UINT16_MAX ? l_count * sizeof(struct dap_store_obj) : 0;
     dap_store_obj_t *l_store_obj = DAP_NEW_Z_SIZE(dap_store_obj_t, l_size);
     if (!l_store_obj || !l_size) {
         log_it(L_ERROR, "Invalid size: can't allocate %"DAP_UINT64_FORMAT_U" bytes", l_size);
@@ -627,38 +639,48 @@ dap_store_obj_t *dap_store_unpacket_multiple(const dap_store_obj_pkt_t *a_pkt, s
         memcpy(&l_str_length, a_pkt->data + l_offset, sizeof(uint16_t));
         l_offset += sizeof(uint16_t);
 
-        if (l_offset+l_str_length> a_pkt->data_size) {log_it(L_ERROR, "Broken GDB element: can't read 'group' field"); break;} // Check for buffer boundries
+        if (l_offset + l_str_length > a_pkt->data_size || !l_str_length) {log_it(L_ERROR, "Broken GDB element: can't read 'group' field"); break;} // Check for buffer boundries
         l_obj->group = DAP_NEW_Z_SIZE(char, l_str_length + 1);
-        memcpy((char*)l_obj->group, a_pkt->data + l_offset, l_str_length);
+        memcpy(l_obj->group, a_pkt->data + l_offset, l_str_length);
         l_offset += l_str_length;
 
-        if (l_offset+sizeof (uint64_t)> a_pkt->data_size) {log_it(L_ERROR, "Broken GDB element: can't read 'id' field"); break;} // Check for buffer boundries
+        if (l_offset+sizeof (uint64_t)> a_pkt->data_size) {log_it(L_ERROR, "Broken GDB element: can't read 'id' field");
+                                                           DAP_DELETE(l_obj->group); break;} // Check for buffer boundries
         memcpy(&l_obj->id, a_pkt->data + l_offset, sizeof(uint64_t));
         l_offset += sizeof(uint64_t);
 
-        if (l_offset+sizeof (uint64_t)> a_pkt->data_size) {log_it(L_ERROR, "Broken GDB element: can't read 'timestamp' field"); break;} // Check for buffer boundries
+        if (l_offset+sizeof (uint64_t)> a_pkt->data_size) {log_it(L_ERROR, "Broken GDB element: can't read 'timestamp' field");
+                                                           DAP_DELETE(l_obj->group); break;} // Check for buffer boundries
         memcpy(&l_obj->timestamp, a_pkt->data + l_offset, sizeof(uint64_t));
         l_offset += sizeof(uint64_t);
 
-        if (l_offset+sizeof (uint16_t)> a_pkt->data_size) {log_it(L_ERROR, "Broken GDB element: can't read 'key_length' field"); break;} // Check for buffer boundries
+        if (l_offset+sizeof (uint16_t)> a_pkt->data_size) {log_it(L_ERROR, "Broken GDB element: can't read 'key_length' field");
+                                                           DAP_DELETE(l_obj->group); break;} // Check for buffer boundries
         memcpy(&l_str_length, a_pkt->data + l_offset, sizeof(uint16_t));
         l_offset += sizeof(uint16_t);
 
-        if (l_offset+ l_str_length > a_pkt->data_size) {log_it(L_ERROR, "Broken GDB element: can't read 'key' field"); break;} // Check for buffer boundries
+        if (l_offset + l_str_length > a_pkt->data_size || !l_str_length) {log_it(L_ERROR, "Broken GDB element: can't read 'key' field");
+                                                                          DAP_DELETE(l_obj->group); break;} // Check for buffer boundries
         l_obj->key = DAP_NEW_Z_SIZE(char, l_str_length + 1);
-        memcpy((char*)l_obj->key, a_pkt->data + l_offset, l_str_length);
+        memcpy((char *)l_obj->key, a_pkt->data + l_offset, l_str_length);
         l_offset += l_str_length;
 
-        if (l_offset+sizeof (uint64_t)> a_pkt->data_size) {log_it(L_ERROR, "Broken GDB element: can't read 'value_length' field"); break;} // Check for buffer boundries
+        if (l_offset+sizeof (uint64_t)> a_pkt->data_size) {log_it(L_ERROR, "Broken GDB element: can't read 'value_length' field");
+                                                           DAP_DELETE(l_obj->group); DAP_DELETE(l_obj->key); break;} // Check for buffer boundries
         memcpy(&l_obj->value_len, a_pkt->data + l_offset, sizeof(uint64_t));
         l_offset += sizeof(uint64_t);
 
-        if (l_offset+l_obj->value_len> a_pkt->data_size) {log_it(L_ERROR, "Broken GDB element: can't read 'value' field"); break;} // Check for buffer boundries
+        if (l_offset + l_obj->value_len > a_pkt->data_size) {log_it(L_ERROR, "Broken GDB element: can't read 'value' field");
+                                                          DAP_DELETE(l_obj->group); DAP_DELETE(l_obj->key);break;} // Check for buffer boundries
         l_obj->value = DAP_NEW_SIZE(uint8_t, l_obj->value_len);
         memcpy((char*)l_obj->value, a_pkt->data + l_offset, l_obj->value_len);
         l_offset += l_obj->value_len;
     }
-    assert(a_pkt->data_size == l_offset);
+    if (a_pkt->data_size != l_offset) {
+        if (l_cur_count)
+            dap_store_obj_free(l_store_obj, l_cur_count);
+        return NULL;
+    }
     // Return the number of completely filled dap_store_obj_t structures
     // because l_cur_count may be less than l_count due to too little memory
     if(a_store_obj_count)
diff --git a/modules/global-db/include/dap_chain_global_db.h b/modules/global-db/include/dap_chain_global_db.h
index 9bddf340c4f650d8bb836301afb96fe953c7a61f..69689bffd6f5c927f48704a73e624c10bacb4455 100644
--- a/modules/global-db/include/dap_chain_global_db.h
+++ b/modules/global-db/include/dap_chain_global_db.h
@@ -10,6 +10,7 @@
 #include "dap_list.h"
 #include "dap_chain_common.h"
 
+#define GDB_VERSION 1
 #define GROUP_LOCAL_NODE_LAST_ID "local.node.last_id"
 #define GROUP_LOCAL_GENERAL "local.general"
 #define GROUP_LOCAL_NODE_ADDR "local.node-addr"
@@ -72,14 +73,16 @@ void dap_global_db_change_notify(dap_store_obj_t *a_store_data);
  */
 dap_store_obj_t *dap_chain_global_db_obj_get(const char *a_key, const char *a_group);
 dap_store_obj_t* dap_chain_global_db_obj_gr_get(const char *a_key, size_t *a_data_len_out, const char *a_group);
+uint8_t* dap_chain_global_db_gr_get_ext(const char *a_key, size_t *a_data_len_out, const char *a_group, uint8_t *a_flags_out);
 uint8_t * dap_chain_global_db_gr_get(const char *a_key, size_t *a_data_len_out, const char *a_group);
 uint8_t * dap_chain_global_db_get(const char *a_key, size_t *a_data_len_out);
 
 /**
  * Set one entry to base
  */
-bool dap_chain_global_db_gr_flags_set(const char *a_key, const void *a_value, size_t a_value_len, const char *a_group, uint8_t a_flags);
+bool dap_chain_global_db_gr_set_ext(const char *a_key, const void *a_value, size_t a_value_len, const char *a_group, uint8_t a_flags);
 bool dap_chain_global_db_gr_set(const char *a_key,  const void *a_value, size_t a_value_len, const char *a_group);
+bool dap_chain_global_db_pinned_gr_set(const char *a_key, const void *a_value, size_t a_value_len, const char *a_group);
 bool dap_chain_global_db_set(const char *a_key, const void *a_value, size_t a_value_len);
 
 /**
@@ -91,7 +94,7 @@ bool dap_chain_global_db_del(char *a_key);
 /**
  * Get timestamp of the deleted entry
  */
-time_t global_db_gr_del_get_timestamp(const char *a_group, const char *a_key);
+uint64_t global_db_gr_del_get_timestamp(const char *a_group, const char *a_key);
 
 /**
  * Read the entire database into an array of size bytes
diff --git a/modules/global-db/include/dap_chain_global_db_driver.h b/modules/global-db/include/dap_chain_global_db_driver.h
index 3c63acd557df61aecc79cf36768f7d19566bea7f..fd0463e0915690a311de414b3f636ecb0d814ba4 100644
--- a/modules/global-db/include/dap_chain_global_db_driver.h
+++ b/modules/global-db/include/dap_chain_global_db_driver.h
@@ -24,6 +24,7 @@
 
 #pragma once
 
+#include "dap_time.h"
 #include "dap_proc_thread.h"
 #include "dap_list.h"
 
@@ -43,22 +44,20 @@ enum RECORD_FLAGS {
 
 typedef struct dap_store_obj {
     uint64_t id;
-    uint64_t timestamp;
+    dap_gdb_time_t timestamp;
     uint32_t type;                              /* Operation type: ADD/DELETE, see DAP_DB$K_OPTYPE_* constants */
     uint8_t flags;                              /* RECORD_FLAGS */
     char *group;
     const char *key;
-    const char *c_key;
     uint8_t *value;
     uint64_t value_len;
 
     dap_proc_queue_callback_t cb;               /* (Async mode only!) A call back to be called on request completion */
     const void *cb_arg;                         /* (Async mode only!) An argument of the callback rotine */
-
-} DAP_ALIGN_PACKED dap_store_obj_t, *pdap_store_obj_t;
+} dap_store_obj_t, *pdap_store_obj_t;
 
 typedef struct dap_store_obj_pkt {
-    uint64_t timestamp;
+    dap_gdb_time_t timestamp;
     uint64_t data_size;
     uint32_t obj_count;
     uint8_t data[];
@@ -93,6 +92,7 @@ void dap_db_driver_deinit(void);
 
 dap_store_obj_t* dap_store_obj_copy(dap_store_obj_t *a_store_obj, size_t a_store_count);
 void dap_store_obj_free(dap_store_obj_t *a_store_obj, size_t a_store_count);
+DAP_STATIC_INLINE void dap_store_obj_free_one(dap_store_obj_t *a_store_obj) { return dap_store_obj_free(a_store_obj, 1); }
 int dap_db_driver_flush(void);
 
 char* dap_chain_global_db_driver_hash(const uint8_t *data, size_t data_size);
diff --git a/modules/mempool/dap_chain_mempool.c b/modules/mempool/dap_chain_mempool.c
index c2410fa915ee5bf669f19df4ae66be0c762b8136..7b0f3feff6c265a0b8f22b29659dd5c229c26d52 100644
--- a/modules/mempool/dap_chain_mempool.c
+++ b/modules/mempool/dap_chain_mempool.c
@@ -85,17 +85,16 @@ char *dap_chain_mempool_datum_add(const dap_chain_datum_t *a_datum, dap_chain_t
 
     dap_chain_hash_fast_t l_key_hash;
 
-    dap_hash_fast(a_datum->data , a_datum->header.data_size, &l_key_hash);
+    dap_hash_fast(a_datum, dap_chain_datum_size(a_datum), &l_key_hash);
     char * l_key_str = dap_chain_hash_fast_to_str_new(&l_key_hash);
     char * l_gdb_group = dap_chain_net_get_gdb_group_mempool(a_chain);
 
     if (dap_chain_global_db_gr_set(l_key_str, a_datum, dap_chain_datum_size(a_datum), l_gdb_group)) {
-        log_it(L_NOTICE, "Datum with data's hash %s was placed in mempool", l_key_str);
+        log_it(L_NOTICE, "Datum with hash %s was placed in mempool", l_key_str);
     } else {
-        log_it(L_WARNING, "Can't place data's hash %s in mempool", l_key_str);
+        log_it(L_WARNING, "Can't place datum with hash %s in mempool", l_key_str);
         DAP_DEL_Z(l_key_str);
     }
-
     DAP_DELETE(l_gdb_group);
     return l_key_str;
 }
diff --git a/modules/modules_dynamic/cdb/dap_modules_dynamic_cdb.c b/modules/modules_dynamic/cdb/dap_modules_dynamic_cdb.c
index b4e8130de195b9c6cd04d81be978001d129ed71b..5d63d36f86d4a4d30d0c5f7cb9036228fe67e398 100644
--- a/modules/modules_dynamic/cdb/dap_modules_dynamic_cdb.c
+++ b/modules/modules_dynamic/cdb/dap_modules_dynamic_cdb.c
@@ -24,6 +24,7 @@
 
 #include "dap_modules_dynamic_cdb.h"
 #include "dap_common.h"
+#include "dap_config.h"
 
 #ifdef DAP_OS_LINUX
 #include <dlfcn.h>
@@ -31,6 +32,9 @@
 
 #define LOG_TAG "dap_modules_dynamic"
 
+extern dap_config_t *g_config;
+
+
 static const char * s_default_path_modules = "var/modules";
 static void *s_cdb_handle = NULL;
 static bool s_cdb_was_init = false;
@@ -78,14 +82,14 @@ void *dap_modules_dynamic_get_cdb_func(const char *a_func_name)
 int dap_modules_dynamic_load_cdb(dap_http_t * a_server)
 {
     s_cdb_was_init = true;
-    int (*dap_chain_net_srv_vpn_cdb_init)(dap_http_t *);
+    int (*dap_chain_net_srv_vpn_cdb_init)(dap_http_t *, dap_config_t *);
     dap_chain_net_srv_vpn_cdb_init = dap_modules_dynamic_get_cdb_func("dap_chain_net_srv_vpn_cdb_init");
     if (!dap_chain_net_srv_vpn_cdb_init) {
         s_cdb_was_init = false;
         log_it(L_ERROR, "dap_modules_dynamic: dap_chain_net_srv_vpn_cdb_init not found");
         return -2;
     }
-    int l_init_res = dap_chain_net_srv_vpn_cdb_init(a_server);
+    int l_init_res = dap_chain_net_srv_vpn_cdb_init(a_server, g_config);
     if (l_init_res) {
         s_cdb_was_init = false;
         log_it(L_ERROR, "dap_modules_dynamic: dap_chain_net_srv_vpn_cdb_init returns %d", l_init_res);
diff --git a/modules/net/dap_chain_net.c b/modules/net/dap_chain_net.c
index 1a24f422fd3809334c24d1063682ab697aa47cab..ee1765f1ace7109dcf65ba191cbbccb7e54e95a7 100644
--- a/modules/net/dap_chain_net.c
+++ b/modules/net/dap_chain_net.c
@@ -101,6 +101,9 @@
 #include "dap_chain_node_dns_client.h"
 #include "dap_module.h"
 
+#include "json-c/json.h"
+#include "json-c/json_object.h"
+
 #include <stdio.h>
 #include <sys/types.h>
 #include <dirent.h>
@@ -118,7 +121,7 @@ static size_t s_required_links_count = 3;// by default 3
 static bool s_debug_more = false;
 
 struct link_dns_request {
-    uint32_t link_id;
+    //uint32_t link_id; // not used
     dap_chain_net_t * net;
     uint_fast16_t tries;
 };
@@ -128,6 +131,12 @@ struct net_link {
     dap_chain_node_client_t *link;
 };
 
+struct downlink {
+    dap_stream_worker_t *worker;
+    dap_stream_ch_uuid_t uuid;
+    UT_hash_handle hh;
+};
+
 /**
   * @struct dap_chain_net_pvt
   * @details Private part of chain_net dap object
@@ -157,6 +166,10 @@ typedef struct dap_chain_net_pvt{
     size_t links_connected_count;
     bool only_static_links;
 
+    struct downlink *downlinks;             // List of links who sent SYNC REQ, it used for sync broadcasting
+    dap_list_t *records_queue;
+    dap_list_t *atoms_queue;
+
     atomic_uint links_dns_requests;
 
     bool load_mode;
@@ -199,8 +212,10 @@ typedef struct dap_chain_net_item{
 #define PVT(a) ( (dap_chain_net_pvt_t *) (void*) a->pvt )
 #define PVT_S(a) ( (dap_chain_net_pvt_t *) (void*) a.pvt )
 
-static dap_chain_net_item_t * s_net_items = NULL;
-static dap_chain_net_item_t * s_net_items_ids = NULL;
+pthread_rwlock_t    g_net_items_rwlock  = PTHREAD_RWLOCK_INITIALIZER,
+                    g_net_ids_rwlock    = PTHREAD_RWLOCK_INITIALIZER;
+static dap_chain_net_item_t     *s_net_items        = NULL,
+                                *s_net_items_ids    = NULL;
 
 
 static const char * c_net_states[]={
@@ -238,8 +253,8 @@ static const dap_chain_node_client_callbacks_t s_node_link_callbacks={
 static bool s_net_states_proc(dap_proc_thread_t *a_thread, void *a_arg);
 
 // Notify about net states
-static void s_net_states_notify(dap_chain_net_t * l_net );
-static void s_net_links_notify(dap_chain_net_t * a_net );
+struct json_object *net_states_json_collect(dap_chain_net_t * l_net);
+static void s_net_states_notify(dap_chain_net_t * l_net);
 
 // Prepare link success/error endpoints
 static void s_net_state_link_prepare_success(dap_worker_t * a_worker,dap_chain_node_info_t * a_node_info, void * a_arg);
@@ -266,6 +281,8 @@ static bool s_seed_mode = false;
 
 static uint8_t *dap_chain_net_set_acl(dap_chain_hash_fast_t *a_pkey_hash);
 
+static bool s_start_dns_request(dap_chain_net_t *a_net, dap_chain_node_info_t *a_link_node_info);
+
 /**
  * @brief
  * init network settings from cellrame-node.cfg file
@@ -296,7 +313,7 @@ int dap_chain_net_init()
             "\tAdd certificate to list of authority cetificates in GDB group\n"
         "net -net <chain net name> ca list\n"
             "\tPrint list of authority cetificates from GDB group\n"
-        "net -net <chain net name> ca del -hash <cert hash> [-H hex|base58(default)]\n"
+        "net -net <chain net name> ca del -hash <cert hash> [-H {hex | base58(default)}]\n"
             "\tDelete certificate from list of authority cetificates in GDB group by it's hash\n"
         "net -net <chain net name> ledger reload\n"
             "\tPurge the cache of chain net ledger and recalculate it from chain file\n");
@@ -396,9 +413,94 @@ void dap_chain_net_add_gdb_notify_callback(dap_chain_net_t *a_net, dap_global_db
     PVT(a_net)->gdb_notifiers = dap_list_append(PVT(a_net)->gdb_notifiers, l_notifier);
 }
 
+int dap_chain_net_add_downlink(dap_chain_net_t *a_net, dap_stream_worker_t *a_worker, dap_stream_ch_uuid_t a_ch_uuid)
+{
+    if (!a_net || !a_worker)
+        return -1;
+    dap_chain_net_pvt_t *l_net_pvt = PVT(a_net);
+    unsigned a_hash_value;
+    HASH_VALUE(&a_ch_uuid, sizeof(a_ch_uuid), a_hash_value);
+    struct downlink *l_downlink = NULL;
+    pthread_rwlock_rdlock(&l_net_pvt->rwlock);
+    HASH_FIND_BYHASHVALUE(hh, l_net_pvt->downlinks, &a_ch_uuid, sizeof(a_ch_uuid), a_hash_value, l_downlink);
+    if (l_downlink) {
+        pthread_rwlock_unlock(&l_net_pvt->rwlock);
+        return -2;
+    }
+    l_downlink = DAP_NEW_Z(struct downlink);
+    l_downlink->worker = a_worker;
+    l_downlink->uuid = a_ch_uuid;
+    HASH_ADD_BYHASHVALUE(hh, l_net_pvt->downlinks, uuid, sizeof(a_ch_uuid), a_hash_value, l_downlink);
+    pthread_rwlock_unlock(&l_net_pvt->rwlock);
+    return 0;
+}
+
+static bool s_net_send_records(dap_proc_thread_t *a_thread, void *a_arg)
+{
+    UNUSED(a_thread);
+    dap_store_obj_t *l_obj, *l_arg = (dap_store_obj_t *)a_arg;
+    dap_chain_net_t *l_net = (dap_chain_net_t *)l_arg->cb_arg;
+    if (l_arg->type == DAP_DB$K_OPTYPE_DEL) {
+        char *l_group = dap_strdup_printf("%s.del", l_arg->group);
+        l_obj = dap_chain_global_db_obj_get(l_arg->key, l_group);
+        DAP_DELETE(l_group);
+    } else
+        l_obj = dap_chain_global_db_obj_get(l_arg->key, l_arg->group);
+
+    if (!l_obj) {
+        log_it(L_DEBUG, "Notified GDB event does not exist");
+        return true;
+    }
+    l_obj->type = l_arg->type;
+    if (l_obj->type == DAP_DB$K_OPTYPE_DEL) {
+        DAP_DELETE(l_obj->group);
+        l_obj->group = l_arg->group;
+    } else
+        DAP_DELETE(l_arg->group);
+    DAP_DELETE(l_arg->key);
+    DAP_DELETE(l_arg);
+    pthread_rwlock_wrlock(&PVT(l_net)->rwlock);
+    if (PVT(l_net)->state) {
+        dap_list_t *it = NULL;
+        do {
+            dap_store_obj_t *l_obj_cur = it ? (dap_store_obj_t *)it->data : l_obj;
+            dap_chain_t *l_chain = NULL;
+            if (l_obj_cur->type == DAP_DB$K_OPTYPE_ADD)
+                l_chain = dap_chain_get_chain_from_group_name(l_net->pub.id, l_obj->group);
+            dap_chain_id_t l_chain_id = l_chain ? l_chain->id : (dap_chain_id_t) {};
+            dap_chain_cell_id_t l_cell_id = l_chain ? l_chain->cells->id : (dap_chain_cell_id_t){};
+            if (!l_obj_cur->group)
+                break;
+            dap_store_obj_pkt_t *l_data_out = dap_store_packet_single(l_obj_cur);
+            dap_store_obj_free_one(l_obj_cur);
+            struct downlink *l_link, *l_tmp;
+            HASH_ITER(hh, PVT(l_net)->downlinks, l_link, l_tmp) {
+                dap_stream_ch_t *l_ch = dap_stream_ch_find_by_uuid_unsafe(l_link->worker, l_link->uuid);
+                if (!l_ch) {
+                    HASH_DEL(PVT(l_net)->downlinks, l_link);
+                    DAP_DELETE(l_link);
+                    continue;
+                }
+                dap_stream_ch_chain_pkt_write_mt(l_link->worker, l_link->uuid, DAP_STREAM_CH_CHAIN_PKT_TYPE_GLOBAL_DB, l_net->pub.id.uint64,
+                                                     l_chain_id.uint64, l_cell_id.uint64, l_data_out,
+                                                     sizeof(dap_store_obj_pkt_t) + l_data_out->data_size);
+            }
+            DAP_DELETE(l_data_out);
+            if (it)
+                PVT(l_net)->records_queue = dap_list_delete_link(PVT(l_net)->records_queue, it);
+            it = PVT(l_net)->records_queue;
+        } while (it);
+    } else
+        //PVT(l_net)->records_queue = dap_list_append(PVT(l_net)->records_queue, l_obj);
+        dap_store_obj_free_one(l_obj);
+    pthread_rwlock_unlock(&PVT(l_net)->rwlock);
+    return true;
+}
+
+static void s_record_obj_free(void *a_obj) { return dap_store_obj_free_one((dap_store_obj_t *)a_obj); }
+
 /**
- * @brief if current network in ONLINE state send to all connected node
- * executes, when you add data to gdb chain (class=gdb in chain config)
+ * @brief executes, when you add data to gdb and sends it to current network connected nodes
  * @param a_arg arguments. Can be network object (dap_chain_net_t)
  * @param a_op_code object type (f.e. l_net->type from dap_store_obj)
  * @param a_group group, for example "chain-gdb.home21-network.chain-F"
@@ -411,50 +513,98 @@ void dap_chain_net_sync_gdb_broadcast(void *a_arg, const char a_op_code, const c
 {
     UNUSED(a_value);
     UNUSED(a_value_len);
+    if (!a_arg || !a_group || !a_key)
+        return;
     dap_chain_net_t *l_net = (dap_chain_net_t *)a_arg;
-    if (PVT(l_net)->state == NET_STATE_ONLINE) {
-        dap_store_obj_t *l_obj = NULL;
-        if (a_op_code == DAP_DB$K_OPTYPE_DEL) {
-            char *l_group = dap_strdup_printf("%s.del", a_group);
-            l_obj = dap_chain_global_db_obj_get(a_key, l_group);
-            DAP_DELETE(l_group);
-        } else
-            l_obj = dap_chain_global_db_obj_get(a_key, a_group);
-
-        if (!l_obj) {
-            log_it(L_DEBUG, "Notified GDB event does not exist");
-            return;
-        }
-        l_obj->type = a_op_code;
-        if (a_op_code == DAP_DB$K_OPTYPE_DEL) {
-            DAP_DELETE(l_obj->group);
-            l_obj->group = dap_strdup(a_group);
+    if (!HASH_COUNT(PVT(l_net)->downlinks)) {
+        if (PVT(l_net)->records_queue) {
+            pthread_rwlock_wrlock(&PVT(l_net)->rwlock);
+            dap_list_free_full(PVT(l_net)->records_queue, s_record_obj_free);
+            PVT(l_net)->records_queue = NULL;
+            pthread_rwlock_unlock(&PVT(l_net)->rwlock);
         }
+        return;
+    }
+    // Use it instead of new type definition to pack params in one callback arg
+    dap_store_obj_t *l_obj = DAP_NEW(dap_store_obj_t);
+    l_obj->type = a_op_code;
+    l_obj->key = dap_strdup(a_key);
+    l_obj->group = dap_strdup(a_group);
+    l_obj->cb_arg = a_arg;
+    dap_proc_queue_add_callback(dap_events_worker_get_auto(), s_net_send_records, l_obj);
+}
 
-        dap_store_obj_pkt_t *l_data_out = dap_store_packet_single(l_obj);
-        dap_store_obj_free(l_obj, 1);
-        dap_chain_id_t l_chain_id;
-        l_chain_id.uint64 = 0;
-        dap_chain_t *l_chain = dap_chain_get_chain_from_group_name(l_net->pub.id, a_group);
-        if (l_chain)  
-            l_chain_id = l_chain ? l_chain->id : (dap_chain_id_t) {};
-
-        dap_chain_cell_id_t l_cell_id = l_chain ? l_chain->cells->id : (dap_chain_cell_id_t){};
-        pthread_rwlock_rdlock(&PVT(l_net)->rwlock);
-        for (dap_list_t *l_tmp = PVT(l_net)->net_links; l_tmp; l_tmp = dap_list_next(l_tmp)) {
-            dap_chain_node_client_t *l_node_client = ((struct net_link *)l_tmp->data)->link;
-            if (!l_node_client)
-                continue;
-            dap_stream_worker_t *l_stream_worker = dap_client_get_stream_worker(l_node_client->client);
-            if (!l_stream_worker)
-                continue;
-            dap_stream_ch_chain_pkt_write_mt(l_stream_worker, l_node_client->ch_chain_uuid, DAP_STREAM_CH_CHAIN_PKT_TYPE_GLOBAL_DB, l_net->pub.id.uint64,
-                                                 l_chain_id.uint64, l_cell_id.uint64, l_data_out,
-                                                 sizeof(dap_store_obj_pkt_t) + l_data_out->data_size);
+static void s_atom_obj_free(void *a_atom_obj)
+{
+    dap_store_obj_t *l_obj = (dap_store_obj_t *)a_atom_obj;
+    DAP_DELETE(l_obj->value);
+    DAP_DELETE(l_obj);
+}
+
+static bool s_net_send_atoms(dap_proc_thread_t *a_thread, void *a_arg)
+{
+    UNUSED(a_thread);
+    dap_store_obj_t *l_arg = (dap_store_obj_t *)a_arg;
+    dap_chain_net_t *l_net = (dap_chain_net_t *)l_arg->cb_arg;
+    pthread_rwlock_rdlock(&PVT(l_net)->rwlock);
+    if (PVT(l_net)->state != NET_STATE_SYNC_CHAINS) {
+        dap_list_t *it = NULL;
+        do {
+            dap_store_obj_t *l_obj_cur = it ? (dap_store_obj_t *)it->data : l_arg;
+            dap_chain_t *l_chain = (dap_chain_t *)l_obj_cur->group;
+            uint64_t l_cell_id = l_obj_cur->timestamp;
+            struct downlink *l_link, *l_tmp;
+            HASH_ITER(hh, PVT(l_net)->downlinks, l_link, l_tmp) {
+                dap_stream_ch_t *l_ch = dap_stream_ch_find_by_uuid_unsafe(l_link->worker, l_link->uuid);
+                if (!l_ch) {
+                    HASH_DEL(PVT(l_net)->downlinks, l_link);
+                    DAP_DELETE(l_link);
+                    continue;
+                }
+                dap_stream_ch_chain_pkt_write_mt(l_link->worker, l_link->uuid, DAP_STREAM_CH_CHAIN_PKT_TYPE_CHAIN,
+                                                 l_net->pub.id.uint64, l_chain->id.uint64, l_cell_id,
+                                                 l_obj_cur->value, l_obj_cur->value_len);
+            }
+            s_atom_obj_free(l_obj_cur);
+            if (it)
+                PVT(l_net)->atoms_queue = dap_list_delete_link(PVT(l_net)->atoms_queue, it);
+            it = PVT(l_net)->atoms_queue;
+        } while (it);
+    } else
+        //PVT(l_net)->atoms_queue = dap_list_append(PVT(l_net)->atoms_queue, l_arg);
+        s_atom_obj_free(a_arg);
+    pthread_rwlock_unlock(&PVT(l_net)->rwlock);
+    return true;
+}
+
+/**
+ * @brief s_chain_callback_notify
+ * @param a_arg
+ * @param a_chain
+ * @param a_id
+ */
+static void s_chain_callback_notify(void *a_arg, dap_chain_t *a_chain, dap_chain_cell_id_t a_id, void* a_atom, size_t a_atom_size)
+{
+    if (!a_arg)
+        return;
+    dap_chain_net_t *l_net = (dap_chain_net_t *)a_arg;
+    if (!HASH_COUNT(PVT(l_net)->downlinks)) {
+        if (PVT(l_net)->atoms_queue) {
+            pthread_rwlock_wrlock(&PVT(l_net)->rwlock);
+            dap_list_free_full(PVT(l_net)->atoms_queue, s_atom_obj_free);
+            PVT(l_net)->atoms_queue = NULL;
+            pthread_rwlock_unlock(&PVT(l_net)->rwlock);
         }
-        pthread_rwlock_unlock(&PVT(l_net)->rwlock);
-        DAP_DELETE(l_data_out);
+        return;
     }
+    // Use it instead of new type definition to pack params in one callback arg
+    dap_store_obj_t *l_obj = DAP_NEW(dap_store_obj_t);
+    l_obj->timestamp = a_id.uint64;
+    l_obj->value = DAP_DUP_SIZE(a_atom, a_atom_size);
+    l_obj->value_len = a_atom_size;
+    l_obj->group = (char *)a_chain;
+    l_obj->cb_arg = a_arg;
+    dap_proc_queue_add_callback(dap_events_worker_get_auto(), s_net_send_atoms, l_obj);
 }
 
 /**
@@ -502,77 +652,34 @@ static void s_gbd_history_callback_notify(void *a_arg, const char a_op_code, con
     }
 }
 
-static void s_print_workers_channels()
-{
-    uint32_t l_worker_count = dap_events_worker_get_count();
-    dap_stream_ch_t* l_msg_ch = NULL;
-    dap_stream_ch_t* l_msg_ch_tmp = NULL;
-    //print all worker connections
-    dap_events_worker_print_all();
-    for (uint32_t i = 0; i < l_worker_count; i++){
-        uint32_t l_channel_count = 0;
-        dap_worker_t* l_worker = dap_events_worker_get(i);
-        if (!l_worker) {
-            log_it(L_CRITICAL, "Can't get stream worker - worker thread don't exist");
-            continue;
-        }
-        dap_stream_worker_t* l_stream_worker = DAP_STREAM_WORKER(l_worker);
-        if (l_stream_worker->channels)
-            HASH_ITER(hh_worker, l_stream_worker->channels, l_msg_ch, l_msg_ch_tmp) {
-                //log_it(L_DEBUG, "Worker id = %d, channel uuid = 0x%llx", l_worker->id, l_msg_ch->uuid);
-                l_channel_count += 1;
-        }
-        log_it(L_DEBUG, "Active workers l_channel_count = %d on worker %d", l_channel_count, l_stream_worker->worker->id);
-    }
-    return;
-}
-
 /**
- * @brief s_chain_callback_notify
- * @param a_arg
- * @param a_chain
- * @param a_id
+ * @brief Get the possible number of links
  */
-static void s_chain_callback_notify(void * a_arg, dap_chain_t *a_chain, dap_chain_cell_id_t a_id, void* a_atom, size_t a_atom_size)
+static size_t s_get_dns_max_links_count_from_cfg(dap_chain_net_t *a_net)
 {
-    if (!a_arg)
-        return;
-    dap_chain_net_t *l_net = (dap_chain_net_t *)a_arg;
-    if (PVT(l_net)->state == NET_STATE_ONLINE) {
-        pthread_rwlock_rdlock(&PVT(l_net)->rwlock);
-        for (dap_list_t *l_tmp = PVT(l_net)->net_links; l_tmp; l_tmp = dap_list_next(l_tmp)) {
-            dap_chain_node_client_t *l_node_client = ((struct net_link *)l_tmp->data)->link;
-            if (l_node_client) {
-                dap_stream_worker_t * l_worker = dap_client_get_stream_worker(l_node_client->client);
-                if (s_debug_more){
-                    if (!l_worker->channels && l_worker->worker){
-                        log_it(L_WARNING, "Worker id = %d hasn't active channels", l_worker->worker->id);
-                        s_print_workers_channels();
-                    }
-                }
-                if(l_worker)
-                    dap_stream_ch_chain_pkt_write_mt(l_worker, l_node_client->ch_chain_uuid, DAP_STREAM_CH_CHAIN_PKT_TYPE_CHAIN,
-                                                  l_net->pub.id.uint64, a_chain->id.uint64, a_id.uint64, a_atom, a_atom_size);
-            }
-        }
-        pthread_rwlock_unlock(&PVT(l_net)->rwlock);
-    }else{
-        if (s_debug_more)    
-             log_it(L_WARNING,"Node current state is %s. Real-time syncing is possible when you in NET_STATE_LINKS_ESTABLISHED (and above) state", s_net_state_to_str(PVT(l_net)->state));     
-    }
+    dap_chain_net_pvt_t *l_net_pvt = a_net ? PVT(a_net) : NULL;
+    if(!l_net_pvt)
+        return 0;
+    return (size_t)(l_net_pvt->seed_aliases_count + l_net_pvt->bootstrap_nodes_count);
 }
 
+/**
+ * @brief Get one random link
+ */
 static dap_chain_node_info_t *s_get_dns_link_from_cfg(dap_chain_net_t *a_net)
 {
-    dap_chain_net_pvt_t *l_net_pvt = PVT(a_net);
+    dap_chain_net_pvt_t *l_net_pvt = a_net ? PVT(a_net) : NULL;
+    if(!l_net_pvt) return NULL;
     struct in_addr l_addr = {};
     uint16_t i, l_port;
+    uint64_t l_node_adrr = 0;
     if (l_net_pvt->seed_aliases_count) {
         i = rand() % l_net_pvt->seed_aliases_count;
         dap_chain_node_addr_t *l_remote_addr = dap_chain_node_alias_find(a_net, l_net_pvt->seed_aliases[i]);
         if (l_remote_addr){
             dap_chain_node_info_t *l_remote_node_info = dap_chain_node_info_read(a_net, l_remote_addr);
             if(l_remote_node_info){
+                l_node_adrr = l_remote_node_info->hdr.address.uint64;
                 l_addr.s_addr = l_remote_node_info ? l_remote_node_info->hdr.ext_addr_v4.s_addr : 0;
                 DAP_DELETE(l_remote_node_info);
                 l_port = DNS_LISTEN_PORT;
@@ -585,6 +692,7 @@ static dap_chain_node_info_t *s_get_dns_link_from_cfg(dap_chain_net_t *a_net)
         }
     } else if (l_net_pvt->bootstrap_nodes_count) {
         i = rand() % l_net_pvt->bootstrap_nodes_count;
+        l_node_adrr = 0;
         l_addr = l_net_pvt->bootstrap_nodes_addrs[i];
         l_port = l_net_pvt->bootstrap_nodes_ports[i];
     }
@@ -595,11 +703,33 @@ static dap_chain_node_info_t *s_get_dns_link_from_cfg(dap_chain_net_t *a_net)
         log_it(L_CRITICAL,"Can't allocate memory for node link info");
         return NULL;
     }
+    l_link_node_info->hdr.address.uint64 = l_node_adrr;
     l_link_node_info->hdr.ext_addr_v4 = l_addr;
     l_link_node_info->hdr.ext_port = l_port;
     return l_link_node_info;
 }
 
+/**
+ * @brief Check if the current link is already present or not
+ *
+ * @param a_net Network
+ * @param a_link_node_info Node info
+ */
+static bool dap_chain_net_link_is_present(dap_chain_net_t *a_net, dap_chain_node_info_t *a_link_node_info)
+{
+    dap_chain_net_pvt_t *l_net_pvt = a_net ? PVT(a_net) : NULL;
+    if(!l_net_pvt)
+        return false;
+    dap_list_t *l_net_links = l_net_pvt->net_links;
+    while(l_net_links) {
+        dap_chain_node_info_t *l_link_node_info = (dap_chain_node_info_t*) l_net_links->data;
+        if(dap_chain_node_info_addr_match(l_link_node_info, a_link_node_info))
+            return true;
+        l_net_links = dap_list_next(l_net_links);
+    }
+    return false;
+}
+
 /**
  * @brief s_fill_links_from_root_aliases
  * @param a_net
@@ -624,15 +754,16 @@ static void s_fill_links_from_root_aliases(dap_chain_net_t * a_net)
              continue;   // Do not link with self
          }
          dap_chain_node_info_t *l_link_node_info = dap_chain_node_info_read(a_net, l_link_addr);
-         if(l_link_node_info) {
+         if(l_link_node_info && !dap_chain_net_link_is_present(a_net, l_link_node_info)) {
              struct net_link *l_new_link = DAP_NEW_Z(struct net_link);
              l_new_link->link_info = l_link_node_info;
              pthread_rwlock_wrlock(&l_pvt_net->rwlock);
              l_pvt_net->net_links = dap_list_append(l_pvt_net->net_links, l_new_link);
              pthread_rwlock_unlock(&l_pvt_net->rwlock);
          } else {
-             log_it(L_WARNING, "Not found link %s."NODE_ADDR_FP_STR" in the node list", a_net->pub.name,
+             log_it(L_WARNING, "Not found link %s."NODE_ADDR_FP_STR" in the node list or link is already in use", a_net->pub.name,
                     NODE_ADDR_FP_ARGS(l_link_addr));
+             DAP_DELETE(l_link_node_info);
          }
      }
 }
@@ -644,7 +775,7 @@ static void s_fill_links_from_root_aliases(dap_chain_net_t * a_net)
  * @param a_arg
  * @param a_errno
  */
-static void s_net_state_link_replace_error(dap_worker_t *a_worker, dap_chain_node_info_t *a_node_info, void *a_arg, int a_errno)
+/*static void s_net_state_link_replace_error(dap_worker_t *a_worker, dap_chain_node_info_t *a_node_info, void *a_arg, int a_errno)
 {
     UNUSED(a_worker);
     struct link_dns_request *l_dns_request = (struct link_dns_request *)a_arg;
@@ -653,14 +784,14 @@ static void s_net_state_link_replace_error(dap_worker_t *a_worker, dap_chain_nod
     inet_ntop(AF_INET, &a_node_info->hdr.ext_addr_v4, l_node_addr_str, sizeof (a_node_info->hdr.ext_addr_v4));
     log_it(L_WARNING,"Link " NODE_ADDR_FP_STR " (%s) replace error with code %d", NODE_ADDR_FP_ARGS_S(a_node_info->hdr.address),
                                                                                  l_node_addr_str,a_errno );
-    dap_notify_server_send_f_mt("{"
-                            "class:\"NetLinkReplaceError\","
-                            "net_id:0x%016" DAP_UINT64_FORMAT_X ","
-                            "cell_id:0x%016"DAP_UINT64_FORMAT_X","
-                            "address:\""NODE_ADDR_FP_STR"\","
-                            "error: %d"
-                            "}\n", l_net->pub.id.uint64, a_node_info->hdr.cell_id.uint64,
-                                NODE_ADDR_FP_ARGS_S(a_node_info->hdr.address), a_errno);
+    struct json_object *l_json = net_states_json_collect(l_net);
+    char l_err_str[128] = { };
+    dap_snprintf(l_err_str, sizeof(l_err_str)
+                 , "Link " NODE_ADDR_FP_STR " [%s] replace errno %d"
+                 , NODE_ADDR_FP_ARGS_S(a_node_info->hdr.address), l_node_addr_str, a_errno);
+    json_object_object_add(l_json, "errorMessage", json_object_new_string(l_err_str));
+    dap_notify_server_send_mt(json_object_get_string(l_json));
+    json_object_put(l_json);
     DAP_DELETE(a_node_info);
     dap_chain_node_info_t *l_link_node_info = NULL;
     for (int i = 0; i < 1000; i++) {
@@ -683,7 +814,7 @@ static void s_net_state_link_replace_error(dap_worker_t *a_worker, dap_chain_nod
         DAP_DELETE(l_link_node_info);
         DAP_DELETE(l_dns_request);
     }
-}
+}*/
 
 /**
  * @brief s_net_state_link_repace_success
@@ -692,7 +823,7 @@ static void s_net_state_link_replace_error(dap_worker_t *a_worker, dap_chain_nod
  * @param a_arg
  */
 
-static void s_net_state_link_replace_success(dap_worker_t *a_worker, dap_chain_node_info_t *a_node_info, void *a_arg)
+/*static void s_net_state_link_replace_success(dap_worker_t *a_worker, dap_chain_node_info_t *a_node_info, void *a_arg)
 {
     if (s_debug_more) {
         char l_node_addr_str[INET_ADDRSTRLEN] = {};
@@ -719,16 +850,16 @@ static void s_net_state_link_replace_success(dap_worker_t *a_worker, dap_chain_n
     pthread_rwlock_wrlock(&l_net_pvt->rwlock);
     l_net_pvt->net_links = dap_list_append(l_net_pvt->net_links, l_new_link);
     pthread_rwlock_unlock(&l_net_pvt->rwlock);
-
-    dap_notify_server_send_f_mt("{"
-                            "class:\"NetLinkReplaceSuccess\","
-                            "net_id:0x%016" DAP_UINT64_FORMAT_X ","
-                            "cell_id:0x%016"DAP_UINT64_FORMAT_X","
-                            "address:\""NODE_ADDR_FP_STR"\""
-                        "}\n", l_net->pub.id.uint64, a_node_info->hdr.cell_id.uint64,
-                                NODE_ADDR_FP_ARGS_S(a_node_info->hdr.address));
+    struct json_object *l_json = net_states_json_collect(l_net);
+    char l_err_str[128] = { };
+    dap_snprintf(l_err_str, sizeof(l_err_str)
+                 , "Link " NODE_ADDR_FP_STR " replace success"
+                 , NODE_ADDR_FP_ARGS_S(a_node_info->hdr.address));
+    json_object_object_add(l_json, "errorMessage", json_object_new_string(l_err_str));
+    dap_notify_server_send_mt(json_object_get_string(l_json));
+    json_object_put(l_json);
     DAP_DELETE(l_dns_request);
-}
+}*/
 
 /**
  * @brief s_node_link_callback_connected
@@ -754,7 +885,14 @@ static void s_node_link_callback_connected(dap_chain_node_client_t * a_node_clie
     pthread_rwlock_wrlock(&l_net_pvt->rwlock);
     l_net_pvt->links_connected_count++;
     a_node_client->is_connected = true;
-    s_net_links_notify(l_net);
+    struct json_object *l_json = net_states_json_collect(l_net);
+    char l_err_str[128] = { };
+    dap_snprintf(l_err_str, sizeof(l_err_str)
+                 , "Established connection with link " NODE_ADDR_FP_STR
+                 , NODE_ADDR_FP_ARGS_S(a_node_client->info->hdr.address));
+    json_object_object_add(l_json, "errorMessage", json_object_new_string(l_err_str));
+    dap_notify_server_send_mt(json_object_get_string(l_json));
+    json_object_put(l_json);
     if(l_net_pvt->state == NET_STATE_LINKS_CONNECTING ){
         l_net_pvt->state = NET_STATE_LINKS_ESTABLISHED;
         dap_proc_queue_add_callback_inter(a_node_client->stream_worker->worker->proc_queue_input,s_net_states_proc,l_net );
@@ -811,20 +949,31 @@ static void s_node_link_callback_disconnected(dap_chain_node_client_t *a_node_cl
             pthread_rwlock_unlock(&l_net_pvt->rwlock);
             return;
         }
-        dap_chain_node_info_t *l_link_node_info = s_get_dns_link_from_cfg(l_net);
+        dap_chain_node_info_t *l_link_node_info = NULL;
+        int l_n = 0;
+        while(l_n < 100) {
+            l_n++;
+            l_link_node_info = s_get_dns_link_from_cfg(l_net);
+            // If this connect not exists
+            if(l_link_node_info && !dap_chain_net_link_is_present(l_net, l_link_node_info)) {
+                break;
+            }
+        }
+
         if (l_link_node_info) {
-            struct link_dns_request *l_dns_request = DAP_NEW_Z(struct link_dns_request);
+            if(!s_start_dns_request(l_net, l_link_node_info)) {
+            /*struct link_dns_request *l_dns_request = DAP_NEW_Z(struct link_dns_request);
             l_dns_request->net = l_net;
             if (dap_chain_node_info_dns_request(l_link_node_info->hdr.ext_addr_v4,
                                                 l_link_node_info->hdr.ext_port,
                                                 l_net->pub.name,
                                                 l_link_node_info,  // use it twice
-                                                s_net_state_link_replace_success,
-                                                s_net_state_link_replace_error,
+                                                s_net_state_link_prepare_success,//s_net_state_link_replace_success,
+                                                s_net_state_link_prepare_error,//s_net_state_link_replace_error,
                                                 l_dns_request)) {
+                                                */
                 log_it(L_ERROR, "Can't process node info dns request");
                 DAP_DELETE(l_link_node_info);
-                DAP_DELETE(l_dns_request);
             } else {
                 s_node_link_remove(l_net_pvt, a_node_client);
                 a_node_client->keep_connection = false;
@@ -846,15 +995,10 @@ static void s_node_link_callback_stage(dap_chain_node_client_t * a_node_client,d
     if( s_debug_more)
         log_it(L_INFO,"%s."NODE_ADDR_FP_STR" stage %s",l_net->pub.name,NODE_ADDR_FP_ARGS_S(a_node_client->remote_node_addr),
                                                         dap_client_stage_str(a_stage));
-    dap_notify_server_send_f_mt("{"
-                            "class:\"NetLinkStage\","
-                            "net_id:0x%016" DAP_UINT64_FORMAT_X ","
-                            "cell_id:0x%016"DAP_UINT64_FORMAT_X","
-                            "address:\""NODE_ADDR_FP_STR"\","
-                            "state:\"%s\""
-                        "}\n", a_node_client->net->pub.id.uint64, a_node_client->info->hdr.cell_id.uint64,
-                                NODE_ADDR_FP_ARGS_S(a_node_client->info->hdr.address),
-                                dap_chain_node_client_state_to_str(a_node_client->state) );
+    struct json_object *l_json = net_states_json_collect(l_net);
+    json_object_object_add(l_json, "errorMessage", json_object_new_string(" "));
+    dap_notify_server_send_mt(json_object_get_string(l_json));
+    json_object_put(l_json);
 }
 
 /**
@@ -868,15 +1012,16 @@ static void s_node_link_callback_error(dap_chain_node_client_t * a_node_client,
     dap_chain_net_t * l_net = (dap_chain_net_t *) a_arg;
     log_it(L_WARNING, "Can't establish link with %s."NODE_ADDR_FP_STR, l_net->pub.name,
            NODE_ADDR_FP_ARGS_S(a_node_client->remote_node_addr));
-    dap_notify_server_send_f_mt("{"
-                            "class:\"NetLinkError\","
-                            "net_id:0x%016" DAP_UINT64_FORMAT_X ","
-                            "cell_id:0x%016"DAP_UINT64_FORMAT_X","
-                            "address:\""NODE_ADDR_FP_STR"\","
-                            "error:\%d"
-                        "}\n", a_node_client->net->pub.id.uint64, a_node_client->info->hdr.cell_id.uint64,
-                                NODE_ADDR_FP_ARGS_S(a_node_client->info->hdr.address),
-                                a_error);
+    struct json_object *l_json = net_states_json_collect(l_net);
+    char l_node_addr_str[INET_ADDRSTRLEN] = {};
+    inet_ntop(AF_INET, &a_node_client->info->hdr.ext_addr_v4, l_node_addr_str, sizeof (a_node_client->info->hdr.ext_addr_v4));
+    char l_err_str[128] = { };
+    dap_snprintf(l_err_str, sizeof(l_err_str)
+                 , "Link " NODE_ADDR_FP_STR " [%s] can't be established, errno %d"
+                 , NODE_ADDR_FP_ARGS_S(a_node_client->info->hdr.address), l_node_addr_str, a_error);
+    json_object_object_add(l_json, "errorMessage", json_object_new_string(l_err_str));
+    dap_notify_server_send_mt(json_object_get_string(l_json));
+    json_object_put(l_json);
 }
 
 /**
@@ -889,13 +1034,10 @@ static void s_node_link_callback_delete(dap_chain_node_client_t * a_node_client,
     dap_chain_net_t * l_net = (dap_chain_net_t *) a_arg;
     dap_chain_net_pvt_t * l_net_pvt = PVT(l_net);
     if (!a_node_client->keep_connection) {
-        dap_notify_server_send_f_mt("{"
-                                "class:\"NetLinkDelete\","
-                                "net_id:0x%016" DAP_UINT64_FORMAT_X ","
-                                "cell_id:0x%016"DAP_UINT64_FORMAT_X","
-                                "address:\""NODE_ADDR_FP_STR"\""
-                                "}\n", a_node_client->net->pub.id.uint64, a_node_client->info->hdr.cell_id.uint64,
-                                    NODE_ADDR_FP_ARGS_S(a_node_client->info->hdr.address));
+        struct json_object *l_json = net_states_json_collect(l_net);
+        json_object_object_add(l_json, "errorMessage", json_object_new_string("Link deleted"));
+        dap_notify_server_send_mt(json_object_get_string(l_json));
+        json_object_put(l_json);
         return;
     } else if (a_node_client->is_connected) {
         a_node_client->is_connected = false;
@@ -903,6 +1045,10 @@ static void s_node_link_callback_delete(dap_chain_node_client_t * a_node_client,
             l_net_pvt->links_connected_count--;
         else
             log_it(L_ERROR, "Links count is zero in delete callback");
+        // If the last link is lost, change the status to NET_STATE_OFFLINE
+        if(!l_net_pvt->links_connected_count) {
+            l_net_pvt->state = NET_STATE_OFFLINE;
+        }
     }
     dap_chain_net_sync_unlock(l_net, a_node_client);
     pthread_rwlock_wrlock(&l_net_pvt->rwlock);
@@ -913,13 +1059,10 @@ static void s_node_link_callback_delete(dap_chain_node_client_t * a_node_client,
         }
     }
     pthread_rwlock_unlock(&l_net_pvt->rwlock);
-    dap_notify_server_send_f_mt("{"
-                            "class:\"NetLinkRestart\","
-                            "net_id:0x%016" DAP_UINT64_FORMAT_X ","
-                            "cell_id:0x%016"DAP_UINT64_FORMAT_X","
-                            "address:\""NODE_ADDR_FP_STR"\""
-                            "}\n", a_node_client->net->pub.id.uint64, a_node_client->info->hdr.cell_id.uint64,
-                                NODE_ADDR_FP_ARGS_S(a_node_client->info->hdr.address));
+    struct json_object *l_json = net_states_json_collect(l_net);
+    json_object_object_add(l_json, "errorMessage", json_object_new_string("Link restart"));
+    dap_notify_server_send_mt(json_object_get_string(l_json));
+    json_object_put(l_json);
     // Then a_alient wiil be destroyed in a right way
 }
 
@@ -961,13 +1104,14 @@ static void s_net_state_link_prepare_success(dap_worker_t * a_worker,dap_chain_n
         dap_proc_queue_add_callback_inter( a_worker->proc_queue_input,s_net_states_proc,l_net );
     }
     pthread_rwlock_unlock(&l_net_pvt->rwlock);
-    dap_notify_server_send_f_mt("{"
-                            "class:\"NetLinkPrepareSuccess\","
-                            "net_id:0x%016" DAP_UINT64_FORMAT_X ","
-                            "cell_id:0x%016"DAP_UINT64_FORMAT_X","
-                            "address:\""NODE_ADDR_FP_STR"\""
-                        "}\n", l_net->pub.id.uint64, a_node_info->hdr.cell_id.uint64,
-                                NODE_ADDR_FP_ARGS_S(a_node_info->hdr.address));
+    struct json_object *l_json = net_states_json_collect(l_net);
+    char l_err_str[128] = { };
+    dap_snprintf(l_err_str, sizeof(l_err_str)
+                 , "Link " NODE_ADDR_FP_STR " prepared"
+                 , NODE_ADDR_FP_ARGS_S(a_node_info->hdr.address));
+    json_object_object_add(l_json, "errorMessage", json_object_new_string(l_err_str));
+    dap_notify_server_send_mt(json_object_get_string(l_json));
+    json_object_put(l_json);
     DAP_DELETE(l_dns_request);
 }
 
@@ -984,25 +1128,23 @@ static void s_net_state_link_prepare_error(dap_worker_t * a_worker,dap_chain_nod
     dap_chain_net_t * l_net = l_dns_request->net;
     dap_chain_net_pvt_t * l_net_pvt = PVT(l_net);
     char l_node_addr_str[INET_ADDRSTRLEN]={};
-    inet_ntop(AF_INET,&a_node_info->hdr.ext_addr_v4,l_node_addr_str,sizeof (a_node_info->hdr.ext_addr_v4));
+    inet_ntop(AF_INET,&a_node_info->hdr.ext_addr_v4,l_node_addr_str, INET_ADDRSTRLEN);
     log_it(L_WARNING,"Link " NODE_ADDR_FP_STR " (%s) prepare error with code %d", NODE_ADDR_FP_ARGS_S(a_node_info->hdr.address),
                                                                                  l_node_addr_str,a_errno );
-
-    dap_notify_server_send_f_mt("{"
-                            "class:\"NetLinkPrepareError\","
-                            "net_id:0x%016" DAP_UINT64_FORMAT_X ","
-                            "cell_id:0x%016"DAP_UINT64_FORMAT_X","
-                            "address:\""NODE_ADDR_FP_STR"\","
-                            "error: %d"
-                        "}\n", l_net->pub.id.uint64, a_node_info->hdr.cell_id.uint64,
-                                NODE_ADDR_FP_ARGS_S(a_node_info->hdr.address),a_errno);
-
+    struct json_object *l_json = net_states_json_collect(l_net);
+    char l_err_str[128] = { };
+    dap_snprintf(l_err_str, sizeof(l_err_str)
+                 , "Link " NODE_ADDR_FP_STR " [%s] can't be prepared, errno %d"
+                 , NODE_ADDR_FP_ARGS_S(a_node_info->hdr.address), l_node_addr_str, a_errno);
+    json_object_object_add(l_json, "errorMessage", json_object_new_string(l_err_str));
+    dap_notify_server_send_mt(json_object_get_string(l_json));
+    json_object_put(l_json);
     pthread_rwlock_wrlock(&l_net_pvt->rwlock);
     if(l_net_pvt->links_dns_requests)
         l_net_pvt->links_dns_requests--;
 
     if(!l_net_pvt->links_dns_requests ){
-        if( l_net_pvt->state != NET_STATE_OFFLINE){
+        if( l_net_pvt->state_target != NET_STATE_OFFLINE){
             log_it(L_WARNING,"Can't prepare links via DNS requests. Prefilling links with root addresses");
             l_net_pvt->state = NET_STATE_LINKS_CONNECTING;
             pthread_rwlock_unlock(&l_net_pvt->rwlock);
@@ -1017,74 +1159,100 @@ static void s_net_state_link_prepare_error(dap_worker_t * a_worker,dap_chain_nod
 }
 
 /**
- * @brief s_net_states_notify
- * @param l_net
+ * @brief Get list of the unique links for the selected net
+ * @param a_net
+ * @return list of dap_chain_node_info_t or NULL
  */
-static void s_net_states_notify(dap_chain_net_t * l_net )
+static dap_chain_node_info_list_t* s_get_links(dap_chain_net_t *a_net)
 {
-    dap_notify_server_send_f_mt("{"
-                                    "class:\"NetStates\","
-                                    "net_id: 0x%016" DAP_UINT64_FORMAT_X ","
-                                    "state: \"%s\","
-                                    "state_target:\"%s\""
-                                "}\n", l_net->pub.id.uint64,
-                                       dap_chain_net_state_to_str( PVT(l_net)->state),
-                                       dap_chain_net_state_to_str(PVT(l_net)->state_target));
+    dap_chain_net_pvt_t *l_net_pvt = a_net ? PVT(a_net) : NULL;
+    if(!l_net_pvt)
+        return false;
 
+    dap_chain_node_info_list_t *l_node_list = NULL;
+    // Choose between the allowed number of links and the number of real links
+    size_t l_max_links_count = MIN(s_max_links_count, s_get_dns_max_links_count_from_cfg(a_net));
+    size_t l_cur_links_count = 0;
+    size_t l_n = 0;// Protect from eternal loop
+    while(l_cur_links_count < l_max_links_count) {
+        if(l_n > 1000) // It's a problem with link prepare
+            break;
+        l_n++;
+        dap_chain_node_info_t *l_link_node_info = s_get_dns_link_from_cfg(a_net);
+        if(!l_link_node_info)
+            continue;
+        // Protect against using the same node
+        if(dap_chain_node_info_list_is_added(l_node_list, l_link_node_info)) {
+            DAP_DEL_Z(l_link_node_info);
+            continue;
+        }
+        l_node_list = dap_chain_node_info_list_add(l_node_list, l_link_node_info);
+        l_cur_links_count++;
+    }
+    return l_node_list;
 }
 
 /**
- * @brief s_net_links_notify
- * @param l_net
+ * @brief Launch a connect with a link
+ * @param a_net
+ * @param a_link_node_info node parameters
+ * @return list of dap_chain_node_info_t
  */
-static void s_net_links_notify(dap_chain_net_t * a_net )
-{
-    dap_chain_net_pvt_t * l_net_pvt = PVT(a_net);
-    dap_string_t * l_str_reply = dap_string_new("[");
-
-    size_t i =0;
-    for (dap_list_t * l_item = l_net_pvt->net_links; l_item;  l_item = l_item->next ) {
-        dap_chain_node_client_t * l_node_client = ((struct net_link *)l_item->data)->link;
-        if(l_node_client){
-            dap_chain_node_info_t * l_info = l_node_client->info;
-            char l_ext_addr_v4[INET_ADDRSTRLEN]={};
-            char l_ext_addr_v6[INET6_ADDRSTRLEN]={};
-            inet_ntop(AF_INET,&l_info->hdr.ext_addr_v4,l_ext_addr_v4,sizeof (l_info->hdr.ext_addr_v4));
-            inet_ntop(AF_INET6,&l_info->hdr.ext_addr_v6,l_ext_addr_v6,sizeof (l_info->hdr.ext_addr_v6));
-
-            dap_string_append_printf(l_str_reply,"{"
-                                        "id:%zu,"
-                                        "address:\""NODE_ADDR_FP_STR"\","
-                                        "alias:\"%s\","
-                                        "cell_id:0x%016"DAP_UINT64_FORMAT_X","
-                                        "ext_ipv4:\"%s\","
-                                        "ext_ipv6:\"%s\","
-                                        "ext_port:%hu"
-                                        "state:\"%s\""
-                                    "}", i,NODE_ADDR_FP_ARGS_S(l_info->hdr.address), l_info->hdr.alias, l_info->hdr.cell_id.uint64,
-                                     l_ext_addr_v4, l_ext_addr_v6,l_info->hdr.ext_port
-                                     , dap_chain_node_client_state_to_str(l_node_client->state) );
-        }
-        i++;
+static bool s_start_dns_request(dap_chain_net_t *a_net, dap_chain_node_info_t *a_link_node_info)
+{
+    dap_chain_net_pvt_t *l_net_pvt = a_net ? PVT(a_net) : NULL;
+    if(!l_net_pvt)
+        return false;
+    l_net_pvt->links_dns_requests++;
+    struct link_dns_request *l_dns_request = DAP_NEW_Z(struct link_dns_request);
+    l_dns_request->net = a_net;
+    //l_dns_request->link_id = a_link_id;
+    if(dap_chain_node_info_dns_request(a_link_node_info->hdr.ext_addr_v4,
+            a_link_node_info->hdr.ext_port,
+            a_net->pub.name,
+            a_link_node_info, // use it twice
+            s_net_state_link_prepare_success,
+            s_net_state_link_prepare_error,
+            l_dns_request)) {
+        log_it(L_ERROR, "Can't process node info dns request");
+        //l_node_list = dap_chain_node_info_list_del(l_node_list, a_link_node_info);
+        DAP_DEL_Z(l_dns_request);
+        return false;
     }
+    return true;
+}
 
 
-    dap_notify_server_send_f_mt("{"
-                                    "class:\"NetLinks\","
-                                    "net_id:0x%016"DAP_UINT64_FORMAT_X","
-                                    "links:%s"
-                                "}]\n", a_net->pub.id.uint64,
-                                       l_str_reply->str);
-    dap_string_free(l_str_reply,true);
+struct json_object *net_states_json_collect(dap_chain_net_t * l_net) {
+    struct json_object *l_json = json_object_new_object();
+    json_object_object_add(l_json, "class"            , json_object_new_string("NetStates"));
+    json_object_object_add(l_json, "name"             , json_object_new_string((const char*)l_net->pub.name));
+    json_object_object_add(l_json, "networkState"     , json_object_new_string(dap_chain_net_state_to_str(PVT(l_net)->state)));
+    json_object_object_add(l_json, "targetState"      , json_object_new_string(dap_chain_net_state_to_str(PVT(l_net)->state_target)));
+    json_object_object_add(l_json, "linksCount"       , json_object_new_int(dap_list_length(PVT(l_net)->net_links)));
+    json_object_object_add(l_json, "activeLinksCount" , json_object_new_int(PVT(l_net)->links_connected_count));
+    char l_node_addr_str[24] = {'\0'};
+    dap_snprintf(l_node_addr_str, sizeof(l_node_addr_str), NODE_ADDR_FP_STR, NODE_ADDR_FP_ARGS(PVT(l_net)->node_addr));
+    json_object_object_add(l_json, "nodeAddress"     , json_object_new_string(l_node_addr_str));
+    return l_json;
+}
 
+/**
+ * @brief s_net_states_notify
+ * @param l_net
+ */
+static void s_net_states_notify(dap_chain_net_t * l_net) {
+    struct json_object *l_json = net_states_json_collect(l_net);
+    json_object_object_add(l_json, "errorMessage", json_object_new_string(" ")); // regular notify has no error
+    dap_notify_server_send_mt(json_object_get_string(l_json));
+    json_object_put(l_json);
 }
 
 /**
  * @brief s_net_states_proc
  * @param l_net
  */
-static bool s_net_states_proc(dap_proc_thread_t *a_thread, void *a_arg)
-{
+static bool s_net_states_proc(dap_proc_thread_t *a_thread, void *a_arg) {
     UNUSED(a_thread);
     bool l_repeat_after_exit = false; // If true - repeat on next iteration of proc thread loop
     dap_chain_net_t *l_net = (dap_chain_net_t *) a_arg;
@@ -1111,9 +1279,9 @@ static bool s_net_states_proc(dap_proc_thread_t *a_thread, void *a_arg)
                     dap_chain_node_client_close(l_link);
                 }
                 DAP_DEL_Z(((struct net_link *)l_tmp->data)->link_info);
-                DAP_DELETE(l_tmp);
                 l_tmp = l_next;
             }
+            dap_list_free_full(l_net_pvt->net_links, free);
             l_net_pvt->net_links = NULL;
             if ( l_net_pvt->state_target != NET_STATE_OFFLINE ){
                 l_net_pvt->state = NET_STATE_LINKS_PREPARE;
@@ -1137,9 +1305,14 @@ static bool s_net_states_proc(dap_proc_thread_t *a_thread, void *a_arg)
                 l_link_node_info->hdr.address.uint64 = l_net_pvt->gdb_sync_nodes_addrs[i].uint64;
                 l_link_node_info->hdr.ext_addr_v4.s_addr = l_net_pvt->gdb_sync_nodes_links_ips[i];
                 l_link_node_info->hdr.ext_port = l_net_pvt->gdb_sync_nodes_links_ports[i];
-                struct net_link *l_new_link = DAP_NEW_Z(struct net_link);
-                l_new_link->link_info = l_link_node_info;
-                l_net_pvt->net_links = dap_list_append(l_net_pvt->net_links, l_new_link);
+                if(!dap_chain_net_link_is_present(l_net, l_link_node_info)){
+                    struct net_link *l_new_link = DAP_NEW_Z(struct net_link);
+                    l_new_link->link_info = l_link_node_info;
+                    l_net_pvt->net_links = dap_list_append(l_net_pvt->net_links, l_new_link);
+                }
+                else{
+                    DAP_DELETE(l_link_node_info);
+                }
 
             }
             uint64_t l_own_addr = dap_chain_net_get_cur_addr_int(l_net);
@@ -1149,12 +1322,17 @@ static bool s_net_states_proc(dap_proc_thread_t *a_thread, void *a_arg)
                     if (!l_link_node_info || l_link_node_info->hdr.address.uint64 == l_own_addr) {
                         continue;   // Do not link with self
                     }
-                    struct net_link *l_new_link = DAP_NEW_Z(struct net_link);
-                    l_new_link->link_info = l_link_node_info;
-                    l_net_pvt->net_links = dap_list_append(l_net_pvt->net_links, l_new_link);
-                    if (dap_list_length(l_net_pvt->net_links) >= s_max_links_count) {
+                    if(!dap_chain_net_link_is_present(l_net, l_link_node_info)) {
+                        struct net_link *l_new_link = DAP_NEW_Z(struct net_link);
+                        l_new_link->link_info = l_link_node_info;
+                        l_net_pvt->net_links = dap_list_append(l_net_pvt->net_links, l_new_link);
+                        if(dap_list_length(l_net_pvt->net_links) >= s_max_links_count) {
 
-                        break;
+                            break;
+                        }
+                    }
+                    else {
+                        DAP_DELETE(l_link_node_info);
                     }
                 }
             } else {
@@ -1181,30 +1359,24 @@ static bool s_net_states_proc(dap_proc_thread_t *a_thread, void *a_arg)
                 }
                 // Get DNS request result from root nodes as synchronization links
                 bool l_sync_fill_root_nodes = false;
-                uint32_t l_link_id = 0;
                 if (!l_sync_fill_root_nodes) {
-                    for (size_t n = 0; l_net_pvt->links_dns_requests < s_max_links_count; n++) {
-                        dap_chain_node_info_t *l_link_node_info = s_get_dns_link_from_cfg(l_net);
-                        if (!l_link_node_info)
-                            continue;
-                        l_net_pvt->links_dns_requests++;
-                        struct link_dns_request *l_dns_request = DAP_NEW_Z(struct link_dns_request);
-                        l_dns_request->net = l_net;
-                        l_dns_request->link_id = l_link_id++;
-                        if (dap_chain_node_info_dns_request(l_link_node_info->hdr.ext_addr_v4,
-                                                            l_link_node_info->hdr.ext_port,
-                                                            l_net->pub.name,
-                                                            l_link_node_info,  // use it twice
-                                                            s_net_state_link_prepare_success,
-                                                            s_net_state_link_prepare_error,
-                                                            l_dns_request)) {
-                            log_it(L_ERROR, "Can't process node info dns request");
-                            DAP_DEL_Z(l_dns_request);
+                    // Get list of the unique links for l_net
+                    dap_chain_node_info_list_t *l_node_list = s_get_links(l_net);
+                    // Start connect to links from list
+                    dap_chain_node_info_list_t *l_node_list_cur = l_node_list;
+                    while(l_node_list_cur) {
+                        dap_chain_node_info_t *l_link_node_info = (dap_chain_node_info_t*)l_node_list_cur->data;
+                        char l_node_addr_str[INET_ADDRSTRLEN] = { };
+                        inet_ntop(AF_INET, &l_link_node_info->hdr.ext_addr_v4, l_node_addr_str, INET_ADDRSTRLEN);
+                        log_it(L_DEBUG, "Start DNS request to %s", l_node_addr_str);
+                        if(!s_start_dns_request(l_net, l_link_node_info))
+                        {
                             DAP_DEL_Z(l_link_node_info);
                         }
-                        if (n > 1000)   // It's a problem with link prepare
-                            break;
+                        l_node_list_cur = dap_list_next(l_node_list_cur);
                     }
+                    dap_chain_node_info_list_free(l_node_list);
+                    
                 } else {
                     log_it(L_ATT, "Not use bootstrap addresses, fill seed nodelist from root aliases");
                     pthread_rwlock_unlock(&l_net_pvt->rwlock);
@@ -1376,8 +1548,8 @@ static dap_chain_net_t *s_net_new(const char * a_id, const char * a_name ,
 #else
     PVT(ret)->state_proc_cond = CreateEventA( NULL, FALSE, FALSE, NULL );
 #endif
-
-    if (sscanf(a_id,"0x%016"DAP_UINT64_FORMAT_X, &ret->pub.id.uint64 ) != 1) {
+    pthread_mutex_init(&(PVT(ret)->state_mutex_cond), NULL);
+    if (dap_sscanf(a_id, "0x%016"DAP_UINT64_FORMAT_X, &ret->pub.id.uint64) != 1) {
         log_it (L_ERROR, "Wrong id format (\"%s\"). Must be like \"0x0123456789ABCDE\"" , a_id );
         DAP_DELETE(ret);
         return NULL;
@@ -1491,12 +1663,27 @@ void s_set_reply_text_node_status(char **a_str_reply, dap_chain_net_t * a_net){
     DAP_DELETE(l_node_address_text_block);
 }
 
+/**
+ * @brief get type of chain
+ * 
+ * @param l_chain 
+ * @return char* 
+ */
+const char* dap_chain_net_get_type(dap_chain_t *l_chain)
+{
+    if (!l_chain){
+        log_it(L_DEBUG, "dap_get_chain_type. Chain object is 0");
+        return NULL;
+    }
+    return (const char*)DAP_CHAIN_PVT(l_chain)->cs_name;
+}
+
 /**
  * @brief reload ledger
  * command cellframe-node-cli net -net <network_name> ledger reload
- * @param l_net 
- * @return true 
- * @return false 
+ * @param l_net
+ * @return true
+ * @return false
  */
 void s_chain_net_ledger_cache_reload(dap_chain_net_t *l_net)
 {
@@ -1531,8 +1718,8 @@ void s_chain_net_ledger_cache_reload(dap_chain_net_t *l_net)
  * if you node build need ledger cache one time reload, uncomment this function
  * iat the end of s_net_load
  * @param l_net network object
- * @return true 
- * @return false 
+ * @return true
+ * @return false
  */
 bool s_chain_net_reload_ledger_cache_once(dap_chain_net_t *l_net)
 {
@@ -1559,14 +1746,14 @@ bool s_chain_net_reload_ledger_cache_once(dap_chain_net_t *l_net)
             dap_fprintf(stderr, "Can't open cache file %s for one time ledger cache reloading.\
                 Please, do it manually using command\
                 cellframe-node-cli net -net <network_name>> ledger reload'\n", l_cache_file);
-            return -1;   
+            return -1;
         }
     }
     // reload ledger cache (same as net -net <network_name>> ledger reload command)
     if (dap_file_simple_test(l_cache_file))
         s_chain_net_ledger_cache_reload(l_net);
-
-    return true; 
+    fclose(s_cache_file);
+    return true;
 }
 
 /**
@@ -1615,6 +1802,7 @@ static int s_cli_net(int argc, char **argv, char **a_str_reply)
                 dap_chain_net_item_t * l_net_item, *l_net_item_tmp;
                 int l_net_i = 0;
                 dap_string_append(l_string_ret,"Networks:\n");
+                pthread_rwlock_rdlock(&g_net_items_rwlock);
                 HASH_ITER(hh, s_net_items, l_net_item, l_net_item_tmp){
                     l_net = l_net_item->chain_net;
                     dap_string_append_printf(l_string_ret, "\t%s:\n", l_net_item->name);
@@ -1626,6 +1814,7 @@ static int s_cli_net(int argc, char **argv, char **a_str_reply)
                         l_chain = l_chain->next;
                     }
                 }
+                pthread_rwlock_unlock(&g_net_items_rwlock);
             }
 
         }else{
@@ -1633,10 +1822,12 @@ static int s_cli_net(int argc, char **argv, char **a_str_reply)
             // show list of nets
             dap_chain_net_item_t * l_net_item, *l_net_item_tmp;
             int l_net_i = 0;
+            pthread_rwlock_rdlock(&g_net_items_rwlock);
             HASH_ITER(hh, s_net_items, l_net_item, l_net_item_tmp){
                 dap_string_append_printf(l_string_ret, "\t%s\n", l_net_item->name);
                 l_net_i++;
             }
+            pthread_rwlock_unlock(&g_net_items_rwlock);
             dap_string_append(l_string_ret, "\n");
         }
 
@@ -1667,7 +1858,6 @@ static int s_cli_net(int argc, char **argv, char **a_str_reply)
         dap_chain_node_cli_find_option_val(argv, arg_index, argc, "-mode", &l_sync_mode_str);
         if ( !dap_strcmp(l_sync_mode_str,"all") )
             dap_chain_net_get_flag_sync_from_zero(l_net);
-
         if (l_stats_str) {
             char l_from_str_new[50], l_to_str_new[50];
             const char c_time_fmt[]="%Y-%m-%d_%H:%M:%S";
@@ -1944,11 +2134,11 @@ static int s_cli_net(int argc, char **argv, char **a_str_reply)
                                                   "Subcommand 'ca' requires one of parameter: add, list, del\n");
                 ret = -5;
             }
-        } else if (l_ledger_str && !strcmp(l_ledger_str, "reload")) 
+        } else if (l_ledger_str && !strcmp(l_ledger_str, "reload"))
         {
            s_chain_net_ledger_cache_reload(l_net);
-        } 
-        else 
+        }
+        else
         {
             dap_chain_node_cli_set_reply_text(a_str_reply,
                                               "Command 'net' requires one of subcomands: sync, link, go, get, stats, ca, ledger");
@@ -2072,10 +2262,14 @@ int s_net_load(const char * a_net_name, uint16_t a_acl_idx)
                      ,dap_config_get_item_str(l_cfg , "general" , "name" ));
         l_net_item->chain_net = l_net;
         l_net_item->net_id.uint64 = l_net->pub.id.uint64;
+        pthread_rwlock_wrlock(&g_net_items_rwlock);
         HASH_ADD_STR(s_net_items,name,l_net_item);
+        pthread_rwlock_unlock(&g_net_items_rwlock);
 
         memcpy( l_net_item2,l_net_item,sizeof (*l_net_item));
+        pthread_rwlock_wrlock(&g_net_ids_rwlock);
         HASH_ADD(hh,s_net_items_ids,net_id,sizeof ( l_net_item2->net_id),l_net_item2);
+        pthread_rwlock_unlock(&g_net_ids_rwlock);
 
         // LEDGER model
         uint16_t l_ledger_flags = 0;
@@ -2194,14 +2388,19 @@ int s_net_load(const char * a_net_name, uint16_t a_acl_idx)
                                 ( l_seed_nodes_hostnames_len  && i < l_seed_nodes_hostnames_len  )
                               )
                                                                     ; i++ ){
-            dap_chain_node_addr_t * l_seed_node_addr;
-            l_seed_node_addr = dap_chain_node_alias_find(l_net, l_net_pvt->seed_aliases[i] );
-            //if (l_seed_node_addr == NULL){
+            dap_chain_node_addr_t *l_seed_node_addr;
+            dap_chain_node_info_t *l_node_info = NULL;
+            l_seed_node_addr = dap_chain_node_alias_find(l_net, l_net_pvt->seed_aliases[i]);
+            if (l_seed_node_addr) {
+                l_node_info = dap_chain_node_info_read(l_net, l_seed_node_addr);
+                DAP_DELETE(l_seed_node_addr);
+            }
+            if (!l_seed_node_addr || !l_node_info) {
                 log_it(L_NOTICE, "Update alias %s in database, prefill it",l_net_pvt->seed_aliases[i]);
-                dap_chain_node_info_t * l_node_info = DAP_NEW_Z(dap_chain_node_info_t);
+                l_node_info = DAP_NEW_Z(dap_chain_node_info_t);
                 l_seed_node_addr = DAP_NEW_Z(dap_chain_node_addr_t);
                 dap_snprintf( l_node_info->hdr.alias,sizeof ( l_node_info->hdr.alias),"%s",PVT(l_net)->seed_aliases[i]);
-                if (sscanf(l_seed_nodes_addrs[i],NODE_ADDR_FP_STR, NODE_ADDR_FPS_ARGS(l_seed_node_addr) ) != 4 ){
+                if (dap_sscanf(l_seed_nodes_addrs[i],NODE_ADDR_FP_STR, NODE_ADDR_FPS_ARGS(l_seed_node_addr) ) != 4 ){
                     log_it(L_ERROR,"Wrong address format,  should be like 0123::4567::890AB::CDEF");
                     DAP_DELETE(l_seed_node_addr);
                     DAP_DELETE(l_node_info);
@@ -2259,16 +2458,14 @@ int s_net_load(const char * a_net_name, uint16_t a_acl_idx)
                                    NODE_ADDR_FP_ARGS(l_seed_node_addr), l_ret);
                         }
                     }
-                    DAP_DELETE( l_seed_node_addr);
+                    DAP_DELETE(l_seed_node_addr);
                 }else
                     log_it(L_WARNING,"No address for seed node, can't populate global_db with it");
                 DAP_DELETE( l_node_info);
-            /*}else{
-                log_it(L_DEBUG,"Seed alias %s is present",PVT(l_net)->seed_aliases[i]);
-                dap_chain_node_info_t * l_node_info= dap_chain_node_info_read(l_net,l_seed_node_addr);
-                l_node
-                DAP_DELETE( l_seed_node_addr);
-            }*/
+            } else {
+                log_it(L_DEBUG,"Seed alias %s is present", PVT(l_net)->seed_aliases[i]);
+                DAP_DELETE(l_node_info);
+            }
         }
         PVT(l_net)->bootstrap_nodes_count = 0;
         PVT(l_net)->bootstrap_nodes_addrs = DAP_NEW_SIZE(struct in_addr, l_bootstrap_nodes_len * sizeof(struct in_addr));
@@ -2334,7 +2531,7 @@ int s_net_load(const char * a_net_name, uint16_t a_acl_idx)
                             const char * l_ext_addr_v4 = dap_config_get_item_str_default(g_config,"server","ext_address",NULL);
                             const char * l_ext_addr_v6 = dap_config_get_item_str_default(g_config,"server","ext_address6",NULL);
                             uint16_t l_ext_port = dap_config_get_item_uint16_default(g_config,"server","ext_port_tcp",0);
-                            uint16_t l_node_info_port = l_ext_port? l_ext_port :
+                            uint16_t l_node_info_port = l_ext_port ? l_ext_port :
                                                     dap_config_get_item_uint16_default(g_config,"server","listen_port_tcp",8089);
                             if (l_ext_addr_v4)
                                 inet_pton(AF_INET,l_ext_addr_v4,&l_net_pvt->node_info->hdr.ext_addr_v4 );
@@ -2345,8 +2542,11 @@ int s_net_load(const char * a_net_name, uint16_t a_acl_idx)
                                    l_node_info_port);
                         }else
                             log_it(L_INFO,"Server is disabled, add only node address in nodelist");
-
-                        dap_chain_node_info_save(l_net,l_net_pvt->node_info);
+                        if (l_net_pvt->node_info->hdr.ext_port &&
+                                (l_net_pvt->node_info->hdr.ext_addr_v4.s_addr != INADDR_ANY ||
+                                 memcmp(&l_net_pvt->node_info->hdr.ext_addr_v6, &in6addr_any, sizeof(struct in6_addr))))
+                            // Save only info with non null address & port!
+                            dap_chain_node_info_save(l_net,l_net_pvt->node_info);
                     }
                     log_it(L_NOTICE,"GDB Info: node_addr: " NODE_ADDR_FP_STR"  links: %u cell_id: 0x%016"DAP_UINT64_FORMAT_X,
                            NODE_ADDR_FP_ARGS(l_node_addr),
@@ -2412,6 +2612,30 @@ int s_net_load(const char * a_net_name, uint16_t a_acl_idx)
                 l_list = dap_list_next(l_list);
             }
             dap_list_free_full(l_prior_list, free);
+
+            dap_chain_t *l_chain02;
+
+            DL_FOREACH(l_net->pub.chains, l_chain){
+                DL_FOREACH(l_net->pub.chains, l_chain02){
+                    if (l_chain != l_chain02){
+                        if (l_chain->id.uint64 == l_chain02->id.uint64)
+                        {
+                            log_it(L_ERROR, "Your network %s has chains with duplicate ids: 0x%"DAP_UINT64_FORMAT_U", chain01: %s, chain02: %s", l_chain->net_name,
+                                            l_chain->id.uint64, l_chain->name,l_chain02->name);
+                            log_it(L_ERROR, "Please, fix your configs and restart node");
+                            return -2;
+                        } 
+                        if (!dap_strcmp(l_chain->name, l_chain02->name))
+                        {
+                            log_it(L_ERROR, "Your network %s has chains with duplicate names %s: chain01 id = 0x%"DAP_UINT64_FORMAT_U", chain02 id = 0x%"DAP_UINT64_FORMAT_U"",l_chain->net_name,
+                                   l_chain->name, l_chain->id.uint64, l_chain02->id.uint64);
+                            log_it(L_ERROR, "Please, fix your configs and restart node");
+                            return -2;
+                        }
+                    }                         
+                }
+            }         
+
             bool l_processed;
             do {
                 l_processed = false;
@@ -2487,7 +2711,7 @@ int s_net_load(const char * a_net_name, uint16_t a_acl_idx)
 
         }
         if (!l_net_pvt->only_static_links)
-            l_net_pvt->only_static_links = dap_config_get_item_bool_default(l_cfg, "general", "static_links_only", false);
+            l_net_pvt->only_static_links = dap_config_get_item_bool_default(l_cfg, "general", "links_static_only", false);
         if (s_seed_mode || !dap_config_get_item_bool_default(g_config ,"general", "auto_online",false ) ) { // If we seed we do everything manual. First think - prefil list of node_addrs and its aliases
             l_target_state = NET_STATE_OFFLINE;
         }
@@ -2518,6 +2742,7 @@ void dap_chain_net_deinit()
 
 dap_chain_net_t **dap_chain_net_list(uint16_t *a_size)
 {
+    pthread_rwlock_rdlock(&g_net_items_rwlock);
     *a_size = HASH_COUNT(s_net_items);
     if(*a_size){
         dap_chain_net_t **l_net_list = DAP_NEW_SIZE(dap_chain_net_t *, (*a_size) * sizeof(dap_chain_net_t *));
@@ -2529,8 +2754,11 @@ dap_chain_net_t **dap_chain_net_list(uint16_t *a_size)
                 break;
         }
         return l_net_list;
-    }else
+        pthread_rwlock_unlock(&g_net_items_rwlock);
+    } else {
+        pthread_rwlock_unlock(&g_net_items_rwlock);
         return NULL;
+    }
 }
 
 /**
@@ -2541,8 +2769,11 @@ dap_chain_net_t **dap_chain_net_list(uint16_t *a_size)
 dap_chain_net_t * dap_chain_net_by_name( const char * a_name)
 {
     dap_chain_net_item_t * l_net_item = NULL;
-    if(a_name)
+    if(a_name) {
+        pthread_rwlock_rdlock(&g_net_items_rwlock);
         HASH_FIND_STR(s_net_items,a_name,l_net_item );
+        pthread_rwlock_unlock(&g_net_items_rwlock);
+    }
     return l_net_item ? l_net_item->chain_net : NULL;
 }
 
@@ -2565,7 +2796,9 @@ dap_ledger_t * dap_chain_ledger_by_net_name( const char * a_net_name)
 dap_chain_net_t * dap_chain_net_by_id( dap_chain_net_id_t a_id)
 {
     dap_chain_net_item_t * l_net_item = NULL;
+    pthread_rwlock_rdlock(&g_net_ids_rwlock);
     HASH_FIND(hh,s_net_items_ids,&a_id,sizeof (a_id), l_net_item );
+    pthread_rwlock_unlock(&g_net_ids_rwlock);
     return l_net_item ? l_net_item->chain_net : NULL;
 }
 
@@ -2580,7 +2813,6 @@ uint16_t dap_chain_net_acl_idx_by_id(dap_chain_net_id_t a_id)
     return l_net ? PVT(l_net)->acl_idx : (uint16_t)-1;
 }
 
-
 /**
  * @brief dap_chain_net_id_by_name
  * @param a_name
@@ -2834,7 +3066,7 @@ void dap_chain_net_proc_mempool (dap_chain_net_t * a_net)
                         char buf[50] = { '\0' };
                         const char *l_type = NULL;
                         DAP_DATUM_TYPE_STR(l_datum->header.type_id, l_type)
-                        time_t l_ts_create = (time_t) l_datum->header.ts_create;
+                        dap_time_t l_ts_create = (dap_time_t) l_datum->header.ts_create;
                         log_it(L_INFO, "\t\t0x%s: type_id=%s ts_create=%s data_size=%u",
                                 l_objs[i].key, l_type,
                                 dap_ctime_r(&l_ts_create, buf), l_datum->header.data_size);
diff --git a/modules/net/dap_chain_node.c b/modules/net/dap_chain_node.c
index 280603a86abbad2168a0ae96e3cbaabd97d4dca2..6ef1916221b051db5a46995e91b3690c1c6f464e 100644
--- a/modules/net/dap_chain_node.c
+++ b/modules/net/dap_chain_node.c
@@ -117,6 +117,28 @@ size_t dap_chain_node_info_get_size(dap_chain_node_info_t *node_info)
     return (sizeof(dap_chain_node_info_t) + node_info->hdr.links_number * sizeof(dap_chain_node_addr_t));
 }
 
+/**
+ * Compare addresses of two dap_chain_node_info_t structures
+ *
+ * @return True if addresses are equal, otherwise false
+ */
+bool dap_chain_node_info_addr_match(dap_chain_node_info_t *node_info1, dap_chain_node_info_t *node_info2)
+{
+    if(!node_info1 || !node_info2) {
+        return false;
+    }
+    //if(memcmp(&node_info1->hdr.address, &node_info2->hdr.address, sizeof(dap_chain_addr_t))) {
+    //    return false;
+    //}
+    if(memcmp(&node_info1->hdr.ext_addr_v6, &node_info2->hdr.ext_addr_v6, sizeof(struct in6_addr)) ||
+            memcmp(&node_info1->hdr.ext_addr_v4, &node_info2->hdr.ext_addr_v4, sizeof(struct in_addr)) ||
+            (node_info1->hdr.ext_port != node_info2->hdr.ext_port)) {
+        return false;
+    }
+    return true;
+}
+
+
 /**
  * @brief dap_chain_node_info_save
  * @param node_info
@@ -311,3 +333,53 @@ bool dap_chain_node_mempool_autoproc_init()
 void dap_chain_node_mempool_autoproc_deinit()
 {
 }
+
+
+/**
+ * @brief Find a_node_info in the a_node_list
+ */
+bool dap_chain_node_info_list_is_added(dap_chain_node_info_list_t *a_node_list, dap_chain_node_info_t *a_node_info)
+{
+    while(a_node_list) {
+        dap_chain_node_info_t *l_node_info = a_node_list->data;
+        if(dap_chain_node_info_addr_match(l_node_info, a_node_info)) {
+            return true;
+        }
+        a_node_list = dap_list_next(a_node_list);
+    }
+    return false;
+}
+
+/**
+ * @brief Add a_node_info to the a_node_list
+ */
+dap_chain_node_info_list_t* dap_chain_node_info_list_add(dap_chain_node_info_list_t *a_node_list, dap_chain_node_info_t *a_node_info)
+{
+    return dap_list_prepend(a_node_list, a_node_info);
+}
+
+/**
+ * @brief Remove a_node_info from the a_node_list
+ */
+dap_chain_node_info_list_t* dap_chain_node_info_list_del(dap_chain_node_info_list_t *a_node_list, dap_chain_node_info_t *a_node_info)
+{
+    dap_chain_node_info_list_t *l_node_link = dap_list_find(a_node_list, a_node_info);
+    return dap_list_remove_link(a_node_list, l_node_link);
+}
+
+//static void s_chain_node_info_callback_destroyed(void* data)
+//{
+//    dap_chain_node_info_t *l_link_node_info = (dap_chain_node_info_t*)data;
+//    DAP_DELETE(l_link_node_info);
+//}
+
+/**
+ * @brief Free a_node_list
+ */
+
+void dap_chain_node_info_list_free(dap_chain_node_info_list_t *a_node_list)
+{
+    dap_list_free(a_node_list);
+    //dap_list_free_full(a_node_list, s_chain_node_info_callback_destroyed);
+}
+
diff --git a/modules/net/dap_chain_node_cli.c b/modules/net/dap_chain_node_cli.c
index d4eb184cfc626dc99524253ce4fb15ab8050e618..8882ddfbf6071e046e54ecac985ff02aff9550bc 100644
--- a/modules/net/dap_chain_node_cli.c
+++ b/modules/net/dap_chain_node_cli.c
@@ -916,16 +916,16 @@ int dap_chain_node_cli_init(dap_config_t * g_config)
 //                    "global_db wallet_info set -addr <wallet address> -cell <cell id> \n\n"
             );
     dap_chain_node_cli_cmd_item_create("mempool", com_signer, "Sign operations",
-               "mempool sign -cert <cert name> -net <net name> -chain <chain name> -file <filename> [-mime <(SIGNER_FILENAME,SIGNER_FILENAME_SHORT,SIGNER_FILESIZE,SIGNER_DATE,SIGNER_MIME_MAGIC) or (SIGNER_ALL_FLAGS)>]\n"
-               "mempool check -cert <cert name> -net <net name> ((-file <filename>) or (-hash <hash>)) [-mime <(SIGNER_FILENAME,SIGNER_FILENAME_SHORT,SIGNER_FILESIZE,SIGNER_DATE,SIGNER_MIME_MAGIC) or (SIGNER_ALL_FLAGS)>]\n"
+               "mempool sign -cert <cert name> -net <net name> -chain <chain name> -file <filename> [-mime {<SIGNER_FILENAME,SIGNER_FILENAME_SHORT,SIGNER_FILESIZE,SIGNER_DATE,SIGNER_MIME_MAGIC> | <SIGNER_ALL_FLAGS>}]\n"
+               "mempool check -cert <cert name> -net <net name> {-file <filename> | -hash <hash>} [-mime {<SIGNER_FILENAME,SIGNER_FILENAME_SHORT,SIGNER_FILESIZE,SIGNER_DATE,SIGNER_MIME_MAGIC> | <SIGNER_ALL_FLAGS>}]\n"
                                           );
     dap_chain_node_cli_cmd_item_create("node", com_node, "Work with node",
-            "node add  -net <net name> -addr {<node address> | -alias <node alias>} {-port <port>} -cell <cell id>  {-ipv4 <ipv4 external address> | -ipv6 <ipv6 external address>}\n\n"
-                    "node del  -net <net name> -addr <node address> | -alias <node alias>\n\n"
-                    "node link {add|del}  -net <net name> {-addr <node address> | -alias <node alias>} -link <node address>\n\n"
+            "node add  -net <net name> -addr {<node address> | -alias <node alias>} -port <port> -cell <cell id>  {-ipv4 <ipv4 external address> | -ipv6 <ipv6 external address>}\n\n"
+                    "node del -net <net name> {-addr <node address> | -alias <node alias>}\n\n"
+                    "node link {add | del}  -net <net name> {-addr <node address> | -alias <node alias>} -link <node address>\n\n"
                     "node alias -addr <node address> -alias <node alias>\n\n"
-                    "node connect {<node address> | -alias <node alias> | auto}\n\n"
-                    "node handshake {<node address> | -alias <node alias>}\n"
+                    "node connect -net <net name> {-addr <node address> | -alias <node alias> | auto}\n\n"
+                    "node handshake -net <net name> {-addr <node address> | -alias <node alias>}\n"
                     "node dump -net <net name> [ -addr <node address> | -alias <node alias>] [-full]\n\n"
                                         );
     dap_chain_node_cli_cmd_item_create ("ping", com_ping, "Send ICMP ECHO_REQUEST to network hosts",
@@ -1070,19 +1070,17 @@ int dap_chain_node_cli_init(dap_config_t * g_config)
 
     dap_chain_node_cli_cmd_item_create ("chain_ca_pub", com_chain_ca_pub,
                                         "Add pubic certificate into the mempool to prepare its way to chains",
-            "chain_ca -net <net name> [-chain <chain name>] -ca_name <Certificate name>\n");
+            "chain_ca_pub -net <net name> [-chain <chain name>] -ca_name <Certificate name>\n");
 
     dap_chain_node_cli_cmd_item_create ("chain_ca_copy", com_chain_ca_copy,
                                         "Copy pubic certificate into the mempool to prepare its way to chains",
-            "chain_ca -net <net name> [-chain <chain name>] -ca_name <Public certificate name>\n");
+            "chain_ca_copy -net <net name> [-chain <chain name>] -ca_name <Public certificate name>\n");
 
     // Transaction commands
     dap_chain_node_cli_cmd_item_create ("tx_create", com_tx_create, "Make transaction",
-            "tx_create -net <net name> -chain <chain name> {-from_wallet <name> -token <token ticker> -value <value> -to_addr <addr> | -from_emission <emission_hash>}"
-                                        "[-fee <addr> -value_fee <val>]\n" );
+            "tx_create -net <net name> -chain <chain name> {-from_wallet <name> -token <token ticker> -value <value> -to_addr <addr> | -from_emission <emission_hash>}[-fee <addr> -value_fee <val>]\n" );
     dap_chain_node_cli_cmd_item_create ("tx_cond_create", com_tx_cond_create, "Make cond transaction",
-                                        "tx_cond_create -net <net name> -token <token ticker> -wallet <from wallet> -cert <public cert>"
-                                        "-value <value datoshi> -unit <mb | kb | b | sec | day> -srv_uid <numeric uid>\n" );
+                                        "tx_cond_create -net <net name> -token <token ticker> -wallet <from wallet> -cert <public cert> -value <value datoshi> -unit {mb | kb | b | sec | day} -srv_uid <numeric uid>\n" );
 
     dap_chain_node_cli_cmd_item_create ("tx_verify", com_tx_verify, "Verifing transaction in mempool",
             "tx_verify -net <net name> -chain <chain name> -tx <tx_hash>\n" );
diff --git a/modules/net/dap_chain_node_cli_cmd.c b/modules/net/dap_chain_node_cli_cmd.c
index 33d3b415c98ee548596cf2516eaf2d6fc8a3edc7..e03b267b3899f2e28370ed1e07db34546834882d 100644
--- a/modules/net/dap_chain_node_cli_cmd.c
+++ b/modules/net/dap_chain_node_cli_cmd.c
@@ -589,7 +589,7 @@ static int node_info_dump_with_reply(dap_chain_net_t * a_net, dap_chain_node_add
 
         dap_string_append_printf(l_string_reply, "\n");
         char l_port_str[10];
-        sprintf(l_port_str,"%d",node_info_read->hdr.ext_port);
+        dap_sprintf(l_port_str,"%d",node_info_read->hdr.ext_port);
 
         // set short reply with node param
         if(!a_is_full)
@@ -636,16 +636,20 @@ static int node_info_dump_with_reply(dap_chain_net_t * a_net, dap_chain_node_add
             for(size_t i = 0; i < l_nodes_count; i++) {
                 dap_chain_node_info_t *l_node_info = (dap_chain_node_info_t *)l_objs[i].value;
                 // read node
-                dap_chain_node_info_t *node_info_read = node_info_read_and_reply(a_net, &l_node_info->hdr.address, NULL);
-                if (!node_info_read)
+                dap_chain_node_info_t *l_node_info_read = node_info_read_and_reply(a_net, &l_node_info->hdr.address, NULL);
+                if (!l_node_info_read) {
+                    log_it(L_ERROR, "Invalid node info object, remove it");
+                    dap_chain_global_db_gr_del(l_objs[i].key, a_net->pub.gdb_nodes);
                     continue;
+                } else
+                    DAP_DELETE(l_node_info_read);
                 const int hostlen = 128;
                 char *host4 = (char*) alloca(hostlen);
                 char *host6 = (char*) alloca(hostlen);
-                struct sockaddr_in sa4 = { .sin_family = AF_INET, .sin_addr = node_info_read->hdr.ext_addr_v4 };
+                struct sockaddr_in sa4 = { .sin_family = AF_INET, .sin_addr = l_node_info->hdr.ext_addr_v4 };
                 const char* str_ip4 = inet_ntop(AF_INET, &(((struct sockaddr_in *) &sa4)->sin_addr), host4, hostlen);
 
-                struct sockaddr_in6 sa6 = { .sin6_family = AF_INET6, .sin6_addr = node_info_read->hdr.ext_addr_v6 };
+                struct sockaddr_in6 sa6 = { .sin6_family = AF_INET6, .sin6_addr = l_node_info->hdr.ext_addr_v6 };
                 const char* str_ip6 = inet_ntop(AF_INET6, &(((struct sockaddr_in6 *) &sa6)->sin6_addr), host6, hostlen);
 
                 // get aliases in form of string
@@ -658,7 +662,7 @@ static int node_info_dump_with_reply(dap_chain_net_t * a_net, dap_chain_node_add
                         break;
                     dap_chain_node_addr_t *l_addr = (dap_chain_node_addr_t *)l_obj->value;
                     if (l_addr && l_obj->value_len == sizeof(dap_chain_node_addr_t) &&
-                            node_info_read->hdr.address.uint64 == l_addr->uint64) {
+                            l_node_info->hdr.address.uint64 == l_addr->uint64) {
                         dap_string_append_printf(aliases_string, "\nalias %s", l_obj->key);
                     }
                 }
@@ -667,8 +671,8 @@ static int node_info_dump_with_reply(dap_chain_net_t * a_net, dap_chain_node_add
 
                 // get links in form of string
                 dap_string_t *links_string = dap_string_new(NULL);
-                for(unsigned int i = 0; i < node_info_read->hdr.links_number; i++) {
-                    dap_chain_node_addr_t link_addr = node_info_read->links[i];
+                for(unsigned int i = 0; i < l_node_info->hdr.links_number; i++) {
+                    dap_chain_node_addr_t link_addr = l_node_info->links[i];
                     dap_string_append_printf(links_string, "\nlink%02d address : " NODE_ADDR_FP_STR, i,
                             NODE_ADDR_FP_ARGS_S(link_addr));
                 }
@@ -676,28 +680,27 @@ static int node_info_dump_with_reply(dap_chain_net_t * a_net, dap_chain_node_add
                 if(i)
                     dap_string_append_printf(l_string_reply, "\n");
                 char l_port_str[10];
-                sprintf(l_port_str,"%d",node_info_read->hdr.ext_port);
+                dap_sprintf(l_port_str,"%d", l_node_info->hdr.ext_port);
                 // set short reply with node param
                 if(!a_is_full)
                     dap_string_append_printf(l_string_reply,
                             "node address "NODE_ADDR_FP_STR"\tcell 0x%016"DAP_UINT64_FORMAT_x"\tipv4 %s\tport: %s\tnumber of links %u",
-                            NODE_ADDR_FP_ARGS_S(node_info_read->hdr.address),
-                            node_info_read->hdr.cell_id.uint64, str_ip4,
-                            node_info_read->hdr.ext_port ? l_port_str : "default",
-                            node_info_read->hdr.links_number);
+                            NODE_ADDR_FP_ARGS_S(l_node_info->hdr.address),
+                            l_node_info->hdr.cell_id.uint64, str_ip4,
+                            l_node_info->hdr.ext_port ? l_port_str : "default",
+                            l_node_info->hdr.links_number);
                 else
                     // set full reply with node param
                     dap_string_append_printf(l_string_reply,
                             "node address " NODE_ADDR_FP_STR "\ncell 0x%016"DAP_UINT64_FORMAT_x"\nipv4 %s\nipv6 %s\nport: %s%s\nlinks %u%s",
-                            NODE_ADDR_FP_ARGS_S(node_info_read->hdr.address),
-                            node_info_read->hdr.cell_id.uint64,
+                            NODE_ADDR_FP_ARGS_S(l_node_info->hdr.address),
+                            l_node_info->hdr.cell_id.uint64,
                             str_ip4, str_ip6,
-                            node_info_read->hdr.ext_port ? l_port_str : "default",
+                            l_node_info->hdr.ext_port ? l_port_str : "default",
                             aliases_string->str,
-                            node_info_read->hdr.links_number, links_string->str);
+                            l_node_info->hdr.links_number, links_string->str);
                 dap_string_free(aliases_string, true);
                 dap_string_free(links_string, true);
-                DAP_DELETE(node_info_read);
             }
             dap_chain_global_db_objs_delete(l_aliases_objs, l_data_size);
         }
@@ -721,7 +724,7 @@ static int node_info_dump_with_reply(dap_chain_net_t * a_net, dap_chain_node_add
 int com_global_db(int a_argc, char ** a_argv, char **a_str_reply)
 {
     enum {
-        CMD_NONE, CMD_NAME_CELL, CMD_ADD, CMD_FLUSH
+        CMD_NONE, CMD_NAME_CELL, CMD_ADD, CMD_FLUSH, CMD_RECORD
     };
     int arg_index = 1;
     int cmd_name = CMD_NONE;
@@ -730,6 +733,8 @@ int com_global_db(int a_argc, char ** a_argv, char **a_str_reply)
         cmd_name = CMD_NAME_CELL;
     else if(dap_chain_node_cli_find_option_val(a_argv, arg_index, min(a_argc, arg_index + 1), "flush", NULL))
         cmd_name = CMD_FLUSH;
+    else if(dap_chain_node_cli_find_option_val(a_argv, arg_index, min(a_argc, arg_index + 1), "record", NULL))
+            cmd_name = CMD_RECORD;
     switch (cmd_name) {
     case CMD_NAME_CELL:
     {
@@ -750,7 +755,7 @@ int com_global_db(int a_argc, char ** a_argv, char **a_str_reply)
 
         // Check for chain
         if(!l_chain_str) {
-            dap_chain_node_cli_set_reply_text(a_str_reply, "%s requires parameter 'chain' to be valid");
+            dap_chain_node_cli_set_reply_text(a_str_reply, "%s requires parameter 'chain' to be valid", a_argv[0]);
             return -12;
         }
 
@@ -819,6 +824,105 @@ int com_global_db(int a_argc, char ** a_argv, char **a_str_reply)
         }
         return 0;
     }
+    case CMD_RECORD:
+    {
+        enum {
+            SUMCMD_GET, SUMCMD_PIN, SUMCMD_UNPIN
+        };
+        if(!arg_index || a_argc < 3) {
+            dap_chain_node_cli_set_reply_text(a_str_reply, "parameters are not valid");
+            return -1;
+        }
+        int arg_index_n = ++arg_index;
+        int l_subcmd;
+        // Get value
+        if((arg_index_n = dap_chain_node_cli_find_option_val(a_argv, arg_index, min(a_argc, arg_index + 1), "get", NULL))!= 0) {
+            l_subcmd = SUMCMD_GET;
+        }
+        // Pin record
+        else if((arg_index_n = dap_chain_node_cli_find_option_val(a_argv, arg_index, min(a_argc, arg_index + 1), "pin", NULL)) != 0) {
+            l_subcmd = SUMCMD_PIN;
+        }
+        // Unpin record
+        else if((arg_index_n = dap_chain_node_cli_find_option_val(a_argv, arg_index, min(a_argc, arg_index + 1), "unpin", NULL)) != 0) {
+            l_subcmd = SUMCMD_UNPIN;
+        }
+        else{
+            dap_chain_node_cli_set_reply_text(a_str_reply, "Subcommand '%s' not recognized, available subcommands are 'get', 'pin' or 'unpin'", a_argv[2]);
+            return -1;
+        }
+        // read record from database
+        const char *l_key = NULL;
+        const char *l_group = NULL;
+        // find key and group
+        dap_chain_node_cli_find_option_val(a_argv, arg_index, a_argc, "-key", &l_key);
+        dap_chain_node_cli_find_option_val(a_argv, arg_index, a_argc, "-group", &l_group);
+        size_t l_value_len = 0;
+        uint8_t l_flags = 0;
+        uint8_t *l_value = dap_chain_global_db_gr_get_ext(l_key, &l_value_len, &l_flags, l_group);
+        if(!l_value || !l_value_len) {
+            dap_chain_node_cli_set_reply_text(a_str_reply, "Record not found\n\n");
+            return -1;
+        }
+        bool is_pinned = l_flags & RECORD_PINNED;
+
+        int l_ret = 0;
+        // prepare record information
+        switch (l_subcmd) {
+        case SUMCMD_GET: // Get value
+        {
+            dap_hash_fast_t l_hash;
+            char *l_hash_str = NULL;
+            if(dap_hash_fast(l_value, l_value_len, &l_hash)) {
+                l_hash_str = dap_chain_hash_fast_to_str_new(&l_hash);
+            }
+            char *l_value_str = DAP_NEW_Z_SIZE(char, l_value_len * 2 + 2);
+            size_t ret = dap_bin2hex(l_value_str, l_value, l_value_len);
+            dap_chain_node_cli_set_reply_text(a_str_reply, "Record found\n"
+                    "lenght:\t%u byte\n"
+                    "hash:\t%s\n"
+                    "pinned:\t%s\n"
+                    "value:\t0x%s\n\n", l_value_len, l_hash_str, is_pinned ? "Yes" : "No", l_value_str);
+            DAP_DELETE(l_value_str);
+            DAP_DELETE(l_hash_str);
+            break;
+        }
+        case SUMCMD_PIN: // Pin record
+        {
+            if(is_pinned){
+                dap_chain_node_cli_set_reply_text(a_str_reply, "record already pinned");
+                break;
+            }
+            if(dap_chain_global_db_gr_set_ext(l_key, l_value, l_value_len,l_group, l_flags | RECORD_PINNED)){
+                dap_chain_node_cli_set_reply_text(a_str_reply, "record successfully pinned");
+            }
+            else{
+                dap_chain_node_cli_set_reply_text(a_str_reply, "can't pin the record");
+                l_ret = -2;
+            }
+            break;
+        }
+        case SUMCMD_UNPIN: // Unpin record
+        {
+            if(!is_pinned) {
+                dap_chain_node_cli_set_reply_text(a_str_reply, "record already unpinned");
+                break;
+            }
+            l_flags &= ~RECORD_PINNED;
+            if(dap_chain_global_db_gr_set_ext(l_key, l_value, l_value_len, l_group, l_flags & ~RECORD_PINNED)) {
+                dap_chain_node_cli_set_reply_text(a_str_reply, "record successfully unpinned");
+            }
+            else {
+                dap_chain_node_cli_set_reply_text(a_str_reply, "can't unpin the record");
+                l_ret = -2;
+            }
+            break;
+        }
+
+        }
+        DAP_DELETE(l_value);
+        return l_ret;
+    }
     default:
         dap_chain_node_cli_set_reply_text(a_str_reply, "parameters are not valid");
         return -1;
@@ -1895,8 +1999,8 @@ int dap_chain_node_cli_cmd_values_parse_net_chain(int *a_arg_index, int argc, ch
         if(l_chain_str) {
             if((*a_chain = dap_chain_net_get_chain_by_name(*a_net, l_chain_str)) == NULL) { // Can't find such chain
                 dap_chain_node_cli_set_reply_text(a_str_reply,
-                        "%s requires parameter '-chain' to be valid chain name in chain net %s",
-                        argv[0], l_net_str);
+                        "%s requires parameter '-chain' to be valid chain name in chain net %s. Current chain %s is not valid",
+                        argv[0], l_net_str, l_chain_str);
                 return -103;
             }
         }
@@ -2165,9 +2269,10 @@ void s_com_mempool_list_print_for_chain(dap_chain_net_t * a_net, dap_chain_t * a
             dap_string_append_printf(a_str_tmp, "%s.%s: Not found records\n", a_net->pub.name, a_chain->name);
         for(size_t i = 0; i < l_objs_size; i++) {
             dap_chain_datum_t * l_datum = (dap_chain_datum_t*) l_objs[i].value;
-            time_t l_ts_create = (time_t) l_datum->header.ts_create;
+            dap_time_t l_ts_create = (dap_time_t) l_datum->header.ts_create;
             if (!l_datum->header.data_size || (l_datum->header.data_size > l_objs[i].value_len)) {
-                //log_it(L_ERROR, "Trash datum in GDB %s.%s, key: %s", a_net->pub.name, a_chain->name, l_objs[i].key);
+                log_it(L_ERROR, "Trash datum in GDB %s.%s, key: %s data_size:%u, value_len:%zu",
+                        a_net->pub.name, a_chain->name, l_objs[i].key, l_datum->header.data_size, l_objs[i].value_len);
                 continue;
             }
             char buf[50] = {[0]='\0'};
@@ -2278,8 +2383,8 @@ int com_mempool_delete(int argc, char ** argv, char ** a_str_reply)
                 l_datum_hash_base58_str = dap_strdup(l_datum_hash_str);
             }
             char * l_gdb_group_mempool = dap_chain_net_get_gdb_group_mempool(l_chain);
-            uint8_t *l_data_tmp = l_datum_hash_hex_str ? dap_chain_global_db_gr_get(dap_strdup(l_datum_hash_hex_str), NULL, l_gdb_group_mempool) : NULL;
-            if(l_data_tmp && dap_chain_global_db_gr_del(dap_strdup(l_datum_hash_hex_str), l_gdb_group_mempool)) {
+            uint8_t *l_data_tmp = l_datum_hash_hex_str ? dap_chain_global_db_gr_get(l_datum_hash_hex_str, NULL, l_gdb_group_mempool) : NULL;
+            if(l_data_tmp && dap_chain_global_db_gr_del(l_datum_hash_hex_str, l_gdb_group_mempool)) {
                 if(!dap_strcmp(l_hash_out_type,"hex"))
                     dap_chain_node_cli_set_reply_text(a_str_reply, "Datum %s deleted", l_datum_hash_hex_str);
                 else
@@ -2384,7 +2489,7 @@ int com_mempool_proc(int argc, char ** argv, char ** a_str_reply)
         }else{
             if(l_datum) {
                 char buf[50];
-                time_t l_ts_create = (time_t) l_datum->header.ts_create;
+                dap_time_t l_ts_create = (dap_time_t)l_datum->header.ts_create;
                 const char *l_type = NULL;
                 DAP_DATUM_TYPE_STR(l_datum->header.type_id, l_type);
                 dap_string_append_printf(l_str_tmp, "hash %s: type_id=%s ts_create=%s data_size=%u\n",
@@ -2752,6 +2857,240 @@ int com_token_update(int a_argc, char ** a_argv, char ** a_str_reply)
     }
 }
 
+/**
+ * @brief 
+ * 
+ * @param a_tx_address 
+ * @param l_tsd_list 
+ * @param l_tsd_total_size 
+ * @param flag 
+ * @return dap_list_t* 
+ */
+dap_list_t* s_parse_wallet_addresses(const char *a_tx_address, dap_list_t *l_tsd_list, size_t *l_tsd_total_size, uint32_t flag)
+{     
+    if (!a_tx_address){
+       log_it(L_DEBUG,"a_tx_address is null");
+       return l_tsd_list;
+    }   
+    
+    char ** l_str_wallet_addr = NULL;
+    l_str_wallet_addr = dap_strsplit(a_tx_address,",",0xffff);
+
+    if (!l_str_wallet_addr){
+       log_it(L_DEBUG,"Error in wallet addresses array parsing in tx_receiver_allowed parameter");
+       return l_tsd_list;
+    }
+
+    while (l_str_wallet_addr && *l_str_wallet_addr){
+        log_it(L_DEBUG,"Processing wallet address: %s", *l_str_wallet_addr);
+        dap_chain_addr_t *addr_to = dap_chain_addr_from_str(*l_str_wallet_addr);
+        if (addr_to){
+            dap_tsd_t * l_tsd = dap_tsd_create(flag, addr_to, sizeof(dap_chain_addr_t));
+            l_tsd_list = dap_list_append(l_tsd_list, l_tsd);
+            *l_tsd_total_size += dap_tsd_size(l_tsd);
+        }else{
+            log_it(L_DEBUG,"Error in wallet address parsing");
+        }
+        l_str_wallet_addr++;
+    }
+
+    return l_tsd_list;
+}
+
+typedef struct _dap_cli_token_additional_params {
+    const char* flags;
+    const char* total_signs_valid; 
+    const char* datum_type_allowed;
+    const char* datum_type_blocked;
+    const char* tx_receiver_allowed;
+    const char* tx_receiver_blocked;
+    const char* tx_sender_allowed;
+    const char* tx_sender_blocked; 
+} dap_cli_token_additional_params;
+
+typedef struct _dap_sdk_cli_params {
+    const char* l_hash_out_type;
+    dap_chain_t * l_chain;
+    dap_chain_net_t * l_net;
+    const char* l_chain_str;
+    const char* l_net_str;
+    const char* l_ticker;
+    const char* l_type_str;
+    uint16_t l_type;
+    const char* l_certs_str;
+    uint16_t l_signs_total;
+    uint16_t l_signs_emission;
+    uint256_t l_total_supply;
+    const char* l_decimals_str;
+    dap_cli_token_additional_params ext;
+} dap_sdk_cli_params, *pdap_sdk_cli_params;
+
+
+int s_parse_common_token_decl_arg(int a_argc, char ** a_argv, char ** a_str_reply, dap_sdk_cli_params* l_params)
+{
+    l_params->l_type = DAP_CHAIN_DATUM_TOKEN_TYPE_SIMPLE;
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-H", &l_params->l_hash_out_type);
+    if(!l_params->l_hash_out_type)
+        l_params->l_hash_out_type = "hex";
+    if(dap_strcmp(l_params->l_hash_out_type,"hex") && dap_strcmp(l_params->l_hash_out_type,"base58")) {
+        dap_chain_node_cli_set_reply_text(a_str_reply, "invalid parameter -H, valid values: -H <hex | base58>");
+        return -1;
+    }
+
+    int l_arg_index = 0;
+    int l_res = dap_chain_node_cli_cmd_values_parse_net_chain(&l_arg_index, a_argc, a_argv, a_str_reply, &l_params->l_chain, &l_params->l_net);
+
+    if(!l_params->l_net || !l_params->l_chain)
+        return l_res;
+    else {
+        if(*a_str_reply) {
+            DAP_DELETE(*a_str_reply);
+            *a_str_reply = NULL;
+        }
+    }
+    //net name
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-net", &l_params->l_net_str);
+    //chainname
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-chain", &l_params->l_chain_str);
+    //token_ticker
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-token", &l_params->l_ticker);
+
+    // Token type
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-type", &l_params->l_type_str);
+
+    if (l_params->l_type_str) {
+        if (strcmp(l_params->l_type_str, "private") == 0){
+            l_params->l_type = DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_DECL; // 256
+        }else if (strcmp(l_params->l_type_str, "private_simple") == 0){
+            l_params->l_type = DAP_CHAIN_DATUM_TOKEN_TYPE_SIMPLE; // 256
+        }else if (strcmp(l_params->l_type_str, "public_simple") == 0){
+            l_params->l_type = DAP_CHAIN_DATUM_TOKEN_TYPE_PUBLIC; // 256
+        }else if (strcmp(l_params->l_type_str, "CF20") == 0){
+            l_params->l_type = DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_DECL; // 256
+        }else{
+            dap_chain_node_cli_set_reply_text(a_str_reply,
+                        "Unknown token type %s was specified. Supported types:\n"
+                        "   private_simple\n"
+                        "   private\n"
+                        "   CF20\n"
+                        "Default token type is private_simple.\n", l_params->l_type_str);
+            return -1;
+        }
+    }
+
+    // Certificates thats will be used to sign currend datum token
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-certs", &l_params->l_certs_str);
+    // Signs number thats own emissioncan't find
+    const char* l_signs_total_str = NULL;
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-signs_total", &l_signs_total_str);
+    // Signs total
+    char* l_tmp = NULL;
+    if(l_signs_total_str){  
+        if((l_params->l_signs_total = (uint16_t) strtol(l_signs_total_str, &l_tmp, 10)) == 0){
+            dap_chain_node_cli_set_reply_text(a_str_reply,
+                    "'signs_total' parameter must be unsigned integer value that fits in 2 bytes");
+            return -8;
+        }
+    }
+    // Signs minimum number thats need to authorize the emission
+    const char* l_signs_emission_str = NULL;
+    l_tmp = NULL;
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-signs_emission", &l_signs_emission_str);
+    if (l_signs_emission_str){
+        if((l_params->l_signs_emission = (uint16_t) strtol(l_signs_emission_str, &l_tmp, 10)) == 0){
+            dap_chain_node_cli_set_reply_text(a_str_reply,
+                "token_decl requires parameter 'signs_emission' to be unsigned integer value that fits in 2 bytes");
+            return -6;
+        }
+    }
+    // Total supply value
+    const char* l_total_supply_str = NULL;
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-total_supply", &l_total_supply_str);
+    if (l_total_supply_str){
+        l_params->l_total_supply = dap_chain_balance_scan(l_total_supply_str);
+        if (IS_ZERO_256(l_params->l_total_supply)){
+            dap_chain_node_cli_set_reply_text(a_str_reply, "'-total_supply' must be unsigned integer value that fits in 8 bytes");
+            return -4;
+        }
+    }
+
+    // Total supply value
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-decimals", &l_params->l_decimals_str);
+    
+    return 0;
+}
+
+int s_parse_additional_token_decl_arg(int a_argc, char ** a_argv, char ** a_str_reply, dap_sdk_cli_params* l_params)
+{
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-flags", &l_params->ext.flags);
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-total_signs_valid", &l_params->ext.total_signs_valid);
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-datum_type_allowed", &l_params->ext.datum_type_allowed);
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-datum_type_blocked", &l_params->ext.datum_type_blocked);
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-tx_receiver_allowed", &l_params->ext.tx_receiver_allowed);
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-tx_receiver_blocked", &l_params->ext.tx_receiver_blocked);
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-tx_sender_allowed", &l_params->ext.tx_sender_allowed);
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-tx_receiver_allowed", &l_params->ext.tx_receiver_allowed);
+    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-tx_sender_blocked", &l_params->ext.tx_sender_blocked);
+    return 0;
+}
+
+int s_token_decl_check_params(int a_argc, char ** a_argv, char ** a_str_reply, dap_sdk_cli_params* l_params)
+{
+    int l_parse_params = s_parse_common_token_decl_arg(a_argc,a_argv,a_str_reply,l_params);
+    if (l_parse_params)
+        return l_parse_params;
+
+    l_parse_params = s_parse_additional_token_decl_arg(a_argc,a_argv,a_str_reply,l_params);
+    if (l_parse_params)
+        return l_parse_params;
+
+
+    dap_chain_datum_token_t * l_datum_token = NULL;
+    size_t l_datum_data_offset = 0;
+
+    //DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_DECL uses decimals parameter
+    if (l_params->l_type == DAP_CHAIN_DATUM_TOKEN_TYPE_SIMPLE || l_params->l_type == DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_DECL){
+        if(IS_ZERO_256(l_params->l_total_supply)) {
+            dap_chain_node_cli_set_reply_text(a_str_reply, "token_decl requires parameter '-total_supply'");
+            return -3;
+        }
+    }
+  
+    if (!l_params->l_signs_emission){
+        dap_chain_node_cli_set_reply_text(a_str_reply, "token_decl requires parameter '-signs_emission'");
+        return -5;
+    }
+
+    if (!l_params->l_signs_total){
+        dap_chain_node_cli_set_reply_text(a_str_reply, "token_decl requires parameter 'signs_total'");
+        return -7;
+    }
+
+    if(!l_params->l_ticker){
+        dap_chain_node_cli_set_reply_text(a_str_reply, "token_decl requires parameter '-token'");
+        return -2;
+    }
+
+    // check l_decimals in CF20 token
+    if (l_params->l_type == DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_DECL){
+        if(!l_params->l_decimals_str) {
+            dap_chain_node_cli_set_reply_text(a_str_reply, "token_decl requires parameter '-decimals'");
+            return -3;
+        } else if (dap_strcmp(l_params->l_decimals_str, "18")) {
+            dap_chain_node_cli_set_reply_text(a_str_reply,
+                    "token_decl support '-decimals' to be 18 only");
+            return -4;
+        }
+    }
+
+    // Check certs list
+    if(!l_params->l_certs_str){
+        dap_chain_node_cli_set_reply_text(a_str_reply, "token_decl requires parameter 'certs'");
+        return -9;
+    }
+    return 0;
+}
+
 /**
  * @brief com_token_decl
  * @param argc
@@ -2798,264 +3137,119 @@ int com_token_update(int a_argc, char ** a_argv, char ** a_str_reply)
 int com_token_decl(int a_argc, char ** a_argv, char ** a_str_reply)
 {
     int l_arg_index = 1;
-
-    const char * l_type_str = NULL;
-
     const char * l_ticker = NULL;
-
-    const char * l_total_supply_str = NULL;
     uint256_t l_total_supply = {}; // 256
-
-    const char * l_signs_emission_str = NULL;
     uint16_t l_signs_emission = 0;
-
-    const char * l_signs_total_str = NULL;
     uint16_t l_signs_total = 0;
-
-    const char * l_certs_str = NULL;
-
     dap_cert_t ** l_certs = NULL;
     size_t l_certs_count = 0;
 
     dap_chain_t * l_chain = NULL;
     dap_chain_net_t * l_net = NULL;
+    const char * l_hash_out_type = NULL;
 
-    uint16_t l_type = DAP_CHAIN_DATUM_TOKEN_TYPE_SIMPLE;
+    dap_sdk_cli_params* l_params = DAP_NEW_Z(dap_sdk_cli_params);
 
-    const char * l_hash_out_type = NULL;
-    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-H", &l_hash_out_type);
-    if(!l_hash_out_type)
-        l_hash_out_type = "hex";
-    if(dap_strcmp(l_hash_out_type,"hex") && dap_strcmp(l_hash_out_type,"base58")) {
-        dap_chain_node_cli_set_reply_text(a_str_reply, "invalid parameter -H, valid values: -H <hex | base58>");
+    if (!l_params)
         return -1;
-    }
 
-    dap_chain_node_cli_cmd_values_parse_net_chain(&l_arg_index, a_argc, a_argv, a_str_reply, &l_chain, &l_net);
-    if(!l_net)
-        return -1;
-    else {
-        if(*a_str_reply) {
-            DAP_DELETE(*a_str_reply);
-            *a_str_reply = NULL;
-        }
-    }
-    // Token ticker
-    l_arg_index=dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-token", &l_ticker);
-    // Check for ticker
-    if(!l_ticker) {
-        dap_chain_node_cli_set_reply_text(a_str_reply, "token_decl requires parameter '-token'");
-        return -2;
-    }
+    l_params->l_type = DAP_CHAIN_DATUM_TOKEN_TYPE_SIMPLE;
 
-    // Token type
-    l_arg_index=dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-type", &l_type_str);
-
-    if (l_type_str) {
-        if (strcmp( l_type_str, "private") == 0){
-            l_type = DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_DECL; // 256
-        }else if (strcmp( l_type_str, "private_simple") == 0){
-            l_type = DAP_CHAIN_DATUM_TOKEN_TYPE_SIMPLE; // 256
-        }else if (strcmp( l_type_str, "public_simple") == 0){
-            l_type = DAP_CHAIN_DATUM_TOKEN_TYPE_PUBLIC; // 256
-        }else if (strcmp( l_type_str, "CF20") == 0){
-            l_type = DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_DECL; // 256
-        }else{
-            dap_chain_node_cli_set_reply_text(a_str_reply,
-                        "uknown token type was specified. Simple token will be used by default");
-        }
-    }
+    int l_parse_params = s_token_decl_check_params(a_argc,a_argv,a_str_reply,l_params);
+    if (l_parse_params)
+        return l_parse_params;
 
     dap_chain_datum_token_t * l_datum_token = NULL;
     size_t l_datum_data_offset = 0;
 
-    // Certificates thats will be used to sign currend datum token
-    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-certs", &l_certs_str);
-    // Signs number thats own emissioncan't find
-    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-signs_total", &l_signs_total_str);
-    // Signs minimum number thats need to authorize the emission
-    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-signs_emission", &l_signs_emission_str);
-
-    //DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_DECL uses decimals parameter
-    if (l_type == DAP_CHAIN_DATUM_TOKEN_TYPE_SIMPLE){
-        // Total supply value
-        dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-total_supply", &l_total_supply_str);
-
-        if(!l_total_supply_str) {
-            dap_chain_node_cli_set_reply_text(a_str_reply, "token_decl requires parameter '-total_supply'");
-            return -3;
-        } else {
-            l_total_supply = dap_chain_balance_scan((char *)l_total_supply_str);
-            if (IS_ZERO_256(l_total_supply)){
-                dap_chain_node_cli_set_reply_text(a_str_reply,
-                        "token_decl requires parameter '-total_supply' to be unsigned integer value that fits in 8 bytes");
-                return -4;
-            }
-        }
-    }
-
-    const char * l_decimals_str = NULL;
-    if (l_type == DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_DECL){
-        dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-decimals", &l_decimals_str);
-        if(!l_decimals_str) {
-            dap_chain_node_cli_set_reply_text(a_str_reply, "token_decl requires parameter '-decimals'");
-            return -3;
-        } else if (dap_strcmp(l_decimals_str, "18")) {
-            dap_chain_node_cli_set_reply_text(a_str_reply,
-                    "token_decl support '-decimals' to be 18 only");
-            return -4;
-        }
-    }
-
-    // Signs emission
-    if(!l_signs_emission_str){
-        dap_chain_node_cli_set_reply_text(a_str_reply, "token_decl requires parameter '-signs_emission'");
-        return -5;
-    } else {
-        char * l_tmp = NULL;
-        if((l_signs_emission = (uint16_t) strtol(l_signs_emission_str, &l_tmp, 10)) == 0){
-            dap_chain_node_cli_set_reply_text(a_str_reply,
-                    "token_decl requires parameter 'signs_emission' to be unsigned integer value that fits in 2 bytes");
-            return -6;
-        }
-    }
-    // Signs total
-    if(!l_signs_total_str){
-        dap_chain_node_cli_set_reply_text(a_str_reply, "token_decl requires parameter 'signs_total'");
-        return -7;
-    } else {
-        char * l_tmp = NULL;
-        if((l_signs_total = (uint16_t) strtol(l_signs_total_str, &l_tmp, 10)) == 0){
-            dap_chain_node_cli_set_reply_text(a_str_reply,
-                    "token_decl requires parameter 'signs_total' to be unsigned integer value that fits in 2 bytes");
-            return -8;
-        }
-    }
-    // Check certs list
-    if(!l_certs_str) {
-        dap_chain_node_cli_set_reply_text(a_str_reply, "token_decl requires parameter 'certs'");
-        return -9;
-    }
     // Load certs lists
-    dap_cert_parse_str_list(l_certs_str, &l_certs, &l_certs_count);
+    dap_cert_parse_str_list(l_params->l_certs_str, &l_certs, &l_certs_count);
     if(!l_certs_count){
         dap_chain_node_cli_set_reply_text(a_str_reply,
                 "token_decl command requres at least one valid certificate to sign token");
         return -10;
     }
 
-    switch(l_type){
+    l_signs_emission = l_params->l_signs_emission;
+    l_signs_total = l_params->l_signs_total;
+    l_total_supply = l_params->l_total_supply;
+    l_chain = l_params->l_chain;
+    l_net = l_params->l_net;
+    l_ticker = l_params->l_ticker;
+    l_hash_out_type = l_params->l_hash_out_type;
+
+    switch(l_params->l_type)
+    {
         case DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_DECL:
-        case DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_DECL: { // 256
+        case DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_DECL: 
+        { // 256
             dap_list_t *l_tsd_list = NULL;
             size_t l_tsd_total_size = 0;
             uint16_t l_flags = 0;
             char ** l_str_flags = NULL;
-            l_arg_index++;
 
-            while (l_arg_index<a_argc-1){
-                char * l_arg_param=  a_argv[l_arg_index+1];
-                if ( strcmp(a_argv[l_arg_index],"-flags" )==0){   // Flags
-                     l_str_flags = dap_strsplit( l_arg_param,",",0xffff );
-                     while (l_str_flags && *l_str_flags){
-                         uint16_t l_flag = dap_chain_datum_token_flag_from_str(*l_str_flags);
-                         if ( l_flag == DAP_CHAIN_DATUM_TOKEN_FLAG_UNDEFINED ){
-                             dap_chain_node_cli_set_reply_text(a_str_reply, "Flag can't be \"%s\"",*l_str_flags);
-                             return -20;
-                         }
-                         l_flags |= l_flag; // if we have multiple flags
-                         l_str_flags++;
+            if (l_params->ext.flags){   // Flags
+                 l_str_flags = dap_strsplit(l_params->ext.flags,",",0xffff );
+                 while (l_str_flags && *l_str_flags){
+                     uint16_t l_flag = dap_chain_datum_token_flag_from_str(*l_str_flags);
+                     if (l_flag == DAP_CHAIN_DATUM_TOKEN_FLAG_UNDEFINED ){
+                         dap_chain_node_cli_set_reply_text(a_str_reply, "Flag can't be \"%s\"",*l_str_flags);
+                         return -20;
                      }
-                } else if ( strcmp( a_argv[l_arg_index],"-total_supply" )==0){ // Total supply
-                    dap_tsd_t * l_tsd;
-                    uint256_t l_param_value = dap_chain_balance_scan(l_arg_param);
-                    l_tsd = dap_tsd_create_scalar(
-                                    DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TOTAL_SUPPLY, l_param_value);
-                    l_tsd_list = dap_list_append( l_tsd_list, l_tsd);
-                    l_tsd_total_size+= dap_tsd_size( l_tsd);
-                }else if ( strcmp( a_argv[l_arg_index],"-total_signs_valid" )==0){ // Signs valid
-                    uint16_t l_param_value = (uint16_t)atoi(l_arg_param);
-                    l_signs_total = l_param_value;
-                    dap_tsd_t * l_tsd = dap_tsd_create_scalar(
-                                                            DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TOTAL_SIGNS_VALID, l_param_value);
-                    l_tsd_list = dap_list_append( l_tsd_list, l_tsd);
-                    l_tsd_total_size+= dap_tsd_size( l_tsd);
-                }else if ( strcmp( a_argv[l_arg_index],"-signs" )==0){
-                    dap_cert_parse_str_list(l_arg_param, &l_certs, &l_certs_count);
-                    if(!l_certs_count) {
-                        dap_chain_node_cli_set_reply_text(a_str_reply,
-                                "token_decl command requres at least one valid certificate to sign the basic transaction of emission");
-                        return -10;
-                    }
-                }else if ( strcmp( a_argv[l_arg_index],"-datum_type_allowed" )==0){
-                    dap_tsd_t * l_tsd = dap_tsd_create_string(
-                                                            DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_DATUM_TYPE_ALLOWED_ADD, l_arg_param);
-                    l_tsd_list = dap_list_append( l_tsd_list, l_tsd);
-                    l_tsd_total_size+= dap_tsd_size( l_tsd);
-                }else if ( strcmp( a_argv[l_arg_index],"-datum_type_blocked" )==0){
-                    dap_tsd_t * l_tsd = dap_tsd_create_string(
-                                                            DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_DATUM_TYPE_BLOCKED_ADD, l_arg_param);
-                    l_tsd_list = dap_list_append( l_tsd_list, l_tsd);
-                    l_tsd_total_size+= dap_tsd_size( l_tsd);
-                }else if ( strcmp( a_argv[l_arg_index],"-tx_receiver_allowed" )==0){
-                    const char *a_tx_receiver_allowed_base58 = NULL;
-                    dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-tx_receiver_allowed", &a_tx_receiver_allowed_base58);
-                    char ** l_str_wallet_addr = NULL;
-                    l_str_wallet_addr = dap_strsplit( a_tx_receiver_allowed_base58,",",0xffff );
-
-                    if (!l_str_wallet_addr){
-                       log_it(L_DEBUG,"Error in wallet addresses array parsing in tx_receiver_allowed parameter");
-                       return -10;
-                    }
-
-                    while (l_str_wallet_addr && *l_str_wallet_addr){
-                        log_it(L_DEBUG,"Processing wallet address: %s", *l_str_wallet_addr);
-                        dap_chain_addr_t *addr_to = dap_chain_addr_from_str(*l_str_wallet_addr);
-                        if (addr_to){
-                            dap_tsd_t * l_tsd = dap_tsd_create(DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TX_RECEIVER_ALLOWED_ADD, addr_to, sizeof(dap_chain_addr_t));
-                            l_tsd_list = dap_list_append( l_tsd_list, l_tsd);
-                            l_tsd_total_size+= dap_tsd_size( l_tsd);
-                        } else{
-                            log_it(L_DEBUG,"Error in wallet address parsing");
-                        }
-                        l_str_wallet_addr++;
-                     }
-                }else if ( strcmp( a_argv[l_arg_index],"-tx_receiver_blocked" )==0){
-                    dap_tsd_t * l_tsd = dap_tsd_create_string(
-                                                            DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TX_RECEIVER_BLOCKED_ADD, l_arg_param);
-                    l_tsd_list = dap_list_append( l_tsd_list, l_tsd);
-                    l_tsd_total_size+= dap_tsd_size( l_tsd);
-                }else if ( strcmp( a_argv[l_arg_index],"-tx_sender_allowed" )==0){
-                    dap_tsd_t * l_tsd = dap_tsd_create_string(
-                                                            DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TX_SENDER_ALLOWED_ADD, l_arg_param);
-                    l_tsd_list = dap_list_append( l_tsd_list, l_tsd);
-                    l_tsd_total_size+= dap_tsd_size( l_tsd);
-                }else if ( strcmp( a_argv[l_arg_index],"-tx_sender_blocked" )==0){
-                    dap_tsd_t * l_tsd = dap_tsd_create_string(
-                                                            DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TX_SENDER_BLOCKED_ADD, l_arg_param);
-                    l_tsd_list = dap_list_append( l_tsd_list, l_tsd);
-                    l_tsd_total_size+= dap_tsd_size( l_tsd);
+                     l_flags |= l_flag; // if we have multiple flags
+                     l_str_flags++;
                 }
-                l_arg_index+=2;
             }
+            if (l_params->ext.total_signs_valid){ // Signs valid
+                uint16_t l_param_value = (uint16_t)atoi(l_params->ext.total_signs_valid);
+                l_signs_total = l_param_value;
+                dap_tsd_t * l_tsd = dap_tsd_create_scalar(
+                                                        DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TOTAL_SIGNS_VALID, l_param_value);
+                l_tsd_list = dap_list_append(l_tsd_list, l_tsd);
+                l_tsd_total_size+= dap_tsd_size(l_tsd);
+            }
+            if (l_params->ext.datum_type_allowed){
+                dap_tsd_t * l_tsd = dap_tsd_create_string(
+                                                        DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_DATUM_TYPE_ALLOWED_ADD, l_params->ext.datum_type_allowed);
+                l_tsd_list = dap_list_append(l_tsd_list, l_tsd);
+                l_tsd_total_size+= dap_tsd_size(l_tsd);
+            }
+            if (l_params->ext.datum_type_blocked){
+                dap_tsd_t * l_tsd = dap_tsd_create_string(
+                                                        DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_DATUM_TYPE_BLOCKED_ADD, l_params->ext.datum_type_blocked);
+                l_tsd_list = dap_list_append(l_tsd_list, l_tsd);
+                l_tsd_total_size+= dap_tsd_size(l_tsd);
+            }
+            if (l_params->ext.tx_receiver_allowed)
+                l_tsd_list = s_parse_wallet_addresses(l_params->ext.tx_receiver_allowed, l_tsd_list, &l_tsd_total_size, DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TX_RECEIVER_ALLOWED_ADD);
+            
+            if (l_params->ext.tx_receiver_blocked)
+                l_tsd_list = s_parse_wallet_addresses(l_params->ext.tx_receiver_blocked, l_tsd_list, &l_tsd_total_size, DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TX_RECEIVER_BLOCKED_ADD);
+
+            if (l_params->ext.tx_sender_allowed)
+                l_tsd_list = s_parse_wallet_addresses(l_params->ext.tx_sender_allowed, l_tsd_list, &l_tsd_total_size, DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TX_SENDER_ALLOWED_ADD);
+
+            if (l_params->ext.tx_sender_blocked)
+                l_tsd_list = s_parse_wallet_addresses(l_params->ext.tx_sender_blocked, l_tsd_list, &l_tsd_total_size, DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TX_SENDER_BLOCKED_ADD);             
+
 
             // Create new datum token
             l_datum_token = DAP_NEW_Z_SIZE(dap_chain_datum_token_t, sizeof(dap_chain_datum_token_t) + l_tsd_total_size) ;
-            l_datum_token->type = l_type;
-            if (l_type == DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_DECL) {
-                log_it(L_DEBUG,"Prepeared TSD sections for private token on %zd total size", l_tsd_total_size);
+            l_datum_token->type = l_params->l_type;
+            if (l_params->l_type == DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_DECL) {
+                log_it(L_DEBUG,"Prepared TSD sections for private token on %zd total size", l_tsd_total_size);
                 dap_snprintf(l_datum_token->ticker, sizeof(l_datum_token->ticker), "%s", l_ticker);
                 l_datum_token->header_private_decl.flags = l_flags;
                 l_datum_token->total_supply = l_total_supply;
                 l_datum_token->signs_valid = l_signs_emission;
                 l_datum_token->header_private_decl.tsd_total_size = l_tsd_total_size;
             } else { //DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_DECL
-                log_it(L_DEBUG,"Prepeared TSD sections for CF20 token on %zd total size", l_tsd_total_size);
+                log_it(L_DEBUG,"Prepared TSD sections for CF20 token on %zd total size", l_tsd_total_size);
                 dap_snprintf(l_datum_token->ticker, sizeof(l_datum_token->ticker), "%s", l_ticker);
                 l_datum_token->header_native_decl.flags = l_flags;
                 l_datum_token->signs_valid = l_signs_emission;
                 l_datum_token->header_native_decl.tsd_total_size = l_tsd_total_size;
-                l_datum_token->header_native_decl.decimals = atoi(l_decimals_str);
+                l_datum_token->header_native_decl.decimals = atoi(l_params->l_decimals_str);
             }
             // Add TSD sections in the end
             for ( dap_list_t* l_iter=dap_list_first(l_tsd_list); l_iter; l_iter=l_iter->next){
@@ -3065,13 +3259,6 @@ int com_token_decl(int a_argc, char ** a_argv, char ** a_str_reply)
                     continue;
                 }
                 switch (l_tsd->type){
-                    case DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TOTAL_SUPPLY: { // 256
-                        char *l_balance;
-                        l_balance = dap_chain_balance_print(dap_tsd_get_scalar(l_tsd, uint256_t));
-                        log_it(L_DEBUG,"== TOTAL_SUPPLY: %s", l_balance);
-                        DAP_DELETE(l_balance);
-                    }
-                    break;
                     case DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TOTAL_SIGNS_VALID:
                         log_it(L_DEBUG,"== TOTAL_SIGNS_VALID: %u",
                                 dap_tsd_get_scalar(l_tsd,uint16_t) );
@@ -3084,25 +3271,23 @@ int com_token_decl(int a_argc, char ** a_argv, char ** a_str_reply)
                         log_it(L_DEBUG,"== TX_SENDER_ALLOWED_ADD: binary data");
                     break;
                     case DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TX_SENDER_BLOCKED_ADD:
-                        log_it(L_DEBUG,"== TX_SENDER_BLOCKED_ADD: %s",
-                                dap_tsd_get_string_const(l_tsd) );
+                        log_it(L_DEBUG,"== TYPE_TX_SENDER_BLOCKED: binary data");
                     break;
                     case DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TX_RECEIVER_ALLOWED_ADD:
-                        log_it(L_DEBUG,"== TX_SENDER_ALLOWED_ADD: binary data");
+                        log_it(L_DEBUG,"== TX_RECEIVER_ALLOWED_ADD: binary data");
                     break;
                     case DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TX_RECEIVER_BLOCKED_ADD:
-                        log_it(L_DEBUG,"== TX_RECEIVER_BLOCKED_ADD: %s",
-                                dap_tsd_get_string_const(l_tsd) );
+                        log_it(L_DEBUG,"== TX_RECEIVER_BLOCKED_ADD: binary data");
                     break;
                     default: log_it(L_DEBUG, "== 0x%04X: binary data %u size ",l_tsd->type, l_tsd->size );
                 }
-                size_t l_tsd_size = dap_tsd_size( l_tsd);
+                size_t l_tsd_size = dap_tsd_size(l_tsd);
                 memcpy(l_datum_token->data_n_tsd + l_datum_data_offset, l_tsd, l_tsd_size);
                 l_datum_data_offset += l_tsd_size;
             }
-            log_it(L_DEBUG, "%s token declaration '%s' initialized", l_type == DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_DECL ?
-                            "Ptivate" : "CF20", l_datum_token->ticker);
-        }break;
+            log_it(L_DEBUG, "%s token declaration '%s' initialized", l_params->l_type == DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_DECL ?
+                            "Private" : "CF20", l_datum_token->ticker);
+        }break;//end 
         case DAP_CHAIN_DATUM_TOKEN_TYPE_SIMPLE: { // 256
             l_datum_token = DAP_NEW_Z_SIZE(dap_chain_datum_token_t, sizeof(dap_chain_datum_token_t));
             l_datum_token->type = DAP_CHAIN_DATUM_TOKEN_TYPE_SIMPLE; // 256
@@ -3159,10 +3344,13 @@ int com_token_decl(int a_argc, char ** a_argv, char ** a_str_reply)
     bool l_placed = dap_chain_global_db_gr_set(l_key_str, (uint8_t *)l_datum, l_datum_size, l_gdb_group_mempool);
     dap_chain_node_cli_set_reply_text(a_str_reply, "Datum %s with 256bit token %s is%s placed in datum pool",
                                       l_key_str_out, l_ticker, l_placed ? "" : " not");
+    //additional checking for incorrect key format
     if (l_key_str_out != l_key_str)
-        DAP_DEL_Z(l_key_str);
-    DAP_DEL_Z(l_key_str);
-    DAP_DEL_Z(l_datum);
+        DAP_DELETE(l_key_str);
+    else
+        DAP_DELETE(l_key_str);
+    DAP_DELETE(l_datum);
+    DAP_DELETE(l_params);
     if (!l_placed) {
         l_ret = -2;
     }
@@ -3170,6 +3358,7 @@ int com_token_decl(int a_argc, char ** a_argv, char ** a_str_reply)
 }
 
 
+
 /**
  * @brief com_token_emit
  * @param argc
diff --git a/modules/net/dap_chain_node_cli_cmd_tx.c b/modules/net/dap_chain_node_cli_cmd_tx.c
index 1e7b378b594c9148bd30282e0a97232d86f280ac..e31057a9e0e55aab67dd0d825d6232057826dc79 100644
--- a/modules/net/dap_chain_node_cli_cmd_tx.c
+++ b/modules/net/dap_chain_node_cli_cmd_tx.c
@@ -95,13 +95,7 @@ static bool s_dap_chain_datum_tx_out_data(dap_chain_datum_tx_t *a_datum,
 {
     const char *l_ticker = NULL;
     if (a_ledger) {
-        dap_list_t *l_list_tx_any = dap_chain_datum_tx_items_get(a_datum, TX_ITEM_TYPE_TOKEN, NULL);
-        if (l_list_tx_any) {
-            l_ticker = ((dap_chain_tx_token_t*)l_list_tx_any->data)->header.ticker;
-        } else {
             l_ticker = dap_chain_ledger_tx_get_token_ticker_by_hash(a_ledger, a_tx_hash);
-        }
-        dap_list_free(l_list_tx_any);
         if (!l_ticker)
             return false;
     }
@@ -401,6 +395,7 @@ char* dap_db_history_tx(dap_chain_hash_fast_t* a_tx_hash, dap_chain_t * a_chain,
  */
 char* dap_db_history_addr(dap_chain_addr_t * a_addr, dap_chain_t * a_chain, const char *a_hash_out_type)
 {
+    char l_time_str[32] = {0};
     dap_string_t *l_str_out = dap_string_new(NULL);
 
     dap_tx_data_t *l_tx_data_hash = NULL;
@@ -411,6 +406,7 @@ char* dap_db_history_addr(dap_chain_addr_t * a_addr, dap_chain_t * a_chain, cons
     if (!l_atom) {
         return NULL;
     }
+
     while (l_atom && l_atom_size) {
         size_t l_datums_count = 0;
         dap_chain_datum_t **l_datums = a_chain->callback_atom_get_datums ? a_chain->callback_atom_get_datums(l_atom, l_atom_size, &l_datums_count) :
@@ -457,39 +453,47 @@ char* dap_db_history_addr(dap_chain_addr_t * a_addr, dap_chain_t * a_chain, cons
                     DAP_DELETE(l_tx_data);
                     continue;
                 }
+
                 strncpy(l_tx_data->token_ticker, l_tx_data_prev->token_ticker, DAP_CHAIN_TICKER_SIZE_MAX);
-                dap_chain_datum_tx_t *l_tx_prev = (dap_chain_datum_tx_t *)l_tx_data_prev->datum->data;
-                dap_list_t *l_list_prev_out_items = dap_chain_datum_tx_items_get(l_tx_prev, TX_ITEM_TYPE_OUT_OLD, NULL);
-                dap_list_t *l_list_out_prev_item = dap_list_nth(l_list_prev_out_items, l_tx_in->header.tx_out_prev_idx);
-                l_src_addr = &((dap_chain_tx_out_old_t *)l_list_out_prev_item->data)->addr;
-                l_src_addr_str = dap_chain_addr_to_str(l_src_addr);
+
+                dap_chain_datum_tx_t *l_tx_prev;
+                dap_list_t *l_list_prev_out_items = NULL, *l_list_out_prev_item;
+
+                if ( (l_tx_prev = (dap_chain_datum_tx_t *)l_tx_data_prev->datum->data) )
+                    if ( (l_list_prev_out_items = dap_chain_datum_tx_items_get(l_tx_prev, TX_ITEM_TYPE_OUT, NULL)) )
+                        if ( (l_list_out_prev_item = dap_list_nth(l_list_prev_out_items, l_tx_in->header.tx_out_prev_idx)) )
+                            {
+                            l_src_addr = &((dap_chain_tx_out_t *)l_list_out_prev_item->data)->addr;
+                            l_src_addr_str = dap_chain_addr_to_str(l_src_addr);
+                            }
+
                 dap_list_free(l_list_prev_out_items);
             }
             dap_list_free(l_list_in_items);
 
             dap_hash_fast(l_tx, dap_chain_datum_tx_get_size(l_tx), &l_tx_data->tx_hash);
+
             // transaction time
-            char *l_time_str = NULL;
-            {
-                if (l_tx->header.ts_created > 0) {
-                    time_t rawtime = (time_t)l_tx->header.ts_created;
-                    struct tm *timeinfo;
-                    timeinfo = localtime(&rawtime);
-                    if(timeinfo)
-                        l_time_str = dap_strdup(asctime(timeinfo));
-                } else
-                    l_time_str = dap_strdup(" ");
+            l_time_str[0] = ' ', l_time_str[1] = '\0';                      /* Prefill string with the space */
+
+            if ( l_tx->header.ts_created) {
+                struct tm l_tm;                                             /* Convert ts to  Sat May 17 01:17:08 2014 */
+                uint64_t l_ts = l_tx->header.ts_created;
+                if ( (localtime_r((time_t *) &l_ts, &l_tm )) )
+                    asctime_r (&l_tm, l_time_str);
             }
+
             char *l_tx_hash_str;
             if (!dap_strcmp(a_hash_out_type, "hex"))
                 l_tx_hash_str = dap_hash_fast_to_str_new(&l_tx_data->tx_hash);
             else
                 l_tx_hash_str = dap_enc_base58_encode_to_str(&l_tx_data->tx_hash_str, sizeof(dap_chain_hash_fast_t));
+
             // find OUT items
             bool l_header_printed = false;
-            dap_list_t *l_list_out_items = dap_chain_datum_tx_items_get(l_tx, TX_ITEM_TYPE_OUT_OLD, NULL);
+            dap_list_t *l_list_out_items = dap_chain_datum_tx_items_get(l_tx, TX_ITEM_TYPE_OUT, NULL);
             for (dap_list_t *l_list_out = l_list_out_items; l_list_out; l_list_out = dap_list_next(l_list_out)) {
-                dap_chain_tx_out_old_t *l_tx_out = (dap_chain_tx_out_old_t *)l_list_out->data;
+                dap_chain_tx_out_t *l_tx_out = (dap_chain_tx_out_t *)l_list_out->data;
                 if (l_src_addr && !memcmp(&l_tx_out->addr, l_src_addr, sizeof(dap_chain_addr_t)))
                     continue;   // send to self
                 if (l_src_addr && !memcmp(l_src_addr, a_addr, sizeof(dap_chain_addr_t))) {
@@ -498,27 +502,30 @@ char* dap_db_history_addr(dap_chain_addr_t * a_addr, dap_chain_t * a_chain, cons
                         l_header_printed = true;
                     }
                     char *l_dst_addr_str = dap_chain_addr_to_str(&l_tx_out->addr);
-                    dap_string_append_printf(l_str_out, "\tsend %"DAP_UINT64_FORMAT_U" %s to %s\n",
-                                             l_tx_out->header.value,
+                    char *l_value_str = dap_chain_balance_print(l_tx_out->header.value);
+                    dap_string_append_printf(l_str_out, "\tsend %s %s to %s\n",
+                                             l_value_str,
                                              l_tx_data->token_ticker,
                                              l_dst_addr_str);
                     DAP_DELETE(l_dst_addr_str);
+                    DAP_DELETE(l_value_str);
                 }
                 if (!memcmp(&l_tx_out->addr, a_addr, sizeof(dap_chain_addr_t))) {
                     if (!l_header_printed) {
                         dap_string_append_printf(l_str_out, "TX hash %s\n\t%s", l_tx_hash_str, l_time_str);
                         l_header_printed = true;
                     }
-                    dap_string_append_printf(l_str_out, "\trecv %"DAP_UINT64_FORMAT_U" %s from %s\n",
-                                             l_tx_out->header.value,
+                    char *l_value_str = dap_chain_balance_print(l_tx_out->header.value);
+                    dap_string_append_printf(l_str_out, "\trecv %s %s from %s\n",
+                                             l_value_str,
                                              l_tx_data->token_ticker,
                                              l_src_addr ? l_src_addr_str : "emission");
+                    DAP_DELETE(l_value_str);
                 }
             }
             dap_list_free(l_list_out_items);
             DAP_DELETE(l_src_addr_str);
             DAP_DELETE(l_tx_hash_str);
-            DAP_DELETE(l_time_str);
 
             size_t l_datum_size = dap_chain_datum_tx_get_size(l_tx) + sizeof(dap_chain_datum_t);
             l_tx_data->datum = DAP_NEW_SIZE(dap_chain_datum_t, l_datum_size);
@@ -782,11 +789,12 @@ int com_ledger(int a_argc, char ** a_argv, char **a_str_reply)
     } else if (dap_chain_node_cli_find_option_val(a_argv, 1, 2, "tx", NULL)){
         l_cmd = CMD_TX_HISTORY;
     } else if (dap_chain_node_cli_find_option_val(a_argv, 2, 3, "info", NULL))
-        l_cmd = CMD_TX_INFO; 
+        l_cmd = CMD_TX_INFO;
+
+    bool l_is_all = dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-all", NULL);
 
     // command tx_history
     if(l_cmd == CMD_TX_HISTORY) {
-        bool l_is_all = dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-all", NULL);
         dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-addr", &l_addr_base58);
         dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-w", &l_wallet_name);
         dap_chain_node_cli_find_option_val(a_argv, 0, a_argc, "-net", &l_net_str);
@@ -919,19 +927,21 @@ int com_ledger(int a_argc, char ** a_argv, char **a_str_reply)
         int l_sub_cmd = SUBCMD_NONE;
         dap_chain_hash_fast_t l_tx_threshold_hash;
         if (dap_chain_node_cli_find_option_val(a_argv, 2, 3, "coins", NULL ))
-                l_sub_cmd = SUBCMD_LIST_COIN;
+            l_sub_cmd = SUBCMD_LIST_COIN;
+        if (dap_chain_node_cli_find_option_val(a_argv, 2, 3, "balance", NULL ))
+            l_sub_cmd = SUB_CMD_LIST_LEDGER_BALANCE;
         if (dap_chain_node_cli_find_option_val(a_argv, 2, a_argc, "threshold", NULL)){
             l_sub_cmd = SUB_CMD_LIST_LEDGER_THRESHOLD;
             const char* l_tx_threshold_hash_str = NULL;
             dap_chain_node_cli_find_option_val(a_argv, 3, a_argc, "-hash", &l_tx_threshold_hash_str);
-            if (l_tx_threshold_hash_str){          
+            if (l_tx_threshold_hash_str){
                 l_sub_cmd = SUB_CMD_LIST_LEDGER_THRESHOLD_WITH_HASH;
                 if (dap_chain_hash_fast_from_str(l_tx_threshold_hash_str, &l_tx_threshold_hash)){
                     l_tx_hash_str = NULL;
                     dap_chain_node_cli_set_reply_text(a_str_reply, "tx threshold hash not recognized");
                     return -1;
                 }
-            }     
+            }
         }
         if (l_sub_cmd == SUBCMD_NONE) {
             dap_chain_node_cli_set_reply_text(a_str_reply, "Command 'list' requires subcommands 'coins' or 'threshold'");
@@ -953,7 +963,7 @@ int com_ledger(int a_argc, char ** a_argv, char **a_str_reply)
                 dap_chain_node_cli_set_reply_text(a_str_reply, l_str_ret->str);
                 dap_string_free(l_str_ret, true);
             }
-                
+
             return 0;
         }
         if (l_sub_cmd == SUB_CMD_LIST_LEDGER_THRESHOLD_WITH_HASH){
@@ -969,7 +979,7 @@ int com_ledger(int a_argc, char ** a_argv, char **a_str_reply)
                 dap_chain_node_cli_set_reply_text(a_str_reply, l_str_ret->str);
                 dap_string_free(l_str_ret, true);
             }
-                
+
             return 0;
         }
         dap_string_t *l_str_ret = dap_string_new("");
diff --git a/modules/net/dap_chain_node_client.c b/modules/net/dap_chain_node_client.c
index b72a6e8114aef279b1fe4d4ec01c89bd0cc385c1..6a53d0cca80f206dc8851e3d5db0b64417cfa3b2 100644
--- a/modules/net/dap_chain_node_client.c
+++ b/modules/net/dap_chain_node_client.c
@@ -233,6 +233,8 @@ dap_chain_node_sync_status_t dap_chain_node_client_start_sync(dap_events_socket_
                             dap_stream_ch_chain_pkt_write_unsafe(l_node_client->ch_chain, DAP_STREAM_CH_CHAIN_PKT_TYPE_UPDATE_GLOBAL_DB_REQ,
                                                                  l_net->pub.id.uint64, 0, 0,
                                                                  &l_sync_gdb, sizeof(l_sync_gdb));
+                            if (!l_ch_chain->activity_timer)
+                                dap_stream_ch_chain_timer_start(l_ch_chain);
                             return NODE_SYNC_STATUS_STARTED;
                         } else
                             return NODE_SYNC_STATUS_WAITING;
@@ -554,8 +556,14 @@ static void s_ch_chain_callback_notify_packet_out(dap_stream_ch_chain_t* a_ch_ch
             dap_chain_node_addr_t *l_node_addr = dap_chain_net_get_cur_addr(l_net);
             log_it(L_DEBUG, "In: State node %s."NODE_ADDR_FP_STR" is timeout for sync", l_net->pub.name, NODE_ADDR_FP_ARGS(l_node_addr));
             l_node_client->state = NODE_CLIENT_STATE_ERROR;
-            dap_chain_net_sync_unlock(l_net, l_node_client);
             dap_timerfd_reset(l_node_client->sync_timer);
+            bool l_have_waiting = dap_chain_net_sync_unlock(l_net, l_node_client);
+            if (!l_have_waiting) {
+                if (dap_chain_net_get_target_state(l_net) == NET_STATE_ONLINE)
+                    dap_chain_net_set_state(l_net, NET_STATE_ONLINE);
+                else
+                    dap_chain_net_state_go_to(l_net, NET_STATE_OFFLINE);
+            }
         } break;
         case DAP_STREAM_CH_CHAIN_PKT_TYPE_DELETE: {
             dap_chain_node_client_close(l_node_client);
diff --git a/modules/net/dap_chain_node_dns_client.c b/modules/net/dap_chain_node_dns_client.c
index 419841a1c9e00d0c5f51f1f13b19828c64c2aa1f..1122be737e9606639e4952727a6ea6d224ad2523 100644
--- a/modules/net/dap_chain_node_dns_client.c
+++ b/modules/net/dap_chain_node_dns_client.c
@@ -260,7 +260,7 @@ int dap_chain_node_info_dns_request(struct in_addr a_addr, uint16_t a_port, char
     l_esocket_callbacks.error_callback = s_dns_client_esocket_error_callback; // Error processing function
 
     dap_events_socket_t * l_esocket = dap_events_socket_create(DESCRIPTOR_TYPE_SOCKET_UDP,&l_esocket_callbacks);
-    l_esocket->flags |= DAP_SOCK_READY_TO_WRITE;
+    // l_esocket->flags  |= DAP_SOCK_DROP_WRITE_IF_ZERO;
     l_esocket->remote_addr.sin_family = AF_INET;
     l_esocket->remote_addr.sin_port = htons(a_port);
     l_esocket->remote_addr.sin_addr = a_addr;
diff --git a/modules/net/include/dap_chain_net.h b/modules/net/include/dap_chain_net.h
index dc0a4bebcf88ff6baf006d5c27a07e3b9e0849e0..4e8d1438de9a1a76a3a3630c50237fd483df6a79 100644
--- a/modules/net/include/dap_chain_net.h
+++ b/modules/net/include/dap_chain_net.h
@@ -28,6 +28,7 @@ along with any CellFrame SDK based project.  If not, see <http://www.gnu.org/lic
 #include <stdint.h>
 #include <string.h>
 #include "dap_net.h"
+#include "dap_stream.h"
 #include "dap_strfuncs.h"
 #include "dap_string.h"
 #include "dap_chain_common.h"
@@ -129,6 +130,7 @@ dap_chain_t * dap_chain_net_get_chain_by_name( dap_chain_net_t * l_net, const ch
 dap_chain_node_addr_t * dap_chain_net_get_cur_addr( dap_chain_net_t * l_net);
 uint64_t dap_chain_net_get_cur_addr_int(dap_chain_net_t * l_net);
 dap_chain_cell_id_t * dap_chain_net_get_cur_cell( dap_chain_net_t * l_net);
+const char* dap_chain_net_get_type(dap_chain_t *l_chain);
 
 dap_list_t* dap_chain_net_get_link_node_list(dap_chain_net_t * l_net, bool a_is_only_cur_cell);
 dap_list_t* dap_chain_net_get_node_list(dap_chain_net_t * l_net);
@@ -186,6 +188,7 @@ bool dap_chain_net_get_add_gdb_group(dap_chain_net_t *a_net, dap_chain_node_addr
 
 int dap_chain_net_verify_datum_for_add(dap_chain_net_t *a_net, dap_chain_datum_t * a_datum );
 void dap_chain_net_dump_datum(dap_string_t *a_str_out, dap_chain_datum_t *a_datum, const char *a_hash_out_type);
+int dap_chain_net_add_downlink(dap_chain_net_t *a_net, dap_stream_worker_t *a_worker, dap_stream_ch_uuid_t a_ch_uuid);
 void dap_chain_net_add_gdb_notify_callback(dap_chain_net_t *a_net, dap_global_db_obj_callback_notify_t a_callback, void *a_cb_arg);
 void dap_chain_net_sync_gdb_broadcast(void *a_arg, const char a_op_code, const char *a_group,
                                       const char *a_key, const void *a_value, const size_t a_value_len);
diff --git a/modules/net/include/dap_chain_node.h b/modules/net/include/dap_chain_node.h
index 8b5c36720ceafb00e6bc40d265f08f7851b41aff..4149f22028cee3b0a2059c398e24dfaaf6e10f92 100644
--- a/modules/net/include/dap_chain_node.h
+++ b/modules/net/include/dap_chain_node.h
@@ -40,6 +40,7 @@
 
 
 #include "dap_common.h"
+#include "dap_list.h"
 #include "dap_worker.h"
 #include "dap_events_socket.h"
 
@@ -100,6 +101,9 @@ typedef struct dap_chain_node_publ{
     dap_chain_node_info_t node_info;
 } DAP_ALIGN_PACKED dap_chain_node_publ_t;
 
+
+typedef dap_list_t dap_chain_node_info_list_t;
+
 #define DAP_CHAIN_NODE_MEMPOOL_INTERVAL 1000    // milliseconds
 
 /**
@@ -107,6 +111,19 @@ typedef struct dap_chain_node_publ{
  */
 size_t dap_chain_node_info_get_size(dap_chain_node_info_t *node_info);
 
+
+/**
+ * Compare addresses of two dap_chain_node_info_t structures
+ *
+ * @return True if addresses are equal, otherwise false
+ */
+bool dap_chain_node_info_addr_match(dap_chain_node_info_t *node_info1, dap_chain_node_info_t *node_info2);
+
+/**
+ * Compare two struct dap_chain_node_info_t
+ */
+bool dap_chain_node_info_match(dap_chain_node_info_t *node_info1, dap_chain_node_info_t *node_info2);
+
 /**
  * Serialize dap_chain_node_info_t
  * size[out] - length of output string
@@ -147,3 +164,22 @@ inline static char* dap_chain_node_addr_to_hash_str(dap_chain_node_addr_t *addre
 int dap_chain_node_mempool_process(dap_chain_t *a_chain, dap_chain_datum_t *a_datum);
 bool dap_chain_node_mempool_autoproc_init();
 void dap_chain_node_mempool_autoproc_deinit();
+
+/**
+ * @brief Find a_node_info in the a_node_list
+ */
+bool dap_chain_node_info_list_is_added(dap_chain_node_info_list_t *a_node_list, dap_chain_node_info_t *a_node_info);
+
+/**
+ * @brief Add a_node_info to the a_node_list
+ */
+dap_chain_node_info_list_t* dap_chain_node_info_list_add(dap_chain_node_info_list_t *a_node_list, dap_chain_node_info_t *a_node_info);
+/**
+ * @brief Remove a_node_info from the a_node_list
+ */
+dap_chain_node_info_list_t* dap_chain_node_info_list_del(dap_chain_node_info_list_t *a_node_list, dap_chain_node_info_t *a_node_info);
+
+/**
+ * @brief Free a_node_list
+ */
+void dap_chain_node_info_list_free(dap_chain_node_info_list_t *a_node_list);
diff --git a/modules/net/srv/dap_chain_net_srv.c b/modules/net/srv/dap_chain_net_srv.c
index 4c0afa65f6c6c27ccaf71c81874e643d6d5d78ce..56114f311e12a8e62d5ed6bb0834ed3967d19e73 100644
--- a/modules/net/srv/dap_chain_net_srv.c
+++ b/modules/net/srv/dap_chain_net_srv.c
@@ -107,7 +107,7 @@ int dap_chain_net_srv_init()
         "\tOrder delete\n"
         "net_srv -net <chain net name> order dump -hash <Order hash>\n"
         "\tOrder dump info\n"
-        "net_srv -net <chain net name> order create -direction <sell | buy> -srv_uid <Service UID> -price <Price>\n"
+        "net_srv -net <chain net name> order create -direction {sell | buy} -srv_uid <Service UID> -price <Price>\n"
         "        -price_unit <Price Unit> -price_token <Token ticker> [-node_addr <Node Address>] [-tx_cond <TX Cond Hash>]\n"
         "        [-expires <Unix time when expires>] [-cert <cert name to sign order>]\n"
         "        [{-ext <Extension with params> | -region <Region name> -continent <Continent name>}]\n"
@@ -466,7 +466,7 @@ static int s_cli_net_srv( int argc, char **argv, char **a_str_reply)
                 dap_chain_net_srv_uid_t l_srv_uid={{0}};
                 dap_chain_node_addr_t l_node_addr={0};
                 dap_chain_hash_fast_t l_tx_cond_hash={{0}};
-                dap_chain_time_t l_expires=0; // TS when the service expires
+                dap_time_t l_expires=0; // TS when the service expires
                 uint256_t l_price = {};
                 char l_price_token[DAP_CHAIN_TICKER_SIZE_MAX]={0};
                 dap_chain_net_srv_price_unit_uid_t l_price_unit={{0}};
@@ -484,7 +484,7 @@ static int s_cli_net_srv( int argc, char **argv, char **a_str_reply)
 
 
                 if (l_expires_str)
-                    l_expires = (dap_chain_time_t ) atoll( l_expires_str);
+                    l_expires = (dap_time_t ) atoll( l_expires_str);
                 l_srv_uid.uint64 = (uint64_t) atoll( l_srv_uid_str);
                 if (l_node_addr_str){
 
diff --git a/modules/net/srv/dap_chain_net_srv_order.c b/modules/net/srv/dap_chain_net_srv_order.c
index 07406de49096a8a93ae64fd376752290b332cc29..096384d333e8f0d4b25e44d2dc0c9380f7ef7a23 100644
--- a/modules/net/srv/dap_chain_net_srv_order.c
+++ b/modules/net/srv/dap_chain_net_srv_order.c
@@ -250,7 +250,7 @@ char * dap_chain_net_srv_order_create(
         uint256_t a_price, //  service price in datoshi, for SERV_CLASS_ONCE ONCE for the whole service, for SERV_CLASS_PERMANENT  for one unit.
         dap_chain_net_srv_price_unit_uid_t a_price_unit, // Unit of service (seconds, megabytes, etc.) Only for SERV_CLASS_PERMANENT
         const char a_price_ticker[DAP_CHAIN_TICKER_SIZE_MAX],
-        dap_chain_time_t a_expires, // TS when the service expires
+        dap_time_t a_expires, // TS when the service expires
         const uint8_t *a_ext,
         uint32_t a_ext_size,
         const char *a_region,
@@ -277,7 +277,7 @@ dap_chain_net_srv_order_t *dap_chain_net_srv_order_compose(
         uint256_t a_price, //  service price in datoshi, for SERV_CLASS_ONCE ONCE for the whole service, for SERV_CLASS_PERMANENT  for one unit.
         dap_chain_net_srv_price_unit_uid_t a_price_unit, // Unit of service (seconds, megabytes, etc.) Only for SERV_CLASS_PERMANENT
         const char a_price_ticker[DAP_CHAIN_TICKER_SIZE_MAX],
-        dap_chain_time_t a_expires, // TS when the service expires
+        dap_time_t a_expires, // TS when the service expires
         const uint8_t *a_ext,
         uint32_t a_ext_size,
         const char *a_region,
@@ -302,7 +302,7 @@ dap_chain_net_srv_order_t *dap_chain_net_srv_order_compose(
     l_order->version = 3;
     l_order->srv_uid = a_srv_uid;
     l_order->direction = a_direction;
-    l_order->ts_created = (dap_chain_time_t) time(NULL);
+    l_order->ts_created = dap_time_now();
 
     if ( a_node_addr.uint64)
         l_order->node_addr.uint64 = a_node_addr.uint64;
@@ -437,7 +437,7 @@ int dap_chain_net_srv_order_find_all_by(dap_chain_net_t * a_net,const dap_chain_
     log_it( L_DEBUG, "Loaded %zu orders", l_orders_count);
     dap_chain_net_srv_order_t *l_order = NULL;
     *a_output_orders = NULL;
-    *a_output_orders_count = 0;
+    size_t l_output_orders_count = 0;
     size_t l_orders_size = 0;
     for (size_t i = 0; i < l_orders_count; i++) {
         DAP_DEL_Z(l_order);
@@ -475,8 +475,9 @@ int dap_chain_net_srv_order_find_all_by(dap_chain_net_t * a_net,const dap_chain_
         *a_output_orders = DAP_REALLOC(*a_output_orders, l_orders_size + l_order_mem_size);
         memcpy((byte_t *)*a_output_orders + l_orders_size, l_order, l_order_mem_size);
         l_orders_size += l_order_mem_size;
-        a_output_orders_count++;
+        l_output_orders_count++;
     }
+    *a_output_orders_count = l_output_orders_count;
     DAP_DEL_Z(l_order);
     dap_chain_global_db_objs_delete(l_orders, l_orders_count);
     DAP_DELETE(l_gdb_group_str);
diff --git a/modules/net/srv/include/dap_chain_net_srv_order.h b/modules/net/srv/include/dap_chain_net_srv_order.h
index 0923e8b8f3a0d5813a9e9c5e1669ba91562fc372..e405b6b435c532bb687a7fcaec6a082a1c71b3b5 100644
--- a/modules/net/srv/include/dap_chain_net_srv_order.h
+++ b/modules/net/srv/include/dap_chain_net_srv_order.h
@@ -38,8 +38,8 @@ typedef struct dap_chain_net_srv_order_old
     dap_chain_node_addr_t node_addr; // Node address that servs the order (if present)
     dap_chain_hash_fast_t tx_cond_hash; // Hash index of conditioned transaction attached with order
     dap_chain_net_srv_price_unit_uid_t price_unit; // Unit of service (seconds, megabytes, etc.) Only for SERV_CLASS_PERMANENT
-    dap_chain_time_t ts_created;
-    dap_chain_time_t ts_expires;
+    dap_time_t ts_created;
+    dap_time_t ts_expires;
     uint64_t price; //  service price in datoshi, for SERV_CLASS_ONCE ONCE for the whole service, for SERV_CLASS_PERMANENT  for one unit.
     char price_ticker[DAP_CHAIN_TICKER_SIZE_MAX]; // Token ticker to pay for service
     //uint8_t continent;
@@ -60,8 +60,8 @@ typedef struct dap_chain_net_srv_order
     dap_chain_node_addr_t node_addr; // Node address that servs the order (if present)
     dap_chain_hash_fast_t tx_cond_hash; // Hash index of conditioned transaction attached with order
     dap_chain_net_srv_price_unit_uid_t price_unit; // Unit of service (seconds, megabytes, etc.) Only for SERV_CLASS_PERMANENT
-    dap_chain_time_t ts_created;
-    dap_chain_time_t ts_expires;
+    dap_time_t ts_created;
+    dap_time_t ts_expires;
     uint256_t price; //  service price in datoshi, for SERV_CLASS_ONCE ONCE for the whole service, for SERV_CLASS_PERMANENT  for one unit.
     char price_ticker[DAP_CHAIN_TICKER_SIZE_MAX]; // Token ticker to pay for service
     uint32_t ext_size;
@@ -122,7 +122,7 @@ char *dap_chain_net_srv_order_create(dap_chain_net_t * a_net,
         uint256_t a_price, //  service price in datoshi, for SERV_CLASS_ONCE ONCE for the whole service, for SERV_CLASS_PERMANENT  for one unit.
         dap_chain_net_srv_price_unit_uid_t a_price_unit, // Unit of service (seconds, megabytes, etc.) Only for SERV_CLASS_PERMANENT
         const char a_price_ticker[],
-        dap_chain_time_t a_expires, // TS when the service expires
+        dap_time_t a_expires, // TS when the service expires
         const uint8_t *a_ext,
         uint32_t a_ext_size,
         const char *a_region,
@@ -139,7 +139,7 @@ dap_chain_net_srv_order_t *dap_chain_net_srv_order_compose(
         uint256_t a_price, //  service price in datoshi, for SERV_CLASS_ONCE ONCE for the whole service, for SERV_CLASS_PERMANENT  for one unit.
         dap_chain_net_srv_price_unit_uid_t a_price_unit, // Unit of service (seconds, megabytes, etc.) Only for SERV_CLASS_PERMANENT
         const char a_price_ticker[DAP_CHAIN_TICKER_SIZE_MAX],
-        dap_chain_time_t a_expires, // TS when the service expires
+        dap_time_t a_expires, // TS when the service expires
         const uint8_t *a_ext,
         uint32_t a_ext_size,
         const char *a_region,
diff --git a/modules/service/stake/dap_chain_net_srv_stake.c b/modules/service/stake/dap_chain_net_srv_stake.c
index 2412f93546a5e0c957ed491343eec8adfe5197bb..9edc1f3b0720df6149bc499006f7d1c166a88772 100644
--- a/modules/service/stake/dap_chain_net_srv_stake.c
+++ b/modules/service/stake/dap_chain_net_srv_stake.c
@@ -53,11 +53,9 @@ int dap_chain_net_srv_stake_init()
         "\tThe fee with specified percent with this delagation will be returned to the fee address pointed by delegator\n"
     "srv_stake order declare -net <net name> -wallet <name> -token <ticker> -coins <value> -fee_percent <value>"
         "\tCreate a new order with specified amount of datoshi and fee which holder is ready to stake.\n"
-    "srv_stake order remove -net <net name> -order <order hash> [-H <hex | base58(default)>]\n"
+    "srv_stake order remove -net <net name> -order <order hash> [-H {hex | base58(default)}]\n"
          "\tRemove order with specified hash\n"
-    "srv_stake order update -net <net name> -order <order hash> {-cert <name> | -wallet <name>} [-H <hex | base58(default)>]"
-                            "{[-addr_hldr <addr>] [-token <ticker>] [-coins <value>] [-fee_percent <value>] |"
-                            " | [-token <ticker>] [-coins <value>] -fee_percent <value>]\n"
+    "srv_stake order update -net <net name> -order <order hash> {-cert <name> | -wallet <name>} [-H {hex | base58(default)}]{[-addr_hldr <addr>] [-token <ticker>] [-coins <value>] [-fee_percent <value>] | [-token <ticker>] [-coins <value>] -fee_percent <value>]}\n"
          "\tUpdate order with specified hash\n"
     "srv_stake order list -net <net name>\n"
          "\tGet the stake orders list within specified net name\n"
@@ -65,12 +63,14 @@ int dap_chain_net_srv_stake_init()
          "\tDelegate tokens with specified order within specified net name. Specify fee address\n"
     "srv_stake approve -net <net name> -tx <transaction hash> -cert <root cert name>\n"
          "\tApprove stake transaction by root node certificate within specified net name.\n"
-    "srv_stake transactions -net <net name> {-addr <addr from>}\n"
+    "srv_stake transactions -net <net name> [-addr <addr from>]\n"
          "\tShow the list of requested, active and canceled stake transactions (optional delegated from addr)\n"
     "srv_stake invalidate -net <net name> -tx <transaction hash> -wallet <wallet name>\n"
          "\tInvalidate requested stake transaction by hash within net name and return stake to specified wallet\n"
     );
+
     s_srv_stake = DAP_NEW_Z(dap_chain_net_srv_stake_t);
+    
     uint16_t l_net_count;
     dap_chain_net_t **l_net_list = dap_chain_net_list(&l_net_count);
     for (uint16_t i = 0; i < l_net_count; i++) {
@@ -152,11 +152,16 @@ void dap_chain_net_srv_stake_deinit()
 static void s_stake_update(dap_chain_tx_out_cond_t *a_cond, dap_chain_datum_tx_t *a_tx, bool a_authorized)
 {
     dap_chain_net_srv_stake_item_t *l_stake;
-    if (a_cond)
+    if (a_cond) {
         HASH_FIND(hh, s_srv_stake->itemlist, &a_cond->subtype.srv_stake.signing_addr, sizeof(dap_chain_addr_t), l_stake);
-    else
+    }
+    else {
         l_stake = DAP_NEW_Z(dap_chain_net_srv_stake_item_t);
-    assert(l_stake);
+    }
+    // assert(l_stake);
+    if (!l_stake) {
+        return;
+    }
     dap_chain_tx_out_cond_t *l_out_cond = (dap_chain_tx_out_cond_t *)dap_chain_datum_tx_item_get(a_tx, NULL, TX_ITEM_TYPE_OUT_COND, NULL);
     if (!l_out_cond || l_out_cond->header.subtype != DAP_CHAIN_TX_OUT_COND_SUBTYPE_SRV_STAKE) {
         // Stake tx is used out
@@ -169,7 +174,8 @@ static void s_stake_update(dap_chain_tx_out_cond_t *a_cond, dap_chain_datum_tx_t
         // New stake transaction
         memcpy(&l_stake->signing_addr, &l_out_cond->subtype.srv_stake.signing_addr, sizeof(dap_chain_addr_t));
         HASH_ADD(hh, s_srv_stake->itemlist, signing_addr, sizeof(dap_chain_addr_t), l_stake);
-    } else if (memcmp(&a_cond->subtype.srv_stake.signing_addr, &l_out_cond->subtype.srv_stake.signing_addr, sizeof(dap_chain_addr_t))) {
+    }
+    else if (memcmp(&a_cond->subtype.srv_stake.signing_addr, &l_out_cond->subtype.srv_stake.signing_addr, sizeof(dap_chain_addr_t))) {
         HASH_DEL(s_srv_stake->itemlist, l_stake);
         dap_chain_net_srv_stake_item_t *l_stake_cur = NULL;
         HASH_FIND(hh, s_srv_stake->itemlist, &l_out_cond->subtype.srv_stake.signing_addr, sizeof(dap_chain_addr_t), l_stake_cur);
@@ -181,8 +187,9 @@ static void s_stake_update(dap_chain_tx_out_cond_t *a_cond, dap_chain_datum_tx_t
         if (l_stake_cur)
             HASH_ADD(hh, s_srv_stake->itemlist, signing_addr, sizeof(dap_chain_addr_t), l_stake);
     }
-    if (a_authorized)
+    if (a_authorized) {
         l_stake->is_active = true;
+    }
     memcpy(&l_stake->addr_hldr, &l_out_cond->subtype.srv_stake.hldr_addr, sizeof(dap_chain_addr_t));
     memcpy(&l_stake->addr_fee, &l_out_cond->subtype.srv_stake.fee_addr, sizeof(dap_chain_addr_t));
     l_stake->fee_value = l_out_cond->subtype.srv_stake.fee_value;
@@ -235,11 +242,17 @@ static bool s_stake_conditions_calc(dap_chain_tx_out_cond_t *a_cond, dap_chain_d
 
 bool dap_chain_net_srv_stake_verificator(dap_chain_tx_out_cond_t *a_cond, dap_chain_datum_tx_t *a_tx, bool a_owner)
 {
+    if (!s_srv_stake) {
+        return false;
+    }
     return s_stake_conditions_calc(a_cond, a_tx, a_owner, false);
 }
 
 bool dap_chain_net_srv_stake_updater(dap_chain_tx_out_cond_t *a_cond, dap_chain_datum_tx_t *a_tx, bool a_owner)
 {
+    if (!s_srv_stake) {
+        return false;
+    }
     return s_stake_conditions_calc(a_cond, a_tx, a_owner, true);
 }
 
@@ -418,7 +431,8 @@ static bool s_stake_tx_put(dap_chain_datum_tx_t *a_tx, dap_chain_net_t *a_net)
     // Put the transaction to mempool or directly to chains
     size_t l_tx_size = dap_chain_datum_tx_get_size(a_tx);
     dap_chain_datum_t *l_datum = dap_chain_datum_create(DAP_CHAIN_DATUM_TX, a_tx, l_tx_size);
-    DAP_DELETE(a_tx);
+    // don't delete a_tx because in s_cli_srv_stake() after this function calc hash this tx
+    // DAP_DELETE(a_tx);
     dap_chain_t *l_chain = dap_chain_net_get_chain_by_chain_type(a_net, CHAIN_TYPE_TX);
     if (!l_chain) {
         return false;
@@ -1248,7 +1262,8 @@ static int s_cli_srv_stake(int a_argc, char **a_argv, char **a_str_reply)
             dap_chain_wallet_close(l_wallet);
             if (l_success) {
                 dap_chain_node_cli_set_reply_text(a_str_reply, "Stake successfully returned to owner");
-                HASH_DEL(s_srv_stake->itemlist, l_stake);
+                // don't delete stake here because it delete in s_stake_update after invalidate tx approve
+                // HASH_DEL(s_srv_stake->itemlist, l_stake);
             } else {
                 dap_chain_node_cli_set_reply_text(a_str_reply, "Can't invalidate transaction %s", l_tx_hash_str);
                 return -21;
diff --git a/modules/service/vpn/dap_chain_net_vpn_client.c b/modules/service/vpn/dap_chain_net_vpn_client.c
index 4f1b396672dc6ccbecf6563d361c2b1cc8d69829..3246500704fb1d82e60ffd791ce1022e7c0a86cd 100644
--- a/modules/service/vpn/dap_chain_net_vpn_client.c
+++ b/modules/service/vpn/dap_chain_net_vpn_client.c
@@ -558,7 +558,8 @@ int dap_chain_net_vpn_client_check(dap_chain_net_t *a_net, const char *a_ipv4_st
             if(a_ipv4_str)
                 memcpy(l_request->ip_recv, a_ipv4_str, min(sizeof(l_request->ip_recv), strlen(a_ipv4_str)));
             l_request->time_connect_ms = l_dtime_connect_ms;
-            gettimeofday(&l_request->send_time1, NULL);
+            gettimeofday(&l_t, NULL);
+            l_t = l_request->send_time1;
             size_t l_request_size = l_request->data_size + sizeof(dap_stream_ch_chain_net_srv_pkt_test_t);
             dap_stream_ch_pkt_write_unsafe(l_ch, DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_CHECK_REQUEST, l_request, l_request_size);
             dap_stream_ch_set_ready_to_write_unsafe(l_ch, true);
diff --git a/modules/service/xchange/dap_chain_net_srv_xchange.c b/modules/service/xchange/dap_chain_net_srv_xchange.c
index 8d6e9724f3dbabb48c970d0060ebb5acf5e8887b..c96bbe1a95522bbd0652d4674f17124ecbb79fa3 100644
--- a/modules/service/xchange/dap_chain_net_srv_xchange.c
+++ b/modules/service/xchange/dap_chain_net_srv_xchange.c
@@ -50,15 +50,13 @@ static dap_chain_net_srv_xchange_t *s_srv_xchange;
 int dap_chain_net_srv_xchange_init()
 {
     dap_chain_node_cli_cmd_item_create("srv_xchange", s_cli_srv_xchange, "eXchange service commands",
-    "srv_xchange price create -net_sell <net name> -token_sell <token ticker> -net_buy <net_name> -token_buy <token ticker>"
-                                        "-wallet <name> -coins <value> -rate <value>\n"
+    "srv_xchange price create -net_sell <net name> -token_sell <token ticker> -net_buy <net_name> -token_buy <token ticker> -wallet <name> -coins <value> -rate <value>\n"
         "\tCreate a new price with specified amount of datoshi to exchange with specified rate (sell : buy)\n"
     "srv_xchange price remove -net_sell <net name> -token_sell <token ticker> -net_buy <net_name> -token_buy <token ticker>\n"
          "\tRemove price with specified tickers within specified net names\n"
     "srv_xchange price list\n"
          "\tList all active prices\n"
-    "srv_xchange price update -net_sell <net name> -token_sell <token ticker> -net_buy <net_name> -token_buy <token ticker>"
-                                        "{-coins <value> | rate <value> | -wallet <name>}\n"
+    "srv_xchange price update -net_sell <net name> -token_sell <token ticker> -net_buy <net_name> -token_buy <token ticker> {-coins <value> | rate <value> | -wallet <name>}\n"
          "\tUpdate price with specified tickers within specified net names\n"
     "srv_xchange orders -net <net name>\n"
          "\tGet the exchange orders list within specified net name\n"
diff --git a/modules/type/blocks/dap_chain_cs_blocks.c b/modules/type/blocks/dap_chain_cs_blocks.c
index a7d08c72a9a8abf12b653901461a4b0ae1b414e2..b19e3f0f45fad6847fba2b36559aa500d6ad7a5e 100644
--- a/modules/type/blocks/dap_chain_cs_blocks.c
+++ b/modules/type/blocks/dap_chain_cs_blocks.c
@@ -217,6 +217,11 @@ int dap_chain_cs_blocks_new(dap_chain_t * a_chain, dap_config_t * a_chain_config
     a_chain->callback_add_datums = s_callback_add_datums;
     a_chain->callback_purge = s_callback_cs_blocks_purge;
 
+    //dap_strdup_printf("%s.chain-%s.%s",l_net->pub.gdb_groups_prefix,l_chain->name,c_mempool_group_str);
+    //l_cs_blocks->gdb_group_datums_queue = "local.datums-queue.";
+    dap_chain_net_t *l_net = dap_chain_net_by_id(a_chain->net_id);
+    l_cs_blocks->gdb_group_datums_queue = dap_strdup_printf("local.datums-queue.chain-%s.%s",
+                                                        l_net->pub.gdb_groups_prefix, a_chain->name);
     l_cs_blocks->callback_new_block_del = s_new_block_delete;
 
     dap_chain_cs_blocks_pvt_t *l_cs_blocks_pvt = DAP_NEW_Z(dap_chain_cs_blocks_pvt_t);
@@ -368,6 +373,15 @@ static int s_cli_blocks(int a_argc, char ** a_argv, char **a_str_reply)
     if(dap_chain_node_cli_cmd_values_parse_net_chain(&arg_index, a_argc, a_argv, a_str_reply, &l_chain, &l_net) < 0)
         return -11;
 
+    const char *l_chain_type = dap_chain_net_get_type(l_chain);
+
+    if (!strstr(l_chain_type, "block_")){
+            dap_chain_node_cli_set_reply_text(a_str_reply,
+                        "Type of chain %s is not block. This chain with type %s is not supported by this command",
+                        l_chain->name, l_chain_type);
+            return -42;
+    }
+
     l_blocks = DAP_CHAIN_CS_BLOCKS(l_chain);
 
     // Parse commands
@@ -566,7 +580,8 @@ static int s_cli_blocks(int a_argc, char ** a_argv, char **a_str_reply)
 
                 HASH_ITER(hh,PVT(l_blocks)->block_cache_first,l_block_cache, l_block_cache_tmp ) {
                     char l_buf[50];
-                    ctime_r((time_t *)&l_block_cache->block->hdr.ts_created, l_buf);
+                    time_t l_ts = l_block_cache->block->hdr.ts_created;
+                    ctime_r(&l_ts, l_buf);
                     dap_string_append_printf(l_str_tmp,"\t%s: ts_create=%s",
                                              l_block_cache->block_hash_str, l_buf);
                 }
@@ -707,7 +722,6 @@ static int s_add_atom_to_blocks(dap_chain_cs_blocks_t * a_blocks, dap_ledger_t *
         res = s_add_atom_to_ledger(a_blocks, a_ledger, a_block_cache);
         if (res != 1) {
             log_it(L_INFO,"Block %s checked, but ledger declined", a_block_cache->block_hash_str );
-            // return res;
         }
         //All correct, no matter for result
         pthread_rwlock_wrlock( &PVT(a_blocks)->rwlock );
@@ -719,7 +733,7 @@ static int s_add_atom_to_blocks(dap_chain_cs_blocks_t * a_blocks, dap_ledger_t *
             PVT(a_blocks)->block_cache_last->next = a_block_cache;
         a_block_cache->prev = PVT(a_blocks)->block_cache_last;
         PVT(a_blocks)->block_cache_last = a_block_cache;
-
+        res = 1;
     } else {
         log_it(L_WARNING,"Block %s check failed: code %d", a_block_cache->block_hash_str,  res );
     }
@@ -802,22 +816,27 @@ static dap_chain_atom_verify_res_t s_callback_atom_add(dap_chain_t * a_chain, da
     dap_chain_atom_verify_res_t ret = ATOM_ACCEPT;
     dap_chain_cs_blocks_t * l_blocks = DAP_CHAIN_CS_BLOCKS(a_chain);
     dap_chain_block_t * l_block = (dap_chain_block_t *) a_atom;
+
+    pthread_rwlock_wrlock(&PVT(l_blocks)->datums_lock);
     dap_chain_hash_fast_t l_block_hash;
     size_t l_block_size = a_atom_size;
     dap_hash_fast(a_atom,a_atom_size, & l_block_hash);
     dap_chain_block_cache_t * l_block_cache = dap_chain_block_cs_cache_get_by_hash(l_blocks, &l_block_hash);
     if (l_block_cache ){
         log_it(L_DEBUG, "... already present in blocks %s",l_block_cache->block_hash_str);
+        pthread_rwlock_unlock(&PVT(l_blocks)->datums_lock);
         return ATOM_PASS;
     } else {
         l_block_cache = dap_chain_block_cache_new(l_blocks, l_block, l_block_size);
         if (!l_block_cache) {
             log_it(L_DEBUG, "... corrupted block");
+            pthread_rwlock_unlock(&PVT(l_blocks)->datums_lock);
             return ATOM_REJECT;
         }
         log_it(L_DEBUG, "... new block %s",l_block_cache->block_hash_str);
         ret = ATOM_ACCEPT;
     }
+    pthread_rwlock_unlock(&PVT(l_blocks)->datums_lock);
 
     // verify hashes and consensus
     if(ret == ATOM_ACCEPT){
@@ -909,8 +928,6 @@ static dap_chain_atom_verify_res_t s_callback_atom_verify(dap_chain_t * a_chain,
                     !dap_hash_fast_compare(&PVT(l_blocks)->block_cache_last->block_hash, &l_block_prev_hash))
             res = ATOM_MOVE_TO_THRESHOLD;
     }
-
-
     return res;
 }
 
@@ -1230,47 +1247,141 @@ static bool s_callback_datums_timer(void *a_arg)
 static size_t s_callback_add_datums(dap_chain_t *a_chain, dap_chain_datum_t **a_datums, size_t a_datums_count)
 {
     dap_chain_cs_blocks_t *l_blocks = DAP_CHAIN_CS_BLOCKS(a_chain);
-    dap_chain_cs_blocks_pvt_t *l_blocks_pvt = PVT(l_blocks);
-    // IMPORTANT - all datums on input should be checked before for curruption because datum size is taken from datum's header
-    pthread_rwlock_wrlock(&l_blocks_pvt->datums_lock);
-    if (!l_blocks->block_new) {
-        l_blocks->block_new = dap_chain_block_new(&l_blocks_pvt->block_cache_last->block_hash, &l_blocks->block_new_size);
-        dap_chain_net_t *l_net = dap_chain_net_by_id(l_blocks->chain->net_id);
-        l_blocks->block_new->hdr.cell_id.uint64 = a_chain->cells->id.uint64;
-        l_blocks->block_new->hdr.chain_id.uint64 = l_blocks->chain->id.uint64;
-    }
+    char *l_gdb_group = l_blocks->gdb_group_datums_queue;
+
+    size_t l_datum_processed = 0;
     for (size_t i = 0; i < a_datums_count; i++) {
         size_t l_datum_size = dap_chain_datum_size(a_datums[i]);
-
-        dap_chain_datum_t * l_datum = a_datums[i];
-        if(l_datum == NULL){ // Was wrong datum thats not passed checks
-            log_it(L_WARNING,"Datum in mempool processing comes NULL");
+        dap_chain_datum_t *l_datum = (dap_chain_datum_t *)a_datums[i];
+        if (!l_datum_size || !l_datum)
             continue;
-        }
 
         // Verify for correctness
-        dap_chain_net_t * l_net = dap_chain_net_by_id( a_chain->net_id);
-        int l_verify_datum= dap_chain_net_verify_datum_for_add( l_net, l_datum) ;
+        dap_chain_net_t *l_net = dap_chain_net_by_id(a_chain->net_id);
+        int l_verify_datum = dap_chain_net_verify_datum_for_add(l_net, l_datum);
         if (l_verify_datum != 0 &&
                 l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_PREVIOUS &&
                 l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_EMISSION &&
-                l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_TOKEN){
+                l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_TOKEN) {
             log_it(L_WARNING, "Datum doesn't pass verifications (code %d)",
                                      l_verify_datum);
             continue;
         }
 
-        if (l_blocks->block_new_size + l_datum_size > l_blocks_pvt->block_size_maximum) {
-            s_new_block_complete(l_blocks);
-            pthread_rwlock_unlock(&l_blocks_pvt->datums_lock);
-            s_callback_add_datums(a_chain, &a_datums[i], a_datums_count - i);
-            pthread_rwlock_wrlock(&l_blocks_pvt->datums_lock);
+        dap_chain_hash_fast_t l_key_hash;
+        dap_hash_fast(l_datum, l_datum_size, &l_key_hash);
+        char *l_key_str = dap_chain_hash_fast_to_str_new(&l_key_hash);
+
+        if (dap_chain_global_db_gr_set(l_key_str, l_datum, l_datum_size, l_gdb_group) ) {
+            l_datum_processed++;
         }
-        l_blocks->block_new_size = dap_chain_block_datum_add(&l_blocks->block_new, l_blocks->block_new_size,
-                                                             a_datums[i], l_datum_size);
     }
-    // if (!l_blocks_pvt->fill_timer)
-    //     l_blocks_pvt->fill_timer = dap_timerfd_start(l_blocks_pvt->fill_timeout, s_callback_datums_timer, l_blocks);
+    return l_datum_processed;
+}
+
+void dap_chain_cs_new_block_add_datums(dap_chain_t *a_chain)
+{
+    dap_chain_cs_blocks_t *l_blocks = DAP_CHAIN_CS_BLOCKS(a_chain);
+    dap_chain_cs_blocks_pvt_t *l_blocks_pvt = PVT(l_blocks);
+
+    pthread_rwlock_wrlock(&l_blocks_pvt->datums_lock);
+    char *l_gdb_group = l_blocks->gdb_group_datums_queue;
+    size_t l_objs_size = 0;
+    dap_global_db_obj_t *l_objs = dap_chain_global_db_gr_load(l_gdb_group, &l_objs_size);
+    
+    if (l_objs_size) {
+        for (size_t i = 0; i < l_objs_size; i++) {
+            if (!l_objs[i].value_len) {
+                dap_chain_global_db_gr_del(l_objs[i].key, l_gdb_group); // delete from datums queue
+                continue;
+            }
+            dap_chain_datum_t *l_datum = (dap_chain_datum_t *)l_objs[i].value;
+            size_t l_datum_size = dap_chain_datum_size(l_datum);
+            if(!l_datum_size || l_datum == NULL){ // Was wrong datum thats not passed checks
+                log_it(L_WARNING,"Datum in mempool processing comes NULL");
+                dap_chain_global_db_gr_del(l_objs[i].key, l_gdb_group); // delete from datums queue
+                continue;
+            }
+            // Verify for correctness
+            dap_chain_net_t *l_net = dap_chain_net_by_id(a_chain->net_id);
+            int l_verify_datum = dap_chain_net_verify_datum_for_add(l_net, l_datum);
+            if (l_verify_datum != 0 &&
+                    l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_PREVIOUS &&
+                    l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_EMISSION &&
+                    l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_TOKEN) {
+                log_it(L_WARNING, "Datum doesn't pass verifications (code %d)",
+                                         l_verify_datum);
+                dap_chain_global_db_gr_del(l_objs[i].key, l_gdb_group); // delete from datums queue
+                continue;
+            }
+            if (l_blocks->block_new_size + l_datum_size > l_blocks_pvt->block_size_maximum)
+                continue;
+
+            if (!l_blocks->block_new) {
+                l_blocks->block_new = dap_chain_block_new(&l_blocks_pvt->block_cache_last->block_hash, &l_blocks->block_new_size);
+                dap_chain_net_t *l_net = dap_chain_net_by_id(l_blocks->chain->net_id);
+                l_blocks->block_new->hdr.cell_id.uint64 = a_chain->cells->id.uint64;
+                l_blocks->block_new->hdr.chain_id.uint64 = l_blocks->chain->id.uint64;
+            }
+
+            l_blocks->block_new_size = dap_chain_block_datum_add(&l_blocks->block_new, l_blocks->block_new_size,
+                                                                    l_datum, l_datum_size);
+        }
+    }
+    dap_chain_global_db_objs_delete(l_objs, l_objs_size);
     pthread_rwlock_unlock(&l_blocks_pvt->datums_lock);
-    return l_blocks->block_new_size;
 }
+
+// static size_t s_callback_add_datums(dap_chain_t *a_chain, dap_chain_datum_t **a_datums, size_t a_datums_count)
+// {
+//     dap_chain_cs_blocks_t *l_blocks = DAP_CHAIN_CS_BLOCKS(a_chain);
+//     dap_chain_cs_blocks_pvt_t *l_blocks_pvt = PVT(l_blocks);
+//     // IMPORTANT - all datums on input should be checked before for curruption because datum size is taken from datum's header
+//     pthread_rwlock_wrlock(&l_blocks_pvt->datums_lock);
+//     if (!l_blocks->block_new) {
+//         l_blocks->block_new = dap_chain_block_new(&l_blocks_pvt->block_cache_last->block_hash, &l_blocks->block_new_size);
+//         dap_chain_net_t *l_net = dap_chain_net_by_id(l_blocks->chain->net_id);
+//         l_blocks->block_new->hdr.cell_id.uint64 = a_chain->cells->id.uint64;
+//         l_blocks->block_new->hdr.chain_id.uint64 = l_blocks->chain->id.uint64;
+//     }
+
+//     size_t l_datum_processed = 0 ;
+//     for (size_t i = 0; i < a_datums_count; i++) {
+//         size_t l_datum_size = dap_chain_datum_size(a_datums[i]);
+
+//         dap_chain_datum_t * l_datum = a_datums[i];
+//         if(l_datum == NULL){ // Was wrong datum thats not passed checks
+//             log_it(L_WARNING,"Datum in mempool processing comes NULL");
+//             continue;
+//         }
+
+//         // Verify for correctness
+//         dap_chain_net_t * l_net = dap_chain_net_by_id( a_chain->net_id);
+//         int l_verify_datum= dap_chain_net_verify_datum_for_add( l_net, l_datum) ;
+//         if (l_verify_datum != 0 &&
+//                 l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_PREVIOUS &&
+//                 l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_EMISSION &&
+//                 l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_TOKEN){
+//             log_it(L_WARNING, "Datum doesn't pass verifications (code %d)",
+//                                      l_verify_datum);
+//             continue;
+//         }
+
+//         // TODO: new blocks queue
+//         if (l_blocks->block_new_size + l_datum_size > l_blocks_pvt->block_size_maximum) {
+//             continue;
+//         //     // s_new_block_complete(l_blocks);
+//         //     pthread_rwlock_unlock(&l_blocks_pvt->datums_lock);
+//         //     s_callback_add_datums(a_chain, &a_datums[i], a_datums_count - i);
+//         //     pthread_rwlock_wrlock(&l_blocks_pvt->datums_lock);
+//         }
+//         l_blocks->block_new_size = dap_chain_block_datum_add(&l_blocks->block_new, l_blocks->block_new_size,
+//                                                              a_datums[i], l_datum_size);
+//         l_datum_processed++;
+//     }
+//     // if (!l_blocks_pvt->fill_timer)
+//     //     l_blocks_pvt->fill_timer = dap_timerfd_start(l_blocks_pvt->fill_timeout, s_callback_datums_timer, l_blocks);
+//     pthread_rwlock_unlock(&l_blocks_pvt->datums_lock);
+//     // return l_blocks->block_new_size;
+//     return l_datum_processed;
+// }
diff --git a/modules/type/blocks/include/dap_chain_block.h b/modules/type/blocks/include/dap_chain_block.h
index 32d35388a4912a31bbf9271abd1379225b6a2771..d7500cd912c604fdd89d59a9e0dda4882843c569 100644
--- a/modules/type/blocks/include/dap_chain_block.h
+++ b/modules/type/blocks/include/dap_chain_block.h
@@ -22,6 +22,7 @@
 */
 #pragma once
 #include "dap_common.h"
+#include "dap_time.h"
 #include "dap_math_ops.h"
 #include "dap_hash.h"
 #include "dap_cert.h"
@@ -46,7 +47,7 @@ typedef struct dap_chain_block_hdr{
     int32_t version; /// @param version @brief block version (be carefull, signed value, as Bitcoin has)
     dap_chain_cell_id_t cell_id; /// Cell id
     dap_chain_id_t chain_id; /// Chain id
-    dap_chain_time_t ts_created; /// @param timestamp @brief Block create time timestamp
+    dap_time_t ts_created; /// @param timestamp @brief Block create time timestamp
     uint16_t meta_count; // Meta values number
     uint16_t datum_count; // Datums's count
     dap_chain_hash_fast_t merkle;
diff --git a/modules/type/blocks/include/dap_chain_cs_blocks.h b/modules/type/blocks/include/dap_chain_cs_blocks.h
index 2a422342557fe6f5555b238d83d5d9c9a9bd1851..ac07ba1ffbb4ec47fc9251257a5092b8624bb3cb 100644
--- a/modules/type/blocks/include/dap_chain_cs_blocks.h
+++ b/modules/type/blocks/include/dap_chain_cs_blocks.h
@@ -33,29 +33,26 @@ typedef void (*dap_chain_cs_blocks_callback_t)(dap_chain_cs_blocks_t *);
 typedef int (*dap_chain_cs_blocks_callback_block_t)(dap_chain_cs_blocks_t *, dap_chain_block_t *, size_t);
 typedef size_t (*dap_chain_cs_blocks_callback_block_sign_t)(dap_chain_cs_blocks_t *, dap_chain_block_t **, size_t);
 
-
-
 typedef dap_chain_block_t * (*dap_chain_cs_blocks_callback_block_create_t)(dap_chain_cs_blocks_t *,
                                                                                dap_chain_datum_t *,
                                                                                dap_chain_hash_fast_t *,
                                                                                size_t, size_t*);
-
-
 typedef struct dap_chain_cs_blocks
 {
-    dap_chain_t * chain;
-    // For new block creating
-    dap_chain_block_t * block_new;
-    size_t block_new_size;
-
-    dap_chain_cs_blocks_callback_t callback_delete;
-    dap_chain_cs_blocks_callback_block_create_t callback_block_create;
-    dap_chain_cs_blocks_callback_block_t callback_block_verify;
-    dap_chain_cs_blocks_callback_block_sign_t callback_block_sign;
-    dap_chain_cs_blocks_callback_t callback_new_block_del;
-
-    void * _pvt;
-    void * _inheritor;
+   dap_chain_t * chain;
+   // For new block creating
+   dap_chain_block_t * block_new;
+   size_t block_new_size;
+   char *gdb_group_datums_queue;
+
+   dap_chain_cs_blocks_callback_t callback_delete;
+   dap_chain_cs_blocks_callback_block_create_t callback_block_create;
+   dap_chain_cs_blocks_callback_block_t callback_block_verify;
+   dap_chain_cs_blocks_callback_block_sign_t callback_block_sign;
+   dap_chain_cs_blocks_callback_t callback_new_block_del;
+
+   void * _pvt;
+   void * _inheritor;
 } dap_chain_cs_blocks_t;
 
 #define DAP_CHAIN_CS_BLOCKS(a) ((dap_chain_cs_blocks_t*) a->_inheritor)
@@ -66,3 +63,6 @@ void dap_chain_cs_blocks_deinit();
 
 int dap_chain_cs_blocks_new(dap_chain_t * a_chain, dap_config_t * a_chain_config);
 void dap_chain_cs_blocks_delete(dap_chain_t * a_chain);
+
+void dap_chain_cs_new_block_add_datums(dap_chain_t *a_chain);
+
diff --git a/modules/type/dag/dap_chain_cs_dag.c b/modules/type/dag/dap_chain_cs_dag.c
index 29c18de4aab53f275ccbba2ec4c902daa209f4c8..c43ae400ba1f4d20ceae5041b33bec4c9f1a466e 100644
--- a/modules/type/dag/dap_chain_cs_dag.c
+++ b/modules/type/dag/dap_chain_cs_dag.c
@@ -58,7 +58,7 @@
 
 typedef struct dap_chain_cs_dag_event_item {
     dap_chain_hash_fast_t hash;
-    time_t ts_added;
+    dap_gdb_time_t ts_added;
     dap_chain_cs_dag_event_t *event;
     size_t event_size;
     UT_hash_handle hh;
@@ -113,6 +113,7 @@ static dap_chain_atom_ptr_t *s_chain_callback_atom_iter_get_lasts( dap_chain_ato
 static void s_chain_callback_atom_iter_delete(dap_chain_atom_iter_t * a_atom_iter );                  //    Get the fisrt event from dag
 
 static size_t s_chain_callback_datums_pool_proc(dap_chain_t * a_chain, dap_chain_datum_t ** a_datums, size_t a_datums_size);
+static size_t s_callback_add_datums(dap_chain_t *a_chain, dap_chain_datum_t **a_datums, size_t a_datums_count);
 // Datum ops
 /*
 static dap_chain_datum_iter_t* s_chain_callback_datum_iter_create(dap_chain_t * a_chain );
@@ -130,6 +131,7 @@ static dap_list_t *s_dap_chain_callback_get_txs(dap_chain_t *a_chain, size_t a_c
 
 static bool s_seed_mode = false;
 static bool s_debug_more = false;
+
 /**
  * @brief dap_chain_cs_dag_init
  * @return
@@ -142,19 +144,19 @@ int dap_chain_cs_dag_init(void)
     s_debug_more = dap_config_get_item_bool_default(g_config,"dag","debug_more",false);
 
     dap_chain_node_cli_cmd_item_create ("dag", s_cli_dag, "DAG commands",
-        "dag -net event create <chain net name> -chain <chain name> -datum <datum hash> [-H hex|base58(default)]\n"
+        "dag event create -net <chain net name> -chain <chain name> -datum <datum hash> [-H {hex | base58(default)}]\n"
             "\tCreate event from datum mempool element\n\n"
         "dag event cancel -net <chain net name> -chain <chain name> -event <event hash>\n"
             "\tRemove event from forming new round and put back its datum to mempool\n\n"
         "dag event sign -net <chain net name> -chain <chain name> -event <event hash>\n"
             "\tAdd sign to event <event hash> in round.new. Hash doesn't include other signs so event hash\n"
             "\tdoesn't changes after sign add to event. \n\n"
-        "dag event dump -net <chain net name> -chain <chain name> -event <event hash> -from < events | events_lasts | round.new  | round.<Round id in hex> > [-H hex|base58(default)]\n"
+        "dag event dump -net <chain net name> -chain <chain name> -event <event hash> -from {events | events_lasts | round.new  | round.<Round id in hex>} [-H {hex | base58(default)}]\n"
             "\tDump event info\n\n"
-        "dag event list -net <chain net name> -chain <chain name> -from < events | events_lasts | threshold | round.new | round.<Round id in hex> \n\n"
+        "dag event list -net <chain net name> -chain <chain name> -from {events | events_lasts | threshold | round.new | round.<Round id in hex>}\n\n"
             "\tShow event list \n\n"
-        "dag round complete -net <chain net name> -chain <chain name> \n\n"
-                                        "\tComplete the current new round, verify it and if everything is ok - publish new events in chain\n\n"
+        "dag round complete -net <chain net name> -chain <chain name> \n"
+                                        "\tComplete the current new round, verify it and if everything is ok - publish new events in chain\n"
                                         );
     log_it(L_NOTICE,"Initialized DAG chain items organization class");
     return 0;
@@ -168,20 +170,38 @@ void dap_chain_cs_dag_deinit(void)
 
 }
 
-static void s_history_callback_round_notify(void * a_arg, const char a_op_code, const char * a_group,
-        const char * a_key, const void * a_value, const size_t a_value_size)
+static void s_history_callback_round_notify(void *a_arg, const char a_op_code, const char *a_group,
+                                        const char *a_key, const void *a_value, const size_t a_value_size)
 {
-    if (a_arg){
-        dap_chain_cs_dag_t * l_dag = (dap_chain_cs_dag_t *) a_arg;
-        dap_chain_net_t *l_net = dap_chain_net_by_id( l_dag->chain->net_id);
-        log_it(L_DEBUG,"%s.%s: op_code='%c' group=\"%s\" key=\"%s\" value_size=%zu",
+    dap_chain_cs_dag_t *l_dag = (dap_chain_cs_dag_t *)a_arg;
+    if (a_arg && !l_dag->broadcast_disable){
+        dap_chain_net_t *l_net = dap_chain_net_by_id(l_dag->chain->net_id);
+        debug_if(s_debug_more, L_DEBUG, "%s.%s: op_code='%c' group=\"%s\" key=\"%s\" value_size=%zu",
             l_net->pub.name, l_dag->chain->name, a_op_code, a_group, a_key, a_value_size);
-        if (l_dag->callback_cs_event_round_sync) {
+        if (a_op_code == DAP_DB$K_OPTYPE_ADD && 
+                            l_dag->callback_cs_event_round_sync) {
+            dap_chain_cs_dag_event_round_item_t *l_event_round_item =
+                                (dap_chain_cs_dag_event_round_item_t *)a_value;
+            if (l_event_round_item) {
+                char *l_datum_hash_str = dap_chain_hash_fast_to_str_new(&l_event_round_item->round_info.datum_hash);
+                dap_chain_global_db_gr_del(l_datum_hash_str, l_dag->gdb_group_events_round_new);
+                DAP_DELETE(l_datum_hash_str);
+            }
             l_dag->callback_cs_event_round_sync(l_dag, a_op_code, a_group, a_key, a_value, a_value_size);
         }
+        else if ( a_op_code == DAP_DB$K_OPTYPE_DEL ) {
+            dap_chain_cs_new_event_add_datums(l_dag->chain, true);
+        }
     }
 }
 
+static void s_dag_chain_cs_event_round_broadcast(dap_chain_cs_dag_t *a_dag, 
+                                    dap_chain_cs_dag_event_round_item_t *a_round_item, const char *a_key) {
+    size_t l_round_item_size = dap_chain_cs_dag_event_round_item_get_size(a_round_item);
+    dap_chain_cs_dag_event_broadcast(a_dag, DAP_DB$K_OPTYPE_ADD, a_dag->gdb_group_events_round_new,
+            a_key, a_round_item, l_round_item_size);
+}
+
 /**
  * @brief dap_chain_cs_dag_new
  * @param a_chain
@@ -219,7 +239,8 @@ int dap_chain_cs_dag_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg)
     a_chain->callback_atom_find_by_hash = s_chain_callback_atom_iter_find_by_hash;
     a_chain->callback_tx_find_by_hash = s_chain_callback_atom_find_by_tx_hash;
 
-    a_chain->callback_add_datums = s_chain_callback_datums_pool_proc;
+    // a_chain->callback_add_datums = s_chain_callback_datums_pool_proc;
+    a_chain->callback_add_datums = s_callback_add_datums;
 
     // Datum operations callbacks
 /*
@@ -260,26 +281,33 @@ int dap_chain_cs_dag_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg)
     l_dag->datum_add_hashes_count = dap_config_get_item_uint16_default(a_chain_cfg,"dag","datum_add_hashes_count",1);
     l_dag->use_event_round_info = false;
     l_dag->callback_cs_set_event_round_info = s_dag_chain_cs_set_event_round_info;
+    l_dag->callback_broadcast = s_dag_chain_cs_event_round_broadcast;
     char * l_round_new_str = dap_strdup( dap_config_get_item_str_default(a_chain_cfg,"dag","gdb_group_events_round_new", "new"));
     dap_chain_net_t *l_net = dap_chain_net_by_id(a_chain->net_id);
+    
+    l_dag->broadcast_disable = true;
     if(!l_dag->is_celled){
-        char * gdb_group = dap_strdup_printf( "%s-%s-round", l_net->pub.gdb_groups_prefix, a_chain->name);
-        l_dag->gdb_group_events_round_new = dap_strdup_printf( "%s.%s", gdb_group, l_round_new_str);
-        dap_chain_global_db_add_sync_group(l_net->pub.name, gdb_group, s_history_callback_round_notify, l_dag);
+        char *l_gdb_group = dap_strdup_printf( "dag-%s-%s-round", l_net->pub.gdb_groups_prefix, a_chain->name);
+        l_dag->gdb_group_events_round_new = dap_strdup_printf( "%s.%s", l_gdb_group, l_round_new_str);
+        dap_chain_global_db_add_sync_group(l_net->pub.name, l_gdb_group, s_history_callback_round_notify, l_dag);
     } else {
-        char * gdb_group = dap_strdup_printf( "%s-%s-%016llx-round", l_net->pub.gdb_groups_prefix, a_chain->name, 0);//a_chain->cells->id.uint64);
-        l_dag->gdb_group_events_round_new = dap_strdup_printf( "%s.%s", gdb_group, l_round_new_str);
-        dap_chain_global_db_add_sync_group(l_net->pub.name, gdb_group, s_history_callback_round_notify, l_dag);
+        char *l_gdb_group = dap_strdup_printf( "dag-%s-%s-%016llx-round", l_net->pub.gdb_groups_prefix, a_chain->name, 0);//a_chain->cells->id.uint64);
+        l_dag->gdb_group_events_round_new = dap_strdup_printf( "%s.%s", l_gdb_group, l_round_new_str);
+        dap_chain_global_db_add_sync_group(l_net->pub.name, l_gdb_group, s_history_callback_round_notify, l_dag);
     }
- 
+    dap_chain_global_db_gr_del(NULL, l_dag->gdb_group_events_round_new);
+    l_dag->gdb_group_datums_queue = dap_strdup_printf("local.datums-queue.chain-%s.%s",
+                                                        l_net->pub.gdb_groups_prefix, a_chain->name);
     DAP_DELETE(l_round_new_str);
+    l_dag->broadcast_disable = false;
 
     if ( l_dag->is_single_line ) {
         log_it (L_NOTICE, "DAG chain initialized (single line)");
     } else {
         log_it (L_NOTICE, "DAG chain initialized (multichain)");
     }
-
+    
+    // dap_chain_cs_new_event_add_datums(l_dag->chain, true);
     return 0;
 }
 
@@ -431,7 +459,7 @@ static dap_chain_atom_verify_res_t s_chain_callback_atom_add(dap_chain_t * a_cha
     pthread_rwlock_t * l_events_rwlock = &PVT(l_dag)->events_rwlock;
     l_event_item->event = l_event;
     l_event_item->event_size = a_atom_size;
-    l_event_item->ts_added = time(NULL);
+    l_event_item->ts_added = dap_time_now();
 
     dap_chain_hash_fast_t l_event_hash;
     dap_chain_cs_dag_event_calc_hash(l_event, a_atom_size, &l_event_hash);
@@ -536,29 +564,129 @@ static dap_chain_atom_ptr_t s_chain_callback_atom_add_from_treshold(dap_chain_t
     return NULL;
 }
 
+
+
+
 /**
  * @brief s_chain_callback_datums_add
  * @param a_chain
  * @param a_datums
  * @param a_datums_size
  */
+static size_t s_callback_add_datums(dap_chain_t *a_chain, dap_chain_datum_t **a_datums, size_t a_datums_count)
+{
+    dap_chain_cs_dag_t *l_dag = DAP_CHAIN_CS_DAG(a_chain);
+    char *l_gdb_group = l_dag->gdb_group_datums_queue;
+
+    if (l_dag->is_add_directly) {
+        return s_chain_callback_datums_pool_proc(a_chain, a_datums, a_datums_count);
+    }
+
+    size_t l_datum_processed = 0;
+    for (size_t i = 0; i < a_datums_count; i++) {
+        size_t l_datum_size = dap_chain_datum_size(a_datums[i]);
+        dap_chain_datum_t *l_datum = (dap_chain_datum_t *)a_datums[i];
+        if (!l_datum_size || !l_datum)
+            continue;
+
+        // Verify for correctness
+        dap_chain_net_t *l_net = dap_chain_net_by_id(a_chain->net_id);
+        int l_verify_datum = dap_chain_net_verify_datum_for_add(l_net, l_datum);
+        if (l_verify_datum != 0 &&
+                l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_PREVIOUS &&
+                l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_EMISSION &&
+                l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_TOKEN) {
+            log_it(L_WARNING, "Datum doesn't pass verifications (code %d)",
+                                     l_verify_datum);
+            continue;
+        }
+
+        dap_chain_hash_fast_t l_key_hash;
+        dap_hash_fast(l_datum, l_datum_size, &l_key_hash);
+        char *l_key_str = dap_chain_hash_fast_to_str_new(&l_key_hash);
+
+        if (dap_chain_global_db_gr_set(l_key_str, l_datum, l_datum_size, l_gdb_group) ) {
+            l_datum_processed++;
+        }
+    }
+    dap_chain_cs_new_event_add_datums(a_chain, true);
+    return l_datum_processed;
+}
+
+void dap_chain_cs_new_event_add_datums(dap_chain_t *a_chain, bool a_round_check)
+{
+    dap_chain_cs_dag_t *l_dag = DAP_CHAIN_CS_DAG(a_chain);
+    char *l_gdb_group_queue = l_dag->gdb_group_datums_queue;
+    char *l_gdb_group_round = l_dag->gdb_group_events_round_new;
+
+    if (l_dag->is_add_directly) {
+        return;
+    }
+
+    if (a_round_check) {
+        size_t l_round_objs_size = 0;
+        dap_global_db_obj_t *l_round_objs = dap_chain_global_db_gr_load(l_gdb_group_round, &l_round_objs_size);
+        if (l_round_objs_size) {
+            dap_chain_global_db_objs_delete(l_round_objs, l_round_objs_size);
+            return;
+        }
+    }
+
+    size_t l_objs_size = 0;
+    dap_global_db_obj_t *l_objs = dap_chain_global_db_gr_load(l_gdb_group_queue, &l_objs_size);
+    if (l_objs_size) {
+        for (size_t i = 0; i < l_objs_size; i++) {
+            if (!l_objs[i].value_len) {
+                dap_chain_global_db_gr_del(l_objs[i].key, l_gdb_group_queue); // delete from datums queue
+                continue;
+            }
+            dap_chain_datum_t *l_datum = (dap_chain_datum_t *)l_objs[i].value;
+            size_t l_datum_size = dap_chain_datum_size(l_datum);
+            if(!l_datum_size || l_datum == NULL){ // Was wrong datum thats not passed checks
+                log_it(L_WARNING,"Datum in mempool processing comes NULL");
+                dap_chain_global_db_gr_del(l_objs[i].key, l_gdb_group_queue); // delete from datums queue
+                continue;
+            }
+
+            // dap_time_t l_ts_create = (dap_time_t) l_datum->header.ts_create;
+            // if ( dap_time_now() -  ) 
+
+            // Verify for correctness
+            dap_chain_net_t *l_net = dap_chain_net_by_id(a_chain->net_id);
+            int l_verify_datum = dap_chain_net_verify_datum_for_add(l_net, l_datum);
+            if (l_verify_datum != 0 &&
+                    l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_PREVIOUS &&
+                    l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_EMISSION &&
+                    l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_TOKEN) {
+                log_it(L_WARNING, "Datum doesn't pass verifications (code %d)",
+                                         l_verify_datum);
+                dap_chain_global_db_gr_del(l_objs[i].key, l_gdb_group_queue); // delete from datums queue
+                continue;
+            }
+
+            // if ( s_chain_callback_datums_pool_proc(a_chain, &l_datum, 1) ) {
+            //     break;
+            // }
+            if (s_chain_callback_datums_pool_proc(a_chain, &l_datum, 1)) {
+                dap_chain_global_db_gr_del(l_objs[i].key, l_gdb_group_queue);
+            }
+            break;
+        }
+        dap_chain_global_db_objs_delete(l_objs, l_objs_size);
+    }
+}
+
+
 static size_t s_chain_callback_datums_pool_proc(dap_chain_t * a_chain, dap_chain_datum_t ** a_datums, size_t a_datums_count)
 {
 
     dap_chain_cs_dag_t * l_dag = DAP_CHAIN_CS_DAG(a_chain);
     size_t l_datum_processed =0;
-    size_t l_events_round_new_size = 0;
-    // Load current events new round pool
-    dap_global_db_obj_t * l_events_round_new = dap_chain_global_db_gr_load(l_dag->gdb_group_events_round_new, &l_events_round_new_size );
     // Prepare hashes
-    size_t l_hashes_int_size = min(l_events_round_new_size + a_datums_count, l_dag->datum_add_hashes_count);
-
+    size_t l_hashes_size = l_dag->datum_add_hashes_count;
     if (l_dag->is_single_line ) // If single line - only one link inside
-        l_hashes_int_size = min(l_hashes_int_size, 1);
-
-    size_t l_hashes_ext_size = 0; // Change in cfg
-    size_t l_hashes_size = l_hashes_int_size+l_hashes_ext_size;
-    dap_chain_hash_fast_t * l_hashes = l_hashes_size ?DAP_NEW_Z_SIZE(dap_chain_hash_fast_t,
+        l_hashes_size = 1;
+    dap_chain_hash_fast_t * l_hashes = l_hashes_size ? DAP_NEW_Z_SIZE(dap_chain_hash_fast_t,
                                              sizeof(dap_chain_hash_fast_t) * l_hashes_size) : NULL;
     size_t l_hashes_linked = 0;
     dap_chain_cell_t *l_cell = NULL;
@@ -569,70 +697,60 @@ static size_t s_chain_callback_datums_pool_proc(dap_chain_t * a_chain, dap_chain
             continue;
         }
 
-        // Verify for correctness
-        dap_chain_net_t * l_net = dap_chain_net_by_id( a_chain->net_id);
-        int l_verify_datum= dap_chain_net_verify_datum_for_add( l_net, l_datum) ;
-        if (l_verify_datum != 0 &&
-                l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_PREVIOUS &&
-                l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_EMISSION &&
-                l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_TOKEN){
-            log_it(L_WARNING, "Datum doesn't pass verifications (code %d)",
-                                     l_verify_datum);
-            continue;
+        if (l_dag->is_add_directly) {
+            // Verify for correctness
+            dap_chain_net_t * l_net = dap_chain_net_by_id( a_chain->net_id);
+            int l_verify_datum= dap_chain_net_verify_datum_for_add( l_net, l_datum) ;
+            if (l_verify_datum != 0 &&
+                    l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_PREVIOUS &&
+                    l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_EMISSION &&
+                    l_verify_datum != DAP_CHAIN_CS_VERIFY_CODE_TX_NO_TOKEN){
+                log_it(L_WARNING, "Datum doesn't pass verifications (code %d)",
+                                         l_verify_datum);
+                continue;
+            }
         }
 
         // Prepare round
-        if ( l_hashes_int_size && l_events_round_new_size){
-            // Linking randomly with current new round set
-            size_t l_rnd_steps;
-            // Linking events inside round
-            l_rnd_steps = 0;
-            do{
-                int l_index = rand() % (int) l_events_round_new_size;
-                dap_chain_hash_fast_t l_hash;
-                dap_chain_cs_dag_event_t * l_event = (dap_chain_cs_dag_event_t *)
-                                ((dap_chain_cs_dag_event_round_item_t *)l_events_round_new[l_index].value)->event_n_signs;
-                size_t l_event_size = ((dap_chain_cs_dag_event_round_item_t *)l_events_round_new[l_index].value)->event_size;
-                dap_hash_fast(l_event, l_event_size,&l_hash);
+        if (l_hashes_size) {
+            pthread_rwlock_rdlock(&PVT(l_dag)->events_rwlock);
+            size_t l_rnd_steps = 0;
+            // Linking events randomly with ones from previous round
+            do {
+                dap_chain_cs_dag_event_item_t *l_event_ext_item = NULL;
+                int l_unlinked_size = HASH_COUNT(PVT(l_dag)->events_lasts_unlinked);
+                if (!l_unlinked_size)
+                    break;
+                int l_index = rand() % l_unlinked_size;
+                l_event_ext_item = PVT(l_dag)->events_lasts_unlinked;
+                for (int i = 0; i < l_index; i++) {
+                    l_event_ext_item = l_event_ext_item->hh.next;
+                }
+                dap_chain_hash_fast_t *l_hash = &l_event_ext_item->hash;
 
                 bool l_is_already_in_event = false;
-                for (uint16_t i=0; i<l_hashes_linked;i++ ){ // check if we already added it
-                    if (l_hashes && memcmp(&l_hashes[i],&l_hash,sizeof (l_hash) )==0 ){
+                for (uint16_t i = 0; i < l_hashes_linked; i++) { // check if we already added it
+                    if (l_hashes && memcmp(&l_hashes[i], l_hash, sizeof(*l_hash)) ==0) {
                         l_is_already_in_event = true;
                         break;
                     }
                 }
-
-                if ( ! l_is_already_in_event ){
-                    if(l_hashes_linked < l_hashes_size) {
-                        memcpy(&l_hashes[l_hashes_linked], &l_hash, sizeof(l_hash));
-                        l_hashes_linked++;
-                    }
+                if (!l_is_already_in_event && l_hashes_linked < l_hashes_size) {
+                    memcpy(&l_hashes[l_hashes_linked], l_hash, sizeof(*l_hash));
+                    l_hashes_linked++;
                 }
+
                 l_rnd_steps++;
                 if (l_rnd_steps > 100) // Too many attempts
                     break;
-            } while (l_hashes_linked < l_hashes_int_size);
-
+            } while (l_hashes_linked < l_hashes_size);
+            pthread_rwlock_unlock(&PVT(l_dag)->events_rwlock);
             // Check if we have enought hash links
-            if (l_hashes_linked < l_hashes_int_size) {
-                log_it(L_ERROR,"Can't link new events randomly for 100 attempts");
+            if (l_hashes_linked < l_hashes_size) {
+                log_it(L_ERROR, "Can't link new events randomly for 100 attempts");
                 break;
             }
         }
-        // Now link with ext events
-        dap_chain_cs_dag_event_item_t *l_event_ext_item = NULL;
-        // is_single_line - only one link inside
-        if(!l_dag->is_single_line || !l_hashes_linked){
-            pthread_rwlock_rdlock(&PVT(l_dag)->events_rwlock);
-            if( PVT(l_dag)->events_lasts_unlinked && l_hashes_linked < l_hashes_size) { // Take then the first one if any events_lasts are present
-                    l_event_ext_item = PVT(l_dag)->events_lasts_unlinked;
-                    if(l_hashes)
-                        memcpy(&l_hashes[l_hashes_linked], &l_event_ext_item->hash, sizeof(l_event_ext_item->hash));
-                    l_hashes_linked++;
-                }
-            pthread_rwlock_unlock(&PVT(l_dag)->events_rwlock);
-        }
         if (l_hashes_linked || s_seed_mode ) {
             dap_chain_cs_dag_event_t * l_event = NULL;
             size_t l_event_size = 0;
@@ -678,47 +796,27 @@ static size_t s_chain_callback_datums_pool_proc(dap_chain_t * a_chain, dap_chain
                 }
                 // add to new round into global_db
                 else {
-                    dap_chain_hash_fast_t l_event_hash;
+                    dap_chain_hash_fast_t l_event_hash, l_datum_hash;
                     dap_chain_cs_dag_event_calc_hash(l_event,l_event_size, &l_event_hash);
                     char * l_event_hash_str = dap_chain_hash_fast_to_str_new(&l_event_hash);
                     dap_chain_cs_dag_event_round_info_t l_event_round_info;
                     if ( l_dag->callback_cs_get_round_info ) {
                         l_dag->callback_cs_get_round_info(l_dag, &l_event_round_info);
                     }
-
-                    // set first event hash for round
-                    memcpy(&l_event_round_info.first_event_hash, &l_event_hash, sizeof(dap_chain_hash_fast_t));
+                    // set datum hash for round
+                    dap_hash_fast(l_datum, dap_chain_datum_size(l_datum), &l_datum_hash);
+                    memcpy(&l_event_round_info.datum_hash, &l_datum_hash, sizeof(dap_chain_hash_fast_t));
                     dap_chain_cs_dag_event_round_item_t * l_round_item = 
                                 DAP_NEW_SIZE(dap_chain_cs_dag_event_round_item_t, 
                                                 sizeof(dap_chain_cs_dag_event_round_item_t)+l_event_size);
                     memcpy(&l_round_item->round_info, &l_event_round_info, sizeof(dap_chain_cs_dag_event_round_info_t));
                     l_round_item->data_size = l_round_item->event_size = 0; 
 
-                    if(dap_chain_cs_dag_event_gdb_set(l_event_hash_str, l_event,
+                    if(dap_chain_cs_dag_event_gdb_set(l_dag, l_event_hash_str, l_event,
                                 l_event_size, l_round_item, l_dag->gdb_group_events_round_new)) {
                                 //&l_event_round_info)) {
                         log_it(L_INFO, "Event %s placed in the new forming round", l_event_hash_str);
-                        DAP_DELETE(l_event_hash_str);
-                        l_event_hash_str = NULL;
-                        // Clear old ext link and place itself as event_lasts
-
-                        dap_chain_cs_dag_event_item_t * l_event_unlinked_item = DAP_NEW_Z(
-                                dap_chain_cs_dag_event_item_t);
-                        if(l_event_ext_item)
-                            memcpy(&l_event_unlinked_item->hash, &l_event_ext_item->hash,
-                                    sizeof(l_event_ext_item->hash));
-                        l_event_unlinked_item->event = l_event;
-                        l_event_unlinked_item->event_size = l_event_size;
-                        l_event_unlinked_item->ts_added = (time_t) l_event->header.ts_created;
-                        pthread_rwlock_wrlock(&PVT(l_dag)->events_rwlock);
-                        HASH_ADD(hh, PVT(l_dag)->events_lasts_unlinked, hash, sizeof(l_event_unlinked_item->hash),
-                                l_event_unlinked_item);
-                        if(l_event_ext_item) {
-                            HASH_DEL(PVT(l_dag)->events_lasts_unlinked, l_event_ext_item);
-                            DAP_DELETE(l_event_ext_item);
-                        }
-                        pthread_rwlock_unlock(&PVT(l_dag)->events_rwlock);
-
+                        DAP_DEL_Z(l_event_hash_str);
                         l_datum_processed++;
                     }else {
                         log_it(L_ERROR,"Can't add new event to the new events round");
@@ -732,8 +830,7 @@ static size_t s_chain_callback_datums_pool_proc(dap_chain_t * a_chain, dap_chain
         }
     }
     DAP_DELETE(l_hashes);
-    dap_chain_global_db_objs_delete(l_events_round_new, l_events_round_new_size);
-    return  l_datum_processed;
+    return l_datum_processed;
 }
 
 
@@ -1275,7 +1372,7 @@ static dap_chain_atom_ptr_t s_chain_callback_atom_iter_get_next( dap_chain_atom_
             break;
     }
 
-    if(!l_event_item && !a_atom_iter->found_in_treshold) {
+    if(!l_event_item && !a_atom_iter->found_in_treshold && a_atom_iter->with_treshold) {
         dap_chain_cs_dag_t *l_dag = DAP_CHAIN_CS_DAG(a_atom_iter->chain);
         assert(l_dag);
         dap_chain_cs_dag_pvt_t *l_dag_pvt = PVT(l_dag);
@@ -1355,7 +1452,7 @@ static int s_cli_dag(int argc, char ** argv, char **a_str_reply)
 
     arg_index++;
     const char * l_hash_out_type = NULL;
-    dap_chain_node_cli_find_option_val(argv, arg_index, argc, "-H", &l_hash_out_type);
+    dap_chain_node_cli_find_option_val(argv, 0, argc, "-H", &l_hash_out_type);
     if(!l_hash_out_type)
         l_hash_out_type = "hex";
     if(dap_strcmp(l_hash_out_type,"hex") && dap_strcmp(l_hash_out_type,"base58")) {
@@ -1364,7 +1461,7 @@ static int s_cli_dag(int argc, char ** argv, char **a_str_reply)
     }
 
     dap_chain_node_cli_cmd_values_parse_net_chain(&arg_index, argc, argv, a_str_reply, &l_chain, &l_net);
-    if ( l_net == NULL ){
+    if ((l_net == NULL) || (l_chain == NULL)){
         return -1;
     } else if (a_str_reply && *a_str_reply) {
         DAP_DELETE(*a_str_reply);
@@ -1372,6 +1469,15 @@ static int s_cli_dag(int argc, char ** argv, char **a_str_reply)
     }
     l_dag = DAP_CHAIN_CS_DAG(l_chain);
 
+    const char *l_chain_type = dap_chain_net_get_type(l_chain);
+
+    if (!strstr(l_chain_type, "dag_")){
+            dap_chain_node_cli_set_reply_text(a_str_reply,
+                        "Type of chain %s is not dag. This chain with type %s is not supported by this command",
+                        l_chain->name, l_chain_type);
+            return -42;
+    }
+
     int ret = 0;
     if ( l_round_cmd_str ) {
         if ( strcmp(l_round_cmd_str,"complete") == 0 ){
@@ -1393,9 +1499,9 @@ static int s_cli_dag(int argc, char ** argv, char **a_str_reply)
 
             // Check if its ready or not
             for (size_t i = 0; i< l_objs_size; i++ ){
-                dap_chain_cs_dag_event_t * l_event = (dap_chain_cs_dag_event_t *)
-                                ((dap_chain_cs_dag_event_round_item_t *)l_objs[i].value)->event_n_signs;
-                size_t l_event_size = ((dap_chain_cs_dag_event_round_item_t *)l_objs[i].value)->event_size;
+                dap_chain_cs_dag_event_round_item_t *l_round_item = (dap_chain_cs_dag_event_round_item_t *)l_objs[i].value;
+                dap_chain_cs_dag_event_t *l_event = (dap_chain_cs_dag_event_t *)l_round_item->event_n_signs;
+                size_t l_event_size = l_round_item->event_size;
                 l_dag->callback_cs_set_event_round_info(l_dag, &((dap_chain_cs_dag_event_round_item_t *)l_objs[i].value)->round_info);
                 int l_ret_event_verify;
                 if ( ( l_ret_event_verify = l_dag->callback_cs_verify (l_dag,l_event,l_event_size) ) !=0 ){// if consensus accept the event
@@ -1419,6 +1525,9 @@ static int s_cli_dag(int argc, char ** argv, char **a_str_reply)
                             l_list_to_del = dap_list_prepend(l_list_to_del, l_objs[i].key);
                             dap_string_append_printf(l_str_ret_tmp, "Event %s added in chain successfully\n",
                                     l_objs[i].key);
+                            // dap_chain_cs_dag_event_broadcast(l_dag, DAP_DB$K_OPTYPE_DEL,
+                            //             l_dag->gdb_group_events_round_new, &l_round_item->round_info.first_event_hash,
+                            //                 NULL, 0);
                         }
                     }
                 }
@@ -1430,6 +1539,9 @@ static int s_cli_dag(int argc, char ** argv, char **a_str_reply)
                     dap_list_t *l_list_tmp = l_list_to_del;
                     while(l_list_tmp) {
                         dap_chain_global_db_gr_del((char*)l_list_tmp->data, l_dag->gdb_group_events_round_new);
+                        // dap_chain_cs_dag_event_broadcast(l_dag, DAP_DB$K_OPTYPE_DEL,
+                        //             l_dag->gdb_group_events_round_new, (char*)l_list_tmp->data,
+                        //                 NULL, 0);
                         l_list_tmp = dap_list_next(l_list_tmp);
                     }
                 }
@@ -1547,6 +1659,9 @@ static int s_cli_dag(int argc, char ** argv, char **a_str_reply)
             case SUBCMD_EVENT_CANCEL:{
                 char * l_gdb_group_events = DAP_CHAIN_CS_DAG(l_chain)->gdb_group_events_round_new;
                 if ( dap_chain_global_db_gr_del( dap_strdup(l_event_hash_hex_str) ,l_gdb_group_events ) ){
+                    // dap_chain_cs_dag_event_broadcast(l_dag, DAP_DB$K_OPTYPE_DEL,
+                    //             l_gdb_group_events, l_event_hash_hex_str,
+                    //                 NULL, 0);
                     if(!dap_strcmp(l_hash_out_type, "hex")){
                         dap_chain_node_cli_set_reply_text(a_str_reply,
                                 "Successfuly removed event %s from the new forming round ",
@@ -1644,11 +1759,23 @@ static int s_cli_dag(int argc, char ** argv, char **a_str_reply)
                                                               "Can't find event %s in events table\n", l_event_hash_str);
                             break;
                         }
-
+                    }else if ( strcmp(l_from_events_str,"threshold") == 0){
+                        dap_chain_cs_dag_event_item_t * l_event_item = NULL;
+                        pthread_rwlock_rdlock(&PVT(l_dag)->events_rwlock);
+                        HASH_FIND(hh,PVT(l_dag)->events_treshold,&l_event_hash,sizeof(l_event_hash),l_event_item);
+                        pthread_rwlock_unlock(&PVT(l_dag)->events_rwlock);
+                        if (l_event_item)
+                            l_event = l_event_item->event;
+                        else {
+                            ret = -23;
+                            dap_chain_node_cli_set_reply_text(a_str_reply,
+                                                              "Can't find event %s in threshold table\n", l_event_hash_str);
+                            break;
+                        }
                     }else {
                         ret = -22;
                         dap_chain_node_cli_set_reply_text(a_str_reply,
-                                                          "Wrong events_from option \"%s\", need one of variant: events, round.new, events_lasts, round.0x0123456789ABCDEF", l_from_events_str);
+                                                          "Wrong events_from option \"%s\", need one of variant: events, round.new, events_lasts, round.0x0123456789ABCDEF, threshold", l_from_events_str);
                         break;
 
                     }
@@ -1661,7 +1788,7 @@ static int s_cli_dag(int argc, char ** argv, char **a_str_reply)
                 if ( l_event ){
                     dap_string_t * l_str_tmp = dap_string_new(NULL);
                     char buf[50];
-                    time_t l_ts_reated = (time_t) l_event->header.ts_created;
+                    dap_time_t l_ts_reated = (dap_time_t)l_event->header.ts_created;
 
                     dap_string_append_printf(l_str_tmp,"\nEvent %s:\n", l_event_hash_str);
 
@@ -1673,16 +1800,15 @@ static int s_cli_dag(int argc, char ** argv, char **a_str_reply)
                             l_round_item->round_info.confirmations_minimum,
                             l_round_item->round_info.confirmations_timeout,
                             l_round_item->round_info.reject_count);
-                        char * l_hash_str = dap_chain_hash_fast_to_str_new(&l_round_item->round_info.first_event_hash);
-                        dap_string_append_printf(l_str_tmp, "\t\t\t\tfirst_event_hash: %s\n", l_hash_str);
+                        char * l_hash_str = dap_chain_hash_fast_to_str_new(&l_round_item->round_info.datum_hash);
+                        dap_string_append_printf(l_str_tmp, "\t\t\t\tdatum_hash: %s\n", l_hash_str);
                         DAP_DELETE(l_hash_str);
-                        dap_string_append_printf(l_str_tmp,
-                            "\t\t\t\tts_update: %s", 
-                            dap_ctime_r((time_t *)&l_round_item->round_info.ts_update, buf) );
-                        if (l_round_item->round_info.ts_confirmations_minimum_completed != 0)
-                            dap_string_append_printf(l_str_tmp,
-                                "\t\t\t\tts_confirmations_minimum_completed: %s", 
-                                dap_ctime_r((time_t *)&l_round_item->round_info.ts_confirmations_minimum_completed, buf) );
+                        dap_time_t l_ts = l_round_item->round_info.ts_update;
+                        dap_string_append_printf(l_str_tmp,"\t\t\t\tts_update: %s", dap_ctime_r(&l_ts, buf));
+                        if (l_round_item->round_info.ts_confirmations_minimum_completed != 0) {
+                            l_ts = l_round_item->round_info.ts_confirmations_minimum_completed;
+                            dap_string_append_printf(l_str_tmp,"\t\t\t\tts_confirmations_minimum_completed: %s", dap_ctime_r(&l_ts, buf));
+                        }
                     }
 
                      // Header
@@ -1704,7 +1830,7 @@ static int s_cli_dag(int argc, char ** argv, char **a_str_reply)
                     size_t l_offset =  l_event->header.hash_count*sizeof (dap_chain_hash_fast_t);
                     dap_chain_datum_t * l_datum = (dap_chain_datum_t*) (l_event->hashes_n_datum_n_signs + l_offset);
                     size_t l_datum_size =  dap_chain_datum_size(l_datum);
-                    time_t l_datum_ts_create = (time_t) l_datum->header.ts_create;
+                    dap_time_t l_datum_ts_create = (dap_time_t) l_datum->header.ts_create;
 
                     // Nested datum
                     const char *l_datum_type = NULL;
@@ -1754,6 +1880,7 @@ static int s_cli_dag(int argc, char ** argv, char **a_str_reply)
             case SUBCMD_EVENT_LIST:{
                 if( (l_from_events_str == NULL) ||
                         (strcmp(l_from_events_str,"round.new") == 0) ){
+
                     char * l_gdb_group_events = DAP_CHAIN_CS_DAG(l_chain)->gdb_group_events_round_new;
                     dap_string_t * l_str_tmp = dap_string_new("");
                     if ( l_gdb_group_events ){
@@ -1766,7 +1893,7 @@ static int s_cli_dag(int argc, char ** argv, char **a_str_reply)
                             dap_chain_cs_dag_event_t * l_event = (dap_chain_cs_dag_event_t *)
                                             ((dap_chain_cs_dag_event_round_item_t *)l_objs[i].value)->event_n_signs;
                             char buf[50];
-                            time_t l_ts_create = (time_t) l_event->header.ts_created;
+                            dap_time_t l_ts_create = (dap_time_t) l_event->header.ts_created;
                             dap_string_append_printf(l_str_tmp,"\t%s: ts_create=%s",
                                                      l_objs[i].key, dap_ctime_r( &l_ts_create,buf ) );
 
@@ -1788,7 +1915,7 @@ static int s_cli_dag(int argc, char ** argv, char **a_str_reply)
                     HASH_ITER(hh,PVT(l_dag)->events,l_event_item, l_event_item_tmp ) {
                         char buf[50];
                         char * l_event_item_hash_str = dap_chain_hash_fast_to_str_new( &l_event_item->hash);
-                        time_t l_ts_create = (time_t) l_event_item->event->header.ts_created;
+                        dap_time_t l_ts_create = (dap_time_t) l_event_item->event->header.ts_created;
                         dap_string_append_printf(l_str_tmp,"\t%s: ts_create=%s",
                                                  l_event_item_hash_str, dap_ctime_r( &l_ts_create,buf ) );
                         DAP_DELETE(l_event_item_hash_str);
@@ -1807,7 +1934,7 @@ static int s_cli_dag(int argc, char ** argv, char **a_str_reply)
                     HASH_ITER(hh,PVT(l_dag)->events_treshold,l_event_item, l_event_item_tmp ) {
                         char buf[50];
                         char * l_event_item_hash_str = dap_chain_hash_fast_to_str_new( &l_event_item->hash);
-                        time_t l_ts_create = (time_t) l_event_item->event->header.ts_created;
+                        dap_time_t l_ts_create = (dap_time_t) l_event_item->event->header.ts_created;
                         dap_string_append_printf(l_str_tmp,"\t%s: ts_create=%s",
                                                  l_event_item_hash_str, dap_ctime_r( &l_ts_create,buf ) );
                         DAP_DELETE(l_event_item_hash_str);
@@ -1847,7 +1974,7 @@ static int s_cli_dag(int argc, char ** argv, char **a_str_reply)
                             if (dap_strcmp(l_hash_out_type, "hex"))
                                 l_event_new_hash_base58_str = dap_enc_base58_encode_hash_to_str(&l_event_new_hash);
 
-                            if (dap_chain_cs_dag_event_gdb_set(l_event_new_hash_hex_str, l_event,
+                            if (dap_chain_cs_dag_event_gdb_set(l_dag, l_event_new_hash_hex_str, l_event,
                                                             l_event_size_new, l_round_item, l_gdb_group_events)) { //&l_event_round_info) ){
                                 // Old event will be cleaned automatically with s_round_event_clean_dup()
                                 dap_chain_node_cli_set_reply_text(a_str_reply,
diff --git a/modules/type/dag/dap_chain_cs_dag_event.c b/modules/type/dag/dap_chain_cs_dag_event.c
index c03215dbc3a64742361416b8efb8391e00909418..c020316381993712c5dffc91c91940886aa8f2c9 100644
--- a/modules/type/dag/dap_chain_cs_dag_event.c
+++ b/modules/type/dag/dap_chain_cs_dag_event.c
@@ -29,6 +29,7 @@
 #include "dap_sign.h"
 #include "dap_chain_datum.h"
 #include "dap_chain_cs_dag.h"
+#include "dap_timerfd.h"
 
 #define LOG_TAG "dap_chain_cs_dag_event"
 
@@ -53,7 +54,7 @@ dap_chain_cs_dag_event_t * dap_chain_cs_dag_event_new(dap_chain_id_t a_chain_id,
             + l_hashes_size
             + l_datum_size;
     l_event_new = DAP_NEW_Z_SIZE(dap_chain_cs_dag_event_t, l_event_size);
-    l_event_new->header.ts_created = (uint64_t)time(NULL);
+    l_event_new->header.ts_created = dap_time_now();
     l_event_new->header.cell_id.uint64 = a_cell_id.uint64;
     l_event_new->header.chain_id.uint64 = a_chain_id.uint64;
     l_event_new->header.hash_count = a_hashes_count;
@@ -153,36 +154,43 @@ size_t dap_chain_cs_dag_event_sign_add( dap_chain_cs_dag_event_t **a_event_ptr,
     return l_event_size+l_sign_size;
 }
 
-bool dap_chain_cs_dag_event_sign_exists(dap_chain_cs_dag_event_t *a_event, size_t a_event_size,
-                                                            dap_chain_net_t * a_net, dap_enc_key_t * a_key) {
-    dap_sign_type_t l_sign_type = dap_sign_type_from_key_type(a_key->type);
+static bool s_sign_exists(uint8_t *a_pos, size_t a_len, dap_enc_key_t *a_key)
+{
     size_t l_pub_key_size = 0;
     uint8_t *l_pub_key = dap_enc_key_serealize_pub_key(a_key, &l_pub_key_size);
-    dap_chain_hash_fast_t l_pkey_hash;
-    dap_hash_fast(l_pub_key, l_pub_key_size, &l_pkey_hash);
-    dap_chain_addr_t l_addr = {0};
-    dap_chain_addr_fill(&l_addr, l_sign_type, &l_pkey_hash, a_net->pub.id);
-    DAP_DELETE(l_pub_key);
-    
-    size_t l_hashes_size = a_event->header.hash_count*sizeof(dap_chain_hash_fast_t);
-    dap_chain_datum_t * l_datum = (dap_chain_datum_t*)(a_event->hashes_n_datum_n_signs + l_hashes_size);
-    size_t l_datum_size =  dap_chain_datum_size(l_datum);
-    size_t l_offset = l_hashes_size+l_datum_size;
-    while ( l_offset+sizeof(a_event->header) < a_event_size  ) {
-        dap_sign_t * l_item_sign = (dap_sign_t *)(a_event->hashes_n_datum_n_signs +l_offset);
+    uint8_t *l_offset = a_pos;
+    while (l_offset < a_pos + a_len) {
+        dap_sign_t * l_item_sign = (dap_sign_t *)l_offset;
         size_t l_sign_item_size = dap_sign_get_size(l_item_sign);
-        dap_chain_addr_t l_item_addr = {0};
-        dap_chain_hash_fast_t l_item_pkey_hash;
-        dap_sign_get_pkey_hash(l_item_sign, &l_item_pkey_hash);
-        dap_chain_addr_fill(&l_item_addr, l_item_sign->header.type, &l_item_pkey_hash, a_net->pub.id);
-        if (memcmp(&l_addr, &l_item_addr, sizeof(l_item_addr)) == 0) {
+        size_t l_sign_key_size = 0;
+        uint8_t *l_sign_key = dap_sign_get_pkey(l_item_sign, &l_sign_key_size);
+        if (l_pub_key_size == l_sign_key_size &&
+                !memcmp(&l_pub_key, &l_sign_key, l_pub_key_size)) {
+            DAP_DELETE(l_pub_key);
             return true;
         }
         l_offset += l_sign_item_size;
     }
+    DAP_DELETE(l_pub_key);
     return false;
 }
 
+bool dap_chain_cs_dag_event_sign_exists(dap_chain_cs_dag_event_t *a_event, size_t a_event_size, dap_enc_key_t *a_key)
+{
+    size_t l_hashes_size = a_event->header.hash_count*sizeof(dap_chain_hash_fast_t);
+    dap_chain_datum_t * l_datum = (dap_chain_datum_t*)(a_event->hashes_n_datum_n_signs + l_hashes_size);
+    size_t l_datum_size =  dap_chain_datum_size(l_datum);
+    uint8_t *l_offset = a_event->hashes_n_datum_n_signs + l_hashes_size + l_datum_size;
+    size_t l_signs_size = a_event_size - sizeof(a_event->header) - l_hashes_size - l_datum_size;
+    return s_sign_exists(l_offset, l_signs_size, a_key);
+}
+
+bool dap_chain_cs_dag_event_round_sign_exists(dap_chain_cs_dag_event_round_item_t *a_round_item, dap_enc_key_t *a_key) {
+    uint8_t *l_offset = a_round_item->event_n_signs + a_round_item->event_size;
+    size_t l_signs_size = a_round_item->data_size - a_round_item->event_size - sizeof(dap_chain_cs_dag_event_round_item_t);
+    return s_sign_exists(l_offset, l_signs_size, a_key);
+}
+
 /**
  * @brief dap_chain_cs_dag_event_get_sign
  * @param a_event
@@ -202,12 +210,13 @@ dap_sign_t * dap_chain_cs_dag_event_get_sign( dap_chain_cs_dag_event_t * a_event
         uint16_t l_signs_passed;
         for ( l_signs_passed=0;  l_signs_passed < a_sign_number; l_signs_passed++){
             dap_sign_t * l_sign = (dap_sign_t *) (l_signs+l_signs_offset);
-            l_signs_offset+=l_sign->header.sign_pkey_size+l_sign->header.sign_size+sizeof(l_sign->header);
+            // l_signs_offset+=l_sign->header.sign_pkey_size+l_sign->header.sign_size+sizeof(l_sign->header);
+            l_signs_offset+=dap_sign_get_size(l_sign);
             l_offset_passed += l_offset_to_sign;
             if ( l_offset_passed >= a_event_size)
                 return NULL;
         }
-        return (dap_sign_t*) l_signs + l_signs_offset;
+        return (dap_sign_t*)(l_signs+l_signs_offset);
     }else
         return NULL;
 }
@@ -215,7 +224,7 @@ dap_sign_t * dap_chain_cs_dag_event_get_sign( dap_chain_cs_dag_event_t * a_event
 size_t dap_chain_cs_dag_event_round_sign_add(dap_chain_cs_dag_event_round_item_t **a_round_item_ptr, size_t a_round_item_size,
                                         dap_chain_net_t * a_net, dap_enc_key_t * a_key) {
     dap_chain_cs_dag_event_round_item_t *l_round_item = *a_round_item_ptr;
-    dap_sign_t * l_sign = dap_sign_create(a_key, &l_round_item->round_info.first_event_hash, sizeof(dap_chain_hash_fast_t), 0);
+    dap_sign_t * l_sign = dap_sign_create(a_key, &l_round_item->round_info.datum_hash, sizeof(dap_chain_hash_fast_t), 0);
     size_t l_sign_size = dap_sign_get_size(l_sign);
     dap_chain_addr_t l_addr = {0};
     dap_chain_hash_fast_t l_pkey_hash;
@@ -243,36 +252,42 @@ size_t dap_chain_cs_dag_event_round_sign_add(dap_chain_cs_dag_event_round_item_t
     return a_round_item_size+l_sign_size;
 }
 
+static bool s_event_broadcast_send(dap_chain_cs_dag_event_round_broadcast_t *l_arg) {
+    dap_chain_net_t *l_net = dap_chain_net_by_id(l_arg->dag->chain->net_id);
+    if (dap_chain_net_get_state(l_net) == NET_STATE_ONLINE) {
+        dap_chain_net_sync_gdb_broadcast((void *)l_net, l_arg->op_code, l_arg->group, l_arg->key, l_arg->value, l_arg->value_size);
+    }
+    else if ( l_arg->attempts < 10 ) {
+        l_arg->attempts++;
+        return true;
+    }
+    DAP_DELETE(l_arg->group);
+    DAP_DELETE(l_arg->key);
+    DAP_DELETE(l_arg->value);
+    DAP_DELETE(l_arg);
+    return false;
+}
 
-bool dap_chain_cs_dag_event_round_sign_exists(dap_chain_cs_dag_event_round_item_t *a_round_item,
-                                                        dap_chain_net_t * a_net, dap_enc_key_t * a_key) {
-    dap_sign_type_t l_sign_type = dap_sign_type_from_key_type(a_key->type);
-    size_t l_pub_key_size = 0;
-    uint8_t *l_pub_key = dap_enc_key_serealize_pub_key(a_key, &l_pub_key_size);
-    dap_chain_hash_fast_t l_pkey_hash;
-    dap_hash_fast(l_pub_key, l_pub_key_size, &l_pkey_hash);
-    dap_chain_addr_t l_addr = {0};
-    dap_chain_addr_fill(&l_addr, l_sign_type, &l_pkey_hash, a_net->pub.id);
-    DAP_DELETE(l_pub_key);
+void dap_chain_cs_dag_event_broadcast(dap_chain_cs_dag_t *a_dag, const char a_op_code, const char *a_group,
+                const char *a_key, const void *a_value, const size_t a_value_size) {
+    dap_chain_cs_dag_event_round_broadcast_t *l_arg = DAP_NEW(dap_chain_cs_dag_event_round_broadcast_t);
+    l_arg->dag = a_dag;
+    l_arg->op_code = a_op_code;
+    l_arg->group = dap_strdup(a_group);
+    l_arg->key = dap_strdup(a_key);
+    l_arg->value = DAP_DUP_SIZE(a_value, a_value_size);
+    l_arg->value_size = a_value_size;
+    l_arg->attempts = 0;
 
-    size_t l_offset = a_round_item->event_size;
-    while ( l_offset < a_round_item->data_size  ) {
-        dap_sign_t * l_item_sign = (dap_sign_t *)(a_round_item->event_n_signs +l_offset);
-        size_t l_sign_item_size = dap_sign_get_size(l_item_sign);
-        dap_chain_addr_t l_item_addr = {0};
-        dap_chain_hash_fast_t l_item_pkey_hash;
-        dap_sign_get_pkey_hash(l_item_sign, &l_item_pkey_hash);
-        dap_chain_addr_fill(&l_item_addr, l_item_sign->header.type, &l_item_pkey_hash, a_net->pub.id);
-        if (memcmp(&l_addr, &l_item_addr, sizeof(l_item_addr)) == 0) {
-            return true;
-        }
-        l_offset += l_sign_item_size;
+    if (dap_timerfd_start(3*1000,
+                        (dap_timerfd_callback_t)s_event_broadcast_send,
+                        l_arg) == NULL) {
+        log_it(L_ERROR,"Can't run timer for broadcast Event %s", a_key);
     }
-    return false;
 }
 
-bool dap_chain_cs_dag_event_gdb_set(char *a_event_hash_str, dap_chain_cs_dag_event_t * a_event, size_t a_event_size,
-                                    dap_chain_cs_dag_event_round_item_t * a_round_item,
+bool dap_chain_cs_dag_event_gdb_set(dap_chain_cs_dag_t *a_dag, char *a_event_hash_str, dap_chain_cs_dag_event_t *a_event,
+                                    size_t a_event_size, dap_chain_cs_dag_event_round_item_t *a_round_item,
                                     const char *a_group)
 {
     size_t l_signs_size = a_round_item->data_size-a_round_item->event_size;
@@ -293,12 +308,13 @@ bool dap_chain_cs_dag_event_gdb_set(char *a_event_hash_str, dap_chain_cs_dag_eve
     memcpy(l_round_item->event_n_signs,                 a_event, a_event_size);
     memcpy(l_round_item->event_n_signs + a_event_size,  l_signs, l_signs_size);
 
-    l_round_item->round_info.ts_update = (uint64_t)time(NULL);
+    l_round_item->round_info.ts_update = dap_time_now();
 
     bool ret = dap_chain_global_db_gr_set(a_event_hash_str, l_round_item,
             dap_chain_cs_dag_event_round_item_get_size(l_round_item),
             a_group);
 
+    a_dag->callback_broadcast(a_dag, l_round_item, a_event_hash_str);
     DAP_DELETE(l_round_item);
     return ret;
 }
diff --git a/modules/type/dag/include/dap_chain_cs_dag.h b/modules/type/dag/include/dap_chain_cs_dag.h
index c497d75205d699b969328ae0762b394d0c6da89c..d96bb74b1f52ed67d096a7ac2f1d358f9a01e6c4 100644
--- a/modules/type/dag/include/dap_chain_cs_dag.h
+++ b/modules/type/dag/include/dap_chain_cs_dag.h
@@ -29,6 +29,8 @@
 typedef struct dap_chain_cs_dag dap_chain_cs_dag_t;
 
 typedef void (*dap_chain_cs_dag_callback_t)(dap_chain_cs_dag_t *);
+typedef void (*dap_chain_cs_dag_callback_broadcast_t)(dap_chain_cs_dag_t *,
+                                    dap_chain_cs_dag_event_round_item_t *, const char *a_key);
 typedef int (*dap_chain_cs_dag_callback_event_t)(dap_chain_cs_dag_t *, dap_chain_cs_dag_event_t *,size_t);
 
 typedef dap_chain_cs_dag_event_t * (*dap_chain_cs_dag_callback_event_create_t)(dap_chain_cs_dag_t *,
@@ -59,11 +61,14 @@ typedef struct dap_chain_cs_dag
 
     dap_chain_cs_dag_event_round_info_t event_round_info; // for verify function
     bool use_event_round_info;
+    bool broadcast_disable;
 
     uint16_t datum_add_hashes_count;
     char * gdb_group_events_round_new;
+    char *gdb_group_datums_queue;
 
     dap_chain_cs_dag_callback_t callback_delete;
+    dap_chain_cs_dag_callback_broadcast_t callback_broadcast;
     dap_chain_cs_dag_callback_event_create_t callback_cs_event_create;
     dap_chain_cs_dag_callback_event_t callback_cs_verify;
     dap_chain_cs_dag_callback_get_round_info_t callback_cs_get_round_info;
@@ -87,3 +92,4 @@ void dap_chain_cs_dag_proc_event_round_new(dap_chain_cs_dag_t *a_dag);
 
 dap_chain_cs_dag_event_t* dap_chain_cs_dag_find_event_by_hash(dap_chain_cs_dag_t * a_dag,
                                                               dap_chain_hash_fast_t * a_hash);
+void dap_chain_cs_new_event_add_datums(dap_chain_t *a_chain, bool a_round_check);
diff --git a/modules/type/dag/include/dap_chain_cs_dag_event.h b/modules/type/dag/include/dap_chain_cs_dag_event.h
index d46c7d2fa1e98c0ce576b7b12062d8d18857a3ee..35ab3b683954abd712cc571e7613f3bf310a566b 100644
--- a/modules/type/dag/include/dap_chain_cs_dag_event.h
+++ b/modules/type/dag/include/dap_chain_cs_dag_event.h
@@ -35,7 +35,7 @@ typedef struct dap_chain_cs_dag dap_chain_cs_dag_t;
 typedef struct dap_chain_class_dag_event_hdr {
         uint16_t version;
         uint64_t round_id;
-        uint64_t ts_created;
+        dap_gdb_time_t ts_created;
         dap_chain_id_t chain_id;
         dap_chain_cell_id_t cell_id; // Cell id if celled dag
         uint16_t hash_count; // Number of hashes
@@ -50,10 +50,10 @@ typedef struct dap_chain_cs_dag_event {
 typedef struct dap_chain_cs_dag_event_round_info {
     uint16_t confirmations_minimum; // param auth_certs_count_verify in PoA
     uint32_t confirmations_timeout; // wait confirmations over minimum value (confirmations_minimum)
-    uint64_t ts_confirmations_minimum_completed;
-    uint64_t ts_update;
+    dap_gdb_time_t ts_confirmations_minimum_completed;
+    dap_gdb_time_t ts_update;
     uint16_t reject_count;
-    dap_chain_hash_fast_t first_event_hash; // first event hash in round
+    dap_chain_hash_fast_t datum_hash; // for duobles finding
 } DAP_ALIGN_PACKED dap_chain_cs_dag_event_round_info_t;
 
 typedef struct dap_chain_cs_dag_event_round_item {
@@ -63,6 +63,16 @@ typedef struct dap_chain_cs_dag_event_round_item {
     uint8_t event_n_signs[]; // event // dap_chain_cs_dag_event_t
 } DAP_ALIGN_PACKED dap_chain_cs_dag_event_round_item_t;
 
+typedef struct dap_chain_cs_dag_event_round_broadcast {
+    dap_chain_cs_dag_t *dag;
+    char op_code;
+    char *group;
+    char *key;
+    void *value;
+    size_t value_size;
+    int attempts;
+} dap_chain_cs_dag_event_round_broadcast_t;
+
 dap_chain_cs_dag_event_t * dap_chain_cs_dag_event_new(dap_chain_id_t a_chain_id, dap_chain_cell_id_t a_cell_id, dap_chain_datum_t * a_datum,
                                                 dap_enc_key_t * a_key,
                                                 dap_chain_hash_fast_t * a_hashes, size_t a_hashes_count, size_t * a_event_size);
@@ -89,10 +99,8 @@ size_t dap_chain_cs_dag_event_sign_add( dap_chain_cs_dag_event_t **a_event_ptr,
                                                             dap_chain_net_t * a_net, dap_enc_key_t * a_key);
 size_t dap_chain_cs_dag_event_round_sign_add(dap_chain_cs_dag_event_round_item_t **a_round_item_ptr, size_t a_round_item_size,
                                         dap_chain_net_t * a_net, dap_enc_key_t * a_key);
-bool dap_chain_cs_dag_event_sign_exists(dap_chain_cs_dag_event_t *a_event, size_t a_event_size,
-                                                            dap_chain_net_t * a_net, dap_enc_key_t * a_key);
-bool dap_chain_cs_dag_event_round_sign_exists(dap_chain_cs_dag_event_round_item_t *a_round_item,
-                                                        dap_chain_net_t * a_net, dap_enc_key_t * a_key);
+bool dap_chain_cs_dag_event_sign_exists(dap_chain_cs_dag_event_t *a_event, size_t a_event_size, dap_enc_key_t * a_key);
+bool dap_chain_cs_dag_event_round_sign_exists(dap_chain_cs_dag_event_round_item_t *a_round_item, dap_enc_key_t * a_key);
 dap_sign_t * dap_chain_cs_dag_event_get_sign( dap_chain_cs_dag_event_t * a_event, size_t a_event_size, uint16_t a_sign_number);
 
 /**
@@ -136,7 +144,7 @@ static inline ssize_t dap_chain_cs_dag_event_calc_size_excl_signs(dap_chain_cs_d
         return -1;
     dap_chain_datum_t * l_datum = (dap_chain_datum_t*) (a_event->hashes_n_datum_n_signs + l_hashes_size);
     size_t l_datum_size = dap_chain_datum_size(l_datum);
-    return  l_hashes_size + sizeof (a_event->header) + l_datum_size;
+    return l_hashes_size + sizeof (a_event->header) + l_datum_size;
 }
 
 /**
@@ -154,9 +162,12 @@ static inline size_t dap_chain_cs_dag_event_round_item_get_size(dap_chain_cs_dag
     return sizeof(dap_chain_cs_dag_event_round_item_t)+a_event_round_item->data_size;
 }
 
-bool dap_chain_cs_dag_event_gdb_set(char *a_event_hash_str, dap_chain_cs_dag_event_t * a_event, size_t a_event_size,
-                                    dap_chain_cs_dag_event_round_item_t * a_round_item,
-                                        const char *a_group);
+void dap_chain_cs_dag_event_broadcast(dap_chain_cs_dag_t *a_dag, const char a_op_code, const char *a_group,
+        const char *a_key, const void *a_value, const size_t a_value_size);
+
+bool dap_chain_cs_dag_event_gdb_set(dap_chain_cs_dag_t *a_dag, char *a_event_hash_str, dap_chain_cs_dag_event_t *a_event,
+                                    size_t a_event_size, dap_chain_cs_dag_event_round_item_t *a_round_item,
+                                    const char *a_group);
 
 dap_chain_cs_dag_event_t* dap_chain_cs_dag_event_gdb_get(const char *a_event_hash_str, size_t *a_event_size,
                                                         const char *a_group, dap_chain_cs_dag_event_round_info_t * a_event_round_info);